mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-23 15:08:22 +02:00
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
This commit is contained in:
1 parent
7a083a0203
commit
369638f3d6
3 files changed
+41
-13
No files matched your search
@@ -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 (
|
||||||
|
<Card className="bg-gradient-to-r from-white to-slate-50 dark:from-slate-800 dark:to-slate-900 border-slate-200 dark:border-slate-700 shadow-lg hover:shadow-xl transition-all duration-300">
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="p-2 bg-slate-100 dark:bg-slate-700 rounded-full">
|
||||||
|
<Calendar className="h-5 w-5 text-slate-600 dark:text-slate-300" />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span className="text-slate-700 dark:text-slate-200 font-semibold text-sm capitalize">
|
||||||
|
{formatDate(now)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import { useAuthUnified } from "@/hooks/useAuthUnified";
|
|||||||
import { useIsMobile } from "@/hooks/use-mobile";
|
import { useIsMobile } from "@/hooks/use-mobile";
|
||||||
import Sidebar from "./Sidebar";
|
import Sidebar from "./Sidebar";
|
||||||
import WeatherWidget from "./WeatherWidget";
|
import WeatherWidget from "./WeatherWidget";
|
||||||
|
import DateWidget from "./DateWidget";
|
||||||
import type { Group } from "@shared/schema";
|
import type { Group } from "@shared/schema";
|
||||||
|
|
||||||
interface StoreContextType {
|
interface StoreContextType {
|
||||||
@@ -92,8 +93,11 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Weather widget */}
|
{/* Weather and Date widgets */}
|
||||||
<WeatherWidget />
|
<div className="flex items-center gap-3">
|
||||||
|
<WeatherWidget />
|
||||||
|
<DateWidget />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Store selector for admin - responsive */}
|
{/* Store selector for admin - responsive */}
|
||||||
|
|||||||
@@ -21,14 +21,7 @@ interface WeatherResponse {
|
|||||||
location: string;
|
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 WeatherIcon = ({ condition, size = 20 }: { condition: string; size?: number }) => {
|
||||||
const iconClass = `h-${Math.floor(size/4)} w-${Math.floor(size/4)}`;
|
const iconClass = `h-${Math.floor(size/4)} w-${Math.floor(size/4)}`;
|
||||||
@@ -128,9 +121,6 @@ export default function WeatherWidget() {
|
|||||||
<span className="text-xs text-slate-500 dark:text-slate-400">
|
<span className="text-xs text-slate-500 dark:text-slate-400">
|
||||||
{weather.currentYear?.condition || 'Inconnu'}
|
{weather.currentYear?.condition || 'Inconnu'}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-slate-400 dark:text-slate-500 mt-1">
|
|
||||||
{formatDate(new Date())}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user