2026-02-05 18:04:00 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Card } from '@/components/ui/card';
|
|
|
|
|
import { CheckSquare, Square, Folder, Music, Image as ImageIcon, File } from 'lucide-react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import type { CloudFileNode } from './types';
|
|
|
|
|
|
|
|
|
|
export interface FileGridCardProps {
|
|
|
|
|
file: CloudFileNode;
|
|
|
|
|
selected: boolean;
|
|
|
|
|
onSelect: (id: string) => void;
|
|
|
|
|
onClick: (file: CloudFileNode) => void;
|
|
|
|
|
isLoading?: boolean;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function FileTypeIcon({ type, size = 'md' }: { type: CloudFileNode['type']; size?: 'md' | 'lg' }) {
|
|
|
|
|
const cl = size === 'lg' ? 'w-8 h-8' : 'w-5 h-5';
|
2026-02-07 14:20:44 +00:00
|
|
|
if (type === 'folder') return <Folder className={cn(cl, 'text-warning')} />;
|
2026-02-05 18:04:00 +00:00
|
|
|
if (type === 'audio') return <Music className={cn(cl, 'text-kodo-steel')} />;
|
2026-02-07 14:20:44 +00:00
|
|
|
if (type === 'image') return <ImageIcon className={cn(cl, 'text-primary')} />;
|
2026-02-05 18:04:00 +00:00
|
|
|
if (['document', 'archive', 'project'].includes(type)) {
|
2026-02-08 23:04:51 +00:00
|
|
|
return <File className={cn(cl, 'text-muted-foreground')} />;
|
2026-02-05 18:04:00 +00:00
|
|
|
}
|
2026-02-08 23:04:51 +00:00
|
|
|
return <File className={cn(cl, 'text-muted-foreground')} />;
|
2026-02-05 18:04:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function FileGridCard({
|
|
|
|
|
file,
|
|
|
|
|
selected,
|
|
|
|
|
onSelect,
|
|
|
|
|
onClick,
|
|
|
|
|
isLoading = false,
|
|
|
|
|
className,
|
|
|
|
|
}: FileGridCardProps) {
|
|
|
|
|
if (isLoading) {
|
|
|
|
|
return (
|
|
|
|
|
<Card
|
|
|
|
|
variant="default"
|
|
|
|
|
className={cn(
|
|
|
|
|
'p-4 flex flex-col items-center text-center gap-4 animate-pulse',
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-02-07 14:20:44 +00:00
|
|
|
<div className="w-16 h-16 rounded-2xl bg-muted" />
|
2026-02-05 18:04:00 +00:00
|
|
|
<div className="w-full space-y-2">
|
2026-02-07 14:20:44 +00:00
|
|
|
<div className="h-4 w-full rounded bg-muted" />
|
2026-02-05 18:04:00 +00:00
|
|
|
<div className="flex justify-center gap-1">
|
2026-02-07 14:20:44 +00:00
|
|
|
<div className="h-3 w-12 rounded bg-muted" />
|
|
|
|
|
<div className="h-3 w-10 rounded bg-muted" />
|
2026-02-05 18:04:00 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Card
|
|
|
|
|
variant="default"
|
|
|
|
|
className={cn(
|
2026-02-07 14:20:44 +00:00
|
|
|
'p-4 flex flex-col items-center text-center gap-4 cursor-pointer hover:border-primary/50 transition-all duration-[var(--duration-normal)] group relative',
|
|
|
|
|
selected && 'border-primary bg-primary/5',
|
2026-02-05 18:04:00 +00:00
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => onClick(file)}
|
|
|
|
|
>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10"
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
onSelect(file.id);
|
|
|
|
|
}}
|
|
|
|
|
aria-label={selected ? 'Désélectionner' : 'Sélectionner'}
|
|
|
|
|
>
|
|
|
|
|
{selected ? (
|
2026-02-07 14:20:44 +00:00
|
|
|
<CheckSquare className="w-4 h-4 text-primary" />
|
2026-02-05 18:04:00 +00:00
|
|
|
) : (
|
2026-02-07 14:20:44 +00:00
|
|
|
<Square className="w-4 h-4 text-muted-foreground hover:text-foreground" />
|
2026-02-05 18:04:00 +00:00
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
|
feat(web): UI premium Discord/Spotify-like — tokens, shadows, focus, layout
Plan UI premium 6–8 semaines (design system, shell, Storybook, a11y):
- Design system: DESIGN_TOKENS.md, APP_SHELL.md, FULL_LAYOUT_PAGE.md. Single source
for layout/shell (index.css), shadows (design-system.css), durations/easing.
- Tokens: shadow-cover-depth, shadow-gold-glow, shadow-fab-glow; layout max-height
(max-h-layout-drawer, max-h-layout-panel, max-h-layout-list). All duration-200/300/500
replaced by --duration-fast/normal/slow. Arbitrary shadows replaced by token classes.
- Shell & player: Sidebar, Header, GlobalPlayer, MiniPlayer, PlayerQueue, PlayerControls,
AudioPlayer use tokens; focus-visible on Sidebar, PlayerQueue, DropdownMenuTrigger/Item,
TabsTrigger. Typography: text-[10px]/[9px] → text-xs where applicable.
- ESLint: no-restricted-syntax (warn) for w-/h-/rounded-/shadow-/text-/spacing arbitrary.
- Scripts: report-arbitrary-values.mjs, capture/compare/generate visual; visual-complete.spec.ts.
- Stories full layout: Dashboard, Playlists, Library, Settings, Profile in DashboardLayout.stories.
- .cursorrules + README: DESIGN_TOKENS, APP_SHELL, visual commands, no arbitrary without justification.
- apps/web/.gitignore: e2e test artifacts (test-results-visual, playwright-report-visual).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 16:15:58 +00:00
|
|
|
<div className="w-16 h-16 rounded-2xl bg-kodo-ink flex items-center justify-center shadow-lg transition-opacity group-hover:opacity-80 duration-[var(--duration-fast)]">
|
2026-02-05 18:04:00 +00:00
|
|
|
<FileTypeIcon type={file.type} size="lg" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="w-full min-w-0">
|
|
|
|
|
<h4
|
|
|
|
|
className="font-bold text-white text-sm truncate w-full"
|
|
|
|
|
title={file.name}
|
|
|
|
|
>
|
|
|
|
|
{file.name}
|
|
|
|
|
</h4>
|
|
|
|
|
<div className="flex justify-center gap-1 mt-1 flex-wrap">
|
|
|
|
|
{file.tags?.slice(0, 2).map((t) => (
|
|
|
|
|
<span
|
|
|
|
|
key={t}
|
2026-02-08 23:04:51 +00:00
|
|
|
className="text-xs bg-white/10 px-1 rounded text-muted-foreground"
|
2026-02-05 18:04:00 +00:00
|
|
|
>
|
|
|
|
|
{t}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|