mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-21 22:18:17 +02:00
Update announcement cards to match task card design and functionality
Refactors `AnnouncementCard.tsx` to mirror the design and priority display of task cards, introducing new icons and a `getPriorityConfig` function for consistent visual representation of announcement priorities (urgent, important, normal). Replit-Commit-Author: Agent Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/aVFsaJG
This commit is contained in:
1 parent
5b6be55904
commit
7591d5699e
1 file changed
+39
-13
@@ -4,7 +4,7 @@ import { useStore } from "@/components/Layout";
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Megaphone, Plus, X, AlertTriangle, Info, Bell } from "lucide-react";
|
import { Megaphone, Plus, X, AlertTriangle, Clock, Circle } from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
@@ -331,6 +331,33 @@ export default function AnnouncementCard() {
|
|||||||
) : (
|
) : (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{announcements.map((announcement) => {
|
{announcements.map((announcement) => {
|
||||||
|
const getPriorityConfig = (priority: string) => {
|
||||||
|
switch (priority) {
|
||||||
|
case 'urgent':
|
||||||
|
return {
|
||||||
|
color: 'destructive' as const,
|
||||||
|
icon: AlertTriangle,
|
||||||
|
label: 'Urgente'
|
||||||
|
};
|
||||||
|
case 'important':
|
||||||
|
return {
|
||||||
|
color: 'default' as const,
|
||||||
|
icon: Clock,
|
||||||
|
label: 'Importante'
|
||||||
|
};
|
||||||
|
case 'normal':
|
||||||
|
default:
|
||||||
|
return {
|
||||||
|
color: 'secondary' as const,
|
||||||
|
icon: Circle,
|
||||||
|
label: 'Normale'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const priorityConfig = getPriorityConfig(announcement.priority);
|
||||||
|
const PriorityIcon = priorityConfig.icon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={announcement.id} className="flex items-start justify-between p-3 rounded-lg border bg-card hover:bg-accent/50 transition-colors">
|
<div key={announcement.id} className="flex items-start justify-between p-3 rounded-lg border bg-card hover:bg-accent/50 transition-colors">
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
@@ -338,26 +365,25 @@ export default function AnnouncementCard() {
|
|||||||
<h4 className="font-medium text-sm truncate">
|
<h4 className="font-medium text-sm truncate">
|
||||||
{announcement.title}
|
{announcement.title}
|
||||||
</h4>
|
</h4>
|
||||||
<Badge variant="secondary" className={getPriorityColor(announcement.priority)}>
|
<Badge variant={priorityConfig.color} className="flex items-center gap-1 text-xs">
|
||||||
<span className="flex items-center gap-1">
|
<PriorityIcon className="w-2.5 h-2.5" />
|
||||||
{getPriorityIcon(announcement.priority)}
|
{priorityConfig.label}
|
||||||
{announcement.priority === 'urgent' ? 'Urgent' :
|
|
||||||
announcement.priority === 'important' ? 'Important' : 'Normal'}
|
|
||||||
</span>
|
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p className="text-xs text-muted-foreground mb-1 line-clamp-2">
|
{announcement.content && (
|
||||||
{announcement.content}
|
<p className="text-xs text-muted-foreground mb-1 line-clamp-1">
|
||||||
</p>
|
{announcement.content}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="flex items-center gap-3 text-xs text-muted-foreground">
|
<div className="flex items-center gap-3 text-xs text-muted-foreground">
|
||||||
<span>
|
<span>
|
||||||
Par {announcement.author.firstName} {announcement.author.lastName}
|
{safeFormat(safeDate(announcement.createdAt), 'dd/MM à HH:mm')}
|
||||||
{announcement.group && ` • ${announcement.group.name}`}
|
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{safeFormat(safeDate(announcement.createdAt), 'dd/MM HH:mm')}
|
{announcement.author.firstName} {announcement.author.lastName}
|
||||||
|
{announcement.group && ` • ${announcement.group.name}`}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user