import titleImg from "@/assets/images/title-img.svg"; import PageMetadata from "@/components/containers/PageMetadata"; import { cn } from "@/utility/utils"; import dayjs from "dayjs"; import { ComponentProps, useEffect, useMemo, useState } from "react"; import { Link } from "react-router-dom"; import { icons } from "./icons"; import { useQuery } from "react-query"; import pb from "@/utility/api"; const HomePage = () => { return (
); }; const BackgroundSlideshow = () => { const { data: wallpapers } = useQuery({ queryKey: ["wallpapers"], queryFn: async () => { const items = await pb.collection("wallpapers").getFullList({ sort: "@random", expand: "artwork", }); return items.map((item) => { const artwork = item.expand?.artwork; return pb.files.getUrl(artwork, artwork?.image); }); }, }); return ( <> title {wallpapers && wallpapers?.length > 0 ? ( ) : null} ); }; type BackgroundImageProps = { src: string; }; const BackgroundImage = ({ src }: BackgroundImageProps) => { const [isLoaded, setLoaded] = useState(false); return ( <> img setTimeout(() => setLoaded(true), 100)} />
); }; const DateTime = () => { const [time, setTime] = useState(new Date()); useEffect(() => { const intv = setInterval(() => { setTime(new Date()); }, 1000); return () => { clearInterval(intv); }; }, [setTime]); const message = useMemo(() => { const hours = time.getHours(); let msg = "Day"; if (hours >= 18 && hours <= 2) { msg = "Night"; } else if (hours > 2 && hours <= 9) { msg = "Morning"; } else if (hours > 9 && hours <= 15) { msg = "Day"; } else if (hours > 15 && hours < 18) { msg = "Evening"; } return `Good ${msg}~ 💧✨`; }, [time]); return (

{message}

{dayjs(time).format("HH:mm")}

{dayjs(time).format("dddd, DD MMM YYYY")}

); }; const AppNav = ({ className }: ComponentProps<"div">) => { return (
); }; type AppNavItemProps = { title: string; icon: string; path?: string; iconClassName?: string; }; const AppNavItem = ({ title, icon, path, iconClassName }: AppNavItemProps) => { return (
{title}

{title}

); }; export default HomePage;