From c72e8b920c97d9300e226814750e39419166b38a Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Sat, 16 Aug 2025 12:35:41 +0000 Subject: [PATCH] Present announcements in a card format similar to task cards Update AnnouncementCard component to display announcements in a card layout, add loading state and conditional fetching. 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 --- client/src/components/AnnouncementCard.tsx | 295 +++++++++++---------- 1 file changed, 158 insertions(+), 137 deletions(-) diff --git a/client/src/components/AnnouncementCard.tsx b/client/src/components/AnnouncementCard.tsx index f0ba692..7716baf 100644 --- a/client/src/components/AnnouncementCard.tsx +++ b/client/src/components/AnnouncementCard.tsx @@ -45,7 +45,7 @@ export default function AnnouncementCard() { }); // Fetch announcements - const { data: announcements = [] } = useQuery({ + const { data: announcements = [], isLoading } = useQuery({ queryKey: ['/api/announcements', selectedStoreId], queryFn: async () => { const params = new URLSearchParams(); @@ -63,6 +63,7 @@ export default function AnnouncementCard() { return response.json(); }, + enabled: !!user, }); // Fetch groups for admin @@ -182,161 +183,181 @@ export default function AnnouncementCard() { } }; + if (isLoading) { + return ( + + + Informations + + + +
+
+
+
+
+ ); + } + return ( - -
- - Informations -
- {user?.role === 'admin' && ( - - - - - - - Nouvelle information - -
- - ( - - Titre - - - - - - )} - /> - ( - - Contenu - -