Files
dashboard-icons/web/src/components/license-notice.tsx
Thomas Camlong bfe293f090 feat: Add website (#1157)
Co-authored-by: Bjorn Lammers <bjorn@lammers.media>
2025-04-16 16:18:20 +02:00

76 lines
2.0 KiB
TypeScript

"use client"
import { Button } from "@/components/ui/button"
import { REPO_PATH } from "@/constants"
import { AnimatePresence, motion } from "framer-motion"
import { X } from "lucide-react"
import Link from "next/link"
import { useEffect, useState } from "react"
const LOCAL_STORAGE_KEY = "licenseNoticeDismissed"
export function LicenseNotice() {
const [isVisible, setIsVisible] = useState(false)
useEffect(() => {
// Check local storage only on the client side
const dismissed = localStorage.getItem(LOCAL_STORAGE_KEY)
if (!dismissed) {
setIsVisible(true)
}
}, [])
const handleDismiss = () => {
localStorage.setItem(LOCAL_STORAGE_KEY, "true")
setIsVisible(false)
}
return (
<AnimatePresence>
{isVisible && (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 20 }}
transition={{ duration: 0.3 }}
className="fixed bottom-4 right-4 z-50 max-w-sm rounded-lg border bg-card p-4 text-card-foreground shadow-lg"
>
<div className="flex items-start justify-between">
<div className="text-xs text-muted-foreground space-y-1">
<p>
Unless otherwise indicated, all images and assets are the property of their respective owners and used for identification
purposes only.
</p>
<p>
Read the{" "}
<Link
href={`${REPO_PATH}/blob/main/LICENSE`}
className="underline hover:text-foreground"
target="_blank"
rel="noopener noreferrer"
>
LICENSE
</Link>{" "}
or{" "}
<a href="mailto:homarr-labs@proton.me" className="underline hover:text-foreground">
contact us
</a>
.
</p>
</div>
<Button
variant="ghost"
size="sm"
className="-mr-2 -mt-2 h-6 w-6 p-0"
onClick={handleDismiss}
aria-label="Dismiss license notice"
>
<X className="h-4 w-4" />
</Button>
</div>
</motion.div>
)}
</AnimatePresence>
)
}