Repository navigation
Description
Context
Following the PWA and mobile layout migration (Issue #1726, PR #1940), the application shell replaced the legacy top navigation bar with a dedicated mobile bottom navigation bar (MobileBottomNavigation) on viewports under 768px (md). As part of this responsive redesign, GlobalHeader was updated to hidden md:flex, hiding the mobile hamburger menu toggle on small screens.
Prior to this change, mobile users accessed the navigation drawer by tapping the hamburger menu. At the bottom of that sidebar sat <AgentTankSidebar>, which displays real-time subscription usage and rate limits (e.g., Claude Code Pro/Max 5-hour session and weekly quotas, Codex session/weekly limits, Antigravity Gemini model tiers). However, when the mobile navigation was refactored into the bottom navigation bar and the expandable "More" bottom sheet, the model usage block (AgentTankSidebar) was not included in MobileBottomNavigation. Because the desktop sidebar is permanently off-canvas (-translate-x-full) on mobile viewports without any toggle button, the model usage block became completely invisible and inaccessible to mobile users.
This issue restores the Agent Tank model usage block to the mobile UI by embedding it directly into the MobileBottomNavigation "More" sheet, alongside system health and account controls, ensuring that mobile and PWA users can monitor their model capacity and rate limits on any device.
Requirements
- Surface Model Usage in Mobile UI: Embed the Agent Tank usage component into the
MobileBottomNavigation"More" bottom sheet, positioning it directly after<HealthDetails>and before the user identity/logout section. - Permission Gating: Guard the usage block so that it only renders if the user has
instance.manage_agentspermission or if the application is running in read-only demo mode (isDemoMode). This matches the backend authorization requirement (requireAgentTankUsageAccesson/api/config/agent-tank/usage) and mirrors the desktop sidebar behavior inLayout.tsx. - Demo Mode Handling: When in demo mode, suppress the manual refresh button (
allowManualRefresh={!isDemoMode}) to prevent unauthorized mutating requests while still displaying the synthetic usage feed. - Container Theming and Spacing: Add an optional
classNameprop toAgentTankSidebarPropsto allow containers like the mobile bottom sheet to supply border colors (e.g.,border-slate-100) that match the surrounding sheet theme instead of being locked toborder-gray-200. - Keyboard and Screen-Reader Accessibility: Enhance multi-metric agent rows in
AgentTankSidebarwithrole="button",tabIndex={0},aria-expanded, and keyboard handlers (Enter/Space) so mobile and desktop keyboard/screen-reader users can toggle metric breakdowns. - Export Semantic Alias: Export
AgentTankSidebarasAgentTankUsagealongside the default export so that call sites outside the desktop sidebar context can refer to the component with semantic clarity. - Graceful Degradation: Ensure that when Agent Tank is disabled, unconfigured, or unreachable, the component returns
nulland takes up 0px without rendering orphaned borders or empty cards in the More sheet. - Automated Unit Testing: Add unit test coverage in
MobileBottomNavigation.test.tsxverifying:- The usage block renders when enabled and the user possesses
instance.manage_agents. - The usage block is hidden when the user lacks
instance.manage_agents(in non-demo mode). - The usage block renders in demo mode with the manual refresh button hidden.
- Tapping an agent row with multiple metrics toggles the sub-metric breakdown display.
- The usage block renders when enabled and the user possesses
Implementation Specification
1. propr-ui/src/components/AgentTankSidebar.tsx
- Extend
AgentTankSidebarPropswith an optionalclassName?: string. - Update
AgentTankSidebar's root element to useborder-t ${className || 'border-gray-200'}to allow custom borders. - In
AgentRow, addrole="button",tabIndex={0},aria-expanded={expanded}, and anonKeyDownhandler listening forEnterandSpacewhenhasMultipleMetricsis true. - Add
export { AgentTankSidebar as AgentTankUsage };beforeexport default AgentTankSidebar;.
2. propr-ui/src/components/MobileBottomNavigation.tsx
- Import
AgentTankSidebarfrom./AgentTankSidebar. - Inside the "More" bottom sheet modal, insert
<AgentTankSidebar allowManualRefresh={!isDemoMode} className="border-slate-100" />immediately after<HealthDetails systemHealth={systemHealth} />, wrapped in the permission check(isDemoMode || userHasPermission(user, 'instance.manage_agents')).
3. propr-ui/src/components/MobileBottomNavigation.test.tsx
- Mock
../api/revertApiusing Vitest (getAgentTankUsageandrefreshAgentTank). - In
beforeEach, defaultgetAgentTankUsageto{ enabled: false }so that existing navigation tests are not impacted. - Add test cases covering permission gating, demo mode refresh suppression, and metric row expansion in the More sheet.
Acceptance Criteria
- When viewing the application on a mobile viewport (
< 768px) with Agent Tank configured, tapping "More" in the bottom navigation bar reveals the "Usage" block showing provider icons, provider names, and usage progress bars. - Clicking or tapping a provider row with multiple metrics (e.g. Claude session and weekly metrics) toggles the expanded detail view showing individual sub-metrics and reset countdowns.
- Keyboard users can focus and toggle multi-metric provider rows using
EnterorSpace. - Users without
instance.manage_agentspermission (and not in demo mode) do not see the Usage block in the More sheet. - In demo mode, the Usage block is visible, but the manual refresh button (
title="Refresh usage") is omitted. - When Agent Tank is disabled or unreachable, no empty space or orphaned divider line appears in the More sheet.
- On desktop viewports (
>= 1024px),AgentTankSidebarcontinues to render in the left sidebar as before with no regression. - Running
npm test -- src/components/MobileBottomNavigation.test.tsxpasses cleanly with all new and existing tests.
Created by ProPR AI Planner
Activity
propr-dev commentedon Sep 2, 2026
Suggested Implementation:
Implementation Approach
This implementation restores the Agent Tank model usage block to mobile users by integrating
AgentTankSidebardirectly into theMobileBottomNavigation"More" bottom sheet. The "More" sheet was established during the PWA mobile redesign as the unified mobile container for all secondary navigation and system health utilities (such asHealthDetailsand user profile actions). Embedding the usage block here ensures it is always accessible from any page on mobile with a single tap, without cluttering the primary 5-icon bottom bar or requiring a redundant secondary drawer.Alternatives Considered
Key Architectural Decisions
AgentTankSidebarrather than creating a separate mobile usage component. This avoids duplicating polling intervals, provider ranking, percentage color coding, Antigravity label formatting, and data-fetching logic.className: We add aclassNameprop toAgentTankSidebarPropsto allow the mobile sheet to specifyborder-slate-100, aligning seamlessly with the surrounding slate borders inMobileBottomNavigationwhile preserving the defaultborder-gray-200in the desktop sidebar.(isDemoMode || userHasPermission(user, 'instance.manage_agents'))andallowManualRefresh={!isDemoMode}, strictly mirroringLayout.tsxand preventing unauthorized 403 network requests against the backend.File:
propr-ui/src/components/AgentTankSidebar.tsxWhy this file: This file contains the core rendering logic for the model usage block. We need to: (1) allow the parent container to customize border styling so it matches the mobile sheet's slate palette, (2) enhance keyboard accessibility on collapsible agent rows for screen readers and keyboard navigation, and (3) export a semantic alias (
AgentTankUsage) so call sites outside the desktop sidebar can reference it intuitively.File:
propr-ui/src/components/MobileBottomNavigation.tsxWhy this file: This is the mobile navigation controller that renders the persistent bottom tab bar and the "More" bottom sheet on viewports
< md. By renderingAgentTankSidebarinside the More sheet directly beneathHealthDetails, we restore model usage observability to mobile users with appropriate permission and demo-mode guards.File:
propr-ui/src/components/MobileBottomNavigation.test.tsxWhy this file: This file tests
MobileBottomNavigation. We add unit test coverage to ensure that the usage block is properly rendered when authorized, hidden when unauthorized, rendered in demo mode without the refresh button, and expandable on mobile tap interactions.propr-dev commentedon Sep 2, 2026
🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-5.6-sol2060/gpt-5.6-sol-restore-agent-tank-model--20260902-0626-psemainissue-2060-20260902-0626-gpt-5.6-sol-pse🔍 Track Task Execution
fix(ai): Resolve issue #2060 - Restore Agent Tank Model Usage Block i…