import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { json } from "@remix-run/node"; import { Outlet, useLoaderData, useNavigate } from "@remix-run/react"; import { useState, useEffect } from "react"; import { Button } from "~/components/ui/button"; import { Separator } from "~/components/ui/separator"; import { Menu, X, Facebook, Twitter, Linkedin, Instagram, Recycle, ArrowUp } from "lucide-react"; import { ModeToggle } from "~/components/ui/dark-mode-toggle"; export const meta: MetaFunction = () => { return [ { title: "Rijig - Platform Pengelolaan Sampah Terpadu" }, { name: "description", content: "Platform pengelolaan sampah terpadu yang menghubungkan masyarakat, pengepul, dan pengelola untuk ekonomi sirkular berkelanjutan" }, { name: "viewport", content: "width=device-width, initial-scale=1" } ]; }; export async function loader({ request }: LoaderFunctionArgs) { const navigationItems = [ { name: "Fitur", href: "#features" }, { name: "Tentang", href: "#about" }, { name: "Cara Kerja", href: "#work-process" }, { name: "Testimoni", href: "#testimonials" }, { name: "Kontak", href: "#support" } ]; const socialLinks = [ { name: "Facebook", icon: "facebook", href: "#" }, { name: "Twitter", icon: "twitter", href: "#" }, { name: "LinkedIn", icon: "linkedin", href: "#" }, { name: "Instagram", icon: "instagram", href: "#" } ]; const authData = { isAuthenticated: false, isRegistrationComplete: false, userRole: null as string | null }; return json({ navigationItems, socialLinks, authData }); } export default function LandingLayout() { const { navigationItems, socialLinks, authData } = useLoaderData(); const navigate = useNavigate(); const [isMenuOpen, setIsMenuOpen] = useState(false); const [isScrolled, setIsScrolled] = useState(false); const [showBackToTop, setShowBackToTop] = useState(false); const { isAuthenticated, isRegistrationComplete, userRole } = authData; useEffect(() => { const handleScroll = () => { const scrollTop = window.scrollY; setIsScrolled(scrollTop > 20); setShowBackToTop(scrollTop > 300); }; handleScroll(); window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); const scrollToTop = () => { window.scrollTo({ top: 0, behavior: "smooth" }); }; const toggleMenu = () => setIsMenuOpen(!isMenuOpen); const handleNavClick = (href: string) => { setIsMenuOpen(false); if (href.startsWith("#")) { const element = document.querySelector(href); if (element) { element.scrollIntoView({ behavior: "smooth" }); } } }; const getRedirectPath = () => { if (userRole === "administrator") { return "/sys-rijig-adminpanel/dashboard"; } return "/pengelola/dashboard"; }; const handleGetStarted = () => { if (isAuthenticated && isRegistrationComplete) { const dashboardPath = userRole === "administrator" ? "/sys-rijig-adminpanel/dashboard" : "/pengelola/dashboard"; navigate(dashboardPath); } else if (isAuthenticated && !isRegistrationComplete) { const redirectPath = getRedirectPath(); navigate(redirectPath); } else { navigate("/pengelola/register"); } }; const handleAdminLogin = () => { navigate("/sys-rijig-adminpanel/login"); }; const getButtonText = () => { if (isAuthenticated && isRegistrationComplete) { return "Go to Dashboard"; } return "Get Started"; }; return (
{/* Header dengan glassmorphism effect */}
{/* Logo */}
Rijig
{/* Mobile Menu Button */} {/* Desktop Navigation - Centered */} {/* Right Side Actions */}
{/* Mobile Menu */}
{/* Main Content */}
{/* Back to Top Button */} {/* Footer */}
); }