feat: enhance EditCheckboxModal with new UI components
- Replaced task status and tags display with `StatusBadge` and `TagDisplay` for improved visual clarity. - Updated task search input to use `SearchInput` for better user experience. - Refactored task display sections to utilize `Card` component for consistent styling.
This commit is contained in:
@@ -5,6 +5,10 @@ import { DailyCheckbox, DailyCheckboxType, Task } from '@/lib/types';
|
|||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import { Input } from '@/components/ui/Input';
|
import { Input } from '@/components/ui/Input';
|
||||||
import { Modal } from '@/components/ui/Modal';
|
import { Modal } from '@/components/ui/Modal';
|
||||||
|
import { TagDisplay } from '@/components/ui/TagDisplay';
|
||||||
|
import { Card } from '@/components/ui/Card';
|
||||||
|
import { SearchInput } from '@/components/ui/SearchInput';
|
||||||
|
import { StatusBadge } from '@/components/ui/StatusBadge';
|
||||||
import { tasksClient } from '@/clients/tasks-client';
|
import { tasksClient } from '@/clients/tasks-client';
|
||||||
|
|
||||||
interface EditCheckboxModalProps {
|
interface EditCheckboxModalProps {
|
||||||
@@ -165,7 +169,7 @@ export function EditCheckboxModal({
|
|||||||
|
|
||||||
{selectedTask ? (
|
{selectedTask ? (
|
||||||
// Tâche déjà sélectionnée
|
// Tâche déjà sélectionnée
|
||||||
<div className="border border-[var(--border)] rounded-lg p-3 bg-[var(--muted)]/30">
|
<Card className="p-3" background="muted">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="font-medium text-sm truncate">{selectedTask.title}</div>
|
<div className="font-medium text-sm truncate">{selectedTask.title}</div>
|
||||||
@@ -175,24 +179,14 @@ export function EditCheckboxModal({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center gap-2 mt-1">
|
<div className="flex items-center gap-2 mt-1">
|
||||||
<span className={`inline-block px-1 py-0.5 rounded text-xs ${
|
<StatusBadge status={selectedTask.status} />
|
||||||
selectedTask.status === 'todo' ? 'bg-blue-100 text-blue-800' :
|
|
||||||
selectedTask.status === 'in_progress' ? 'bg-yellow-100 text-yellow-800' :
|
|
||||||
'bg-gray-100 text-gray-800'
|
|
||||||
}`}>
|
|
||||||
{selectedTask.status}
|
|
||||||
</span>
|
|
||||||
{selectedTask.tags && selectedTask.tags.length > 0 && (
|
{selectedTask.tags && selectedTask.tags.length > 0 && (
|
||||||
<div className="flex flex-wrap gap-1">
|
<TagDisplay
|
||||||
{selectedTask.tags.map((tag, index) => (
|
tags={selectedTask.tags}
|
||||||
<span
|
size="sm"
|
||||||
key={index}
|
availableTags={selectedTask.tagDetails}
|
||||||
className="inline-block px-1.5 py-0.5 rounded text-xs bg-[var(--primary)]/20 text-[var(--primary)] border border-[var(--primary)]/30"
|
maxTags={3}
|
||||||
>
|
/>
|
||||||
#{tag}
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -207,21 +201,20 @@ export function EditCheckboxModal({
|
|||||||
×
|
×
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
// Interface de sélection simplifiée
|
// Interface de sélection simplifiée
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Input
|
<SearchInput
|
||||||
type="text"
|
|
||||||
placeholder="Rechercher une tâche..."
|
|
||||||
value={taskSearch}
|
value={taskSearch}
|
||||||
onChange={(e) => setTaskSearch(e.target.value)}
|
onChange={setTaskSearch}
|
||||||
|
placeholder="Rechercher une tâche..."
|
||||||
disabled={saving || tasksLoading}
|
disabled={saving || tasksLoading}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{taskSearch.trim() && (
|
{taskSearch.trim() && (
|
||||||
<div className="border border-[var(--border)] rounded-lg max-h-40 overflow-y-auto">
|
<Card className="max-h-40 overflow-y-auto" shadow="sm">
|
||||||
{tasksLoading ? (
|
{tasksLoading ? (
|
||||||
<div className="p-3 text-center text-sm text-[var(--muted-foreground)]">
|
<div className="p-3 text-center text-sm text-[var(--muted-foreground)]">
|
||||||
Chargement...
|
Chargement...
|
||||||
@@ -246,35 +239,20 @@ export function EditCheckboxModal({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center gap-2 mt-1">
|
<div className="flex items-center gap-2 mt-1">
|
||||||
<span className={`inline-block px-1 py-0.5 rounded text-xs ${
|
<StatusBadge status={task.status} />
|
||||||
task.status === 'todo' ? 'bg-blue-100 text-blue-800' :
|
|
||||||
task.status === 'in_progress' ? 'bg-yellow-100 text-yellow-800' :
|
|
||||||
'bg-gray-100 text-gray-800'
|
|
||||||
}`}>
|
|
||||||
{task.status}
|
|
||||||
</span>
|
|
||||||
{task.tags && task.tags.length > 0 && (
|
{task.tags && task.tags.length > 0 && (
|
||||||
<div className="flex flex-wrap gap-1">
|
<TagDisplay
|
||||||
{task.tags.slice(0, 3).map((tag, index) => (
|
tags={task.tags}
|
||||||
<span
|
size="sm"
|
||||||
key={index}
|
availableTags={task.tagDetails}
|
||||||
className="inline-block px-1.5 py-0.5 rounded text-xs bg-[var(--primary)]/20 text-[var(--primary)] border border-[var(--primary)]/30"
|
maxTags={3}
|
||||||
>
|
/>
|
||||||
#{tag}
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
{task.tags.length > 3 && (
|
|
||||||
<span className="text-xs text-[var(--muted-foreground)]">
|
|
||||||
+{task.tags.length - 3}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</Card>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
20
src/components/ui/StatusBadge.tsx
Normal file
20
src/components/ui/StatusBadge.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { TaskStatus } from '@/lib/types';
|
||||||
|
import { getStatusConfig, getStatusBadgeClasses } from '@/lib/status-config';
|
||||||
|
|
||||||
|
interface StatusBadgeProps {
|
||||||
|
status: TaskStatus;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function StatusBadge({ status, className = '' }: StatusBadgeProps) {
|
||||||
|
const config = getStatusConfig(status);
|
||||||
|
const badgeClasses = getStatusBadgeClasses(status);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className={`text-xs px-2 py-0.5 rounded font-medium border ${badgeClasses} ${className}`}>
|
||||||
|
{config.icon} {config.label}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ export { DropZone } from './DropZone';
|
|||||||
// Composants Weekly Manager
|
// Composants Weekly Manager
|
||||||
export { Tabs } from './Tabs';
|
export { Tabs } from './Tabs';
|
||||||
export { PriorityBadge } from './PriorityBadge';
|
export { PriorityBadge } from './PriorityBadge';
|
||||||
|
export { StatusBadge } from './StatusBadge';
|
||||||
export { AchievementCard } from './AchievementCard';
|
export { AchievementCard } from './AchievementCard';
|
||||||
export { ChallengeCard } from './ChallengeCard';
|
export { ChallengeCard } from './ChallengeCard';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user