Conversation
This reverts commit bc2a989.
There was a problem hiding this comment.
Pull request overview
Reverts the previously introduced “Activity Search” frontend feature set and associated types/routes, while reworking openings search/map behaviors and related UI/styling to align with the reverted state.
Changes:
- Removed Activity Search screen, route config, table header/types, and related UI components/tests.
- Updated openings search and opening details map interactions (polygon selection, availability handling, and map layer metadata/types).
- Adjusted auth/token handling and Carbon prefix usage, plus updated some E2E tests.
Reviewed changes
Copilot reviewed 65 out of 65 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/utils/DateUtils.ts | Removes date-picker helper utilities and simplifies imports. |
| frontend/src/types/TableHeader.ts | Removes Activity table header types tied to reverted Activity Search. |
| frontend/src/types/MapLayer.ts | Extends map layer typing (adds URLs) and introduces base map type. |
| frontend/src/types/ApiType.ts | Removes Activity search params type (no longer needed). |
| frontend/src/styles/default-components.scss | Removes shared “search grid” and other styles previously added for Activity Search. |
| frontend/src/services/OpenApi/services/SearchEndpointService.ts | Removes intraAgencyNumber support from generated search client call. |
| frontend/src/screens/OpeningsSearch/styles.scss | Adds openings-search-specific grid/banner styles (moved from defaults). |
| frontend/src/screens/OpeningsSearch/index.tsx | Updates grid class usage and pagination props after revert. |
| frontend/src/screens/Openings/OpeningDetails/index.tsx | Adds “available polygon IDs” state passed to details subcomponents. |
| frontend/src/screens/ActivitySearch/styles.scss | Removes Activity Search screen styles. |
| frontend/src/screens/ActivitySearch/index.tsx | Removes Activity Search screen. |
| frontend/src/routes/index.tsx | Removes Activity Search route from protected routes. |
| frontend/src/routes/config.tsx | Removes Activity Search route config and related router imports. |
| frontend/src/hooks/usePolygonAvailability.ts | Removes polygon availability hook (previously used by Activity Search/details tables). |
| frontend/src/contexts/AuthProvider.tsx | Adjusts token persistence and adds new token helpers (currently unused). |
| frontend/src/constants/tanstackConfig.ts | Changes refresh token selection logic (access token fallback) and imports. |
| frontend/src/constants/tableConstants.ts | Removes pagination cap constant previously used for Activity Search. |
| frontend/src/constants/mapKindConstants.ts | Removes map kind constants helper (replaced by string literals). |
| frontend/src/constants/index.ts | Changes Carbon class prefix and removes shared max-length constants (moved). |
| frontend/src/components/Tags/index.tsx | Removes Activity status tag export. |
| frontend/src/components/Tags/ActivityStatusTag/index.tsx | Removes ActivityStatusTag component. |
| frontend/src/components/SpatialCheckbox/index.tsx | Simplifies SpatialCheckbox API (removes availability/tooltip wrapper behavior). |
| frontend/src/components/OpeningsSearchInput/styles.scss | Updates selectors/classes for openings search input styling. |
| frontend/src/components/OpeningsSearchInput/index.tsx | Inlines date handling and replaces ForestClientMultiSelect with local logic. |
| frontend/src/components/OpeningsSearchInput/constants.ts | Adds openings-search specific max-length constants. |
| frontend/src/components/OpeningsMapFullScreen/index.tsx | Adds a Leaflet fullscreen control component. |
| frontend/src/components/OpeningsMapFullScreen/constants.ts | Adds SVG icon constant for fullscreen control. |
| frontend/src/components/OpeningsMapEntryPopup/index.tsx | Replaces MAP_KINDS usage with string literals; import changes. |
| frontend/src/components/OpeningsMapEntry/index.tsx | Refactors feature hover/click behavior and polygon rendering. |
| frontend/src/components/OpeningsMap/index.tsx | Refactors map query/data flow and polygon availability propagation. |
| frontend/src/components/OpeningsMap/fetcher.ts | Adds query caching configuration for map polygon queries. |
| frontend/src/components/OpeningsMap/constants.ts | Adds metadata URLs to layers and introduces default base map definitions. |
| frontend/src/components/OpeningTableRow/styles.scss | Moves table-cell link wrapper styling into component-level stylesheet. |
| frontend/src/components/OpeningTableRow/index.tsx | Removes availability hook usage and updates link wrapper class. |
| frontend/src/components/OpeningDetails/OpeningSummary/index.tsx | Wires available polygon ID setters into map component. |
| frontend/src/components/OpeningDetails/OpeningStandardUnits/styles.scss | Updates Carbon class selectors for dropdown/menu styling. |
| frontend/src/components/OpeningDetails/OpeningForestCover/styles.scss | Updates Carbon class selectors and adds map header checkbox container styling. |
| frontend/src/components/OpeningDetails/OpeningForestCover/index.tsx | Reworks “select on map” logic to rely on available IDs from map results. |
| frontend/src/components/OpeningDetails/OpeningActivities/styles.scss | Adds map header checkbox container styling. |
| frontend/src/components/OpeningDetails/OpeningActivities/index.tsx | Threads available IDs into activity/disturbance accordions. |
| frontend/src/components/OpeningDetails/OpeningActivities/DisturbanceAccordion.tsx | Removes per-row availability queries; relies on available ID list. |
| frontend/src/components/OpeningDetails/OpeningActivities/ActivityAccordion.tsx | Removes per-row availability queries; relies on available ID list. |
| frontend/src/components/MapPreview/index.tsx | Adjusts Leaflet import usage for GeoJSON bounds fitting. |
| frontend/src/components/ForestClientMultiSelect/index.tsx | Removes standalone ForestClientMultiSelect component. |
| frontend/src/components/DisturbancesSearchSection/index.tsx | Removes placeholder disturbances search section. |
| frontend/src/components/CustomMultiSelect/styles.scss | Updates selector prefix used for multi-select focus styling workaround. |
| frontend/src/components/BCHeader/constants.ts | Removes “Activities” entry from the header navigation menu. |
| frontend/src/components/ActivitySearchSection/utils.ts | Removes Activity Search URL-param utilities. |
| frontend/src/components/ActivitySearchSection/styles.scss | Removes Activity Search styles. |
| frontend/src/components/ActivitySearchSection/index.tsx | Removes Activity Search section component. |
| frontend/src/components/ActivitySearchSection/constants.ts | Removes Activity Search table header defaults. |
| frontend/src/components/ActivitySearchSection/ActivitySearchTableRow.tsx | Removes Activity Search result row component. |
| frontend/src/components/ActivitySearchSection/ActivitySearchInput.tsx | Removes Activity Search filters input component. |
| frontend/src/test/components/SpatialCheckbox.test.tsx | Updates unit tests to new SpatialCheckbox props. |
| frontend/src/test/components/ActivitySearchSection/ActivitySearchTableRow.test.tsx | Removes Activity Search table row tests. |
| frontend/src/test/components/ActivitySearchSection/ActivitySearchInput.test.tsx | Removes Activity Search input tests. |
| frontend/src/test/components/ActivitySearchSection/ActivitiesSearchSection.test.tsx | Removes Activity Search section tests. |
| frontend/src/e2e/tests/top-nav.spec.ts | Adds theme toggle coverage in top nav E2E tests. |
| frontend/src/e2e/pages/top-nav-bar.ts | Updates top-nav page object to avoid CARBON_CLASS_PREFIX and adds theme actions. |
| frontend/src/e2e/pages/opening-details-page.ts | Simplifies isMapVisible() to use locator.isVisible(). |
| backend/src/test/java/ca/bc/gov/restapi/results/common/service/AbstractActivityServiceIntegrationTest.java | Updates filter DTO construction after parameter removal. |
| backend/src/main/java/ca/bc/gov/restapi/results/postgres/SilvaPostgresQueryConstants.java | Changes activity search “intraAgencyNumber” mapping and removes related filter clause. |
| backend/src/main/java/ca/bc/gov/restapi/results/oracle/SilvaOracleQueryConstants.java | Changes activity search “intraAgencyNumber” mapping and removes related filter clause. |
| backend/src/main/java/ca/bc/gov/restapi/results/common/endpoint/SearchEndpoint.java | Removes intraAgencyNumber request parameter from activity search endpoint. |
| backend/src/main/java/ca/bc/gov/restapi/results/common/dto/activity/ActivitySearchFiltersDto.java | Removes intra-agency field and updates schema annotations/constructor signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| openingIds.map((id) => ({ | ||
| queryKey: ["opening", "map", id, { kinds }], | ||
| queryFn: () => API.OpeningMapsEndpointService.getOpeningPolygonAndProperties(id.toString(), kinds.join(",")), | ||
| staleTime: THREE_HOURS, | ||
| cacheTime: THREE_HALF_HOURS, | ||
| refetchOnReconnect: false, |
There was a problem hiding this comment.
cacheTime is not a valid option in @tanstack/react-query v5 (this project depends on v5.x); it was renamed to gcTime. As-is, this should be a TypeScript error and won’t compile. Replace cacheTime with gcTime (or remove it if relying on defaults).
| import { THREE_HOURS } from "@/constants/TimeUnits"; | ||
| import { env } from "@/env"; | ||
| import { ACCESS_TOKEN_KEY } from "."; |
There was a problem hiding this comment.
env is imported but never used, which will fail linting under @typescript-eslint/no-unused-vars. Remove the import or use it (e.g., if behavior is meant to vary by environment).
| import React, { useEffect, useState, useRef } from "react"; | ||
| import { renderToString } from "react-dom/server"; | ||
| import L from "leaflet"; | ||
| import { useMapEvents, GeoJSON, Marker } from "react-leaflet"; | ||
| import { useMapEvents, Popup, GeoJSON, Marker } from "react-leaflet"; | ||
| import { Feature, FeatureCollection, Geometry } from "geojson"; | ||
| import { | ||
| getStyleForFeature, | ||
| getPropertyForFeature, | ||
| getPopupCenter, | ||
| getCenterOfFeatureCollection, | ||
| } from "@/types/MapLayer"; | ||
| import OpeningsMapEntryPopup from "@/components/OpeningsMapEntryPopup"; | ||
| import "./styles.scss"; |
There was a problem hiding this comment.
Several imports here are unused (renderToString, Popup, getPropertyForFeature, getPopupCenter, OpeningsMapEntryPopup). With @typescript-eslint/no-unused-vars enabled, this will fail linting/CI. Please remove unused imports (or add the missing usage if popup rendering was intended).
| private final List<String> openingCategories; | ||
|
|
||
| @Schema(type = "string", nullable = true) | ||
| @Schema(type = "string") |
There was a problem hiding this comment.
@Schema(type = "string") on fileId no longer marks the field as nullable, but fileId is explicitly set to null when not provided. This makes the OpenAPI schema inaccurate for clients. Set nullable = true again (or make the field non-null and default it appropriately).
| @Schema(type = "string") | |
| @Schema(type = "string", nullable = true) |
| @@ -100,6 +192,17 @@ const OpeningsSearchInput = ({ searchParams, onSearchParamsChange }: props) => { | |||
| ); | |||
| }; | |||
|
|
|||
| const getDateValue = (isStartDate: boolean) => { | |||
| const key = isStartDate ? 'updateDateStart' : 'updateDateEnd'; | |||
| if (searchParams?.[key]) { | |||
| return DateTime.fromFormat( | |||
| searchParams[key], | |||
| API_DATE_FORMAT | |||
| ).toFormat(DATE_PICKER_FORMAT); | |||
| } | |||
| return undefined; | |||
| }; | |||
There was a problem hiding this comment.
getStartMaxDate/getEndMinDate/getDateValue format dates without checking DateTime.fromFormat(...).isValid. For invalid URL/state values, Luxon will format to "Invalid DateTime", which then gets passed into Carbon DatePicker minDate/maxDate/value and can break the picker. Restore the previous validity checks and return undefined when parsing fails.
| import React from "react"; | ||
| import OpeningsMapDownloader from "@/components/OpeningsMapDownloader"; | ||
| import { MAP_KINDS } from "@/constants/mapKindConstants"; | ||
| import { silvicultureStatusCodes } from "@/constants/statusCodes"; | ||
| import { formatLocalDate } from "@/utils/DateUtils"; | ||
| import { formatDate, formatLocalDate } from "@/utils/DateUtils"; | ||
|
|
There was a problem hiding this comment.
formatDate is imported but not used in this module, which will fail @typescript-eslint/no-unused-vars in CI. Remove the unused import or use it where intended.
| const OpeningForestCover = ({ | ||
| openingId, | ||
| availableForestCoverIds, | ||
| setAvailableForestCoverIds, |
There was a problem hiding this comment.
setAvailableForestCoverIds is required in the prop type and destructured, but it’s never used in the component body. This will fail @typescript-eslint/no-unused-vars. If the setter is no longer needed, remove it from the props; otherwise, use it (or rename to _setAvailableForestCoverIds) to document intentional non-use.
| setAvailableForestCoverIds, | |
| setAvailableForestCoverIds: _setAvailableForestCoverIds, |
| export const CARBON_CLASS_PREFIX = "bx" as const; | ||
|
|
There was a problem hiding this comment.
CARBON_CLASS_PREFIX was changed to "bx", but there are still many hard-coded .cds--… selectors in the codebase (tests and SCSS). This risks breaking styling/tests unless everything is migrated consistently. Either keep the previous prefix or update remaining .cds-- selectors to use the configured prefix (or avoid hard-coding class prefixes in tests).
| const iconStyle = ` | ||
| fond-size: 22px; | ||
| `; |
There was a problem hiding this comment.
There’s a typo in the inline CSS: fond-size should be font-size, otherwise the icon sizing style won’t apply. Fixing this also makes it easier to spot real styling issues later.
| // Store initial clientNumbers on mount to prefetch only once | ||
| const initialClientNumbersRef = useRef<string[] | undefined>(undefined); | ||
| const hasLoadedInitialClientsRef = useRef(false); | ||
|
|
||
| // Capture clientNumbers on first arrival of searchParams | ||
| useEffect(() => { | ||
| if (!hasLoadedInitialClientsRef.current && searchParams?.clientNumbers && searchParams.clientNumbers.length > 0) { | ||
| initialClientNumbersRef.current = searchParams.clientNumbers; | ||
| } | ||
| }, [searchParams?.clientNumbers]); | ||
|
|
||
| // Prefetch client data when searchParams contains clientNumbers | ||
| const initialClientsQuery = useQuery({ | ||
| queryKey: ['forest-clients', 'byClientNumbers', initialClientNumbersRef.current], | ||
| queryFn: () => API.ForestClientEndpointService.searchByClientNumbers( | ||
| initialClientNumbersRef.current!, | ||
| 0, | ||
| initialClientNumbersRef.current!.length | ||
| ), | ||
| enabled: !hasLoadedInitialClientsRef.current && !!(initialClientNumbersRef.current && initialClientNumbersRef.current.length > 0), | ||
| }); |
There was a problem hiding this comment.
initialClientNumbersRef.current is updated in a useEffect, but refs don’t trigger re-renders. If searchParams.clientNumbers arrives after mount, initialClientsQuery will still see undefined and never enable/run. Use state for the initial client numbers (or set a piece of state when the ref is populated) so React Query re-evaluates enabled/queryKey when the value becomes available.
This reverts commit bc2a989.
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: