Share your household
Invite roommates by sharing the household link.
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 (
Fair chores, happy roommates
Invite roommates by sharing the household link.