From 369638f3d6e129a7706750dbcd48f31ade1eee0a Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Fri, 15 Aug 2025 08:48:58 +0000 Subject: [PATCH] Add a widget to display the current date alongside weather information Introduce a new DateWidget component, integrated into the main layout to display the current date, and refactor WeatherWidget to remove redundant date formatting. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/dB3dp7l --- client/src/components/DateWidget.tsx | 34 +++++++++++++++++++++++++ client/src/components/Layout.tsx | 8 ++++-- client/src/components/WeatherWidget.tsx | 12 +-------- 3 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 client/src/components/DateWidget.tsx diff --git a/client/src/components/DateWidget.tsx b/client/src/components/DateWidget.tsx new file mode 100644 index 0000000..2d44f04 --- /dev/null +++ b/client/src/components/DateWidget.tsx @@ -0,0 +1,34 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Calendar } from "lucide-react"; + +const formatDate = (date: Date): string => { + return date.toLocaleDateString('fr-FR', { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric' + }); +}; + + + +export default function DateWidget() { + const now = new Date(); + + return ( + + +
+
+ +
+
+ + {formatDate(now)} + +
+
+
+
+ ); +} \ No newline at end of file diff --git a/client/src/components/Layout.tsx b/client/src/components/Layout.tsx index 1d60d87..bf3b9ec 100644 --- a/client/src/components/Layout.tsx +++ b/client/src/components/Layout.tsx @@ -7,6 +7,7 @@ import { useAuthUnified } from "@/hooks/useAuthUnified"; import { useIsMobile } from "@/hooks/use-mobile"; import Sidebar from "./Sidebar"; import WeatherWidget from "./WeatherWidget"; +import DateWidget from "./DateWidget"; import type { Group } from "@shared/schema"; interface StoreContextType { @@ -92,8 +93,11 @@ export default function Layout({ children }: LayoutProps) { )} - {/* Weather widget */} - + {/* Weather and Date widgets */} +
+ + +
{/* Store selector for admin - responsive */} diff --git a/client/src/components/WeatherWidget.tsx b/client/src/components/WeatherWidget.tsx index 73a2b6d..0920590 100644 --- a/client/src/components/WeatherWidget.tsx +++ b/client/src/components/WeatherWidget.tsx @@ -21,14 +21,7 @@ interface WeatherResponse { location: string; } -const formatDate = (date: Date): string => { - return date.toLocaleDateString('fr-FR', { - weekday: 'long', - year: 'numeric', - month: 'long', - day: 'numeric' - }); -}; + const WeatherIcon = ({ condition, size = 20 }: { condition: string; size?: number }) => { const iconClass = `h-${Math.floor(size/4)} w-${Math.floor(size/4)}`; @@ -128,9 +121,6 @@ export default function WeatherWidget() { {weather.currentYear?.condition || 'Inconnu'} - - {formatDate(new Date())} -