import { useEffect, useState } from "preact/hooks"; import FloatingTileButtons from "./tiles/FloatingTileButtons.tsx"; import type { OnboardingStatus } from "../services/onboardingService.ts"; interface MemberHomeProps { onboardingStatus?: OnboardingStatus | null; } export default function MemberHome({ onboardingStatus }: MemberHomeProps) { const [spinDirection, setSpinDirection] = useState<"cw" | "ccw">("cw"); const handleLogoMouseEnter = () => { setSpinDirection(Math.random() < 0.5 ? "cw" : "ccw"); }; useEffect(() => { const lockRoute = localStorage.getItem("lock-route"); if (lockRoute) { localStorage.removeItem("lock-route"); globalThis.location.href = lockRoute; return; } const loginPurpose = localStorage.getItem("login-purpose"); if (loginPurpose) { localStorage.removeItem("login-purpose"); const destination = loginPurpose === "landlord" ? "/landlord/dashboard" : loginPurpose === "tenant" ? "/tenant/dashboard" : ""; if (destination) { globalThis.location.href = destination; } } }, []); // Sample tile data for FloatingTileButtons const tileIds = [ { id: "landlord-hub", label: "Landlord" }, { id: "tenant-hub", label: "Tenant" }, { id: "admin-center", label: "Admin" }, { id: "user-profile", label: "Profile" }, { id: "dashboard", label: "Dashboard" }, { id: "financial-calendar", label: "Financial Calendar" }, ]; const tenantOnboarded = Boolean(onboardingStatus?.onboarded_tenant); const landlordStep = onboardingStatus?.onboarding_step ?? 0; const landlordStarted = Boolean(onboardingStatus?.onboarded_landlord) || landlordStep > 0; const landlordReady = landlordStarted && landlordStep === 0; const landlordInProgress = landlordStep > 0; const landlordProgressHref = landlordStep >= 2 ? "/landlord/onboarding/property-setup" : "/landlord/onboarding/profile"; const landlordPrimary = landlordReady ? { label: "Landlord Dashboard", href: "/landlord/dashboard" } : landlordInProgress ? { label: "Continue Landlord Setup", href: landlordProgressHref } : { label: "Start Landlord Setup", href: "/onboarding#landlord" }; const tenantPrimary = tenantOnboarded ? { label: "Tenant Dashboard", href: "/tenant/dashboard" } : { label: "Start Tenant Setup", href: "/onboarding#tenant" }; return (
{/* Animated background grid */}
{/* Teal colored orbs */}
{/* Large Logo */}
Cyber Hybrid Hub Logo
{/* Main message */}

Apps available to you!

{/* Real Estate Hub */}

Landlord HQ

Launch new listings, manage leases, and track revenue.

{landlordReady ? "Onboarded" : landlordInProgress ? "In Progress" : "Not Set Up"}

Ownership Tools

Properties, applications, rent schedules.

Tenant Pipeline

Review applications and coordinate repairs.

Tenant Command

Pay rent, request maintenance, and stay in sync.

{tenantOnboarded ? "Active" : "Not Set Up"}

Payment Hub

Auto-pay options and transaction history.

Service Requests

Track repairs and chat with your landlord.

{/* App tiles container */}
{/* Admin Center Tile */}

Admin Center

Manage system settings and user permissions

{/* User Profile Tile */}

User Profile

View and edit your personal information

{/* Dashboard Tile */} {/* Financial Calendar Tile */}

Financial Calendar

See your incomes and obligations by day

{/* Glitch effect container */}

> Loading applications...

{/* Animated scanlines */}
{/* Floating Tile Buttons */}
); }