refactor(ui): switch icons to WebP and standardize icon-only actions #22
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 792 B |
|
Before Width: | Height: | Size: 625 B |
|
After Width: | Height: | Size: 466 B |
|
After Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 929 B |
|
After Width: | Height: | Size: 626 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 932 B |
|
Before Width: | Height: | Size: 803 B |
|
After Width: | Height: | Size: 656 B |
|
Before Width: | Height: | Size: 915 B |
|
After Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 952 B |
|
After Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 684 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 907 B |
|
After Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 648 B |
|
After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 869 B |
|
After Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 566 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 919 B |
|
After Width: | Height: | Size: 732 B |
|
After Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 994 B |
|
After Width: | Height: | Size: 752 B |
|
After Width: | Height: | Size: 814 B |
|
After Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 808 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 764 B |
|
Before Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 831 B |
|
After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 832 B |
|
Before Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 909 B |
|
After Width: | Height: | Size: 676 B |
@@ -527,7 +527,7 @@ export const FolderChat = ({ folder, onClose }: { folder: ChatFolder; onClose: (
|
||||
) : null}
|
||||
<div
|
||||
className={cn(
|
||||
"group flex items-start gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover",
|
||||
"group flex items-start gap-3 rounded-md px-2 py-1.5 backdrop-blur-sm transition-colors hover:bg-surface/50",
|
||||
continuation && "mt-0",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -8,6 +8,8 @@ export const IconAction = ({
|
||||
isLoading = false,
|
||||
tone = "neutral",
|
||||
badge = 0,
|
||||
className,
|
||||
disabled = false,
|
||||
}: {
|
||||
label: string;
|
||||
icon: ReactNode;
|
||||
@@ -15,17 +17,20 @@ export const IconAction = ({
|
||||
isLoading?: boolean;
|
||||
tone?: "neutral" | "danger";
|
||||
badge?: number;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
}) => (
|
||||
<button
|
||||
type="button"
|
||||
title={label}
|
||||
aria-label={label}
|
||||
disabled={isLoading}
|
||||
disabled={isLoading || disabled}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
"group relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-all",
|
||||
"hover:-translate-y-0.5 hover:bg-surface/60 hover:text-foreground hover:shadow-sm backdrop-blur-sm disabled:pointer-events-none disabled:opacity-50",
|
||||
tone === "danger" && "hover:text-destructive",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{isLoading ? <Spinner size="xs" /> : icon}
|
||||
|
||||
@@ -5,9 +5,10 @@ import {
|
||||
useState,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { Button } from "../ui/index.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { Modal } from "./feedback.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
import { CloseIcon, TrashIcon, MoveIcon } from "./icons.js";
|
||||
|
||||
export interface ConfirmOptions {
|
||||
/** Titre de la modale. */
|
||||
@@ -18,6 +19,8 @@ export interface ConfirmOptions {
|
||||
cancelLabel?: string;
|
||||
/** `danger` reserve l'action a une operation destructive. */
|
||||
tone?: "default" | "danger";
|
||||
/** Icone du bouton de confirmation (defaut selon le tone). */
|
||||
confirmIcon?: ReactNode;
|
||||
}
|
||||
|
||||
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
||||
@@ -61,18 +64,22 @@ export const ConfirmProvider = ({ children }: { children: ReactNode }) => {
|
||||
<p className="text-sm leading-relaxed text-muted-foreground">
|
||||
{pending?.options.message}
|
||||
</p>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={() => answer(false)}>
|
||||
{pending?.options.cancelLabel ?? t("Annuler")}
|
||||
</Button>
|
||||
<Button
|
||||
variant={tone === "danger" ? "destructive" : "primary"}
|
||||
size="md"
|
||||
autoFocus
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={pending?.options.cancelLabel ?? t("Annuler")}
|
||||
icon={<CloseIcon className="h-4 w-4" />}
|
||||
className="w-full"
|
||||
onClick={() => answer(false)}
|
||||
/>
|
||||
<IconAction
|
||||
label={pending?.options.confirmLabel ?? t("Confirmer")}
|
||||
icon={
|
||||
pending?.options.confirmIcon ??
|
||||
(tone === "danger" ? <TrashIcon className="h-4 w-4" /> : <MoveIcon className="h-4 w-4" />)
|
||||
}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
onClick={() => answer(true)}
|
||||
>
|
||||
{pending?.options.confirmLabel ?? t("Confirmer")}
|
||||
</Button>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "../lib/api.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { Alert, Modal } from "./feedback.js";
|
||||
import { PlusIcon, TrashIcon } from "./icons.js";
|
||||
import { CloseIcon, MoveIcon, PenIcon, PlusIcon, TrashIcon } from "./icons.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
|
||||
const LEVELS = ["read", "write", "admin"] as const;
|
||||
@@ -70,15 +70,17 @@ export const CreateFolderDialog = ({
|
||||
onChange={(event) => setName(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-1">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<img src="/icons/close.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<CloseIcon className="h-4 w-4" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Créer")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
@@ -132,13 +134,23 @@ export const RenameDialog = ({
|
||||
onChange={(event) => setName(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={onClose}>
|
||||
{t("Annuler")}
|
||||
</Button>
|
||||
<Button type="submit" size="md" isLoading={busy}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<CloseIcon className="h-4 w-4" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Enregistrer")}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void submit(e as any);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -243,15 +255,17 @@ export const MoveDialog = ({
|
||||
</label>
|
||||
)}
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-1">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<img src="/icons/close.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<CloseIcon className="h-4 w-4" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Déplacer")}
|
||||
icon={<img src="/icons/move.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<MoveIcon className="h-4 w-4 object-contain" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -19,130 +19,157 @@ const ImgIcon = ({
|
||||
);
|
||||
|
||||
export const FolderIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/folder.png" {...props} />
|
||||
<ImgIcon src="/icons/folder.webp" {...props} />
|
||||
);
|
||||
|
||||
export const FileIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/document.png" {...props} />
|
||||
<ImgIcon src="/icons/document.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ImageIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/picture.png" {...props} />
|
||||
<ImgIcon src="/icons/picture.webp" {...props} />
|
||||
);
|
||||
|
||||
export const PlayIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
<ImgIcon src="/icons/file.webp" {...props} />
|
||||
);
|
||||
|
||||
export const AudioIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
<ImgIcon src="/icons/file.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ArchiveIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/folder.png" {...props} />
|
||||
<ImgIcon src="/icons/folder.webp" {...props} />
|
||||
);
|
||||
|
||||
export const UploadIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/upload.png" {...props} />
|
||||
<ImgIcon src="/icons/upload.webp" {...props} />
|
||||
);
|
||||
|
||||
export const DownloadIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/download.png" {...props} />
|
||||
<ImgIcon src="/icons/download.webp" {...props} />
|
||||
);
|
||||
|
||||
export const PlusIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/plus.png" {...props} />
|
||||
<ImgIcon src="/icons/plus.webp" {...props} />
|
||||
);
|
||||
|
||||
export const TrashIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/trash-can.png" {...props} />
|
||||
<ImgIcon src="/icons/trash-can.webp" {...props} />
|
||||
);
|
||||
|
||||
export const TrashEmptyIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/trash-empty.webp" {...props} />
|
||||
);
|
||||
|
||||
export const RestoreIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
<ImgIcon src="/icons/restore-data.webp" {...props} />
|
||||
);
|
||||
|
||||
export const RefreshIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
<ImgIcon src="/icons/synchronize.webp" {...props} />
|
||||
);
|
||||
|
||||
export const StarIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/favorite.png" {...props} />
|
||||
<ImgIcon src="/icons/favorite.webp" {...props} />
|
||||
);
|
||||
|
||||
export const SearchIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/search.png" {...props} />
|
||||
<ImgIcon src="/icons/search.webp" {...props} />
|
||||
);
|
||||
|
||||
export const UsersIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/accounts.png" {...props} />
|
||||
<ImgIcon src="/icons/accounts.webp" {...props} />
|
||||
);
|
||||
|
||||
export const SettingsIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/personal-settings.png" {...props} />
|
||||
<ImgIcon src="/icons/personal-settings.webp" {...props} />
|
||||
);
|
||||
|
||||
export const LogoutIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/sign-out.png" {...props} />
|
||||
<ImgIcon src="/icons/sign-out.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ShieldIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/accounts.png" {...props} />
|
||||
<ImgIcon src="/icons/accounts.webp" {...props} />
|
||||
);
|
||||
|
||||
export const HardDriveIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/storage.png" {...props} />
|
||||
<ImgIcon src="/icons/storage.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ActivityIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/activity.png" {...props} />
|
||||
<ImgIcon src="/icons/activity.webp" {...props} />
|
||||
);
|
||||
|
||||
export const SearchNavIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/search.png" {...props} />
|
||||
<ImgIcon src="/icons/search.webp" {...props} />
|
||||
);
|
||||
|
||||
export const FilterIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/filter.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ShareIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/share.png" {...props} />
|
||||
<ImgIcon src="/icons/share.webp" {...props} />
|
||||
);
|
||||
|
||||
export const MenuIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/menu.png" {...props} />
|
||||
<ImgIcon src="/icons/menu.webp" {...props} />
|
||||
);
|
||||
|
||||
export const CloseIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/close.png" {...props} />
|
||||
<ImgIcon src="/icons/close.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ArrowLeftIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/back.png" {...props} />
|
||||
<ImgIcon src="/icons/back.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ArrowRightIcon = (props: IconProps) => (
|
||||
<ImgIcon
|
||||
src="/icons/back.png"
|
||||
src="/icons/back.webp"
|
||||
{...props}
|
||||
style={{ transform: "rotate(180deg)", ...((props.style as any) || {}) }}
|
||||
/>
|
||||
);
|
||||
|
||||
export const PenIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/edit-pencil.png" {...props} />
|
||||
<ImgIcon src="/icons/edit-pencil.webp" {...props} />
|
||||
);
|
||||
|
||||
/** Epingle : tete du pushpin en haut, pointe en bas. */
|
||||
export const PinIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
<ImgIcon src="/icons/pin.webp" {...props} />
|
||||
);
|
||||
|
||||
export const MoveIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
<ImgIcon src="/icons/move.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ChatIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/speech-bubble.png" {...props} />
|
||||
<ImgIcon src="/icons/speech-bubble.webp" {...props} />
|
||||
);
|
||||
|
||||
export const SendIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/send.png" {...props} />
|
||||
<ImgIcon src="/icons/send.webp" {...props} />
|
||||
);
|
||||
|
||||
export const ClearIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/clear.webp" {...props} />
|
||||
);
|
||||
|
||||
export const SaveIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/save.webp" {...props} />
|
||||
);
|
||||
|
||||
export const OpenedFolderIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/opened-folder.webp" {...props} />
|
||||
);
|
||||
|
||||
export const DeactivateIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/deactivate.webp" {...props} />
|
||||
);
|
||||
|
||||
export const PasswordResetIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/password-reset.webp" {...props} />
|
||||
);
|
||||
|
||||
@@ -16,8 +16,14 @@ import { useConfirm } from "../components/confirm.js";
|
||||
import { IconAction } from "../components/IconAction.js";
|
||||
import {
|
||||
ActivityIcon,
|
||||
CloseIcon,
|
||||
DeactivateIcon,
|
||||
FilterIcon,
|
||||
HardDriveIcon,
|
||||
PasswordResetIcon,
|
||||
PenIcon,
|
||||
PlusIcon,
|
||||
RefreshIcon,
|
||||
TrashIcon,
|
||||
UsersIcon,
|
||||
} from "../components/icons.js";
|
||||
@@ -132,6 +138,7 @@ export const AdminUsers = () => {
|
||||
<IconAction
|
||||
label={t("Nouveau membre")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
className="h-9 w-9 bg-accent text-accent-foreground hover:bg-accent"
|
||||
onClick={() => setCreateOpen(true)}
|
||||
/>
|
||||
}
|
||||
@@ -164,9 +171,16 @@ export const AdminUsers = () => {
|
||||
onChange={(event) => setQ(event.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" size="md" variant="secondary">
|
||||
{t("Filtrer")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Filtrer")}
|
||||
icon={<FilterIcon className="h-4 w-4" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</form>
|
||||
</>
|
||||
}
|
||||
@@ -210,18 +224,18 @@ export const AdminUsers = () => {
|
||||
<div className="flex items-center gap-1">
|
||||
<IconAction
|
||||
label={t("Modifier")}
|
||||
icon={<img src="/icons/edit-pencil.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<PenIcon className="h-4 w-4 object-contain" />}
|
||||
onClick={() => setEdit(user)}
|
||||
/>
|
||||
<IconAction
|
||||
label={user.is_active ? t("Désactiver") : t("Réactiver")}
|
||||
icon={<img src="/icons/deactivate.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<DeactivateIcon className="h-4 w-4 object-contain" />}
|
||||
isLoading={busy === user.id}
|
||||
onClick={() => void toggleActive(user)}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Réinitialiser le mot de passe")}
|
||||
icon={<img src="/icons/password-reset.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<PasswordResetIcon className="h-4 w-4 object-contain" />}
|
||||
isLoading={busy === user.id}
|
||||
onClick={() => void resetPassword(user)}
|
||||
/>
|
||||
@@ -356,13 +370,24 @@ const CreateUserDialog = ({
|
||||
/>
|
||||
</div>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={onClose}>
|
||||
{t("Annuler")}
|
||||
</Button>
|
||||
<Button type="submit" size="md" isLoading={busy}>
|
||||
{t("Créer")}
|
||||
</Button>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<CloseIcon className="h-4 w-4 object-contain" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Créer")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -454,13 +479,24 @@ const EditUserDialog = ({
|
||||
/>
|
||||
</div>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={onClose}>
|
||||
{t("Annuler")}
|
||||
</Button>
|
||||
<Button type="submit" size="md" isLoading={busy}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<CloseIcon className="h-4 w-4 object-contain" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Enregistrer")}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -508,6 +544,7 @@ export const AdminStorage = () => {
|
||||
<IconAction
|
||||
label={t("Nouvel emplacement")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
className="h-9 w-9 bg-accent text-accent-foreground hover:bg-accent"
|
||||
onClick={() => setCreateOpen(true)}
|
||||
/>
|
||||
}
|
||||
@@ -544,7 +581,7 @@ export const AdminStorage = () => {
|
||||
</span>
|
||||
<IconAction
|
||||
label={location.is_active ? t("Désactiver") : t("Réactiver")}
|
||||
icon={<img src={location.is_active ? "/icons/close.png" : "/icons/synchronize.png"} alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={location.is_active ? <CloseIcon className="h-4 w-4" /> : <RefreshIcon className="h-4 w-4" />}
|
||||
onClick={() => void toggle(location)}
|
||||
/>
|
||||
</li>
|
||||
@@ -632,13 +669,24 @@ const CreateLocationDialog = ({
|
||||
onChange={(event) => setQuotaGb(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" size="md" onClick={onClose}>
|
||||
{t("Annuler")}
|
||||
</Button>
|
||||
<Button type="submit" size="md" isLoading={busy}>
|
||||
{t("Créer")}
|
||||
</Button>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<CloseIcon className="h-4 w-4 object-contain" />}
|
||||
className="w-full"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Créer")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
className="w-full bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
@@ -35,6 +35,8 @@ import {
|
||||
ChatIcon,
|
||||
CloseIcon,
|
||||
DownloadIcon,
|
||||
MoveIcon,
|
||||
OpenedFolderIcon,
|
||||
PenIcon,
|
||||
PlusIcon,
|
||||
RefreshIcon,
|
||||
@@ -498,7 +500,7 @@ export const Browser = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => goTo(path.length - 2)}
|
||||
className="inline-flex items-center gap-1.5 rounded-sm border border-border-control bg-surface px-2.5 py-1.5 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-foreground transition-colors duration-fast hover:bg-surface-hover focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
className="inline-flex items-center gap-1.5 rounded-sm border border-border-control bg-surface/60 px-2.5 py-1.5 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-foreground backdrop-blur-sm transition-colors duration-fast hover:bg-surface/80 focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<ArrowLeftIcon className="h-3.5 w-3.5" />
|
||||
{t("Retour")}
|
||||
@@ -619,13 +621,15 @@ export const Browser = () => {
|
||||
/>
|
||||
<IconAction
|
||||
label={uploading && uploadProgress ? t("Envoi {current}/{total}…", uploadProgress) : t("Envoyer")}
|
||||
icon={<UploadIcon className="h-4 w-4" />}
|
||||
icon={<UploadIcon className="h-5 w-5" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={uploading}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Nouveau dossier")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
icon={<PlusIcon className="h-5 w-5" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
onClick={() => setDialog({ kind: "create" })}
|
||||
/>
|
||||
</div>
|
||||
@@ -672,7 +676,7 @@ export const Browser = () => {
|
||||
<div className="flex flex-wrap items-center justify-center gap-1">
|
||||
<IconAction
|
||||
label={t("Déplacer")}
|
||||
icon={<img src="/icons/move.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
icon={<MoveIcon className="h-4 w-4 object-contain" />}
|
||||
onClick={() => setDialog({ kind: "moveMany", targets: selectedItems })}
|
||||
/>
|
||||
<IconAction
|
||||
@@ -717,7 +721,7 @@ export const Browser = () => {
|
||||
</div>
|
||||
) : empty ? (
|
||||
<EmptyState
|
||||
icon={<img src="/icons/opened-folder.png" alt="" className="h-8 w-8 object-contain" />}
|
||||
icon={<OpenedFolderIcon className="h-8 w-8 object-contain" />}
|
||||
title={t("Emplacement vide")}
|
||||
description={t(
|
||||
"Créez un sous-dossier ou envoyez un fichier pour commencer.",
|
||||
@@ -775,7 +779,7 @@ export const Browser = () => {
|
||||
className="flex min-w-0 flex-1 items-center gap-3 rounded-sm p-1 text-left focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<span className="shrink-0 text-accent">
|
||||
<img src="/icons/opened-folder.png" alt="" className="h-5 w-5 object-contain" />
|
||||
<OpenedFolderIcon className="h-5 w-5 object-contain" />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-sm font-medium text-foreground">
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useEffect, useRef, useState, type FormEvent } from "react";
|
||||
import { Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Input, Spinner } from "../ui/index.js";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle, Input, Spinner } from "../ui/index.js";
|
||||
import { ApiError, api, formatDate, type Language, type SessionInfo, type Theme } from "../lib/api.js";
|
||||
import { useSession } from "../lib/session.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { Alert, Badge, PageHeader } from "../components/feedback.js";
|
||||
import { useConfirm } from "../components/confirm.js";
|
||||
import { TrashIcon } from "../components/icons.js";
|
||||
import { IconAction } from "../components/IconAction.js";
|
||||
import { ClearIcon, OpenedFolderIcon, SaveIcon, TrashIcon } from "../components/icons.js";
|
||||
|
||||
const THEMES: { value: Theme; label: string }[] = [
|
||||
{ value: "system", label: "Système" },
|
||||
@@ -151,6 +152,7 @@ export const Profile = () => {
|
||||
title: t("Fermer la session"),
|
||||
message: t("Fermer la session en cours vous déconnectera immédiatement."),
|
||||
confirmLabel: t("Fermer"),
|
||||
confirmIcon: <ClearIcon className="h-4 w-4 object-contain" />,
|
||||
});
|
||||
if (!ok) return;
|
||||
}
|
||||
@@ -237,9 +239,17 @@ export const Profile = () => {
|
||||
{prefError ? <Alert>{prefError}</Alert> : null}
|
||||
{prefMessage ? <Alert tone="success">{prefMessage}</Alert> : null}
|
||||
<div className="flex justify-end">
|
||||
<Button type="submit" size="md" isLoading={savingPrefs}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Enregistrer")}
|
||||
icon={<SaveIcon className="h-4 w-4 object-contain" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={savingPrefs}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
@@ -271,9 +281,17 @@ export const Profile = () => {
|
||||
{profileError ? <Alert>{profileError}</Alert> : null}
|
||||
{profileMessage ? <Alert tone="success">{profileMessage}</Alert> : null}
|
||||
<div className="flex justify-end">
|
||||
<Button type="submit" size="md" isLoading={savingProfile}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Enregistrer")}
|
||||
icon={<SaveIcon className="h-4 w-4 object-contain" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={savingProfile}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
@@ -305,12 +323,18 @@ export const Profile = () => {
|
||||
onChange={(event) => void changeAvatar(event.target.files?.[0])}
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="secondary" size="sm" onClick={() => avatarInput.current?.click()}>
|
||||
{t("Choisir une image")}
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => void removeAvatar()}>
|
||||
{t("Retirer")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Choisir une image")}
|
||||
icon={<OpenedFolderIcon className="h-4 w-4 object-contain" />}
|
||||
className="h-9 w-9"
|
||||
onClick={() => avatarInput.current?.click()}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Retirer")}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
className="h-9 w-9"
|
||||
onClick={() => void removeAvatar()}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-[0.6875rem] text-subtle-foreground">
|
||||
{t("Si aucune image n'est définie, vos initiales sont affichées.")}
|
||||
@@ -348,9 +372,17 @@ export const Profile = () => {
|
||||
{emailError ? <Alert>{emailError}</Alert> : null}
|
||||
{emailMessage ? <Alert tone="success">{emailMessage}</Alert> : null}
|
||||
<div className="flex justify-end">
|
||||
<Button type="submit" size="md" isLoading={sendingEmail}>
|
||||
{t("Demander le changement")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Demander le changement")}
|
||||
icon={<SaveIcon className="h-4 w-4 object-contain" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={sendingEmail}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
@@ -385,29 +417,24 @@ export const Profile = () => {
|
||||
{t("vue le {date}", { date: formatDate(session.last_seen_at) })}
|
||||
</span>
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t("Fermer cette session")}
|
||||
disabled={revoking === session.id}
|
||||
<IconAction
|
||||
label={t("Fermer cette session")}
|
||||
icon={<ClearIcon className="h-4 w-4 object-contain" />}
|
||||
tone="danger"
|
||||
isLoading={revoking === session.id}
|
||||
onClick={() => void revokeSession(session)}
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50"
|
||||
>
|
||||
<TrashIcon className="h-4 w-4" />
|
||||
</button>
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<TrashIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Nettoyer")}
|
||||
icon={<ClearIcon className="h-4 w-4 object-contain" />}
|
||||
disabled={sessions === null || sessions.length <= 1}
|
||||
onClick={() => void revokeOthers()}
|
||||
>
|
||||
{t("Fermer les autres sessions")}
|
||||
</Button>
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -60,6 +60,7 @@ export const Search = () => {
|
||||
<IconAction
|
||||
label={t("Rechercher")}
|
||||
icon={<SearchIcon className="h-4 w-4" />}
|
||||
className="h-10 w-10 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={loading}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Button, Spinner } from "../ui/index.js";
|
||||
import { Spinner } from "../ui/index.js";
|
||||
import {
|
||||
ApiError,
|
||||
api,
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { Alert, EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { useConfirm } from "../components/confirm.js";
|
||||
import { IconAction } from "../components/IconAction.js";
|
||||
import { FileIcon, FolderIcon, RestoreIcon, TrashIcon } from "../components/icons.js";
|
||||
import { FileIcon, FolderIcon, RestoreIcon, TrashEmptyIcon, TrashIcon } from "../components/icons.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
|
||||
interface TrashData {
|
||||
@@ -64,6 +64,7 @@ export const Trash = () => {
|
||||
message: t("Tous les éléments seront définitivement supprimés. Cette action est irréversible."),
|
||||
confirmLabel: t("Vider"),
|
||||
tone: "danger",
|
||||
confirmIcon: <TrashEmptyIcon className="h-4 w-4" />,
|
||||
});
|
||||
if (!ok) return;
|
||||
void run("empty", () => api.emptyTrash());
|
||||
@@ -95,9 +96,13 @@ export const Trash = () => {
|
||||
}
|
||||
actions={
|
||||
data && !empty ? (
|
||||
<Button variant="destructive" size="sm" isLoading={busy === "empty"} onClick={emptyTrash}>
|
||||
{t("Vider la corbeille")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Vider la corbeille")}
|
||||
icon={<TrashEmptyIcon className="h-4 w-4" />}
|
||||
className="h-9 w-9 bg-accent text-accent-foreground hover:bg-accent"
|
||||
isLoading={busy === "empty"}
|
||||
onClick={emptyTrash}
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
|
||||