From e6f47034bc463790cc80cf2b4c097a62a1da6cd2 Mon Sep 17 00:00:00 2001 From: Wally Hackenslacker Date: Mon, 16 Mar 2026 16:03:47 -0400 Subject: [PATCH] fix: align select-all behavior and board-detail docs with filters --- AGENTS.md | 16 ++++++++++------ .../app/boarddetail/BoardDetailViewModel.kt | 2 +- app/src/main/res/values/strings.xml | 4 ++-- .../app/boarddetail/BoardDetailViewModelTest.kt | 12 ++++++++++++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index fd554b1..707c2eb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -97,12 +97,16 @@ Kanbn4Droid is an unofficial app to connect to and manipulate data stored in sel - Pressing "Delete" in the modal dialog MUST show a second confirmation modal asking if the user is sure, with buttons for "Cancel" and "I'm sure". - Only on pressing "I'm sure" in the second confirmation modal dialog should a board delete request be sent to the API. - Long-pressing any of the buttons must show a tooltip with the button name. -- The view has a floating + button that shows a modal dialog that allows creating a new card using the Kan.bn API. - - The new card is added to the top of the currently shown list. - - The modal dialog has a field for the card's name. This field is mandatory - - Below the card name field there is a markdown-enabled text area for an optional card description. - - Below the card description field there is an optional date field to set the card's due date. - - Below the card's due date field there is an optional multi-value selector that allows choosing the card's tags from the tags available for the current board. +- The view has a floating + button that allows choosing between two options: "Add new list", "Add new card" + - The Add new list option shows a modal dialog that asks for a list title. The modal dialog has two buttons at the bottom for "Cancel" and "Create" + - The list is created using the Kan.bn API. + - The new list is added at the end of the lists in the current board after the current last list. + - The Add new card option shows a modal dialog for creating a new card using the Kan.bn API. + - The new card is added to the top of the currently shown list. + - The modal dialog has a field for the card's name. This field is mandatory + - Below the card name field there is a markdown-enabled text area for an optional card description. + - Below the card description field there is an optional date field to set the card's due date. + - Below the card's due date field there is an optional multi-value selector that allows choosing the card's tags from the tags available for the current board. - The title bar of the view has two icon-only buttons for "Filter by tag" (icon is three bars of decreasing width, widest on top) and "Search" (icon is a leaning looking glass) - The filter by tag button opens a modal dialog that shows a multi-value selector that allows choosing from the tags available on the current board. The modal has a title that says "Filter by tag". The modal has buttons for "Cancel" and "Filter". - The search button a modal dialog that shows a text field that has the placeholder value "Search". The modal has a title that seas "Search by title". The modal has buttons for "Cancel" and "Search". diff --git a/app/src/main/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModel.kt b/app/src/main/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModel.kt index 5bb8dbd..52bdb2b 100644 --- a/app/src/main/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModel.kt +++ b/app/src/main/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModel.kt @@ -148,7 +148,7 @@ class BoardDetailViewModel( fun selectAllOnCurrentPage() { val current = _uiState.value - val pageCards = current.boardDetail + val pageCards = current.filteredBoardDetail ?.lists ?.getOrNull(current.currentPageIndex) ?.cards diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index caf8074..6146bf1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -66,6 +66,6 @@ Due date Clear date Tags - Tag selector will be wired in the next task. - Tag selector will be wired in the next task. + Select one or more tags. + Select tags to include. diff --git a/app/src/test/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModelTest.kt b/app/src/test/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModelTest.kt index a7f1687..b1893e6 100644 --- a/app/src/test/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModelTest.kt +++ b/app/src/test/java/space/hackenslacker/kanbn4droid/app/boarddetail/BoardDetailViewModelTest.kt @@ -51,6 +51,18 @@ class BoardDetailViewModelTest { assertEquals(setOf("card-1", "card-2", "card-3"), viewModel.uiState.value.selectedCardIds) } + @Test + fun selectAllWithActiveFilter_selectsOnlyVisibleCardsOnCurrentPage() = runTest { + val viewModel = newLoadedViewModel(this, FakeBoardDetailDataSource(), detailWithFilterFixture()) + + viewModel.openFilterDialog() + viewModel.updatePendingTagFilterIds(setOf("tag-b")) + viewModel.applyFilterDialog() + viewModel.selectAllOnCurrentPage() + + assertEquals(setOf("card-2"), viewModel.uiState.value.selectedCardIds) + } + @Test fun backPressWithSelection_clearsSelectionAndReturnsTrue() = runTest { val viewModel = newLoadedViewModel(this, FakeBoardDetailDataSource(), detailWithTwoLists())