refactor(ui): switch icons to WebP and standardize icon-only actions (#22)
CD — Deployment / deploy (push) Successful in 16s

- Replace PNG icon assets with WebP in public/icons
- Route every icon through icons.tsx and add missing exports
  (Clear, Save, OpenedFolder, Deactivate, PasswordReset, TrashEmpty, Filter)
- Replace text buttons with icon-only actions backed by tooltips
- Unify confirm/delete/primary dialog buttons on the accent red
- Use liquid glass hover on chat messages

---------

Co-authored-by: xEsiah <[email protected]>
Reviewed-on: #22
Reviewed-by: Esiah <[email protected]>
Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #22.
This commit is contained in:
Gitea Actions
2026-11-04 10:44:43 +00:00
committed by Esiah
co-authored by Esiah
parent 82cd712252
commit a82711c9b1
72 changed files with 268 additions and 130 deletions
+1 -1
View File
@@ -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",
)}
>
+6 -1
View File
@@ -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}
+19 -12
View File
@@ -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>
+27 -13
View File
@@ -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();
+59 -32
View File
@@ -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} />
);