feat(ui): add grouped actions; add contextual menu for grouped actions; items & folders can be selected without precisly clicking the checkbox (#16)
CD — Deployment / deploy (push) Successful in 15s
CD — Deployment / deploy (push) Successful in 15s
PR automatique de feat/bulk-move-upload-progress vers main. --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #16 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #16.
This commit is contained in:
@@ -11,7 +11,7 @@ export const IconAction = ({
|
||||
}: {
|
||||
label: string;
|
||||
icon: ReactNode;
|
||||
onClick: () => void;
|
||||
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
||||
isLoading?: boolean;
|
||||
tone?: "neutral" | "danger";
|
||||
badge?: number;
|
||||
|
||||
@@ -157,14 +157,19 @@ const loadTree = async (): Promise<TreeEntry[]> => {
|
||||
|
||||
export const MoveDialog = ({
|
||||
target,
|
||||
targets,
|
||||
onClose,
|
||||
onDone,
|
||||
}: {
|
||||
target: Target;
|
||||
target?: Target;
|
||||
targets?: Target[];
|
||||
onClose: () => void;
|
||||
onDone: () => void;
|
||||
}) => {
|
||||
const { t } = useI18n();
|
||||
const items = targets && targets.length > 0 ? targets : target ? [target] : [];
|
||||
const single = items.length === 1 ? items[0] : null;
|
||||
const title = single ? t("Déplacer") : t("Déplacer {count} éléments", { count: items.length });
|
||||
const [entries, setEntries] = useState<TreeEntry[] | null>(null);
|
||||
const [destination, setDestination] = useState<string>("");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -182,8 +187,10 @@ export const MoveDialog = ({
|
||||
setError(null);
|
||||
const parentId = destination === "" ? null : destination;
|
||||
try {
|
||||
if (target.type === "folder") await api.moveFolder(target.id, parentId);
|
||||
else await api.moveFile(target.id, parentId);
|
||||
for (const item of items) {
|
||||
if (item.type === "folder") await api.moveFolder(item.id, parentId);
|
||||
else await api.moveFile(item.id, parentId);
|
||||
}
|
||||
onDone();
|
||||
} catch (caught) {
|
||||
setError(messageOf(caught, t("Déplacement impossible.")));
|
||||
@@ -193,10 +200,12 @@ export const MoveDialog = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal open title={t("Déplacer")} onClose={onClose}>
|
||||
<Modal open title={title} onClose={onClose}>
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("Destination de {name}.", { name: target.name })}
|
||||
{single
|
||||
? t("Destination de {name}.", { name: single.name })
|
||||
: t("{count} éléments seront déplacés.", { count: items.length })}
|
||||
</p>
|
||||
{entries === null && !error ? (
|
||||
<Alert tone="info">{t("Chargement des dossiers…")}</Alert>
|
||||
@@ -214,13 +223,13 @@ export const MoveDialog = ({
|
||||
)}
|
||||
>
|
||||
<option value="">{t("Racine")}</option>
|
||||
{(entries ?? [])
|
||||
.filter((entry) => entry.id !== target.id)
|
||||
.map((entry) => (
|
||||
<option key={entry.id} value={entry.id}>
|
||||
{entry.label}
|
||||
</option>
|
||||
))}
|
||||
{(entries ?? [])
|
||||
.filter((entry) => !items.some((item) => item.type === "folder" && item.id === entry.id))
|
||||
.map((entry) => (
|
||||
<option key={entry.id} value={entry.id}>
|
||||
{entry.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
|
||||
@@ -42,7 +42,7 @@ export const Modal = ({
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={title}
|
||||
className="animate-panel-in relative w-full max-w-md rounded-lg border border-border bg-surface p-4 shadow-lg"
|
||||
className="animate-panel-in relative w-full max-w-lg sm:max-w-md rounded-lg border border-border bg-surface p-4 sm:p-5 shadow-lg"
|
||||
>
|
||||
<div className="mb-4 flex items-center justify-between gap-4">
|
||||
<h2 className="font-display text-xs font-semibold uppercase tracking-label text-foreground">
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { createContext, useCallback, useContext, useState, type ReactNode } from "react";
|
||||
import { cn } from "../ui/index.js";
|
||||
import { CloseIcon } from "./icons.js";
|
||||
|
||||
type ToastTone = "success" | "error" | "info";
|
||||
|
||||
interface Toast {
|
||||
id: number;
|
||||
message: string;
|
||||
tone: ToastTone;
|
||||
duration: number;
|
||||
}
|
||||
|
||||
interface ToastContextValue {
|
||||
toast: (message: string, tone?: ToastTone, duration?: number) => void;
|
||||
success: (message: string, duration?: number) => void;
|
||||
error: (message: string, duration?: number) => void;
|
||||
info: (message: string, duration?: number) => void;
|
||||
}
|
||||
|
||||
const ToastContext = createContext<ToastContextValue | null>(null);
|
||||
|
||||
export const useToast = () => {
|
||||
const ctx = useContext(ToastContext);
|
||||
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
||||
return ctx;
|
||||
};
|
||||
|
||||
let toastId = 0;
|
||||
|
||||
export const ToastProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [toasts, setToasts] = useState<Toast[]>([]);
|
||||
|
||||
const remove = useCallback((id: number) => {
|
||||
setToasts((prev) => prev.filter((t) => t.id !== id));
|
||||
}, []);
|
||||
|
||||
const toast = useCallback((message: string, tone: ToastTone = "info", duration = 4000) => {
|
||||
const id = ++toastId;
|
||||
setToasts((prev) => [...prev, { id, message, tone, duration }]);
|
||||
if (duration > 0) {
|
||||
setTimeout(() => remove(id), duration);
|
||||
}
|
||||
}, [remove]);
|
||||
|
||||
const success = useCallback((message: string, duration = 4000) => toast(message, "success", duration), [toast]);
|
||||
const error = useCallback((message: string, duration = 5000) => toast(message, "error", duration), [toast]);
|
||||
const info = useCallback((message: string, duration = 4000) => toast(message, "info", duration), [toast]);
|
||||
|
||||
return (
|
||||
<ToastContext.Provider value={{ toast, success, error, info }}>
|
||||
{children}
|
||||
<div className="fixed left-4 right-4 top-6 z-[100] flex flex-col gap-2 sm:left-auto sm:right-4 sm:max-w-sm">
|
||||
{toasts.map((t) => (
|
||||
<div
|
||||
key={t.id}
|
||||
className={cn(
|
||||
"animate-in slide-in-from-right fade-in flex min-w-[280px] max-w-sm items-start gap-3 rounded-lg border px-4 py-3 shadow-lg backdrop-blur",
|
||||
t.tone === "success" && "border-accent/40 bg-accent/10 text-foreground",
|
||||
t.tone === "error" && "border-destructive/40 bg-destructive/10 text-destructive",
|
||||
t.tone === "info" && "border-border bg-surface text-foreground",
|
||||
)}
|
||||
role="status"
|
||||
>
|
||||
<p className="flex-1 text-sm leading-relaxed">{t.message}</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => remove(t.id)}
|
||||
className="text-muted-foreground transition-colors hover:text-foreground"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<CloseIcon className="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</ToastContext.Provider>
|
||||
);
|
||||
};
|
||||
@@ -6,6 +6,7 @@ import { SessionProvider, useSession } from "./lib/session.js";
|
||||
import { I18nProvider } from "./lib/i18n.js";
|
||||
import { ThemeProvider } from "./lib/theme.js";
|
||||
import { ConfirmProvider } from "./components/confirm.js";
|
||||
import { ToastProvider } from "./components/toast.js";
|
||||
import "./styles/index.css";
|
||||
|
||||
const container = document.getElementById("root");
|
||||
@@ -23,7 +24,9 @@ const Providers = ({ children }: { children: ReactNode }) => {
|
||||
return (
|
||||
<ThemeProvider theme={user?.theme ?? "system"}>
|
||||
<I18nProvider language={user?.language ?? "fr"}>
|
||||
<ConfirmProvider>{children}</ConfirmProvider>
|
||||
<ConfirmProvider>
|
||||
<ToastProvider>{children}</ToastProvider>
|
||||
</ConfirmProvider>
|
||||
</I18nProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
||||
+486
-229
@@ -1,4 +1,10 @@
|
||||
import { useCallback, useEffect, useRef, useState, type DragEvent } from "react";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
type DragEvent,
|
||||
} from "react";
|
||||
import { Button, Card, Spinner, cn } from "../ui/index.js";
|
||||
import {
|
||||
ApiError,
|
||||
@@ -11,12 +17,13 @@ import { useSession } from "../lib/session.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { getLocale } from "../lib/locale.js";
|
||||
import { mediaKind } from "../lib/media.js";
|
||||
import { Alert, Badge, EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { Badge, EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { useConfirm } from "../components/confirm.js";
|
||||
import { MediaViewer } from "../components/MediaViewer.js";
|
||||
import { MediaThumb } from "../components/MediaThumb.js";
|
||||
import { IconAction } from "../components/IconAction.js";
|
||||
import { FolderChat, type ChatFolder } from "../components/FolderChat.js";
|
||||
import { useToast } from "../components/toast.js";
|
||||
import {
|
||||
CreateFolderDialog,
|
||||
MoveDialog,
|
||||
@@ -28,7 +35,6 @@ import {
|
||||
ChatIcon,
|
||||
DownloadIcon,
|
||||
FolderIcon,
|
||||
MoveIcon,
|
||||
PenIcon,
|
||||
PlusIcon,
|
||||
ShareIcon,
|
||||
@@ -48,6 +54,7 @@ type Dialog =
|
||||
| { kind: "create" }
|
||||
| { kind: "rename"; target: Target }
|
||||
| { kind: "move"; target: Target }
|
||||
| { kind: "moveMany"; targets: Target[] }
|
||||
| { kind: "share"; folder: Folder }
|
||||
| null;
|
||||
|
||||
@@ -65,12 +72,13 @@ export const Browser = () => {
|
||||
const { user, refresh } = useSession();
|
||||
const { t } = useI18n();
|
||||
const confirm = useConfirm();
|
||||
const toast = useToast();
|
||||
const [path, setPath] = useState<Crumb[]>([{ id: null, name: "Racine" }]);
|
||||
const [folders, setFolders] = useState<Folder[]>([]);
|
||||
const [files, setFiles] = useState<UploadedFile[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [notice, setNotice] = useState<string | null>(null);
|
||||
const [, setError] = useState<string | null>(null);
|
||||
const [, setNotice] = useState<string | null>(null);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [removing, setRemoving] = useState<string | null>(null);
|
||||
const [dialog, setDialog] = useState<Dialog>(null);
|
||||
@@ -84,28 +92,41 @@ export const Browser = () => {
|
||||
// quand le pointeur passe d'un element enfant a un autre.
|
||||
const [dragDepth, setDragDepth] = useState(0);
|
||||
const [dropTargetId, setDropTargetId] = useState<string | null>(null);
|
||||
const [selected, setSelected] = useState<Set<string>>(new Set());
|
||||
const [uploadProgress, setUploadProgress] = useState<{
|
||||
current: number;
|
||||
total: number;
|
||||
} | null>(null);
|
||||
|
||||
const current = path[path.length - 1] ?? { id: null, name: "Racine" };
|
||||
const dragActive = dragDepth > 0;
|
||||
|
||||
const load = useCallback(async (parentId: string | null) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const [folderResult, fileResult] = await Promise.all([
|
||||
api.folders(parentId),
|
||||
api.files(parentId),
|
||||
]);
|
||||
setFolders(folderResult.folders);
|
||||
setFiles(fileResult.files);
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : t("Chargement impossible."));
|
||||
setFolders([]);
|
||||
setFiles([]);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [t]);
|
||||
const load = useCallback(
|
||||
async (parentId: string | null) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const [folderResult, fileResult] = await Promise.all([
|
||||
api.folders(parentId),
|
||||
api.files(parentId),
|
||||
]);
|
||||
setFolders(folderResult.folders);
|
||||
setFiles(fileResult.files);
|
||||
} catch (caught) {
|
||||
const msg =
|
||||
caught instanceof ApiError
|
||||
? caught.message
|
||||
: t("Chargement impossible.");
|
||||
setError(msg);
|
||||
toast.error(msg);
|
||||
setFolders([]);
|
||||
setFiles([]);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
},
|
||||
[t],
|
||||
);
|
||||
|
||||
const refreshUnread = useCallback(async () => {
|
||||
try {
|
||||
@@ -136,23 +157,33 @@ export const Browser = () => {
|
||||
setPath((previous) => [...previous, { id: folder.id, name: folder.name }]);
|
||||
};
|
||||
|
||||
const goTo = (index: number) => setPath((previous) => previous.slice(0, index + 1));
|
||||
const goTo = (index: number) =>
|
||||
setPath((previous) => previous.slice(0, index + 1));
|
||||
|
||||
const upload = async (selected: FileList | null) => {
|
||||
if (!selected || selected.length === 0) return;
|
||||
const upload = async (selectedFiles: FileList | null) => {
|
||||
if (!selectedFiles || selectedFiles.length === 0) return;
|
||||
setUploading(true);
|
||||
setError(null);
|
||||
setNotice(null);
|
||||
const total = selectedFiles.length;
|
||||
setUploadProgress({ current: 0, total });
|
||||
try {
|
||||
for (const file of Array.from(selected)) {
|
||||
await api.uploadFile(file, current.id);
|
||||
const filesArr = Array.from(selectedFiles);
|
||||
for (let i = 0; i < filesArr.length; i++) {
|
||||
const f = filesArr[i] as File;
|
||||
setUploadProgress({ current: i + 1, total });
|
||||
await api.uploadFile(f, current.id);
|
||||
}
|
||||
void refresh();
|
||||
await reload();
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : t("Envoi impossible."));
|
||||
const msg =
|
||||
caught instanceof ApiError ? caught.message : t("Envoi impossible.");
|
||||
setError(msg);
|
||||
toast.error(msg);
|
||||
} finally {
|
||||
setUploading(false);
|
||||
setUploadProgress(null);
|
||||
if (fileInputRef.current) fileInputRef.current.value = "";
|
||||
}
|
||||
};
|
||||
@@ -162,31 +193,46 @@ export const Browser = () => {
|
||||
* dossier affiche ou l'un des sous-dossiers listes ; le serveur revalide les
|
||||
* droits d'ecriture dans tous les cas.
|
||||
*/
|
||||
const uploadInto = async (selected: FileList | null, folderId: string | null, label?: string) => {
|
||||
if (!selected || selected.length === 0) return;
|
||||
const uploadInto = async (
|
||||
selectedFiles: FileList | null,
|
||||
folderId: string | null,
|
||||
label?: string,
|
||||
) => {
|
||||
if (!selectedFiles || selectedFiles.length === 0) return;
|
||||
setUploading(true);
|
||||
setError(null);
|
||||
setNotice(null);
|
||||
const total = selectedFiles.length;
|
||||
setUploadProgress({ current: 0, total });
|
||||
try {
|
||||
for (const file of Array.from(selected)) {
|
||||
await api.uploadFile(file, folderId);
|
||||
const filesArr = Array.from(selectedFiles);
|
||||
for (let i = 0; i < filesArr.length; i++) {
|
||||
const f = filesArr[i] as File;
|
||||
setUploadProgress({ current: i + 1, total });
|
||||
await api.uploadFile(f, folderId);
|
||||
}
|
||||
void refresh();
|
||||
// Seule la vue courante est rechargée : un depot dans un sous-dossier ne
|
||||
// change rien a l'ecran tant qu'on ne l'ouvre pas.
|
||||
if (folderId === current.id) await reload();
|
||||
setNotice(
|
||||
label
|
||||
? t("{count} fichier(s) déposé(s) dans {name}.", {
|
||||
count: selected.length,
|
||||
name: label,
|
||||
})
|
||||
: t("{count} fichier(s) déposé(s) dans ce dossier.", { count: selected.length }),
|
||||
);
|
||||
const msg = label
|
||||
? t("{count} fichier(s) déposé(s) dans {name}.", {
|
||||
count: filesArr.length,
|
||||
name: label,
|
||||
})
|
||||
: t("{count} fichier(s) déposé(s) dans ce dossier.", {
|
||||
count: filesArr.length,
|
||||
});
|
||||
setNotice(msg);
|
||||
toast.success(msg);
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : t("Envoi impossible."));
|
||||
const msg =
|
||||
caught instanceof ApiError ? caught.message : t("Envoi impossible.");
|
||||
setError(msg);
|
||||
toast.error(msg);
|
||||
} finally {
|
||||
setUploading(false);
|
||||
setUploadProgress(null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -263,7 +309,10 @@ export const Browser = () => {
|
||||
const kind = target.type === "folder" ? t("ce dossier") : t("ce fichier");
|
||||
const ok = await confirm({
|
||||
title: t("Mettre à la corbeille"),
|
||||
message: t("Placer {name} ({kind}) dans la corbeille ?", { name: target.name, kind }),
|
||||
message: t("Placer {name} ({kind}) dans la corbeille ?", {
|
||||
name: target.name,
|
||||
kind,
|
||||
}),
|
||||
confirmLabel: t("Corbeille"),
|
||||
tone: "danger",
|
||||
});
|
||||
@@ -279,7 +328,12 @@ export const Browser = () => {
|
||||
}
|
||||
await reload();
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : t("Suppression impossible."));
|
||||
const msg =
|
||||
caught instanceof ApiError
|
||||
? caught.message
|
||||
: t("Suppression impossible.");
|
||||
setError(msg);
|
||||
toast.error(msg);
|
||||
} finally {
|
||||
setRemoving(null);
|
||||
}
|
||||
@@ -289,9 +343,14 @@ export const Browser = () => {
|
||||
setError(null);
|
||||
try {
|
||||
const { file: updated } = await api.starFile(file.id);
|
||||
setFiles((previous) => previous.map((item) => (item.id === updated.id ? updated : item)));
|
||||
setFiles((previous) =>
|
||||
previous.map((item) => (item.id === updated.id ? updated : item)),
|
||||
);
|
||||
} catch (caught) {
|
||||
setError(caught instanceof ApiError ? caught.message : t("Action impossible."));
|
||||
const msg =
|
||||
caught instanceof ApiError ? caught.message : t("Action impossible.");
|
||||
setError(msg);
|
||||
toast.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -300,10 +359,32 @@ export const Browser = () => {
|
||||
void refreshUnread();
|
||||
};
|
||||
|
||||
const canWrite = user?.role_slug === "admin" || user?.role_slug === "user";
|
||||
const toggleSelection = (key: string) => {
|
||||
setSelected((previous) => {
|
||||
const next = new Set(previous);
|
||||
if (next.has(key)) next.delete(key);
|
||||
else next.add(key);
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const clearSelection = () => setSelected(new Set());
|
||||
|
||||
const selectedItems: Target[] = [];
|
||||
for (const folder of folders) {
|
||||
if (selected.has(`f:${folder.id}`))
|
||||
selectedItems.push({ type: "folder", id: folder.id, name: folder.name });
|
||||
}
|
||||
for (const file of files) {
|
||||
if (selected.has(`i:${file.id}`))
|
||||
selectedItems.push({ type: "file", id: file.id, name: file.name });
|
||||
}
|
||||
const empty = folders.length === 0 && files.length === 0;
|
||||
const visibleFiles = kind ? files.filter((file) => mediaKind(file.mime_type) === kind) : files;
|
||||
const currentUnread = current.id ? unread[current.id] ?? 0 : 0;
|
||||
const canWrite = true;
|
||||
const visibleFiles = kind
|
||||
? files.filter((file) => mediaKind(file.mime_type) === kind)
|
||||
: files;
|
||||
const currentUnread = current.id ? (unread[current.id] ?? 0) : 0;
|
||||
const quotaPercent =
|
||||
user && user.quota_bytes > 0
|
||||
? Math.min(100, Math.round((user.used_bytes / user.quota_bytes) * 100))
|
||||
@@ -330,60 +411,72 @@ export const Browser = () => {
|
||||
|
||||
<PageHeader
|
||||
title={current.name}
|
||||
description={t("Vos dossiers et fichiers. Envoyez un fichier ou créez un dossier.")}
|
||||
description={t(
|
||||
"Vos dossiers et fichiers. Envoyez un fichier ou créez un dossier.",
|
||||
)}
|
||||
toolbar={
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
{path.length > 1 ? (
|
||||
<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"
|
||||
>
|
||||
<ArrowLeftIcon className="h-3.5 w-3.5" />
|
||||
{t("Retour")}
|
||||
</button>
|
||||
) : null}
|
||||
{path.length > 1 ? (
|
||||
<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"
|
||||
>
|
||||
<ArrowLeftIcon className="h-3.5 w-3.5" />
|
||||
{t("Retour")}
|
||||
</button>
|
||||
) : null}
|
||||
|
||||
<nav aria-label={t("Fil d'Ariane")} className="min-w-0">
|
||||
<ol className="flex flex-wrap items-center gap-1.5 text-xs">
|
||||
{path.map((crumb, index) => (
|
||||
<li key={`${crumb.id ?? "root"}-${index}`} className="flex items-center gap-1.5">
|
||||
{index > 0 ? (
|
||||
<span className="text-border" aria-hidden="true">
|
||||
/
|
||||
</span>
|
||||
) : null}
|
||||
{index === path.length - 1 ? (
|
||||
<span className="font-medium text-foreground" aria-current="page">
|
||||
{t(crumb.name)}
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => goTo(index)}
|
||||
className="text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
|
||||
<nav aria-label={t("Fil d'Ariane")} className="min-w-0">
|
||||
<ol className="flex flex-wrap items-center gap-1.5 text-xs">
|
||||
{path.map((crumb, index) => (
|
||||
<li
|
||||
key={`${crumb.id ?? "root"}-${index}`}
|
||||
className="flex items-center gap-1.5"
|
||||
>
|
||||
{t(crumb.name)}
|
||||
</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</nav>
|
||||
{index > 0 ? (
|
||||
<span className="text-border" aria-hidden="true">
|
||||
/
|
||||
</span>
|
||||
) : null}
|
||||
{index === path.length - 1 ? (
|
||||
<span
|
||||
className="font-medium text-foreground"
|
||||
aria-current="page"
|
||||
>
|
||||
{t(crumb.name)}
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => goTo(index)}
|
||||
className="text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline"
|
||||
>
|
||||
{t(crumb.name)}
|
||||
</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
{current.id ? (
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<ChatIcon className="h-3.5 w-3.5" />}
|
||||
onClick={() => setChat({ id: current.id as string, name: current.name })}
|
||||
>
|
||||
<span className="inline-flex items-center gap-2">
|
||||
{t("Discussion")}
|
||||
{currentUnread > 0 ? <Badge tone="accent">{currentUnread}</Badge> : null}
|
||||
</span>
|
||||
</Button>
|
||||
) : null}
|
||||
{current.id ? (
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<ChatIcon className="h-3.5 w-3.5" />}
|
||||
onClick={() =>
|
||||
setChat({ id: current.id as string, name: current.name })
|
||||
}
|
||||
>
|
||||
<span className="inline-flex items-center gap-2">
|
||||
{t("Discussion")}
|
||||
{currentUnread > 0 ? (
|
||||
<Badge tone="accent">{currentUnread}</Badge>
|
||||
) : null}
|
||||
</span>
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
@@ -392,7 +485,9 @@ export const Browser = () => {
|
||||
<div className="flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-baseline justify-between gap-3">
|
||||
<span className="text-xs font-medium text-foreground">{t("Espace utilisé")}</span>
|
||||
<span className="text-xs font-medium text-foreground">
|
||||
{t("Espace utilisé")}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{t("{used} sur {quota}", {
|
||||
used: formatBytes(user?.used_bytes ?? 0),
|
||||
@@ -408,6 +503,27 @@ export const Browser = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{uploading && uploadProgress ? (
|
||||
<div className="w-full px-4">
|
||||
<div className="flex items-baseline justify-between gap-2 mb-1">
|
||||
<span className="text-xs font-medium text-foreground">
|
||||
{t("Envoi en cours")}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{t("{current}/{total}", uploadProgress)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-1.5 w-full overflow-hidden rounded-full bg-surface-muted">
|
||||
<div
|
||||
className="h-full rounded-full bg-accent transition-[width] duration-200"
|
||||
style={{
|
||||
width: `${Math.round((uploadProgress.current / uploadProgress.total) * 100)}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{canWrite ? (
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
@@ -424,7 +540,9 @@ export const Browser = () => {
|
||||
isLoading={uploading}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
>
|
||||
{t("Envoyer")}
|
||||
{uploading && uploadProgress
|
||||
? t("Envoi {current}/{total}…", uploadProgress)
|
||||
: t("Envoyer")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -440,7 +558,11 @@ export const Browser = () => {
|
||||
</Card>
|
||||
|
||||
{files.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-1.5" role="tablist" aria-label={t("Filtrer par type")}>
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="tablist"
|
||||
aria-label={t("Filtrer par type")}
|
||||
>
|
||||
{KINDS.map((option) => (
|
||||
<button
|
||||
key={option.value}
|
||||
@@ -461,8 +583,51 @@ export const Browser = () => {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
{notice ? <Alert tone="success">{notice}</Alert> : null}
|
||||
{/* Alerts replaced by toasts */}
|
||||
|
||||
{canWrite && selectedItems.length > 0 ? (
|
||||
<div className="fixed bottom-3 left-1/2 z-40 w-[calc(100%-1rem)] max-w-xl -translate-x-1/2 px-1 sm:bottom-4 sm:w-auto">
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-border-strong bg-surface px-3 py-2 shadow-lg sm:flex-row sm:flex-wrap sm:items-center sm:justify-center">
|
||||
<p className="text-center text-sm font-medium text-foreground">
|
||||
{t("{count} élément(s) sélectionné(s).", {
|
||||
count: selectedItems.length,
|
||||
})}
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center justify-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() =>
|
||||
setDialog({ kind: "moveMany", targets: selectedItems })
|
||||
}
|
||||
>
|
||||
{t("Déplacer")}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="destructive"
|
||||
onClick={() =>
|
||||
void Promise.all(
|
||||
selectedItems.map((target) =>
|
||||
target.type === "folder"
|
||||
? api.deleteFolder(target.id)
|
||||
: api.deleteFile(target.id),
|
||||
),
|
||||
).then(async () => {
|
||||
clearSelection();
|
||||
await reload();
|
||||
})
|
||||
}
|
||||
>
|
||||
{t("Supprimer")}
|
||||
</Button>
|
||||
<Button size="sm" variant="ghost" onClick={clearSelection}>
|
||||
{t("Annuler la sélection")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-16">
|
||||
@@ -472,7 +637,9 @@ export const Browser = () => {
|
||||
<EmptyState
|
||||
icon={<FolderIcon className="h-8 w-8" />}
|
||||
title={t("Emplacement vide")}
|
||||
description={t("Créez un sous-dossier ou envoyez un fichier pour commencer.")}
|
||||
description={t(
|
||||
"Créez un sous-dossier ou envoyez un fichier pour commencer.",
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex flex-col gap-6">
|
||||
@@ -488,14 +655,39 @@ export const Browser = () => {
|
||||
onDragOver={(event) => onFolderDragOver(event, folder.id)}
|
||||
onDragLeave={(event) => onFolderDragLeave(event, folder.id)}
|
||||
onDrop={(event) => onFolderDrop(event, folder)}
|
||||
onClick={() => toggleSelection(`f:${folder.id}`)}
|
||||
className={cn(
|
||||
"flex items-center gap-1 rounded-lg border border-border bg-surface p-2 transition-colors hover:border-border-strong hover:bg-surface-hover",
|
||||
dropTargetId === folder.id && "border-accent bg-accent/10 ring-1 ring-accent/50",
|
||||
"group relative flex items-center gap-1 rounded-lg border border-border bg-surface p-2 transition-colors hover:border-border-strong hover:bg-surface-hover cursor-pointer",
|
||||
dropTargetId === folder.id &&
|
||||
"border-accent bg-accent/10 ring-1 ring-accent/50",
|
||||
selected.has(`f:${folder.id}`) &&
|
||||
"border-accent/60 ring-1 ring-accent/40",
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
className={cn(
|
||||
"ml-1 h-4 w-4 rounded border-border-control transition-opacity",
|
||||
selected.has(`f:${folder.id}`) ||
|
||||
selectedItems.length > 0
|
||||
? "opacity-100"
|
||||
: "opacity-100 md:opacity-0 md:group-hover:opacity-100 md:focus:opacity-100",
|
||||
)}
|
||||
checked={selected.has(`f:${folder.id}`)}
|
||||
aria-label={t("Sélectionner {name}", {
|
||||
name: folder.name,
|
||||
})}
|
||||
onChange={(event) => {
|
||||
event.stopPropagation();
|
||||
toggleSelection(`f:${folder.id}`);
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => open(folder)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
open(folder);
|
||||
}}
|
||||
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">
|
||||
@@ -506,54 +698,64 @@ export const Browser = () => {
|
||||
{folder.name}
|
||||
</span>
|
||||
<span className="mt-0.5 block text-[0.6875rem] text-subtle-foreground">
|
||||
{new Date(folder.created_at).toLocaleDateString(getLocale())}
|
||||
{new Date(folder.created_at).toLocaleDateString(
|
||||
getLocale(),
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
<IconAction
|
||||
label={t("Discussion {name}", { name: folder.name })}
|
||||
icon={<ChatIcon className="h-4 w-4" />}
|
||||
badge={unread[folder.id] ?? 0}
|
||||
onClick={() => setChat({ id: folder.id, name: folder.name })}
|
||||
/>
|
||||
{canWrite ? (
|
||||
<div className="flex shrink-0 items-center gap-0.5">
|
||||
<IconAction
|
||||
label={t("Partager {name}", { name: folder.name })}
|
||||
icon={<ShareIcon className="h-4 w-4" />}
|
||||
onClick={() => setDialog({ kind: "share", folder })}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Renommer {name}", { name: folder.name })}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
onClick={() =>
|
||||
setDialog({
|
||||
kind: "rename",
|
||||
target: { type: "folder", id: folder.id, name: folder.name },
|
||||
})
|
||||
}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Déplacer {name}", { name: folder.name })}
|
||||
icon={<MoveIcon className="h-4 w-4" />}
|
||||
onClick={() =>
|
||||
setDialog({
|
||||
kind: "move",
|
||||
target: { type: "folder", id: folder.id, name: folder.name },
|
||||
})
|
||||
}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Supprimer {name}", { name: folder.name })}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
isLoading={removing === folder.id}
|
||||
tone="danger"
|
||||
onClick={() =>
|
||||
void removeTarget({ type: "folder", id: folder.id, name: folder.name })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex shrink-0 items-center gap-0.5 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:focus-within:opacity-100">
|
||||
<IconAction
|
||||
label={t("Discussion {name}", { name: folder.name })}
|
||||
icon={<ChatIcon className="h-4 w-4" />}
|
||||
badge={unread[folder.id] ?? 0}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setChat({ id: folder.id, name: folder.name });
|
||||
}}
|
||||
/>
|
||||
{canWrite ? (
|
||||
<>
|
||||
<IconAction
|
||||
label={t("Partager {name}", { name: folder.name })}
|
||||
icon={<ShareIcon className="h-4 w-4" />}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setDialog({ kind: "share", folder });
|
||||
}}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Renommer {name}", { name: folder.name })}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setDialog({
|
||||
kind: "rename",
|
||||
target: {
|
||||
type: "folder",
|
||||
id: folder.id,
|
||||
name: folder.name,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Supprimer {name}", { name: folder.name })}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
isLoading={removing === folder.id}
|
||||
tone="danger"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
void removeTarget({
|
||||
type: "folder",
|
||||
id: folder.id,
|
||||
name: folder.name,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -566,86 +768,135 @@ export const Browser = () => {
|
||||
{t("Fichiers")}
|
||||
</h2>
|
||||
{visibleFiles.length === 0 ? (
|
||||
<p className="text-xs text-muted-foreground">{t("Rien à afficher pour ce filtre.")}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("Rien à afficher pour ce filtre.")}
|
||||
</p>
|
||||
) : (
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
{visibleFiles.map((file, index) => (
|
||||
<li key={file.id} className="flex items-center gap-2 px-3 py-2.5">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setViewer(index)}
|
||||
className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-sm border border-border bg-surface-muted text-muted-foreground transition-colors hover:border-border-strong focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
aria-label={t("Aperçu de {name}", { name: file.name })}
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
{visibleFiles.map((file, index) => (
|
||||
<li
|
||||
key={file.id}
|
||||
onClick={() => toggleSelection(`i:${file.id}`)}
|
||||
className={cn(
|
||||
"group flex items-center gap-2 px-3 py-2.5 cursor-pointer",
|
||||
selected.has(`i:${file.id}`) && "bg-accent/5",
|
||||
)}
|
||||
>
|
||||
<MediaThumb id={file.id} mime={file.mime_type} name={file.name} />
|
||||
</button>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-sm font-medium text-foreground">
|
||||
{file.name}
|
||||
<input
|
||||
type="checkbox"
|
||||
className={cn(
|
||||
"h-4 w-4 rounded border-border-control transition-opacity",
|
||||
selected.has(`i:${file.id}`) ||
|
||||
selectedItems.length > 0
|
||||
? "opacity-100"
|
||||
: "opacity-100 md:opacity-0 md:group-hover:opacity-100 md:focus:opacity-100",
|
||||
)}
|
||||
checked={selected.has(`i:${file.id}`)}
|
||||
aria-label={t("Sélectionner {name}", {
|
||||
name: file.name,
|
||||
})}
|
||||
onChange={(event) => {
|
||||
event.stopPropagation();
|
||||
toggleSelection(`i:${file.id}`);
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setViewer(index);
|
||||
}}
|
||||
className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-sm border border-border bg-surface-muted text-muted-foreground transition-colors hover:border-border-strong focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
aria-label={t("Aperçu de {name}", { name: file.name })}
|
||||
>
|
||||
<MediaThumb
|
||||
id={file.id}
|
||||
mime={file.mime_type}
|
||||
name={file.name}
|
||||
/>
|
||||
</button>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-sm font-medium text-foreground">
|
||||
{file.name}
|
||||
</span>
|
||||
<span className="block text-[0.6875rem] text-subtle-foreground">
|
||||
{formatBytes(file.size_bytes)} ·{" "}
|
||||
{new Date(file.created_at).toLocaleDateString(
|
||||
getLocale(),
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
<span className="block text-[0.6875rem] text-subtle-foreground">
|
||||
{formatBytes(file.size_bytes)} ·{" "}
|
||||
{new Date(file.created_at).toLocaleDateString(getLocale())}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<IconAction
|
||||
label={
|
||||
file.is_starred
|
||||
? t("Retirer l'étoile de {name}", { name: file.name })
|
||||
: t("Étoiler {name}", { name: file.name })
|
||||
}
|
||||
icon={
|
||||
<StarIcon className="h-4 w-4" {...(file.is_starred ? { filled: true } : {})} />
|
||||
}
|
||||
onClick={() => void toggleStar(file)}
|
||||
/>
|
||||
<div className="flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:focus-within:opacity-100">
|
||||
<IconAction
|
||||
label={
|
||||
file.is_starred
|
||||
? t("Retirer l'étoile de {name}", {
|
||||
name: file.name,
|
||||
})
|
||||
: t("Étoiler {name}", { name: file.name })
|
||||
}
|
||||
icon={
|
||||
<StarIcon
|
||||
className="h-4 w-4"
|
||||
{...(file.is_starred ? { filled: true } : {})}
|
||||
/>
|
||||
}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
void toggleStar(file);
|
||||
}}
|
||||
/>
|
||||
|
||||
<a
|
||||
href={api.downloadUrl(file.id)}
|
||||
download={file.name}
|
||||
className="inline-flex h-8 items-center gap-1.5 rounded-sm border border-border-strong bg-surface px-3 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-foreground transition-colors hover:bg-surface-hover"
|
||||
>
|
||||
<DownloadIcon className="h-3.5 w-3.5" />
|
||||
<span className="hidden sm:inline">{t("Télécharger")}</span>
|
||||
</a>
|
||||
<a
|
||||
href={api.downloadUrl(file.id)}
|
||||
download={file.name}
|
||||
className="inline-flex h-8 items-center gap-1.5 rounded-sm border border-border-strong bg-surface px-3 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-foreground transition-colors hover:bg-surface-hover"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
<DownloadIcon className="h-3.5 w-3.5" />
|
||||
<span className="hidden sm:inline">
|
||||
{t("Télécharger")}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
{canWrite ? (
|
||||
<>
|
||||
<IconAction
|
||||
label={t("Renommer {name}", { name: file.name })}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
onClick={() =>
|
||||
setDialog({
|
||||
kind: "rename",
|
||||
target: { type: "file", id: file.id, name: file.name },
|
||||
})
|
||||
}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Déplacer {name}", { name: file.name })}
|
||||
icon={<MoveIcon className="h-4 w-4" />}
|
||||
onClick={() =>
|
||||
setDialog({
|
||||
kind: "move",
|
||||
target: { type: "file", id: file.id, name: file.name },
|
||||
})
|
||||
}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Supprimer {name}", { name: file.name })}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
isLoading={removing === file.id}
|
||||
tone="danger"
|
||||
onClick={() =>
|
||||
void removeTarget({ type: "file", id: file.id, name: file.name })
|
||||
}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{canWrite ? (
|
||||
<>
|
||||
<IconAction
|
||||
label={t("Renommer {name}", { name: file.name })}
|
||||
icon={<PenIcon className="h-4 w-4" />}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setDialog({
|
||||
kind: "rename",
|
||||
target: {
|
||||
type: "file",
|
||||
id: file.id,
|
||||
name: file.name,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Supprimer {name}", { name: file.name })}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
isLoading={removing === file.id}
|
||||
tone="danger"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
void removeTarget({
|
||||
type: "file",
|
||||
id: file.id,
|
||||
name: file.name,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
) : null}
|
||||
@@ -674,13 +925,15 @@ export const Browser = () => {
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{dialog?.kind === "move" ? (
|
||||
{dialog?.kind === "moveMany" ? (
|
||||
<MoveDialog
|
||||
target={dialog.target}
|
||||
targets={dialog.targets}
|
||||
onClose={() => setDialog(null)}
|
||||
onDone={() => {
|
||||
setDialog(null);
|
||||
clearSelection();
|
||||
void reload();
|
||||
void refresh();
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
@@ -691,7 +944,11 @@ export const Browser = () => {
|
||||
|
||||
{viewer !== null ? (
|
||||
<MediaViewer
|
||||
items={visibleFiles.map((item) => ({ id: item.id, name: item.name, mime_type: item.mime_type }))}
|
||||
items={visibleFiles.map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
mime_type: item.mime_type,
|
||||
}))}
|
||||
startIndex={viewer}
|
||||
onClose={() => setViewer(null)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user