diff --git a/src/components/dashboard/dashboard-shell.tsx b/src/components/dashboard/dashboard-shell.tsx index 7fd91ed..efe5ac1 100644 --- a/src/components/dashboard/dashboard-shell.tsx +++ b/src/components/dashboard/dashboard-shell.tsx @@ -225,6 +225,7 @@ type MobileAction = type FinanceViewMode = "monthly" | "yearly" | "cutoff"; type FinancePresentation = "charts" | "table"; type DesktopSection = "overview" | "finance" | "budgetGroups" | "periods" | "users" | "logs"; +const GENERAL_DONATIONS_MOBILE_ID = "__general_donations__"; type CutoffSelectionOption = { value: string; cutoffId: string; @@ -657,6 +658,10 @@ export function DashboardShell({ }, [router, searchParams, visibleGroups]); useEffect(() => { + if (selectedMobileGroupId === GENERAL_DONATIONS_MOBILE_ID) { + return; + } + if (!visibleGroups.some((group) => group.id === selectedMobileGroupId)) { setSelectedMobileGroupId(visibleGroups[0]?.id ?? ""); } @@ -3402,8 +3407,10 @@ export function DashboardShell({ ) : null; - const selectedMobileGroup = visibleGroups.find((group) => group.id === selectedMobileGroupId) ?? visibleGroups[0] ?? null; - const overviewGroups = isCompactLayout && selectedMobileGroup ? [selectedMobileGroup] : visibleGroups; + const isMobileGeneralDonationsSelected = isCompactLayout && selectedMobileGroupId === GENERAL_DONATIONS_MOBILE_ID; + const selectedMobileGroup = + isMobileGeneralDonationsSelected ? null : visibleGroups.find((group) => group.id === selectedMobileGroupId) ?? visibleGroups[0] ?? null; + const overviewGroups = isCompactLayout ? (selectedMobileGroup ? [selectedMobileGroup] : []) : visibleGroups; const generalDonations = donations.filter((donation) => !donation.expenseId); function renderDonationEditor(donation: DashboardDonation) { @@ -3573,11 +3580,11 @@ export function DashboardShell({ const overviewContent = ( - {isCompactLayout && visibleGroups.length > 1 ? ( + {isCompactLayout ? ( { setSelectedMobileGroupId(event.target.value); setFocusedBudgetId(null); @@ -3590,6 +3597,7 @@ export function DashboardShell({ {group.name} ))} + Spenden ) : null} {isCompactLayout ? ( @@ -3608,32 +3616,32 @@ export function DashboardShell({ > {overviewGroups.map((group) => ( - - - + + + ))} - {generalDonationsColumn} + {isMobileGeneralDonationsSelected ? generalDonationsColumn : null} ) : ( @@ -3953,7 +3961,7 @@ export function DashboardShell({ return ( - + - + {message ? {message.text} : null} {periodOverviewCard}