feat(ui): glass layout, icon actions and new icon set (#21)
CD — Deployment / deploy (push) Successful in 33s
CD — Deployment / deploy (push) Successful in 33s
PR automatique de feat/ui-glass-layout-icons vers main. --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #21 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #21.
This commit is contained in:
+10
-5
@@ -2,6 +2,7 @@ import { Navigate, Outlet, Route, Routes } from "react-router-dom";
|
||||
import { Spinner } from "./ui/index.js";
|
||||
import { useSession } from "./lib/session.js";
|
||||
import { AppShell } from "./components/AppShell.js";
|
||||
import { AuthLayout } from "./components/AuthLayout.js";
|
||||
import { Login } from "./pages/Login.js";
|
||||
import { ForgotPassword } from "./pages/ForgotPassword.js";
|
||||
import { ResetPassword } from "./pages/ResetPassword.js";
|
||||
@@ -42,13 +43,17 @@ const RequireAdmin = () => {
|
||||
|
||||
export const App = () => (
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
<Route path="/confirm-email" element={<ConfirmEmail />} />
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
<Route path="/confirm-email" element={<ConfirmEmail />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireAuth />}>
|
||||
<Route path="/change-password" element={<ChangePassword />} />
|
||||
<Route element={<AuthLayout />}>
|
||||
<Route path="/change-password" element={<ChangePassword />} />
|
||||
</Route>
|
||||
|
||||
<Route element={<RequireReady />}>
|
||||
<Route element={<AppShell />}>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useState } from "react";
|
||||
import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
|
||||
import { NavLink, Outlet } from "react-router-dom";
|
||||
import { Button, cn } from "../ui/index.js";
|
||||
import { cn } from "../ui/index.js";
|
||||
import { useSession } from "../lib/session.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { Avatar } from "./Avatar.js";
|
||||
import { ColorBendsBackdrop } from "./ColorBendsBackdrop.js";
|
||||
import {
|
||||
ActivityIcon,
|
||||
CloseIcon,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
StarIcon,
|
||||
TrashIcon,
|
||||
} from "./icons.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
|
||||
interface NavItem {
|
||||
to: string;
|
||||
@@ -49,10 +51,27 @@ const navClass = ({ isActive }: { isActive: boolean }) =>
|
||||
: "text-muted-foreground hover:bg-surface-hover hover:text-foreground",
|
||||
);
|
||||
|
||||
type PageHeaderContextValue = {
|
||||
header: ReactNode | null;
|
||||
setHeader: (header: ReactNode | null) => void;
|
||||
};
|
||||
|
||||
const PageHeaderContext = createContext<PageHeaderContextValue | null>(null);
|
||||
|
||||
export const usePageHeader = (header: ReactNode | null) => {
|
||||
const ctx = useContext(PageHeaderContext);
|
||||
useEffect(() => {
|
||||
if (!ctx) return;
|
||||
ctx.setHeader(header);
|
||||
return () => ctx.setHeader(null);
|
||||
}, [ctx, header]);
|
||||
};
|
||||
|
||||
export const AppShell = () => {
|
||||
const { user, logout } = useSession();
|
||||
const { t } = useI18n();
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const [pageHeader, setPageHeader] = useState<ReactNode | null>(null);
|
||||
if (!user) return null;
|
||||
|
||||
const isAdmin = user.role_slug === "admin";
|
||||
@@ -88,24 +107,12 @@ export const AppShell = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-dvh overflow-hidden bg-background">
|
||||
<aside className="hidden w-60 shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-surface p-3 lg:flex">
|
||||
<div className="px-1 py-2">{brand}</div>
|
||||
{NAV.map(renderLink)}
|
||||
{isAdmin ? (
|
||||
<>
|
||||
<p className="mt-3 px-3 py-1 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Administration")}
|
||||
</p>
|
||||
{ADMIN_NAV.map(renderLink)}
|
||||
</>
|
||||
) : null}
|
||||
<div className="mt-auto pt-3">{renderLink(ACCOUNT_NAV)}</div>
|
||||
</aside>
|
||||
<PageHeaderContext.Provider value={{ header: pageHeader, setHeader: setPageHeader }}>
|
||||
<div className="relative grid h-dvh grid-cols-[auto_1fr] grid-rows-[auto_1fr] overflow-hidden bg-background">
|
||||
<ColorBendsBackdrop variant="shell" />
|
||||
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<header className="z-20 shrink-0 border-b border-border bg-surface">
|
||||
<div className="mx-auto flex w-full max-w-5xl items-center justify-between gap-4 px-4 py-3">
|
||||
<header className="relative z-50 col-span-2 row-start-1 border-b border-border/50 bg-surface/70 backdrop-blur-md">
|
||||
<div className="flex w-full items-center justify-between gap-4 px-4 py-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
type="button"
|
||||
@@ -116,7 +123,7 @@ export const AppShell = () => {
|
||||
>
|
||||
{menuOpen ? <CloseIcon className="h-5 w-5" /> : <MenuIcon className="h-5 w-5" />}
|
||||
</button>
|
||||
<span className="lg:hidden">{brand}</span>
|
||||
{brand}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
@@ -135,30 +142,62 @@ export const AppShell = () => {
|
||||
hasAvatar={user.has_avatar}
|
||||
avatarUpdatedAt={user.avatar_updated_at}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<LogoutIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Déconnexion")}
|
||||
icon={<LogoutIcon className="h-4 w-4" />}
|
||||
onClick={() => void logout()}
|
||||
>
|
||||
<span className="hidden sm:inline">{t("Déconnexion")}</span>
|
||||
</Button>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{menuOpen ? (
|
||||
<nav className="flex flex-col gap-1 border-t border-border px-3 py-2 lg:hidden">
|
||||
{allNav.map(renderLink)}
|
||||
</nav>
|
||||
) : null}
|
||||
</header>
|
||||
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
<main className="mx-auto w-full max-w-5xl px-4 py-6">
|
||||
<Outlet />
|
||||
</main>
|
||||
<aside className="relative z-40 col-start-1 row-start-2 hidden w-60 flex-col gap-1 overflow-y-auto border-r border-border/50 bg-surface/70 p-3 backdrop-blur-md lg:flex">
|
||||
{NAV.map(renderLink)}
|
||||
{isAdmin ? (
|
||||
<>
|
||||
<p className="mt-3 px-3 py-1 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Administration")}
|
||||
</p>
|
||||
{ADMIN_NAV.map(renderLink)}
|
||||
</>
|
||||
) : null}
|
||||
<div className="mt-auto pt-3">{renderLink(ACCOUNT_NAV)}</div>
|
||||
</aside>
|
||||
|
||||
{menuOpen ? (
|
||||
<div className="lg:hidden">
|
||||
<div className="fixed inset-0 z-40 bg-black/50 backdrop-blur-sm" onClick={() => setMenuOpen(false)} aria-hidden="true" />
|
||||
<nav className="fixed inset-0 z-50 flex flex-col bg-background/95 backdrop-blur-lg transition-transform duration-300 sm:absolute sm:inset-y-0 sm:left-0 sm:w-72 sm:inset-x-auto">
|
||||
<div className="flex items-center justify-between border-b border-border/50 px-4 py-3">
|
||||
{brand}
|
||||
<button
|
||||
type="button"
|
||||
className="text-muted-foreground"
|
||||
aria-label={t("Fermer le menu")}
|
||||
onClick={() => setMenuOpen(false)}
|
||||
>
|
||||
<CloseIcon className="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-1 flex-col gap-1 overflow-y-auto p-3">
|
||||
{allNav.map(renderLink)}
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="relative z-10 col-start-2 row-start-2 min-h-0 overflow-hidden">
|
||||
<div className="h-full w-full bg-surface/30 backdrop-blur-lg">
|
||||
<div className="flex h-full flex-col">
|
||||
{pageHeader ? <div className="relative z-30 shrink-0">{pageHeader}</div> : null}
|
||||
<main className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-4 pb-6 pt-4 [scrollbar-gutter:stable]">
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PageHeaderContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Outlet } from "react-router-dom";
|
||||
import { ColorBendsBackdrop } from "./ColorBendsBackdrop.js";
|
||||
|
||||
/**
|
||||
* Coque des ecrans d'authentification : fond carmin animé, puis une colonne
|
||||
* centree qui contient la page courante. Le degrade garantit la lisibilite des
|
||||
* cartes et des champs par-dessus le shader, dans les deux themes.
|
||||
*/
|
||||
export const AuthLayout = () => (
|
||||
<main className="relative flex min-h-dvh items-center justify-center overflow-hidden bg-background px-4 py-10">
|
||||
<ColorBendsBackdrop variant="auth" />
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute inset-0 bg-gradient-to-b from-background/10 via-background/40 to-background/80 dark:from-background/25 dark:via-background/50 dark:to-background/85"
|
||||
/>
|
||||
<div className="relative z-10 flex w-full justify-center">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
.color-bends-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.color-bends-container canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
import { useEffect, useRef, type CSSProperties } from "react";
|
||||
import {
|
||||
Clock,
|
||||
Mesh,
|
||||
OrthographicCamera,
|
||||
PlaneGeometry,
|
||||
Scene,
|
||||
ShaderMaterial,
|
||||
SRGBColorSpace,
|
||||
Vector2,
|
||||
Vector3,
|
||||
WebGLRenderer,
|
||||
type IUniform,
|
||||
} from "three";
|
||||
import "./ColorBends.css";
|
||||
|
||||
/**
|
||||
* Fond anime "ColorBends" (React Bits), porte en TypeScript pour le projet.
|
||||
*
|
||||
* Le rendu est un shader plein ecran : aucune image, aucun appel reseau. Le
|
||||
* composant respecte `prefers-reduced-motion` en figeant le shader apres une
|
||||
* premiere image, et libere le contexte WebGL au demontage.
|
||||
*/
|
||||
|
||||
const MAX_COLORS = 8;
|
||||
|
||||
const frag = `
|
||||
#define MAX_COLORS ${MAX_COLORS}
|
||||
uniform vec2 uCanvas;
|
||||
uniform float uTime;
|
||||
uniform float uSpeed;
|
||||
uniform vec2 uRot;
|
||||
uniform int uColorCount;
|
||||
uniform vec3 uColors[MAX_COLORS];
|
||||
uniform int uTransparent;
|
||||
uniform float uScale;
|
||||
uniform float uFrequency;
|
||||
uniform float uWarpStrength;
|
||||
uniform vec2 uPointer;
|
||||
uniform float uMouseInfluence;
|
||||
uniform float uParallax;
|
||||
uniform float uNoise;
|
||||
uniform int uIterations;
|
||||
uniform float uIntensity;
|
||||
uniform float uBandWidth;
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
float t = uTime * uSpeed;
|
||||
vec2 p = vUv * 2.0 - 1.0;
|
||||
p += uPointer * uParallax * 0.1;
|
||||
vec2 rp = vec2(p.x * uRot.x - p.y * uRot.y, p.x * uRot.y + p.y * uRot.x);
|
||||
vec2 q = vec2(rp.x * (uCanvas.x / uCanvas.y), rp.y);
|
||||
q /= max(uScale, 0.0001);
|
||||
q /= 0.5 + 0.2 * dot(q, q);
|
||||
q += 0.2 * cos(t) - 7.56;
|
||||
vec2 toward = (uPointer - rp);
|
||||
q += toward * uMouseInfluence * 0.2;
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (j >= uIterations - 1) break;
|
||||
vec2 rr = sin(1.5 * (q.yx * uFrequency) + 2.0 * cos(q * uFrequency));
|
||||
q += (rr - q) * 0.15;
|
||||
}
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
float a = 1.0;
|
||||
|
||||
if (uColorCount > 0) {
|
||||
vec2 s = q;
|
||||
vec3 sumCol = vec3(0.0);
|
||||
float cover = 0.0;
|
||||
for (int i = 0; i < MAX_COLORS; ++i) {
|
||||
if (i >= uColorCount) break;
|
||||
s -= 0.01;
|
||||
vec2 r = sin(1.5 * (s.yx * uFrequency) + 2.0 * cos(s * uFrequency));
|
||||
float m0 = length(r + sin(5.0 * r.y * uFrequency - 3.0 * t + float(i)) / 4.0);
|
||||
float kBelow = clamp(uWarpStrength, 0.0, 1.0);
|
||||
float kMix = pow(kBelow, 0.3);
|
||||
float gain = 1.0 + max(uWarpStrength - 1.0, 0.0);
|
||||
vec2 disp = (r - s) * kBelow;
|
||||
vec2 warped = s + disp * gain;
|
||||
float m1 = length(warped + sin(5.0 * warped.y * uFrequency - 3.0 * t + float(i)) / 4.0);
|
||||
float m = mix(m0, m1, kMix);
|
||||
float w = 1.0 - exp(-uBandWidth / exp(uBandWidth * m));
|
||||
sumCol += uColors[i] * w;
|
||||
cover = max(cover, w);
|
||||
}
|
||||
col = clamp(sumCol, 0.0, 1.0);
|
||||
a = uTransparent > 0 ? cover : 1.0;
|
||||
} else {
|
||||
vec2 s = q;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
s -= 0.01;
|
||||
vec2 r = sin(1.5 * (s.yx * uFrequency) + 2.0 * cos(s * uFrequency));
|
||||
float m0 = length(r + sin(5.0 * r.y * uFrequency - 3.0 * t + float(k)) / 4.0);
|
||||
float kBelow = clamp(uWarpStrength, 0.0, 1.0);
|
||||
float kMix = pow(kBelow, 0.3);
|
||||
float gain = 1.0 + max(uWarpStrength - 1.0, 0.0);
|
||||
vec2 disp = (r - s) * kBelow;
|
||||
vec2 warped = s + disp * gain;
|
||||
float m1 = length(warped + sin(5.0 * warped.y * uFrequency - 3.0 * t + float(k)) / 4.0);
|
||||
float m = mix(m0, m1, kMix);
|
||||
col[k] = 1.0 - exp(-uBandWidth / exp(uBandWidth * m));
|
||||
}
|
||||
a = uTransparent > 0 ? max(max(col.r, col.g), col.b) : 1.0;
|
||||
}
|
||||
|
||||
col *= uIntensity;
|
||||
|
||||
if (uNoise > 0.0001) {
|
||||
float n = fract(sin(dot(gl_FragCoord.xy + vec2(uTime), vec2(12.9898, 78.233))) * 43758.5453123);
|
||||
col += (n - 0.5) * uNoise;
|
||||
col = clamp(col, 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec3 rgb = (uTransparent > 0) ? col * a : col;
|
||||
gl_FragColor = vec4(rgb, a);
|
||||
}
|
||||
`;
|
||||
|
||||
const vert = `
|
||||
varying vec2 vUv;
|
||||
void main() {
|
||||
vUv = uv;
|
||||
gl_Position = vec4(position, 1.0);
|
||||
}
|
||||
`;
|
||||
|
||||
export interface ColorBendsProps {
|
||||
className?: string;
|
||||
style?: CSSProperties;
|
||||
rotation?: number;
|
||||
speed?: number;
|
||||
colors?: string[];
|
||||
transparent?: boolean;
|
||||
autoRotate?: number;
|
||||
scale?: number;
|
||||
frequency?: number;
|
||||
warpStrength?: number;
|
||||
mouseInfluence?: number;
|
||||
parallax?: number;
|
||||
noise?: number;
|
||||
iterations?: number;
|
||||
intensity?: number;
|
||||
bandWidth?: number;
|
||||
}
|
||||
|
||||
interface ColorBendsUniforms {
|
||||
uCanvas: IUniform<Vector2>;
|
||||
uTime: IUniform<number>;
|
||||
uSpeed: IUniform<number>;
|
||||
uRot: IUniform<Vector2>;
|
||||
uColorCount: IUniform<number>;
|
||||
uColors: IUniform<Vector3[]>;
|
||||
uTransparent: IUniform<number>;
|
||||
uScale: IUniform<number>;
|
||||
uFrequency: IUniform<number>;
|
||||
uWarpStrength: IUniform<number>;
|
||||
uPointer: IUniform<Vector2>;
|
||||
uMouseInfluence: IUniform<number>;
|
||||
uParallax: IUniform<number>;
|
||||
uNoise: IUniform<number>;
|
||||
uIterations: IUniform<number>;
|
||||
uIntensity: IUniform<number>;
|
||||
uBandWidth: IUniform<number>;
|
||||
}
|
||||
|
||||
const toVec3 = (hex: string): Vector3 => {
|
||||
const value = hex.replace("#", "").trim();
|
||||
const channels =
|
||||
value.length === 3
|
||||
? [
|
||||
parseInt(value.slice(0, 1).repeat(2), 16),
|
||||
parseInt(value.slice(1, 2).repeat(2), 16),
|
||||
parseInt(value.slice(2, 3).repeat(2), 16),
|
||||
]
|
||||
: [
|
||||
parseInt(value.slice(0, 2), 16),
|
||||
parseInt(value.slice(2, 4), 16),
|
||||
parseInt(value.slice(4, 6), 16),
|
||||
];
|
||||
return new Vector3(channels[0]! / 255, channels[1]! / 255, channels[2]! / 255);
|
||||
};
|
||||
|
||||
export default function ColorBends({
|
||||
className,
|
||||
style,
|
||||
rotation = 90,
|
||||
speed = 0.2,
|
||||
colors = [],
|
||||
transparent = true,
|
||||
autoRotate = 0,
|
||||
scale = 1,
|
||||
frequency = 1,
|
||||
warpStrength = 1,
|
||||
mouseInfluence = 1,
|
||||
parallax = 0.5,
|
||||
noise = 0.15,
|
||||
iterations = 1,
|
||||
intensity = 1.5,
|
||||
bandWidth = 6,
|
||||
}: ColorBendsProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const rendererRef = useRef<WebGLRenderer | null>(null);
|
||||
const rafRef = useRef<number | null>(null);
|
||||
const renderOnceRef = useRef<(() => void) | null>(null);
|
||||
const materialRef = useRef<ShaderMaterial | null>(null);
|
||||
const resizeObserverRef = useRef<ResizeObserver | null>(null);
|
||||
const rotationRef = useRef(rotation);
|
||||
const autoRotateRef = useRef(autoRotate);
|
||||
const pointerTargetRef = useRef(new Vector2(0, 0));
|
||||
const pointerCurrentRef = useRef(new Vector2(0, 0));
|
||||
const pointerSmoothRef = useRef(8);
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
if (!container) return;
|
||||
|
||||
let renderer: WebGLRenderer;
|
||||
try {
|
||||
renderer = new WebGLRenderer({
|
||||
antialias: false,
|
||||
powerPreference: "high-performance",
|
||||
alpha: true,
|
||||
});
|
||||
} catch {
|
||||
// Pas de WebGL (navigateur ancien, materiel bloque) : le fond reste
|
||||
// simplement absent, l'ecran et le formulaire continuent de fonctionner.
|
||||
return;
|
||||
}
|
||||
|
||||
const scene = new Scene();
|
||||
const camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
||||
const geometry = new PlaneGeometry(2, 2);
|
||||
const uColors = Array.from({ length: MAX_COLORS }, () => new Vector3(0, 0, 0));
|
||||
const material = new ShaderMaterial({
|
||||
vertexShader: vert,
|
||||
fragmentShader: frag,
|
||||
uniforms: {
|
||||
uCanvas: { value: new Vector2(1, 1) },
|
||||
uTime: { value: 0 },
|
||||
uSpeed: { value: speed },
|
||||
uRot: { value: new Vector2(1, 0) },
|
||||
uColorCount: { value: 0 },
|
||||
uColors: { value: uColors },
|
||||
uTransparent: { value: transparent ? 1 : 0 },
|
||||
uScale: { value: scale },
|
||||
uFrequency: { value: frequency },
|
||||
uWarpStrength: { value: warpStrength },
|
||||
uPointer: { value: new Vector2(0, 0) },
|
||||
uMouseInfluence: { value: mouseInfluence },
|
||||
uParallax: { value: parallax },
|
||||
uNoise: { value: noise },
|
||||
uIterations: { value: iterations },
|
||||
uIntensity: { value: intensity },
|
||||
uBandWidth: { value: bandWidth },
|
||||
} satisfies ColorBendsUniforms,
|
||||
premultipliedAlpha: true,
|
||||
transparent: true,
|
||||
});
|
||||
materialRef.current = material;
|
||||
|
||||
const mesh = new Mesh(geometry, material);
|
||||
scene.add(mesh);
|
||||
|
||||
rendererRef.current = renderer;
|
||||
renderer.outputColorSpace = SRGBColorSpace;
|
||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
|
||||
renderer.setClearColor(0x000000, transparent ? 0 : 1);
|
||||
renderer.domElement.style.width = "100%";
|
||||
renderer.domElement.style.height = "100%";
|
||||
renderer.domElement.style.display = "block";
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
const clock = new Clock();
|
||||
const motion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
||||
let reducedMotion = motion.matches;
|
||||
|
||||
const handleResize = () => {
|
||||
const width = container.clientWidth || 1;
|
||||
const height = container.clientHeight || 1;
|
||||
renderer.setSize(width, height, false);
|
||||
material.uniforms.uCanvas!.value.set(width, height);
|
||||
if (reducedMotion) renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
const renderFrame = () => {
|
||||
const delta = clock.getDelta();
|
||||
const elapsed = clock.elapsedTime;
|
||||
material.uniforms.uTime!.value = elapsed;
|
||||
|
||||
const degrees = (rotationRef.current % 360) + autoRotateRef.current * elapsed;
|
||||
const radians = (degrees * Math.PI) / 180;
|
||||
material.uniforms.uRot!.value.set(Math.cos(radians), Math.sin(radians));
|
||||
|
||||
const current = pointerCurrentRef.current;
|
||||
current.lerp(pointerTargetRef.current, Math.min(1, delta * pointerSmoothRef.current));
|
||||
material.uniforms.uPointer!.value.copy(current);
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
renderOnceRef.current = renderFrame;
|
||||
|
||||
const stop = () => {
|
||||
if (rafRef.current !== null) {
|
||||
cancelAnimationFrame(rafRef.current);
|
||||
rafRef.current = null;
|
||||
}
|
||||
};
|
||||
|
||||
const loop = () => {
|
||||
renderFrame();
|
||||
rafRef.current = requestAnimationFrame(loop);
|
||||
};
|
||||
|
||||
const start = () => {
|
||||
if (!reducedMotion && rafRef.current === null) {
|
||||
clock.start();
|
||||
rafRef.current = requestAnimationFrame(loop);
|
||||
}
|
||||
};
|
||||
|
||||
handleResize();
|
||||
|
||||
if (typeof ResizeObserver !== "undefined") {
|
||||
const observer = new ResizeObserver(handleResize);
|
||||
observer.observe(container);
|
||||
resizeObserverRef.current = observer;
|
||||
} else {
|
||||
window.addEventListener("resize", handleResize);
|
||||
}
|
||||
|
||||
const handleMotionChange = () => {
|
||||
reducedMotion = motion.matches;
|
||||
if (reducedMotion) {
|
||||
stop();
|
||||
renderFrame();
|
||||
} else {
|
||||
start();
|
||||
}
|
||||
};
|
||||
motion.addEventListener("change", handleMotionChange);
|
||||
|
||||
if (reducedMotion) renderFrame();
|
||||
else start();
|
||||
|
||||
return () => {
|
||||
stop();
|
||||
motion.removeEventListener("change", handleMotionChange);
|
||||
if (resizeObserverRef.current) resizeObserverRef.current.disconnect();
|
||||
else window.removeEventListener("resize", handleResize);
|
||||
geometry.dispose();
|
||||
material.dispose();
|
||||
renderer.dispose();
|
||||
renderer.forceContextLoss();
|
||||
if (renderer.domElement.parentElement === container) {
|
||||
container.removeChild(renderer.domElement);
|
||||
}
|
||||
materialRef.current = null;
|
||||
rendererRef.current = null;
|
||||
renderOnceRef.current = null;
|
||||
resizeObserverRef.current = null;
|
||||
};
|
||||
// Les uniformes sont mis a jour par l'effet suivant ; ce premier montage ne
|
||||
// depend donc que du conteneur et ne recree jamais le contexte WebGL.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const material = materialRef.current;
|
||||
if (!material) return;
|
||||
|
||||
rotationRef.current = rotation;
|
||||
autoRotateRef.current = autoRotate;
|
||||
material.uniforms.uSpeed!.value = speed;
|
||||
material.uniforms.uScale!.value = scale;
|
||||
material.uniforms.uFrequency!.value = frequency;
|
||||
material.uniforms.uWarpStrength!.value = warpStrength;
|
||||
material.uniforms.uMouseInfluence!.value = mouseInfluence;
|
||||
material.uniforms.uParallax!.value = parallax;
|
||||
material.uniforms.uNoise!.value = noise;
|
||||
material.uniforms.uIterations!.value = iterations;
|
||||
material.uniforms.uIntensity!.value = intensity;
|
||||
material.uniforms.uBandWidth!.value = bandWidth;
|
||||
|
||||
const parsed = colors.filter(Boolean).slice(0, MAX_COLORS).map(toVec3);
|
||||
const target = material.uniforms.uColors!.value as Vector3[];
|
||||
for (let index = 0; index < MAX_COLORS; index += 1) {
|
||||
const vector = target[index]!;
|
||||
if (index < parsed.length) vector.copy(parsed[index]!);
|
||||
else vector.set(0, 0, 0);
|
||||
}
|
||||
material.uniforms.uColorCount!.value = parsed.length;
|
||||
|
||||
material.uniforms.uTransparent!.value = transparent ? 1 : 0;
|
||||
if (rendererRef.current) rendererRef.current.setClearColor(0x000000, transparent ? 0 : 1);
|
||||
|
||||
// Sans boucle (prefers-reduced-motion), les uniformes viennent de changer :
|
||||
// il faut une image de plus pour que la palette soit réellement appliquée.
|
||||
if (rafRef.current === null) renderOnceRef.current?.();
|
||||
}, [
|
||||
rotation,
|
||||
autoRotate,
|
||||
speed,
|
||||
scale,
|
||||
frequency,
|
||||
warpStrength,
|
||||
mouseInfluence,
|
||||
parallax,
|
||||
noise,
|
||||
iterations,
|
||||
intensity,
|
||||
bandWidth,
|
||||
colors,
|
||||
transparent,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
if (!container) return;
|
||||
|
||||
const handlePointerMove = (event: PointerEvent) => {
|
||||
const rect = container.getBoundingClientRect();
|
||||
const x = ((event.clientX - rect.left) / (rect.width || 1)) * 2 - 1;
|
||||
const y = -(((event.clientY - rect.top) / (rect.height || 1)) * 2 - 1);
|
||||
pointerTargetRef.current.set(x, y);
|
||||
};
|
||||
|
||||
// Ecoute au niveau de la fenetre : le fond peut etre recouvert par la
|
||||
// coque ou par une carte, et doit reagir quand meme au mouvement.
|
||||
window.addEventListener("pointermove", handlePointerMove, { passive: true });
|
||||
return () => {
|
||||
window.removeEventListener("pointermove", handlePointerMove);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return <div ref={containerRef} className={`color-bends-container ${className ?? ""}`} style={style} />;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { lazy, Suspense } from "react";
|
||||
import { COHAISE_BENDS } from "./colorBendsPalette.js";
|
||||
import type { ColorBendsProps } from "./ColorBends.js";
|
||||
|
||||
const ColorBends = lazy(() => import("./ColorBends.js"));
|
||||
|
||||
type BackdropVariant = "auth" | "shell" | "chat";
|
||||
|
||||
type BackdropPreset = Omit<ColorBendsProps, "colors" | "transparent" | "className"> & {
|
||||
className: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fond carmin partage par les ecrans d'authentification, la coque connectee
|
||||
* et le salon de discussion. Le composant WebGL reste charge a la demande :
|
||||
* seuls les presets sont dans le bundle initial.
|
||||
*/
|
||||
const PRESETS: Record<BackdropVariant, BackdropPreset> = {
|
||||
auth: {
|
||||
className: "opacity-[0.55] dark:opacity-[0.7]",
|
||||
rotation: 90,
|
||||
speed: 0.18,
|
||||
scale: 1,
|
||||
frequency: 1,
|
||||
warpStrength: 1,
|
||||
mouseInfluence: 0.6,
|
||||
parallax: 0.4,
|
||||
noise: 0.08,
|
||||
iterations: 2,
|
||||
intensity: 1.15,
|
||||
bandWidth: 5,
|
||||
},
|
||||
shell: {
|
||||
className: "opacity-[0.85] dark:opacity-[0.9]",
|
||||
rotation: 90,
|
||||
speed: 0.18,
|
||||
scale: 1,
|
||||
frequency: 1,
|
||||
warpStrength: 1,
|
||||
mouseInfluence: 0.6,
|
||||
parallax: 0.4,
|
||||
noise: 0.08,
|
||||
iterations: 2,
|
||||
intensity: 1.3,
|
||||
bandWidth: 5,
|
||||
},
|
||||
chat: {
|
||||
className: "opacity-[0.3] dark:opacity-[0.42]",
|
||||
rotation: 90,
|
||||
speed: 0.1,
|
||||
scale: 1.05,
|
||||
frequency: 0.95,
|
||||
warpStrength: 0.9,
|
||||
mouseInfluence: 0.3,
|
||||
parallax: 0.25,
|
||||
noise: 0.05,
|
||||
iterations: 1,
|
||||
intensity: 0.8,
|
||||
bandWidth: 4.5,
|
||||
},
|
||||
};
|
||||
|
||||
export const ColorBendsBackdrop = ({
|
||||
variant,
|
||||
className,
|
||||
}: {
|
||||
variant: BackdropVariant;
|
||||
className?: string;
|
||||
}) => {
|
||||
const { className: presetClassName, ...preset } = PRESETS[variant];
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className={`pointer-events-none absolute inset-0 z-0 ${className ?? ""}`}
|
||||
>
|
||||
<Suspense fallback={null}>
|
||||
<ColorBends
|
||||
{...preset}
|
||||
colors={COHAISE_BENDS}
|
||||
transparent
|
||||
className={presetClassName}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -21,6 +21,7 @@ import { getLocale } from "../lib/locale.js";
|
||||
import { useSession } from "../lib/session.js";
|
||||
import { useConfirm } from "./confirm.js";
|
||||
import { Avatar } from "./Avatar.js";
|
||||
import { ColorBendsBackdrop } from "./ColorBendsBackdrop.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
import { Alert, Badge, EmptyState } from "./feedback.js";
|
||||
import {
|
||||
@@ -359,8 +360,9 @@ export const FolderChat = ({ folder, onClose }: { folder: ChatFolder; onClose: (
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-40 flex flex-col bg-background">
|
||||
<div className="relative flex h-full min-h-0">
|
||||
<div className="fixed inset-0 z-40 flex flex-col overflow-hidden bg-background">
|
||||
<ColorBendsBackdrop variant="chat" />
|
||||
<div className="relative z-10 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",
|
||||
@@ -437,7 +439,7 @@ export const FolderChat = ({ folder, onClose }: { folder: ChatFolder; onClose: (
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label={t("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"
|
||||
className="rounded-md p-1 text-muted-foreground transition-all hover:-translate-y-0.5 hover:bg-surface/60 hover:text-foreground hover:shadow-sm focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<CloseIcon className="h-5 w-5" />
|
||||
</button>
|
||||
@@ -672,15 +674,15 @@ export const FolderChat = ({ folder, onClose }: { folder: ChatFolder; onClose: (
|
||||
aria-label={t("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"
|
||||
<IconAction
|
||||
label={t("Envoyer")}
|
||||
icon={<SendIcon className="h-4 w-4" />}
|
||||
isLoading={sending}
|
||||
disabled={draft.trim().length === 0}
|
||||
iconLeading={<SendIcon className="h-4 w-4" />}
|
||||
>
|
||||
<span className="hidden sm:inline">{t("Envoyer")}</span>
|
||||
</Button>
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
void send(event as any);
|
||||
}}
|
||||
/>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -23,8 +23,8 @@ export const IconAction = ({
|
||||
disabled={isLoading}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
"relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors",
|
||||
"hover:bg-surface-hover hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
|
||||
"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",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Palette carmin de la marque, alignee sur `tokens.css`. */
|
||||
export const COHAISE_BENDS = ["#b71c1c", "#c92a2a", "#8f1116", "#5e0a14"];
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
} from "../lib/api.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { Alert, Modal } from "./feedback.js";
|
||||
import { TrashIcon } from "./icons.js";
|
||||
import { PlusIcon, TrashIcon } from "./icons.js";
|
||||
import { IconAction } from "./IconAction.js";
|
||||
|
||||
const LEVELS = ["read", "write", "admin"] as const;
|
||||
const LEVEL_LABEL: Record<string, string> = {
|
||||
@@ -69,13 +70,21 @@ export const CreateFolderDialog = ({
|
||||
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("Créer")}
|
||||
</Button>
|
||||
<div className="flex justify-end gap-1">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<img src="/icons/close.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Créer")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void submit(e as any);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -234,13 +243,21 @@ export const MoveDialog = ({
|
||||
</label>
|
||||
)}
|
||||
{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} disabled={entries === null}>
|
||||
{t("Déplacer")}
|
||||
</Button>
|
||||
<div className="flex justify-end gap-1">
|
||||
<IconAction
|
||||
label={t("Annuler")}
|
||||
icon={<img src="/icons/close.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
onClick={onClose}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Déplacer")}
|
||||
icon={<img src="/icons/move.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
isLoading={busy}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void submit(e as any);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</Modal>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useEffect, type ReactNode } from "react";
|
||||
import { useEffect, useMemo, type ReactNode } from "react";
|
||||
import { cn } from "../ui/index.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
import { CloseIcon } from "./icons.js";
|
||||
import { usePageHeader } from "./AppShell.js";
|
||||
|
||||
export const Modal = ({
|
||||
open,
|
||||
@@ -52,7 +53,7 @@ export const Modal = ({
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label={t("Fermer")}
|
||||
className="rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
className="rounded-md p-1 text-muted-foreground transition-all hover:-translate-y-0.5 hover:bg-surface/60 hover:text-foreground hover:shadow-sm focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<CloseIcon className="h-5 w-5" />
|
||||
</button>
|
||||
@@ -97,22 +98,29 @@ export const PageHeader = ({
|
||||
description?: string;
|
||||
actions?: ReactNode;
|
||||
toolbar?: ReactNode;
|
||||
}) => (
|
||||
<header className="sticky top-0 z-10 -mx-4 flex flex-col gap-3 border-b border-border bg-background px-4 py-4">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<h1 className="font-display text-base font-semibold uppercase tracking-label text-foreground">
|
||||
{title}
|
||||
</h1>
|
||||
{description ? (
|
||||
<p className="mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground">{description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
{actions ? <div className="flex flex-wrap items-center gap-2">{actions}</div> : null}
|
||||
</div>
|
||||
{toolbar ? <div className="flex flex-col gap-3">{toolbar}</div> : null}
|
||||
</header>
|
||||
);
|
||||
}) => {
|
||||
const header = useMemo(
|
||||
() => (
|
||||
<header className="flex flex-col gap-3 border-b border-border/50 bg-surface/70 px-4 py-4 backdrop-blur-md">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<h1 className="font-display text-base font-semibold uppercase tracking-label text-foreground">
|
||||
{title}
|
||||
</h1>
|
||||
{description ? (
|
||||
<p className="mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground">{description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
{actions ? <div className="flex flex-wrap items-center gap-2">{actions}</div> : null}
|
||||
</div>
|
||||
{toolbar ? <div className="flex flex-col gap-3">{toolbar}</div> : null}
|
||||
</header>
|
||||
),
|
||||
[title, description, actions, toolbar],
|
||||
);
|
||||
usePageHeader(header);
|
||||
return null;
|
||||
};
|
||||
|
||||
export const EmptyState = ({
|
||||
icon,
|
||||
|
||||
@@ -1,221 +1,148 @@
|
||||
import type { SVGProps } from "react";
|
||||
import type { ImgHTMLAttributes } from "react";
|
||||
|
||||
type IconProps = SVGProps<SVGSVGElement>;
|
||||
type IconProps = Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "alt"> & {
|
||||
filled?: boolean;
|
||||
};
|
||||
|
||||
const base = (props: IconProps) => ({
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
strokeWidth: 1.6,
|
||||
strokeLinecap: "round" as const,
|
||||
strokeLinejoin: "round" as const,
|
||||
"aria-hidden": true,
|
||||
...props,
|
||||
});
|
||||
const ImgIcon = ({
|
||||
src,
|
||||
className = "",
|
||||
...props
|
||||
}: { src: string } & IconProps) => (
|
||||
<img
|
||||
src={src}
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
className={`inline-block h-4 w-4 object-contain ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
export const FolderIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M3 7.5A1.5 1.5 0 0 1 4.5 6h4l2 2.5h7A1.5 1.5 0 0 1 19 10v7.5A1.5 1.5 0 0 1 17.5 19h-13A1.5 1.5 0 0 1 3 17.5Z" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/folder.png" {...props} />
|
||||
);
|
||||
|
||||
export const FileIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M6 3.5h7l5 5v12A1.5 1.5 0 0 1 16.5 22h-10A1.5 1.5 0 0 1 5 20.5v-16A1.5 1.5 0 0 1 6 3Z" />
|
||||
<path d="M13 3.5v5h5" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/document.png" {...props} />
|
||||
);
|
||||
|
||||
export const ImageIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<rect x="3" y="4" width="18" height="16" rx="2" />
|
||||
<circle cx="8.5" cy="9.5" r="1.5" />
|
||||
<path d="m4 17 4.5-4.5a1.5 1.5 0 0 1 2.1 0L15 17m1.5-2 1.2-1.2a1.5 1.5 0 0 1 2.1 0L21 15" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/picture.png" {...props} />
|
||||
);
|
||||
|
||||
export const PlayIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M8 5.5v13l11-6.5Z" fill="currentColor" stroke="none" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
);
|
||||
|
||||
export const AudioIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M9 17V5l10-2v12" />
|
||||
<circle cx="6.5" cy="17.5" r="2.5" />
|
||||
<circle cx="16.5" cy="15.5" r="2.5" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
);
|
||||
|
||||
export const ArchiveIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M3 7.5A1.5 1.5 0 0 1 4.5 6h4l2 2.5h7A1.5 1.5 0 0 1 19 10v7.5A1.5 1.5 0 0 1 17.5 19h-13A1.5 1.5 0 0 1 3 17.5Z" />
|
||||
<path d="M11 11.5h2m-2 3h2m-2 3h2" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/folder.png" {...props} />
|
||||
);
|
||||
|
||||
export const UploadIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M12 16V4m0 0L7.5 8.5M12 4l4.5 4.5M4 17v1.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V17" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/upload.png" {...props} />
|
||||
);
|
||||
|
||||
export const DownloadIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M12 4v12m0 0-4.5-4.5M12 16l4.5-4.5M4 17v1.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V17" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/download.png" {...props} />
|
||||
);
|
||||
|
||||
export const PlusIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M12 5v14M5 12h14" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/plus.png" {...props} />
|
||||
);
|
||||
|
||||
export const TrashIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M4 7h16M9 7V5.5A1.5 1.5 0 0 1 10.5 4h3A1.5 1.5 0 0 1 15 5.5V7m-8 0 .7 11.1A1.5 1.5 0 0 0 9.2 19.6h5.6a1.5 1.5 0 0 0 1.5-1.5L17 7" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/trash-can.png" {...props} />
|
||||
);
|
||||
|
||||
export const RestoreIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M4 12a8 8 0 1 0 2.3-5.6M4 4v4h4" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
);
|
||||
|
||||
export const RefreshIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M20 12a8 8 0 1 1-2.3-5.6M20 4v4h-4" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
);
|
||||
|
||||
export const StarIcon = ({ filled, ...props }: IconProps & { filled?: boolean }) => (
|
||||
<svg {...base(props)} fill={filled ? "currentColor" : "none"}>
|
||||
<path d="m12 3.5 2.6 5.3 5.9.9-4.2 4.1 1 5.8L12 20.8l-5.3 2.8 1-5.8L3.5 14l5.9-.9Z" />
|
||||
</svg>
|
||||
export const StarIcon = (props: IconProps) => (
|
||||
<ImgIcon src="/icons/favorite.png" {...props} />
|
||||
);
|
||||
|
||||
export const SearchIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<circle cx="11" cy="11" r="7" />
|
||||
<path d="m20 20-3.5-3.5" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/search.png" {...props} />
|
||||
);
|
||||
|
||||
export const UsersIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<circle cx="9" cy="8" r="3.5" />
|
||||
<path d="M3.5 20a5.5 5.5 0 0 1 11 0M16 5.5a3 3 0 0 1 0 6M16.5 20a5.5 1.5 0 0 0-2.2-4.3" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/accounts.png" {...props} />
|
||||
);
|
||||
|
||||
export const SettingsIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2 2 2 0 1 1-4 0 1.7 1.7 0 0 0-2.9-1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 2.6 15a2 2 0 1 1 0-4 1.7 1.7 0 0 0 1.2-2.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 9 4.6a2 2 0 1 1 4 0 1.7 1.7 0 0 0 2.9 1.2l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0 1.2 2.9 2 2 0 1 1 0 4 1.7 1.7 0 0 0-1.5 1Z" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/personal-settings.png" {...props} />
|
||||
);
|
||||
|
||||
export const LogoutIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M15 4h2.5A1.5 1.5 0 0 1 19 5.5v13a1.5 1.5 0 0 1-1.5 1.5H15M10 8l-4 4 4 4M6 12h9" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/sign-out.png" {...props} />
|
||||
);
|
||||
|
||||
export const ShieldIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M12 3 5 6v5c0 4.3 3 8.2 7 9.5 4-1.3 7-5.2 7-9.5V6Z" />
|
||||
<path d="m9 12 2 2 4-4" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/accounts.png" {...props} />
|
||||
);
|
||||
|
||||
export const HardDriveIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<rect x="3" y="4" width="18" height="16" rx="2" />
|
||||
<path d="M3 14h18M7 17h.01M11 17h.01" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/storage.png" {...props} />
|
||||
);
|
||||
|
||||
export const ActivityIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M3 12h4l3 8 4-16 3 8h4" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/activity.png" {...props} />
|
||||
);
|
||||
|
||||
export const SearchNavIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<circle cx="11" cy="11" r="7" />
|
||||
<path d="m20 20-3.5-3.5" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/search.png" {...props} />
|
||||
);
|
||||
|
||||
export const ShareIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<circle cx="18" cy="5" r="2.5" />
|
||||
<circle cx="6" cy="12" r="2.5" />
|
||||
<circle cx="18" cy="19" r="2.5" />
|
||||
<path d="m8.2 10.8 7.6-4.6M8.2 13.2l7.6 4.6" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/share.png" {...props} />
|
||||
);
|
||||
|
||||
export const MenuIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M4 7h16M4 12h16M4 17h16" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/menu.png" {...props} />
|
||||
);
|
||||
|
||||
export const CloseIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M6 6l12 12M18 6 6 18" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/close.png" {...props} />
|
||||
);
|
||||
|
||||
export const ArrowLeftIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M19 12H5M11 18l-6-6 6-6" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/back.png" {...props} />
|
||||
);
|
||||
|
||||
export const ArrowRightIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M5 12h14M13 6l6 6-6 6" />
|
||||
</svg>
|
||||
<ImgIcon
|
||||
src="/icons/back.png"
|
||||
{...props}
|
||||
style={{ transform: "rotate(180deg)", ...((props.style as any) || {}) }}
|
||||
/>
|
||||
);
|
||||
|
||||
export const PenIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3Z" />
|
||||
<path d="m13.5 6.5 3 3" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/edit-pencil.png" {...props} />
|
||||
);
|
||||
|
||||
/** Epingle : tete du pushpin en haut, pointe en bas. */
|
||||
export const PinIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M9 3.5h6l-.8 5.2 3.3 3.1H6.5l3.3-3.1Z" />
|
||||
<path d="M12 11.8V20.5" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/file.png" {...props} />
|
||||
);
|
||||
|
||||
export const MoveIcon = (props: IconProps) => (
|
||||
<svg {...base(props)}>
|
||||
<path d="M12 4v16M4 12h16" />
|
||||
<path d="m9 7 3-3 3 3M9 17l3 3 3-3M7 9l-3 3 3 3M17 9l3 3-3 3" />
|
||||
</svg>
|
||||
<ImgIcon src="/icons/synchronize.png" {...props} />
|
||||
);
|
||||
|
||||
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>
|
||||
<ImgIcon src="/icons/speech-bubble.png" {...props} />
|
||||
);
|
||||
|
||||
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>
|
||||
<ImgIcon src="/icons/send.png" {...props} />
|
||||
);
|
||||
|
||||
@@ -129,13 +129,11 @@ export const AdminUsers = () => {
|
||||
title={t("Comptes")}
|
||||
description={t("Créer des membres, ajustez leurs quotas et gérez les accès.")}
|
||||
actions={
|
||||
<Button
|
||||
size="sm"
|
||||
iconLeading={<PlusIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Nouveau membre")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
onClick={() => setCreateOpen(true)}
|
||||
>
|
||||
{t("Nouveau membre")}
|
||||
</Button>
|
||||
/>
|
||||
}
|
||||
toolbar={
|
||||
<>
|
||||
@@ -210,18 +208,20 @@ export const AdminUsers = () => {
|
||||
</span>
|
||||
|
||||
<div className="flex items-center gap-1">
|
||||
<Button variant="ghost" size="sm" onClick={() => setEdit(user)}>
|
||||
{t("Modifier")}
|
||||
</Button>
|
||||
<IconAction
|
||||
label={t("Modifier")}
|
||||
icon={<img src="/icons/edit-pencil.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
onClick={() => setEdit(user)}
|
||||
/>
|
||||
<IconAction
|
||||
label={user.is_active ? t("Désactiver") : t("Réactiver")}
|
||||
icon={<HardDriveIcon className="h-4 w-4" />}
|
||||
icon={<img src="/icons/deactivate.png" alt="" 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={<ActivityIcon className="h-4 w-4" />}
|
||||
icon={<img src="/icons/password-reset.png" alt="" className="h-4 w-4 object-contain" />}
|
||||
isLoading={busy === user.id}
|
||||
onClick={() => void resetPassword(user)}
|
||||
/>
|
||||
@@ -505,13 +505,11 @@ export const AdminStorage = () => {
|
||||
title={t("Emplacements de stockage")}
|
||||
description={t("Volumes montés utilisés pour stocker les fichiers.")}
|
||||
actions={
|
||||
<Button
|
||||
size="sm"
|
||||
iconLeading={<PlusIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Nouvel emplacement")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
onClick={() => setCreateOpen(true)}
|
||||
>
|
||||
{t("Nouvel emplacement")}
|
||||
</Button>
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -544,9 +542,11 @@ export const AdminStorage = () => {
|
||||
: t("{used} Go utilisés", { used: toGb(location.used_bytes) })}
|
||||
</span>
|
||||
</span>
|
||||
<Button variant="ghost" size="sm" onClick={() => void toggle(location)}>
|
||||
{location.is_active ? t("Désactiver") : t("Réactiver")}
|
||||
</Button>
|
||||
<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" />}
|
||||
onClick={() => void toggle(location)}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
useState,
|
||||
type DragEvent,
|
||||
} from "react";
|
||||
import { Button, Card, Spinner, cn } from "../ui/index.js";
|
||||
import { Card, Spinner, cn } from "../ui/index.js";
|
||||
import {
|
||||
ApiError,
|
||||
api,
|
||||
@@ -17,7 +17,7 @@ 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 { Badge, EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { useConfirm } from "../components/confirm.js";
|
||||
import { MediaViewer } from "../components/MediaViewer.js";
|
||||
import { MediaThumb } from "../components/MediaThumb.js";
|
||||
@@ -33,8 +33,8 @@ import {
|
||||
import {
|
||||
ArrowLeftIcon,
|
||||
ChatIcon,
|
||||
CloseIcon,
|
||||
DownloadIcon,
|
||||
FolderIcon,
|
||||
PenIcon,
|
||||
PlusIcon,
|
||||
RefreshIcon,
|
||||
@@ -538,32 +538,22 @@ export const Browser = () => {
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<RefreshIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Rafraîchir")}
|
||||
icon={<RefreshIcon className="h-4 w-4" />}
|
||||
isLoading={refreshing}
|
||||
onClick={() => void manualRefresh()}
|
||||
>
|
||||
{t("Rafraîchir")}
|
||||
</Button>
|
||||
/>
|
||||
|
||||
{current.id ? (
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<ChatIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={t("Discussion")}
|
||||
icon={<ChatIcon className="h-4 w-4" />}
|
||||
badge={currentUnread}
|
||||
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>
|
||||
}
|
||||
@@ -619,7 +609,7 @@ export const Browser = () => {
|
||||
) : null}
|
||||
|
||||
{canWrite ? (
|
||||
<div className="flex gap-2">
|
||||
<div className="flex gap-1">
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
@@ -627,25 +617,17 @@ export const Browser = () => {
|
||||
className="sr-only"
|
||||
onChange={(event) => void upload(event.target.files)}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<UploadIcon className="h-3.5 w-3.5" />}
|
||||
<IconAction
|
||||
label={uploading && uploadProgress ? t("Envoi {current}/{total}…", uploadProgress) : t("Envoyer")}
|
||||
icon={<UploadIcon className="h-4 w-4" />}
|
||||
isLoading={uploading}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
>
|
||||
{uploading && uploadProgress
|
||||
? t("Envoi {current}/{total}…", uploadProgress)
|
||||
: t("Envoyer")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
iconLeading={<PlusIcon className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Nouveau dossier")}
|
||||
icon={<PlusIcon className="h-4 w-4" />}
|
||||
onClick={() => setDialog({ kind: "create" })}
|
||||
>
|
||||
{t("Nouveau dossier")}
|
||||
</Button>
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
@@ -681,25 +663,21 @@ export const Browser = () => {
|
||||
|
||||
{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">
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-border-strong bg-surface/80 px-3 py-2 shadow-lg backdrop-blur-md 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="secondary"
|
||||
<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" />}
|
||||
onClick={() => setDialog({ kind: "moveMany", targets: selectedItems })}
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Télécharger")}
|
||||
icon={<DownloadIcon className="h-4 w-4" />}
|
||||
onClick={() => {
|
||||
const files = selectedItems.filter((t) => t.type === "file");
|
||||
if (files.length === 0) {
|
||||
@@ -716,19 +694,18 @@ export const Browser = () => {
|
||||
toast.info(t("Les dossiers n'ont pas été téléchargés."));
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("Télécharger")}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="destructive"
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Supprimer")}
|
||||
icon={<TrashIcon className="h-4 w-4" />}
|
||||
tone="danger"
|
||||
onClick={() => void removeSelected()}
|
||||
>
|
||||
{t("Supprimer")}
|
||||
</Button>
|
||||
<Button size="sm" variant="ghost" onClick={clearSelection}>
|
||||
{t("Annuler la sélection")}
|
||||
</Button>
|
||||
/>
|
||||
<IconAction
|
||||
label={t("Annuler la sélection")}
|
||||
icon={<CloseIcon className="h-4 w-4" />}
|
||||
onClick={clearSelection}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -740,7 +717,7 @@ export const Browser = () => {
|
||||
</div>
|
||||
) : empty ? (
|
||||
<EmptyState
|
||||
icon={<FolderIcon className="h-8 w-8" />}
|
||||
icon={<img src="/icons/opened-folder.png" alt="" className="h-8 w-8 object-contain" />}
|
||||
title={t("Emplacement vide")}
|
||||
description={t(
|
||||
"Créez un sous-dossier ou envoyez un fichier pour commencer.",
|
||||
@@ -762,7 +739,7 @@ export const Browser = () => {
|
||||
onDrop={(event) => onFolderDrop(event, folder)}
|
||||
onClick={() => toggleSelection(`f:${folder.id}`)}
|
||||
className={cn(
|
||||
"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",
|
||||
"group relative flex items-center gap-1 rounded-xl border border-border/50 bg-surface/60 p-2 backdrop-blur-md transition-all hover:-translate-y-1 hover:border-border-strong hover:bg-surface/80 hover:shadow-lg cursor-pointer",
|
||||
dropTargetId === folder.id &&
|
||||
"border-accent bg-accent/10 ring-1 ring-accent/50",
|
||||
selected.has(`f:${folder.id}`) &&
|
||||
@@ -798,7 +775,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">
|
||||
<FolderIcon className="h-5 w-5" />
|
||||
<img src="/icons/opened-folder.png" alt="" 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">
|
||||
@@ -879,7 +856,7 @@ export const Browser = () => {
|
||||
{t("Rien à afficher pour ce filtre.")}
|
||||
</p>
|
||||
) : (
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{visibleFiles.map((file, index) => (
|
||||
<li
|
||||
key={file.id}
|
||||
@@ -943,8 +920,7 @@ export const Browser = () => {
|
||||
}
|
||||
icon={
|
||||
<StarIcon
|
||||
className="h-4 w-4"
|
||||
{...(file.is_starred ? { filled: true } : {})}
|
||||
className={`h-4 w-4 ${file.is_starred ? "text-accent" : "opacity-60"}`}
|
||||
/>
|
||||
}
|
||||
onClick={(event) => {
|
||||
@@ -956,13 +932,12 @@ export const Browser = () => {
|
||||
<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"
|
||||
aria-label={t("Télécharger {name}", { name: file.name })}
|
||||
title={t("Télécharger {name}", { name: file.name })}
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-surface/60 text-muted-foreground backdrop-blur-sm transition-all hover:-translate-y-0.5 hover:bg-surface/80 hover:text-foreground hover:shadow-sm"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
<DownloadIcon className="h-3.5 w-3.5" />
|
||||
<span className="hidden sm:inline">
|
||||
{t("Télécharger")}
|
||||
</span>
|
||||
<DownloadIcon className="h-4 w-4" />
|
||||
</a>
|
||||
|
||||
{canWrite ? (
|
||||
|
||||
@@ -36,83 +36,81 @@ export const ChangePassword = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="flex min-h-dvh items-center justify-center bg-background px-4 py-10">
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Nouveau mot de passe")}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Nouveau mot de passe")}
|
||||
</h1>
|
||||
</div>
|
||||
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">
|
||||
{t("Bienvenue {name}. Ce mot de passe a été défini par un administrateur : choisissez le vôtre.", { name: user?.first_name ?? "" })}
|
||||
</p>
|
||||
</header>
|
||||
</div>
|
||||
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">
|
||||
{t("Bienvenue {name}. Ce mot de passe a été défini par un administrateur : choisissez le vôtre.", { name: user?.first_name ?? "" })}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Changement requis")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Les autres sessions ouvertes sur ce compte seront fermées.")}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Mot de passe actuel")}
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
autoFocus
|
||||
value={current}
|
||||
onChange={(event) => setCurrent(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Nouveau mot de passe")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
hint={t("8 caractères minimum.")}
|
||||
value={next}
|
||||
onChange={(event) => setNext(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Confirmation")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
value={confirm}
|
||||
onChange={(event) => setConfirm(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="md"
|
||||
fullWidth
|
||||
onClick={() => void logout()}
|
||||
>
|
||||
{t("Se déconnecter")}
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Changement requis")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Les autres sessions ouvertes sur ce compte seront fermées.")}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Mot de passe actuel")}
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
autoFocus
|
||||
value={current}
|
||||
onChange={(event) => setCurrent(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Nouveau mot de passe")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
hint={t("8 caractères minimum.")}
|
||||
value={next}
|
||||
onChange={(event) => setNext(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Confirmation")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
value={confirm}
|
||||
onChange={(event) => setConfirm(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Enregistrer")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="md"
|
||||
fullWidth
|
||||
onClick={() => void logout()}
|
||||
>
|
||||
{t("Se déconnecter")}
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -36,57 +36,55 @@ export const ConfirmEmail = () => {
|
||||
}, [token, refresh]);
|
||||
|
||||
return (
|
||||
<main className="flex min-h-dvh items-center justify-center bg-background px-4 py-10">
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Changement d'adresse")}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Changement d'adresse")}
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Confirmation")}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-4">
|
||||
{state === "loading" ? (
|
||||
<div className="flex justify-center py-4">
|
||||
<Spinner size="md" />
|
||||
</div>
|
||||
) : state === "success" ? (
|
||||
<>
|
||||
<Alert tone="success">{t("Votre adresse e-mail a été mise à jour.")}</Alert>
|
||||
<Link to="/files">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Accéder à mes fichiers")}
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Alert>{error}</Alert>
|
||||
<Link to="/profile">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Mon compte")}
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Confirmation")}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col gap-4">
|
||||
{state === "loading" ? (
|
||||
<div className="flex justify-center py-4">
|
||||
<Spinner size="md" />
|
||||
</div>
|
||||
) : state === "success" ? (
|
||||
<>
|
||||
<Alert tone="success">{t("Votre adresse e-mail a été mise à jour.")}</Alert>
|
||||
<Link to="/files">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Accéder à mes fichiers")}
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Alert>{error}</Alert>
|
||||
<Link to="/profile">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Mon compte")}
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ export const Favorites = () => {
|
||||
description={t("Étoilez un fichier dans l'explorateur pour le retrouver ici.")}
|
||||
/>
|
||||
) : (
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{files.map((file, index) => (
|
||||
<li key={file.id} className="flex items-center gap-2 px-3 py-2.5">
|
||||
<button
|
||||
@@ -85,17 +85,18 @@ export const Favorites = () => {
|
||||
|
||||
<IconAction
|
||||
label={t("Retirer l'étoile de {name}", { name: file.name })}
|
||||
icon={<StarIcon className="h-4 w-4" filled />}
|
||||
icon={<StarIcon className="h-4 w-4" />}
|
||||
onClick={() => void unstar(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"
|
||||
aria-label={t("Télécharger {name}", { name: file.name })}
|
||||
title={t("Télécharger {name}", { name: file.name })}
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-surface/60 text-muted-foreground backdrop-blur-sm transition-all hover:-translate-y-0.5 hover:bg-surface/80 hover:text-foreground hover:shadow-sm"
|
||||
>
|
||||
<DownloadIcon className="h-3.5 w-3.5" />
|
||||
<span className="hidden sm:inline">{t("Télécharger")}</span>
|
||||
<DownloadIcon className="h-4 w-4" />
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@@ -27,75 +27,73 @@ export const ForgotPassword = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="flex min-h-dvh items-center justify-center bg-background px-4 py-10">
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Mot de passe oublié")}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Mot de passe oublié")}
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Réinitialisation")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Nous vous enverrons un lien valable une heure.")}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{sent ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert tone="success">
|
||||
{t("Si cette adresse correspond à un compte, un message contenant le lien de réinitialisation vient d'être envoyé.")}
|
||||
</Alert>
|
||||
<Link
|
||||
to="/login"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Retour à la connexion")}
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<form
|
||||
className="flex flex-col gap-4"
|
||||
onSubmit={(event) => void submit(event)}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Réinitialisation")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Nous vous enverrons un lien valable une heure.")}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{sent ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert tone="success">
|
||||
{t("Si cette adresse correspond à un compte, un message contenant le lien de réinitialisation vient d'être envoyé.")}
|
||||
</Alert>
|
||||
<Link
|
||||
to="/login"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
<Input
|
||||
label={t("Adresse e-mail")}
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
required
|
||||
autoFocus
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Envoyer le lien")}
|
||||
</Button>
|
||||
<Link
|
||||
to="/login"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Retour à la connexion")}
|
||||
</Link>
|
||||
</form>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
{t("Retour à la connexion")}
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<form
|
||||
className="flex flex-col gap-4"
|
||||
onSubmit={(event) => void submit(event)}
|
||||
>
|
||||
<Input
|
||||
label={t("Adresse e-mail")}
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
required
|
||||
autoFocus
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Envoyer le lien")}
|
||||
</Button>
|
||||
<Link
|
||||
to="/login"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Retour à la connexion")}
|
||||
</Link>
|
||||
</form>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -32,71 +32,69 @@ export const Login = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="flex min-h-dvh items-center justify-center bg-background px-4 py-10">
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
Cloud
|
||||
</h1>
|
||||
</div>
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
Cloud
|
||||
</h1>
|
||||
</div>
|
||||
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">
|
||||
{t("Connectez-vous pour accéder à vos fichiers.")}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Connexion")}</CardTitle>
|
||||
<CardDescription>{t("Votre session reste ouverte 14 jours.")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Adresse e-mail")}
|
||||
type="email"
|
||||
autoComplete="username"
|
||||
required
|
||||
autoFocus
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Mot de passe")}
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.target.value)}
|
||||
{...(error ? { error } : {})}
|
||||
/>
|
||||
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Se connecter")}
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<p className="mt-4 text-center text-xs text-muted-foreground">
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
className="underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Mot de passe oublié ?")}
|
||||
</Link>
|
||||
</div>
|
||||
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">
|
||||
{t("Connectez-vous pour accéder à vos fichiers.")}
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Connexion")}</CardTitle>
|
||||
<CardDescription>{t("Votre session reste ouverte 14 jours.")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Adresse e-mail")}
|
||||
type="email"
|
||||
autoComplete="username"
|
||||
required
|
||||
autoFocus
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Mot de passe")}
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.target.value)}
|
||||
{...(error ? { error } : {})}
|
||||
/>
|
||||
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Se connecter")}
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<p className="mt-4 text-center text-xs text-muted-foreground">
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
className="underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Mot de passe oublié ?")}
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -34,84 +34,82 @@ export const ResetPassword = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="flex min-h-dvh items-center justify-center bg-background px-4 py-10">
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Nouveau mot de passe")}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="w-full max-w-sm">
|
||||
<header className="mb-6 text-center">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img
|
||||
src="/icon.png"
|
||||
alt=""
|
||||
className="h-12 w-12 rounded-xl ring-1 ring-black/5"
|
||||
/>
|
||||
<div className="text-left">
|
||||
<p className="font-display text-xs font-semibold uppercase tracking-logo text-accent">
|
||||
CoHaiSe
|
||||
</p>
|
||||
<h1 className="font-display text-lg font-semibold uppercase tracking-label text-foreground">
|
||||
{t("Nouveau mot de passe")}
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Réinitialisation")}</CardTitle>
|
||||
<CardDescription>{t("Choisissez un mot de passe robuste.")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{!token ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert>{t("Ce lien est incomplet ou invalide.")}</Alert>
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Demander un nouveau lien")}
|
||||
</Link>
|
||||
</div>
|
||||
) : done ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert tone="success">
|
||||
{t("Votre mot de passe a été réinitialisé. Vous pouvez vous connecter.")}
|
||||
</Alert>
|
||||
<Link to="/login">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Se connecter")}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Nouveau mot de passe")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
autoFocus
|
||||
hint={t("8 caractères minimum.")}
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Confirmation")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
value={confirm}
|
||||
onChange={(event) => setConfirm(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Réinitialiser")}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("Réinitialisation")}</CardTitle>
|
||||
<CardDescription>{t("Choisissez un mot de passe robuste.")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{!token ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert>{t("Ce lien est incomplet ou invalide.")}</Alert>
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
className="text-center text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
|
||||
>
|
||||
{t("Demander un nouveau lien")}
|
||||
</Link>
|
||||
</div>
|
||||
) : done ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Alert tone="success">
|
||||
{t("Votre mot de passe a été réinitialisé. Vous pouvez vous connecter.")}
|
||||
</Alert>
|
||||
<Link to="/login">
|
||||
<Button size="lg" fullWidth>
|
||||
{t("Se connecter")}
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<form className="flex flex-col gap-4" onSubmit={(event) => void submit(event)}>
|
||||
<Input
|
||||
label={t("Nouveau mot de passe")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
autoFocus
|
||||
hint={t("8 caractères minimum.")}
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.target.value)}
|
||||
/>
|
||||
<Input
|
||||
label={t("Confirmation")}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
value={confirm}
|
||||
onChange={(event) => setConfirm(event.target.value)}
|
||||
/>
|
||||
{error ? <Alert>{error}</Alert> : null}
|
||||
<Button type="submit" size="lg" fullWidth isLoading={busy}>
|
||||
{t("Réinitialiser")}
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useState, type FormEvent } from "react";
|
||||
import { Button, Input, Spinner } from "../ui/index.js";
|
||||
import { Input, Spinner } from "../ui/index.js";
|
||||
import { ApiError, api, formatBytes, type Folder, type UploadedFile } from "../lib/api.js";
|
||||
import { Alert, EmptyState, PageHeader } from "../components/feedback.js";
|
||||
import { IconAction } from "../components/IconAction.js";
|
||||
import { DownloadIcon, FileIcon, FolderIcon, SearchIcon } from "../components/icons.js";
|
||||
import { useI18n } from "../lib/i18n.js";
|
||||
|
||||
@@ -56,14 +57,16 @@ export const Search = () => {
|
||||
onChange={(event) => setQ(event.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="submit"
|
||||
size="md"
|
||||
<IconAction
|
||||
label={t("Rechercher")}
|
||||
icon={<SearchIcon className="h-4 w-4" />}
|
||||
isLoading={loading}
|
||||
iconLeading={<SearchIcon className="h-3.5 w-3.5" />}
|
||||
>
|
||||
{t("Rechercher")}
|
||||
</Button>
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
const form = e.currentTarget.closest('form');
|
||||
form?.requestSubmit();
|
||||
}}
|
||||
/>
|
||||
</form>
|
||||
}
|
||||
/>
|
||||
@@ -87,7 +90,7 @@ export const Search = () => {
|
||||
<h2 className="mb-2 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Dossiers")}
|
||||
</h2>
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{results.folders.map((folder) => (
|
||||
<li key={folder.id} className="flex items-center gap-3 px-3 py-2.5">
|
||||
<span className="shrink-0 text-accent">
|
||||
@@ -107,7 +110,7 @@ export const Search = () => {
|
||||
<h2 className="mb-2 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Fichiers")}
|
||||
</h2>
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{results.files.map((file) => (
|
||||
<li key={file.id} className="flex items-center gap-3 px-3 py-2.5">
|
||||
<span className="shrink-0 text-muted-foreground">
|
||||
|
||||
@@ -121,7 +121,7 @@ export const Trash = () => {
|
||||
<h2 className="mb-2 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Dossiers")}
|
||||
</h2>
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{data.folders.map((folder) => (
|
||||
<li key={folder.id} className="flex items-center gap-3 px-3 py-2.5">
|
||||
<span className="shrink-0 text-accent">
|
||||
@@ -165,7 +165,7 @@ export const Trash = () => {
|
||||
<h2 className="mb-2 font-display text-[0.6875rem] font-semibold uppercase tracking-label text-subtle-foreground">
|
||||
{t("Fichiers")}
|
||||
</h2>
|
||||
<ul className="flex flex-col divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
<ul className="flex flex-col divide-y divide-border rounded-xl border border-border/50 bg-surface/60 backdrop-blur-md">
|
||||
{data.files.map((file) => (
|
||||
<li key={file.id} className="flex items-center gap-3 px-3 py-2.5">
|
||||
<span className="shrink-0 text-muted-foreground">
|
||||
|
||||
@@ -5,8 +5,8 @@ import type { SpinnerSize } from "./Spinner.js";
|
||||
|
||||
const variantClasses = {
|
||||
primary: "bg-primary text-primary-foreground hover:bg-primary-hover",
|
||||
secondary: "border border-border-strong bg-surface text-foreground hover:bg-surface-hover",
|
||||
ghost: "text-foreground hover:bg-surface-hover",
|
||||
secondary: "rounded-lg border border-border-strong bg-surface/60 text-foreground backdrop-blur-sm transition-all hover:-translate-y-0.5 hover:bg-surface/80 hover:shadow-md",
|
||||
ghost: "rounded-lg text-foreground transition-all hover:-translate-y-0.5 hover:bg-surface/50 hover:shadow-sm",
|
||||
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive-hover",
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import { cn } from "../lib/cn.js";
|
||||
export const Card = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
|
||||
<div
|
||||
className={cn(
|
||||
"relative overflow-hidden rounded-lg border border-border bg-surface text-foreground shadow-sm",
|
||||
"transition-colors duration-base ease-out-soft",
|
||||
"relative overflow-hidden rounded-xl border border-border/50 bg-surface/60 text-foreground shadow-sm backdrop-blur-md",
|
||||
"transition-all duration-base ease-out-soft hover:-translate-y-1 hover:shadow-lg",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -47,7 +47,7 @@ export const Input = ({
|
||||
aria-invalid={isInvalid}
|
||||
aria-describedby={isInvalid || hint ? messageId : undefined}
|
||||
className={cn(
|
||||
"w-full rounded-sm border bg-surface text-foreground placeholder:text-subtle-foreground",
|
||||
"w-full rounded-lg border bg-surface/60 text-foreground placeholder:text-subtle-foreground backdrop-blur-sm",
|
||||
"transition-[background-color,border-color,box-shadow] duration-fast ease-out-soft",
|
||||
"focus-visible:ring-ring focus-visible:border-border-strong focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none",
|
||||
"disabled:cursor-not-allowed disabled:bg-surface-muted disabled:opacity-60",
|
||||
|
||||
Reference in New Issue
Block a user