Expense tabs: use TabText with per-tab badge counts #25

Closed
opened 2026-06-28 13:41:19 +00:00 by admin · 0 comments
Owner

Enhancement

The Expenses screen has two tabs (Expenses, Recurring) but renders them with plain Text, no badge.

Current codeapp/src/main/java/dev/achmad/ledgerr/ui/screens/expenses/ExpenseListScreen.kt:166-181

PrimaryTabRow(selectedTabIndex = selectedTab) {
    listOf(
        stringResource(R.string.expense_list_tab_expenses),
        stringResource(R.string.expense_list_tab_recurring),
    ).forEachIndexed { index, title ->
        Tab(
            selected = selectedTab == index,
            onClick = {  },
            text = { Text(text = title) },
        )
    }
}

Expected behavior

Use the shared TabText composable in app/src/main/java/dev/achmad/ledgerr/ui/components/TabText.kt:13, which accepts a badgeCount: Int? and renders a small pill next to the label.

  • Expenses tab — badgeCount = current size of the (already filtered) expenses list.
  • Recurring tab — badgeCount = current size of the recurring list.

The counts must reflect the post-search / post-filter result, not the raw table size. (When a search query or date-range filter is active, the Expenses badge should show the number of items actually visible after filtering.)

Acceptance criteria

  • Each tab renders via TabText(title, badgeCount = …).
  • Counts update reactively as expenses/recurring are added, deleted, or filtered.
  • Counts ignore the search/dialog state on the other tab (only filter the count for its own list).
**Enhancement** The Expenses screen has two tabs (Expenses, Recurring) but renders them with plain `Text`, no badge. **Current code** — `app/src/main/java/dev/achmad/ledgerr/ui/screens/expenses/ExpenseListScreen.kt:166-181` ```kotlin PrimaryTabRow(selectedTabIndex = selectedTab) { listOf( stringResource(R.string.expense_list_tab_expenses), stringResource(R.string.expense_list_tab_recurring), ).forEachIndexed { index, title -> Tab( selected = selectedTab == index, onClick = { … }, text = { Text(text = title) }, ) } } ``` **Expected behavior** Use the shared `TabText` composable in `app/src/main/java/dev/achmad/ledgerr/ui/components/TabText.kt:13`, which accepts a `badgeCount: Int?` and renders a small pill next to the label. - **Expenses** tab — `badgeCount` = current size of the (already filtered) `expenses` list. - **Recurring** tab — `badgeCount` = current size of the `recurring` list. The counts must reflect the post-search / post-filter result, not the raw table size. (When a search query or date-range filter is active, the Expenses badge should show the number of items actually visible after filtering.) **Acceptance criteria** - Each tab renders via `TabText(title, badgeCount = …)`. - Counts update reactively as expenses/recurring are added, deleted, or filtered. - Counts ignore the search/dialog state on the *other* tab (only filter the count for its own list).
admin closed this issue 2026-06-28 14:33:43 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/ledgerr#25