'use client'
import LottieReact from "@lottielab/lottie-player/react";
import {cn} from "@/lib/utils";
import {Clock4, LucideIcon} from "lucide-react";
import {DateFormatter} from "@/lib/date";
import Image from "next/image";
// Follow WMO weather interpretation codes.
interface SpriteTitleProps {
title?: string;
icon?: LucideIcon
}
function SpriteTitle(props: SpriteTitleProps) {
const Icon = props.icon || Clock4;
const title = props.title || new DateFormatter().generateFormattedDate(new Date(), { formatTemplate: "PPP", locale: "fr" })
return (
{title}
)
}
type SpriteIndicatorProps = {
type : "slippery" | "snow-covered" | "strong-wind"
className?: string
}
function SpriteIndicator(props: SpriteIndicatorProps) {
switch (props.type) {
case "slippery":
return (
)
}
}
interface WeatherSpriteProps {
weather: number;
title?: string;
indicator?: SpriteIndicatorProps
className?: string;
danger?: boolean;
}
export default function WeatherSprite(props: WeatherSpriteProps) {
const wmo = new Map([
[0, "clear.json"],
[1, "partial_cloud.json"],
[2, "partial_cloud.json"],
[3, "cloud.json"],
[45, "foggy.json"],
[48, "fog.json"],
])
const displayWmo = new Map([
[0, "Ciel clair"],
[1, "Principalement clair"],
[2, "Partiellement nuageux"],
[3, "Partiellement couvert"],
[45, "Brouillard"],
[48, "Brouillard givrant"],
])
return (
{props.title &&
}
{
props.indicator &&
}
{displayWmo.get(props.weather)}
)
}