From c6fcc3810a9c8169a673bcf20f14ac1fb39a7598 Mon Sep 17 00:00:00 2001 From: Tom Owers Date: Mon, 20 Jul 2026 17:17:37 +0100 Subject: [PATCH] feat(mobile): add "Any" option to inbox Source and Priority filters Ports #3493 to the mobile filter sheet. Adds an "Any" row at the top of the Source and Priority sections that reads as selected when the filter is empty and clears the filter back to empty when tapped. Source clears via a new clearSourceProductFilter store action; Priority reuses setPriorityFilter([]). Generated-By: PostHog Code Task-Id: be78b0df-c31b-4e0e-8d37-feaf22a054d0 --- .../src/features/inbox/components/FilterSheet.tsx | 14 ++++++++++++++ .../inbox/stores/inboxFilterStore.test.ts | 15 +++++++++++++++ .../src/features/inbox/stores/inboxFilterStore.ts | 2 ++ 3 files changed, 31 insertions(+) diff --git a/apps/mobile/src/features/inbox/components/FilterSheet.tsx b/apps/mobile/src/features/inbox/components/FilterSheet.tsx index 5243c67648..83163b2547 100644 --- a/apps/mobile/src/features/inbox/components/FilterSheet.tsx +++ b/apps/mobile/src/features/inbox/components/FilterSheet.tsx @@ -126,8 +126,12 @@ export function FilterSheet({ visible, onClose }: FilterSheetProps) { const toggleStatus = useInboxFilterStore((s) => s.toggleStatus); const sourceProductFilter = useInboxFilterStore((s) => s.sourceProductFilter); const toggleSourceProduct = useInboxFilterStore((s) => s.toggleSourceProduct); + const clearSourceProductFilter = useInboxFilterStore( + (s) => s.clearSourceProductFilter, + ); const priorityFilter = useInboxFilterStore((s) => s.priorityFilter); const togglePriority = useInboxFilterStore((s) => s.togglePriority); + const setPriorityFilter = useInboxFilterStore((s) => s.setPriorityFilter); const resetFilters = useInboxFilterStore((s) => s.resetFilters); const hasActiveFilters = @@ -213,6 +217,11 @@ export function FilterSheet({ visible, onClose }: FilterSheetProps) { {/* Priority */} + setPriorityFilter([])} + /> {FILTERABLE_PRIORITIES.map((priority) => ( + {SOURCE_PRODUCT_OPTIONS.map((option) => ( { expect(useInboxFilterStore.getState().sourceProductFilter).toEqual([]); }, ); + + it("clears the source filter", () => { + const { toggleSourceProduct, clearSourceProductFilter } = + useInboxFilterStore.getState(); + + toggleSourceProduct("github"); + toggleSourceProduct("linear"); + expect(useInboxFilterStore.getState().sourceProductFilter).toEqual([ + "github", + "linear", + ]); + + clearSourceProductFilter(); + expect(useInboxFilterStore.getState().sourceProductFilter).toEqual([]); + }); }); const INITIAL_STATE = useInboxFilterStore.getState(); diff --git a/apps/mobile/src/features/inbox/stores/inboxFilterStore.ts b/apps/mobile/src/features/inbox/stores/inboxFilterStore.ts index ea363b4e42..ab97b29525 100644 --- a/apps/mobile/src/features/inbox/stores/inboxFilterStore.ts +++ b/apps/mobile/src/features/inbox/stores/inboxFilterStore.ts @@ -47,6 +47,7 @@ interface InboxFilterActions { setStatusFilter: (statuses: SignalReportStatus[]) => void; toggleStatus: (status: SignalReportStatus) => void; toggleSourceProduct: (source: SourceProduct) => void; + clearSourceProductFilter: () => void; toggleSuggestedReviewer: (reviewerUuid: string) => void; setSuggestedReviewerFilter: (reviewerUuids: string[]) => void; togglePriority: (priority: SignalReportPriority) => void; @@ -85,6 +86,7 @@ export const useInboxFilterStore = create()( : [...current, source]; return { sourceProductFilter: next }; }), + clearSourceProductFilter: () => set({ sourceProductFilter: [] }), toggleSuggestedReviewer: (reviewerUuid) => set((state) => { const current = state.suggestedReviewerFilter;