Update announcement card to show priority and simplify admin actions

Refactor AnnouncementCard component to include priority display using Shadcn/ui dialogs and buttons, and move the admin trigger button.

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:
michaelschal committed 2025-08-16 13:03:49 +00:00
1 parent 7591d5699e
commit ad396339f0
2 files changed
+33 -35

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

+33 -35
View File
@@ -199,20 +199,40 @@ export default function AnnouncementCard() {
);
}
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'
};
}
};
return (
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Informations</CardTitle>
<Megaphone className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
{user?.role === 'admin' && (
<div className="mb-4">
<div className="flex items-center gap-2">
{user?.role === 'admin' && (
<Dialog open={isCreateDialogOpen} onOpenChange={setIsCreateDialogOpen}>
<DialogTrigger asChild>
<Button size="sm" variant="outline" className="w-full">
<Plus className="h-4 w-4 mr-2" />
Nouvelle information
<Button size="sm" variant="ghost" className="h-8 w-8 p-0">
<Plus className="h-4 w-4" />
</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[500px]">
@@ -318,9 +338,11 @@ export default function AnnouncementCard() {
</Form>
</DialogContent>
</Dialog>
</div>
)}
)}
<Megaphone className="h-4 w-4 text-muted-foreground" />
</div>
</CardHeader>
<CardContent>
{announcements.length === 0 ? (
<div className="text-center py-6">
<Megaphone className="h-8 w-8 text-muted-foreground mx-auto mb-2" />
@@ -331,30 +353,6 @@ export default function AnnouncementCard() {
) : (
<div className="space-y-3">
{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;