feat(files): improve bulk selection, upload progress and i18n (#17)
CD — Deployment / deploy (push) Successful in 15s

PR automatique de feat/bulk-selection-ux vers main.

---------

Co-authored-by: xEsiah <[email protected]>
Reviewed-on: #17
Reviewed-by: Esiah <[email protected]>
Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #17.
This commit is contained in:
Gitea Actions
2026-10-24 12:50:24 +00:00
committed by Esiah
co-authored by Esiah
parent 60b0795849
commit f39c07e58c
3 changed files with 76 additions and 28 deletions
+10 -8
View File
@@ -1,5 +1,6 @@
import { createContext, useCallback, useContext, useState, type ReactNode } from "react";
import { cn } from "../ui/index.js";
import { useI18n } from "../lib/i18n.js";
import { CloseIcon } from "./icons.js";
type ToastTone = "success" | "error" | "info";
@@ -29,6 +30,7 @@ export const useToast = () => {
let toastId = 0;
export const ToastProvider = ({ children }: { children: ReactNode }) => {
const { t } = useI18n();
const [toasts, setToasts] = useState<Toast[]>([]);
const remove = useCallback((id: number) => {
@@ -51,23 +53,23 @@ export const ToastProvider = ({ children }: { children: ReactNode }) => {
<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) => (
{toasts.map((toastItem) => (
<div
key={t.id}
key={toastItem.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",
toastItem.tone === "success" && "border-accent/40 bg-accent/10 text-foreground",
toastItem.tone === "error" && "border-destructive/40 bg-destructive/10 text-destructive",
toastItem.tone === "info" && "border-border bg-surface text-foreground",
)}
role="status"
>
<p className="flex-1 text-sm leading-relaxed">{t.message}</p>
<p className="flex-1 text-sm leading-relaxed">{toastItem.message}</p>
<button
type="button"
onClick={() => remove(t.id)}
onClick={() => remove(toastItem.id)}
className="text-muted-foreground transition-colors hover:text-foreground"
aria-label="Fermer"
aria-label={t("Fermer")}
>
<CloseIcon className="h-4 w-4" />
</button>