feat: add new dashboard components and enhance UI

- Introduced new CSS variables for light theme in `globals.css` to improve visual consistency.
- Replaced `Card` component with `StatCard`, `ProgressBar`, and `MetricCard` in `DashboardStats`, `ProductivityAnalytics`, and `RecentTasks` for better modularity and reusability.
- Updated `QuickActions` to use `ActionCard` for a more cohesive design.
- Enhanced `Badge` and `Button` components with new variants for improved styling options.
- Added new UI showcase section in `UIShowcaseClient` to demonstrate the new dashboard components.
This commit is contained in:
Julien Froidefond
2025-09-28 21:22:33 +02:00
parent 0e2eaf1052
commit bdf8ab9fb4
16 changed files with 753 additions and 220 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable react/no-unescaped-entities */
'use client';
import { useState } from 'react';
@@ -7,6 +8,7 @@ import { Alert, AlertTitle, AlertDescription } from '@/components/ui/Alert';
import { Input } from '@/components/ui/Input';
import { StyledCard } from '@/components/ui/StyledCard';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card';
import { StatCard, ProgressBar, ActionCard, TaskCard, MetricCard } from '@/components/ui';
import { ThemeSelector } from '@/components/ThemeSelector';
export function UIShowcaseClient() {
@@ -315,6 +317,251 @@ export function UIShowcaseClient() {
</div>
</section>
{/* Dashboard Components Section */}
<section className="space-y-8">
<h2 className="text-2xl font-mono font-semibold text-[var(--foreground)] border-b border-[var(--border)] pb-3">
Dashboard Components
</h2>
{/* Stat Cards */}
<div className="space-y-6">
<h3 className="text-lg font-medium text-[var(--foreground)]">Stat Cards</h3>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="default"
</div>
<StatCard
title="Total Tâches"
value={42}
icon="📋"
color="default"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="primary"
</div>
<StatCard
title="En Cours"
value={8}
icon="🔄"
color="primary"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="success"
</div>
<StatCard
title="Terminées"
value={28}
icon="✅"
color="success"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="warning"
</div>
<StatCard
title="En Attente"
value={6}
icon="⏳"
color="warning"
/>
</div>
</div>
</div>
{/* Progress Bars */}
<div className="space-y-6">
<h3 className="text-lg font-medium text-[var(--foreground)]">Progress Bars</h3>
<div className="space-y-4 max-w-md">
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="success"
</div>
<ProgressBar
value={75}
label="Completion Rate"
color="success"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="primary"
</div>
<ProgressBar
value={45}
label="En Cours"
color="primary"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="warning"
</div>
<ProgressBar
value={20}
label="En Attente"
color="warning"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="default"
</div>
<ProgressBar
value={90}
label="Performance"
color="default"
/>
</div>
</div>
</div>
{/* Action Cards */}
<div className="space-y-6">
<h3 className="text-lg font-medium text-[var(--foreground)]">Action Cards</h3>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
variant="primary"
</div>
<ActionCard
title="Nouvelle Tâche"
description="Créer une nouvelle tâche"
icon={
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" />
</svg>
}
onClick={() => alert('Action clicked!')}
variant="primary"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
variant="secondary"
</div>
<ActionCard
title="Kanban Board"
description="Gérer les tâches"
icon={
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 0V5a2 2 0 012-2h2a2 2 0 002-2" />
</svg>
}
href="#"
variant="secondary"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
variant="ghost"
</div>
<ActionCard
title="Paramètres"
description="Configuration"
icon={
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
}
href="#"
variant="ghost"
/>
</div>
</div>
</div>
{/* Task Cards */}
<div className="space-y-6">
<h3 className="text-lg font-medium text-[var(--foreground)]">Task Cards</h3>
<div className="space-y-3 max-w-2xl">
<TaskCard
title="Refactoriser le système de thèmes"
description="Améliorer la gestion des thèmes avec CSS variables"
status="En Cours"
priority="Haute"
tags={[
<Badge key="tag1" variant="primary" className="text-xs">Frontend</Badge>,
<Badge key="tag2" variant="success" className="text-xs">UI</Badge>
]}
metadata="Il y a 2h"
actions={
<button className="p-1 rounded hover:bg-[var(--muted)]/50 transition-colors">
<svg className="w-3 h-3 text-[var(--primary)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
</button>
}
/>
<TaskCard
title="Créer les composants UI réutilisables"
description="Développer une bibliothèque de composants cohérente"
status="Terminé"
priority="Moyenne"
tags={[
<Badge key="tag1" variant="accent" className="text-xs">Design</Badge>
]}
metadata="Hier"
actions={
<button className="p-1 rounded hover:bg-[var(--muted)]/50 transition-colors">
<svg className="w-3 h-3 text-[var(--primary)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
</button>
}
/>
</div>
</div>
{/* Metric Cards */}
<div className="space-y-6">
<h3 className="text-lg font-medium text-[var(--foreground)]">Metric Cards</h3>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="primary"
</div>
<MetricCard
title="Vélocité Moyenne"
value="12 tâches/sem"
color="primary"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="success"
</div>
<MetricCard
title="Priorité Principale"
value="Haute"
color="success"
/>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-[var(--muted-foreground)] bg-[var(--card)] px-2 py-1 rounded">
color="warning"
</div>
<MetricCard
title="Taux de Completion"
value="85%"
color="warning"
/>
</div>
</div>
</div>
</section>
{/* Footer */}
<div className="text-center pt-8 border-t border-[var(--border)]">
<p className="text-[var(--muted-foreground)]">