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 (
Launch new listings, manage leases, and track revenue.
Ownership Tools
Properties, applications, rent schedules.
Tenant Pipeline
Review applications and coordinate repairs.
Pay rent, request maintenance, and stay in sync.
Payment Hub
Auto-pay options and transaction history.
Service Requests
Track repairs and chat with your landlord.
Manage system settings and user permissions
View and edit your personal information
See your incomes and obligations by day
> Loading applications...