feat(chat,files): salon par dossier, favoris, cloisonnement des droits admin (#8)
CD — Déploiement / deploy (push) Successful in 19s
CD — Déploiement / deploy (push) Successful in 19s
- chat: salon attache a un dossier, membres = comptes ayant acces au dossier - securite: suppression du passage automatique admin sur fichiers/dossiers/ corbeille/recherche/galerie/chat ; l'admin n'accede qu'a ses partages - favoris: tri en tete dans l'explorateur + page dediee (GET /favorites) - ui: retrait des pastilles Systeme/Public sur la carte dossier - migration 007_chat : table chat_messages --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #8 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #8.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useState } from "react";
|
||||
import { NavLink, Outlet } from "react-router-dom";
|
||||
import { Button, cn } from "../ui/index.js";
|
||||
import { api } from "../lib/api.js";
|
||||
import { useSession } from "../lib/session.js";
|
||||
import { Avatar } from "./Avatar.js";
|
||||
import {
|
||||
ActivityIcon,
|
||||
CloseIcon,
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
SearchNavIcon,
|
||||
SettingsIcon,
|
||||
ShieldIcon,
|
||||
StarIcon,
|
||||
TrashIcon,
|
||||
} from "./icons.js";
|
||||
|
||||
@@ -25,6 +26,7 @@ interface NavItem {
|
||||
|
||||
const NAV: NavItem[] = [
|
||||
{ to: "/files", label: "Fichiers", icon: FolderIcon },
|
||||
{ to: "/favorites", label: "Favoris", icon: StarIcon },
|
||||
{ to: "/search", label: "Recherche", icon: SearchNavIcon },
|
||||
{ to: "/gallery", label: "Galerie", icon: ImageIcon },
|
||||
{ to: "/trash", label: "Corbeille", icon: TrashIcon },
|
||||
@@ -38,9 +40,6 @@ const ADMIN_NAV: NavItem[] = [
|
||||
|
||||
const ACCOUNT_NAV: NavItem = { to: "/profile", label: "Mon compte", icon: SettingsIcon };
|
||||
|
||||
const initials = (first: string, last: string): string =>
|
||||
`${first.charAt(0)}${last.charAt(0)}`.toUpperCase() || "?";
|
||||
|
||||
const navClass = ({ isActive }: { isActive: boolean }) =>
|
||||
cn(
|
||||
"flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors",
|
||||
@@ -127,22 +126,13 @@ export const AppShell = () => {
|
||||
{user.role_name}
|
||||
</p>
|
||||
</div>
|
||||
<span
|
||||
className="relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-surface text-xs font-semibold text-foreground"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{initials(user.first_name, user.last_name)}
|
||||
{user.has_avatar ? (
|
||||
<img
|
||||
src={`${api.avatarUrl(user.id)}?v=${encodeURIComponent(user.avatar_updated_at ?? "")}`}
|
||||
alt=""
|
||||
className="absolute inset-0 h-full w-full object-cover"
|
||||
onError={(event) => {
|
||||
event.currentTarget.style.display = "none";
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</span>
|
||||
<Avatar
|
||||
userId={user.id}
|
||||
firstName={user.first_name}
|
||||
lastName={user.last_name}
|
||||
hasAvatar={user.has_avatar}
|
||||
avatarUpdatedAt={user.avatar_updated_at}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { api } from "../lib/api.js";
|
||||
import { cn } from "../ui/index.js";
|
||||
|
||||
const initials = (first: string, last: string): string =>
|
||||
`${first.charAt(0)}${last.charAt(0)}`.toUpperCase() || "?";
|
||||
|
||||
/**
|
||||
* Pastille d'identite : initiales sur fond neutre, remplacees par la photo de
|
||||
* profil quand elle existe. La version de la photo est passee en parametre
|
||||
* pour invalider le cache navigateur des qu'elle change.
|
||||
*/
|
||||
export const Avatar = ({
|
||||
userId,
|
||||
firstName,
|
||||
lastName,
|
||||
hasAvatar,
|
||||
avatarUpdatedAt,
|
||||
className,
|
||||
}: {
|
||||
userId: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
hasAvatar: boolean;
|
||||
avatarUpdatedAt: string | null;
|
||||
className?: string;
|
||||
}) => (
|
||||
<span
|
||||
className={cn(
|
||||
"relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-surface text-xs font-semibold text-foreground",
|
||||
className,
|
||||
)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{initials(firstName, lastName)}
|
||||
{hasAvatar ? (
|
||||
<img
|
||||
src={`${api.avatarUrl(userId)}?v=${encodeURIComponent(avatarUpdatedAt ?? "")}`}
|
||||
alt=""
|
||||
className="absolute inset-0 h-full w-full object-cover"
|
||||
onError={(event) => {
|
||||
event.currentTarget.style.display = "none";
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</span>
|
||||
);
|
||||
@@ -0,0 +1,442 @@
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type FormEvent,
|
||||
type KeyboardEvent as ReactKeyboardEvent,
|
||||
} from "react";
|
||||
import { Button, Spinner, cn } from "../ui/index.js";
|
||||
import { ApiError, api, formatDate, type ChatMember, type ChatMessage } from "../lib/api.js";
|
||||
import { useSession } from "../lib/session.js";
|
||||
import { useConfirm } from "./confirm.js";
|
||||
import { Avatar } from "./Avatar.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
import { Alert, Badge, EmptyState } from "./feedback.js";
|
||||
import { ChatIcon, CloseIcon, SendIcon, TrashIcon, UsersIcon } from "./icons.js";
|
||||
|
||||
const MAX_LENGTH = 2000;
|
||||
const POLL_MESSAGES_MS = 4000;
|
||||
const POLL_MEMBERS_MS = 30_000;
|
||||
const GROUP_WINDOW_MS = 5 * 60 * 1000;
|
||||
|
||||
const timeOf = (value: string): string =>
|
||||
new Date(value).toLocaleTimeString("fr-FR", { hour: "2-digit", minute: "2-digit" });
|
||||
|
||||
const dayOf = (value: string): string =>
|
||||
new Date(value).toLocaleDateString("fr-FR", {
|
||||
weekday: "long",
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
});
|
||||
|
||||
const isSameDay = (a: string, b: string): boolean =>
|
||||
new Date(a).toDateString() === new Date(b).toDateString();
|
||||
|
||||
const fullName = (member: { first_name: string | null; last_name: string | null }): string =>
|
||||
`${member.first_name ?? ""} ${member.last_name ?? ""}`.trim() || "Compte supprimé";
|
||||
|
||||
const MAX_ID = (list: ChatMessage[]): number =>
|
||||
list.reduce((max, message) => Math.max(max, message.id), 0);
|
||||
|
||||
export interface ChatFolder {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Salon de discussion d'un dossier, ouvert en plein ecran par-dessus la vue
|
||||
* des fichiers. Les membres sont les comptes ayant acces au dossier (le role
|
||||
* admin n'ouvre aucun acces supplementaire) ; le serveur reevalue cet acces a
|
||||
* chaque requete, l'interface ne fait que l'afficher.
|
||||
*/
|
||||
export const FolderChat = ({ folder, onClose }: { folder: ChatFolder; onClose: () => void }) => {
|
||||
const { user } = useSession();
|
||||
const confirm = useConfirm();
|
||||
const folderId = folder.id;
|
||||
|
||||
const [members, setMembers] = useState<ChatMember[]>([]);
|
||||
const [messages, setMessages] = useState<ChatMessage[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [draft, setDraft] = useState("");
|
||||
const [sending, setSending] = useState(false);
|
||||
const [deletingId, setDeletingId] = useState<number | null>(null);
|
||||
const [membersOpen, setMembersOpen] = useState(false);
|
||||
|
||||
const scrollRef = useRef<HTMLDivElement | null>(null);
|
||||
const lastIdRef = useRef(0);
|
||||
// Tant que l'utilisateur reste au bas de la conversation, chaque nouveau
|
||||
// message le ramene en bas ; s'il remonte lire l'historique, on ne le force
|
||||
// pas a redescendre.
|
||||
const stickToBottomRef = useRef(true);
|
||||
|
||||
const scrollToBottom = useCallback(() => {
|
||||
const node = scrollRef.current;
|
||||
if (node) node.scrollTop = node.scrollHeight;
|
||||
}, []);
|
||||
|
||||
const mergeMessages = useCallback(
|
||||
(incoming: ChatMessage[]) => {
|
||||
if (incoming.length === 0) return;
|
||||
setMessages((previous) => {
|
||||
const known = new Set(previous.map((message) => message.id));
|
||||
const fresh = incoming.filter((message) => !known.has(message.id));
|
||||
return fresh.length > 0 ? [...previous, ...fresh] : previous;
|
||||
});
|
||||
lastIdRef.current = Math.max(lastIdRef.current, MAX_ID(incoming));
|
||||
if (stickToBottomRef.current) queueMicrotask(scrollToBottom);
|
||||
},
|
||||
[scrollToBottom],
|
||||
);
|
||||
|
||||
const loadMembers = useCallback(async () => {
|
||||
const { members: list } = await api.chatMembers(folderId);
|
||||
setMembers(list);
|
||||
}, [folderId]);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
setLoading(true);
|
||||
setMessages([]);
|
||||
lastIdRef.current = 0;
|
||||
void (async () => {
|
||||
try {
|
||||
const [memberResult, messageResult] = await Promise.all([
|
||||
api.chatMembers(folderId),
|
||||
api.chatMessages(folderId, 0, 50),
|
||||
]);
|
||||
if (!active) return;
|
||||
setMembers(memberResult.members);
|
||||
setMessages(messageResult.messages);
|
||||
lastIdRef.current = MAX_ID(messageResult.messages);
|
||||
setError(null);
|
||||
} catch (caught) {
|
||||
if (!active) return;
|
||||
setError(caught instanceof ApiError ? caught.message : "Chargement impossible.");
|
||||
} finally {
|
||||
if (active) {
|
||||
setLoading(false);
|
||||
queueMicrotask(scrollToBottom);
|
||||
}
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [folderId, scrollToBottom]);
|
||||
|
||||
// Synchronisation incrementale : rien n'est charge tant que l'onglet est en
|
||||
// arriere-plan, la reprise se fait au retour de visibilite.
|
||||
useEffect(() => {
|
||||
const poll = async () => {
|
||||
if (document.hidden) return;
|
||||
try {
|
||||
const { messages: fresh } = await api.chatMessages(folderId, lastIdRef.current, 100);
|
||||
mergeMessages(fresh);
|
||||
} catch {
|
||||
/* le prochain cycle retentera */
|
||||
}
|
||||
};
|
||||
const onVisible = () => {
|
||||
if (!document.hidden) void poll();
|
||||
};
|
||||
const timer = window.setInterval(() => void poll(), POLL_MESSAGES_MS);
|
||||
document.addEventListener("visibilitychange", onVisible);
|
||||
return () => {
|
||||
window.clearInterval(timer);
|
||||
document.removeEventListener("visibilitychange", onVisible);
|
||||
};
|
||||
}, [folderId, mergeMessages]);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = window.setInterval(() => {
|
||||
if (!document.hidden) void loadMembers().catch(() => undefined);
|
||||
}, POLL_MEMBERS_MS);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [loadMembers]);
|
||||
|
||||
// Fermeture au clavier et blocage du defilement de la page sous l'overlay.
|
||||
useEffect(() => {
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") onClose();
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
const previousOverflow = document.body.style.overflow;
|
||||
document.body.style.overflow = "hidden";
|
||||
return () => {
|
||||
window.removeEventListener("keydown", onKeyDown);
|
||||
document.body.style.overflow = previousOverflow;
|
||||
};
|
||||
}, [onClose]);
|
||||
|
||||
const onScroll = () => {
|
||||
const node = scrollRef.current;
|
||||
if (!node) return;
|
||||
stickToBottomRef.current = node.scrollHeight - node.scrollTop - node.clientHeight < 80;
|
||||
};
|
||||
|
||||
const send = async (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
const body = draft.trim();
|
||||
if (!body || sending) return;
|
||||
setSending(true);
|
||||
setError(null);
|
||||
try {
|
||||
const { message } = await api.chatSend(folderId, body);
|
||||
stickToBottomRef.current = true;
|
||||
mergeMessages([message]);
|
||||
setDraft("");
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : "Envoi impossible.");
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = async (message: ChatMessage) => {
|
||||
if (
|
||||
!(await confirm({
|
||||
title: "Supprimer le message",
|
||||
message: "Ce message sera retiré du salon pour tout le monde.",
|
||||
confirmLabel: "Supprimer",
|
||||
tone: "danger",
|
||||
}))
|
||||
)
|
||||
return;
|
||||
setDeletingId(message.id);
|
||||
try {
|
||||
await api.chatDeleteMessage(folderId, message.id);
|
||||
setMessages((previous) => previous.filter((item) => item.id !== message.id));
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : "Suppression impossible.");
|
||||
} finally {
|
||||
setDeletingId(null);
|
||||
}
|
||||
};
|
||||
|
||||
const onComposerKeyDown = (event: ReactKeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (event.key === "Enter" && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
event.currentTarget.form?.requestSubmit();
|
||||
}
|
||||
};
|
||||
|
||||
const rendered = useMemo(
|
||||
() =>
|
||||
messages.map((message, index) => {
|
||||
const previous = index > 0 ? messages[index - 1] : null;
|
||||
const newDay = !previous || !isSameDay(previous.created_at, message.created_at);
|
||||
const continuation =
|
||||
!newDay &&
|
||||
previous !== null &&
|
||||
previous.user_id === message.user_id &&
|
||||
new Date(message.created_at).getTime() - new Date(previous.created_at).getTime() <
|
||||
GROUP_WINDOW_MS;
|
||||
const own = message.user_id === user?.id;
|
||||
const canDelete = own;
|
||||
return { message, newDay, continuation, own, canDelete };
|
||||
}),
|
||||
[messages, user?.id],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-40 flex flex-col bg-background">
|
||||
<div className="relative flex h-full min-h-0">
|
||||
<aside
|
||||
className={cn(
|
||||
"absolute inset-y-0 left-0 z-20 flex w-64 flex-col border-r border-border bg-surface transition-transform md:static md:z-auto md:translate-x-0",
|
||||
membersOpen ? "translate-x-0 shadow-lg md:shadow-none" : "-translate-x-full",
|
||||
)}
|
||||
aria-label="Membres du dossier"
|
||||
>
|
||||
<div className="flex shrink-0 items-center justify-between gap-2 border-b border-border px-4 py-3">
|
||||
<span className="font-display text-xs font-semibold uppercase tracking-label text-foreground">
|
||||
Membres
|
||||
</span>
|
||||
<span className="text-xs text-subtle-foreground">{members.length}</span>
|
||||
</div>
|
||||
<ul className="min-h-0 flex-1 overflow-y-auto p-2">
|
||||
{members.map((member) => (
|
||||
<li key={member.id} className="flex items-center gap-3 rounded-md px-2 py-2">
|
||||
<Avatar
|
||||
userId={member.id}
|
||||
firstName={member.first_name}
|
||||
lastName={member.last_name}
|
||||
hasAvatar={member.has_avatar}
|
||||
avatarUpdatedAt={member.avatar_updated_at}
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="flex items-center gap-1.5 truncate text-xs font-medium text-foreground">
|
||||
{fullName(member)}
|
||||
{member.is_self ? (
|
||||
<span className="text-subtle-foreground">(vous)</span>
|
||||
) : null}
|
||||
</p>
|
||||
<p className="truncate text-[0.6875rem] text-subtle-foreground">
|
||||
{member.last_login_at
|
||||
? `Dernière connexion le ${formatDate(member.last_login_at)}`
|
||||
: "Jamais connecté"}
|
||||
</p>
|
||||
</div>
|
||||
{member.role_slug === "admin" ? <Badge tone="accent">Admin</Badge> : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
{membersOpen ? (
|
||||
<div
|
||||
className="absolute inset-0 z-10 bg-black/30 md:hidden"
|
||||
onClick={() => setMembersOpen(false)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<section className="flex min-w-0 flex-1 flex-col">
|
||||
<div className="flex shrink-0 items-center gap-3 border-b border-border bg-background px-4 py-3">
|
||||
<button
|
||||
type="button"
|
||||
className="text-muted-foreground md:hidden"
|
||||
aria-label={membersOpen ? "Masquer les membres" : "Afficher les membres"}
|
||||
aria-expanded={membersOpen}
|
||||
onClick={() => setMembersOpen((value) => !value)}
|
||||
>
|
||||
<UsersIcon className="h-5 w-5" />
|
||||
</button>
|
||||
<div className="min-w-0 flex-1">
|
||||
<h1 className="truncate font-display text-sm font-semibold uppercase tracking-label text-foreground">
|
||||
Discussion · {folder.name}
|
||||
</h1>
|
||||
<p className="text-[0.6875rem] text-subtle-foreground">
|
||||
Membres ayant accès à ce dossier
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label="Fermer la discussion"
|
||||
className="rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<CloseIcon className="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{error ? (
|
||||
<div className="shrink-0 px-4 pt-3">
|
||||
<Alert>{error}</Alert>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div
|
||||
ref={scrollRef}
|
||||
onScroll={onScroll}
|
||||
className="min-h-0 flex-1 overflow-y-auto px-4 py-4"
|
||||
>
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-16">
|
||||
<Spinner size="md" />
|
||||
</div>
|
||||
) : messages.length === 0 ? (
|
||||
<EmptyState
|
||||
icon={<ChatIcon className="h-8 w-8" />}
|
||||
title="Aucun message"
|
||||
description="Lancez la discussion : les membres du dossier verront votre message."
|
||||
/>
|
||||
) : (
|
||||
<ol className="flex flex-col gap-1">
|
||||
{rendered.map(({ message, newDay, continuation, own, canDelete }) => (
|
||||
<li key={message.id}>
|
||||
{newDay ? (
|
||||
<div className="my-3 flex items-center gap-3" role="separator">
|
||||
<span className="h-px flex-1 bg-border" />
|
||||
<span className="font-display text-[0.625rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{dayOf(message.created_at)}
|
||||
</span>
|
||||
<span className="h-px flex-1 bg-border" />
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
className={cn(
|
||||
"group flex items-start gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover",
|
||||
continuation && "mt-0",
|
||||
)}
|
||||
>
|
||||
{continuation ? (
|
||||
<span className="w-9 shrink-0" aria-hidden="true" />
|
||||
) : (
|
||||
<Avatar
|
||||
userId={message.user_id ?? message.first_name ?? "unknown"}
|
||||
firstName={message.first_name ?? "?"}
|
||||
lastName={message.last_name ?? ""}
|
||||
hasAvatar={message.has_avatar}
|
||||
avatarUpdatedAt={message.avatar_updated_at}
|
||||
className="h-9 w-9"
|
||||
/>
|
||||
)}
|
||||
<div className="min-w-0 flex-1">
|
||||
{continuation ? null : (
|
||||
<p className="flex items-center gap-2 text-xs">
|
||||
<span
|
||||
className={cn("font-medium", own ? "text-accent" : "text-foreground")}
|
||||
>
|
||||
{fullName(message)}
|
||||
</span>
|
||||
<span className="text-[0.6875rem] text-subtle-foreground">
|
||||
{timeOf(message.created_at)}
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground">
|
||||
{message.body}
|
||||
</p>
|
||||
</div>
|
||||
{canDelete ? (
|
||||
<span className="opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
|
||||
<IconAction
|
||||
label="Supprimer le message"
|
||||
tone="danger"
|
||||
isLoading={deletingId === message.id}
|
||||
icon={<TrashIcon className="h-3.5 w-3.5" />}
|
||||
onClick={() => void remove(message)}
|
||||
/>
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<form
|
||||
onSubmit={(event) => void send(event)}
|
||||
className="flex shrink-0 items-end gap-2 border-t border-border bg-background px-4 py-3"
|
||||
>
|
||||
<textarea
|
||||
value={draft}
|
||||
onChange={(event) => setDraft(event.target.value.slice(0, MAX_LENGTH))}
|
||||
onKeyDown={onComposerKeyDown}
|
||||
rows={1}
|
||||
maxLength={MAX_LENGTH}
|
||||
placeholder="Écrire un message… (Entrée pour envoyer, Maj+Entrée pour retour à la ligne)"
|
||||
aria-label="Votre message"
|
||||
className="max-h-40 min-h-[2.5rem] flex-1 resize-y rounded-sm border border-border-control bg-surface px-3 py-2 text-sm text-foreground placeholder:text-subtle-foreground focus-visible:border-border-strong focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none"
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
size="md"
|
||||
isLoading={sending}
|
||||
disabled={draft.trim().length === 0}
|
||||
iconLeading={<SendIcon className="h-4 w-4" />}
|
||||
>
|
||||
<span className="hidden sm:inline">Envoyer</span>
|
||||
</Button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -191,3 +191,17 @@ export const MoveIcon = (props: IconProps) => (
|
||||
<path d="m9 7 3-3 3 3M9 17l3 3 3-3M7 9l-3 3 3 3M17 9l3 3-3 3" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const ChatIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M20 15.5a1.5 1.5 0 0 1-1.5 1.5H8l-4 3.5V6.5A1.5 1.5 0 0 1 5.5 5h13A1.5 1.5 0 0 1 20 6.5Z" />
|
||||
<path d="M8 9.5h8M8 13h5" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const SendIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M4.5 12 20 4.5 15 20l-3.5-6.5L4.5 12Z" />
|
||||
<path d="m11.5 13.5 4-4" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user