import { useEffect, useMemo, useState } from 'react'; import { Dashboard } from './components/Dashboard.jsx'; import { RoommateManager } from './components/RoommateManager.jsx'; import { ChoreManager } from './components/ChoreManager.jsx'; import { RotationHistory } from './components/RotationHistory.jsx'; function App() { const [activeTab, setActiveTab] = useState('dashboard'); const [shareStatus, setShareStatus] = useState(''); const tabs = [ { id: 'dashboard', label: '๐Ÿ“‹ This Week', icon: '๐Ÿ“‹' }, { id: 'roommates', label: '๐Ÿ‘ฅ Roommates', icon: '๐Ÿ‘ฅ' }, { id: 'chores', label: '๐Ÿงน Chores', icon: '๐Ÿงน' }, { id: 'history', label: '๐Ÿ“Š History', icon: '๐Ÿ“Š' }, ]; const householdShareLink = useMemo(() => { if (typeof window === 'undefined') return ''; return window.location.href; }, []); useEffect(() => { if (!shareStatus) return undefined; const timer = setTimeout(() => setShareStatus(''), 2500); return () => clearTimeout(timer); }, [shareStatus]); const handleShareHousehold = async () => { const url = householdShareLink || window.location.href; const shareData = { title: 'Join my ChoreWheel household', text: 'Use this link to access our household chore rotation.', url, }; try { if (navigator.share) { await navigator.share(shareData); setShareStatus('Shared successfully'); return; } if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(url); setShareStatus('Household link copied'); return; } const fallbackInput = document.createElement('input'); fallbackInput.value = url; document.body.appendChild(fallbackInput); fallbackInput.select(); document.execCommand('copy'); document.body.removeChild(fallbackInput); setShareStatus('Household link copied'); } catch (error) { setShareStatus('Could not share link'); } }; return (

ChoreWheel

Fair chores, happy roommates

Share your household

Invite roommates by sharing the household link.

{shareStatus ? {shareStatus} : null}
{activeTab === 'dashboard' && } {activeTab === 'roommates' && } {activeTab === 'chores' && } {activeTab === 'history' && }
); } ReactDOM.createRoot(document.getElementById("root")).render();