diff --git a/client/src/components/Planner/PlacesSidebarHeader.tsx b/client/src/components/Planner/PlacesSidebarHeader.tsx index 9702fcabe..70d18fd78 100644 --- a/client/src/components/Planner/PlacesSidebarHeader.tsx +++ b/client/src/components/Planner/PlacesSidebarHeader.tsx @@ -9,7 +9,7 @@ import { tintOf } from './planParts' import { CategoryTile } from './PlacesBulkCategoryModal' import type { PlacesFilter, SidebarState } from './usePlacesSidebar' import { PLACES_SORTS, type PlacesSort } from './placesSort' -import { RATING_FLOORS } from '../../utils/placesFilter' +import { RATING_FLOORS, UNCATEGORIZED } from '../../utils/placesFilter' /** * Below this the two labels stop fitting side by side and both buttons fall back @@ -259,7 +259,7 @@ function CategoryFilter(S: SidebarState) { let label = t('places.allCategories') if (categoryFilters.size === 1) { const only = categories.find(c => categoryFilters.has(String(c.id))) - if (categoryFilters.has('uncategorized')) label = t('places.noCategory') + if (categoryFilters.has(UNCATEGORIZED)) label = t('places.noCategory') else if (only) label = only.name } else if (categoryFilters.size > 1) { label = `${categoryFilters.size} ${t('places.categoriesSelected')}` @@ -278,8 +278,8 @@ function CategoryFilter(S: SidebarState) { ))} {places.some(p => p.category_id == null) && ( toggleCategoryFilter('uncategorized')} + on={categoryFilters.has(UNCATEGORIZED)} + onClick={() => toggleCategoryFilter(UNCATEGORIZED)} tile={} label={t('places.noCategory')} /> diff --git a/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts b/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts index 52a6dc005..f6607f302 100644 --- a/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts +++ b/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts @@ -1,8 +1,9 @@ import { describe, it, expect } from 'vitest' import { - filterPool, firstPlannedDayNumbers, matchesCategoryFilter, matchesSearch, + filterPool, firstPlannedDayNumbers, matchesSearch, plannedPlaceIds, poolCounts, } from './placesBrowserModel' +import { matchesCategoryFilter } from '../../../../utils/placesFilter' import type { AssignmentsMap, Day, Place } from '../../../../types' const mkPlace = (id: number, over: Partial = {}): Place => diff --git a/client/src/mobile/screens/trip/places/placesBrowserModel.ts b/client/src/mobile/screens/trip/places/placesBrowserModel.ts index 851f0fe0f..000e334b9 100644 --- a/client/src/mobile/screens/trip/places/placesBrowserModel.ts +++ b/client/src/mobile/screens/trip/places/placesBrowserModel.ts @@ -17,9 +17,6 @@ import { * there. */ -/** Kept under this name for the browser's callers; the predicate itself lives in utils/placesFilter. */ -export { matchesCategoryFilter } - export function plannedPlaceIds( assignments: AssignmentsMap, accommodations: PlannedAccommodation[] = [], diff --git a/shared/src/i18n/en/places.ts b/shared/src/i18n/en/places.ts index 33241eb1d..188eea970 100644 --- a/shared/src/i18n/en/places.ts +++ b/shared/src/i18n/en/places.ts @@ -61,10 +61,12 @@ const places: TranslationStrings = { 'places.sortUpdated': 'Recently changed', 'places.filterByLocation': 'Filter by country or region', 'places.allLocations': 'All countries', - /** The button that opens the filter panel, and the panel's name. */ /** Label over the all/unplanned/planned/tracks choice in the filter panel. */ 'places.filterShow': 'Show', - /** The phone map's button that opens the places filter sheet, and the sheet's title. */ + /** + * The button that opens the places filter panel, and the panel's name: the phone + * map's control and the title of its sheet, and the phone places list's panel button. + */ 'places.filters': 'Filters', 'places.clearSearch': 'Clear search', 'places.yourRating': 'Your rating',