mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-23 15:08:22 +02:00
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:
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 |
@@ -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 (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">Informations</CardTitle>
|
<CardTitle className="text-sm font-medium">Informations</CardTitle>
|
||||||
<Megaphone className="h-4 w-4 text-muted-foreground" />
|
<div className="flex items-center gap-2">
|
||||||
</CardHeader>
|
{user?.role === 'admin' && (
|
||||||
<CardContent>
|
|
||||||
{user?.role === 'admin' && (
|
|
||||||
<div className="mb-4">
|
|
||||||
<Dialog open={isCreateDialogOpen} onOpenChange={setIsCreateDialogOpen}>
|
<Dialog open={isCreateDialogOpen} onOpenChange={setIsCreateDialogOpen}>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button size="sm" variant="outline" className="w-full">
|
<Button size="sm" variant="ghost" className="h-8 w-8 p-0">
|
||||||
<Plus className="h-4 w-4 mr-2" />
|
<Plus className="h-4 w-4" />
|
||||||
Nouvelle information
|
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="sm:max-w-[500px]">
|
<DialogContent className="sm:max-w-[500px]">
|
||||||
@@ -318,9 +338,11 @@ export default function AnnouncementCard() {
|
|||||||
</Form>
|
</Form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
)}
|
||||||
)}
|
<Megaphone className="h-4 w-4 text-muted-foreground" />
|
||||||
|
</div>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
{announcements.length === 0 ? (
|
{announcements.length === 0 ? (
|
||||||
<div className="text-center py-6">
|
<div className="text-center py-6">
|
||||||
<Megaphone className="h-8 w-8 text-muted-foreground mx-auto mb-2" />
|
<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">
|
<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 priorityConfig = getPriorityConfig(announcement.priority);
|
||||||
const PriorityIcon = priorityConfig.icon;
|
const PriorityIcon = priorityConfig.icon;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user