feat(nav): surface Data in the primary app menu (IMP-IA-01)
Import/export/backups (/data) was only reachable from the account overflow dropdown + command palette — buried for how central it is. Move it into the main Tracker nav menu alongside Bills/Categories/Spending/… so it appears in both the desktop dropdown and the mobile nav. Preserves the existing gate: Data stays hidden for the default-admin account (new `accountToolsOnly` flag on the nav item, filtered by the same `!user.is_default_admin` check the account dropdown used). Removed the now -redundant account-dropdown entry; command palette entry unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
54484ec8a0
commit
0b1c6a8322
|
|
@ -46,6 +46,7 @@ const trackerItems = [
|
||||||
{ to: '/bank-transactions', icon: Landmark, label: 'Banking', simplefinOnly: true },
|
{ to: '/bank-transactions', icon: Landmark, label: 'Banking', simplefinOnly: true },
|
||||||
{ to: '/snowball', icon: TrendingDown, label: 'Snowball' },
|
{ to: '/snowball', icon: TrendingDown, label: 'Snowball' },
|
||||||
{ to: '/payoff', icon: Calculator, label: 'Payoff' },
|
{ to: '/payoff', icon: Calculator, label: 'Payoff' },
|
||||||
|
{ to: '/data', icon: Database, label: 'Data', accountToolsOnly: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
function TrackerMenu({ onNavigate, badge, badgeNames = [], items = trackerItems }) {
|
function TrackerMenu({ onNavigate, badge, badgeNames = [], items = trackerItems }) {
|
||||||
|
|
@ -164,10 +165,6 @@ function UserMenu({ adminMode = false }) {
|
||||||
<Settings className="h-4 w-4" />
|
<Settings className="h-4 w-4" />
|
||||||
Settings
|
Settings
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onSelect={() => navigate('/data')}>
|
|
||||||
<Database className="h-4 w-4" />
|
|
||||||
Data
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
@ -199,9 +196,13 @@ export default function Sidebar({ adminMode = false }) {
|
||||||
const { data: overdueData } = useOverdueCount();
|
const { data: overdueData } = useOverdueCount();
|
||||||
const overdueCount = (!adminMode && overdueData?.count) ? overdueData.count : 0;
|
const overdueCount = (!adminMode && overdueData?.count) ? overdueData.count : 0;
|
||||||
const overdueNames = (!adminMode && overdueData?.names) ? overdueData.names : [];
|
const overdueNames = (!adminMode && overdueData?.names) ? overdueData.names : [];
|
||||||
|
const accountToolsAllowed = !user?.is_default_admin;
|
||||||
const trackerMenuItems = useMemo(
|
const trackerMenuItems = useMemo(
|
||||||
() => trackerItems.filter(item => !item.simplefinOnly || simplefinReady),
|
() => trackerItems.filter(item => (
|
||||||
[simplefinReady],
|
(!item.simplefinOnly || simplefinReady)
|
||||||
|
&& (!item.accountToolsOnly || accountToolsAllowed)
|
||||||
|
)),
|
||||||
|
[simplefinReady, accountToolsAllowed],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue