Conversation
There was a problem hiding this comment.
Pull request overview
This PR tweaks the map visualisation UI by (a) updating select styling in the visualisation panel, (b) adjusting hover-info table rendering, and (c) auto-defaulting locality boundaries to WMC24 when the visualisation panel is opened.
Changes:
- Default
areaSetGroupCodetoWMC24when opening the boundaries/visualisation panel (viauseChoropleth). - Apply shared “select looks like button” classes to several
SelectTriggers inVisualisationPanel. - Only render primary-value headers/cells in
AreasListwhen a non-emptyprimaryLabelexists.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/app/map/[id]/hooks/useChoropleth.ts |
Wrapes setBoundariesPanelOpen to also set a default boundary group on open. |
src/app/map/[id]/components/controls/VisualisationPanel/VisualisationPanel.tsx |
Adds shared Tailwind classes to make selects visually match buttons. |
src/app/map/[id]/components/BoundaryHoverInfo/AreasList.tsx |
Adjusts conditional rendering of primary label/value columns in the hover info table. |
Comments suppressed due to low confidence (1)
src/app/map/[id]/components/BoundaryHoverInfo/AreasList.tsx:55
- The table header is now gated on
multipleAreas && primaryLabel. WhenprimaryLabelis an empty string (e.g., beforeareaStatshas loaded) butsecondaryLabelis set, the secondary values column will render without any header label. Consider rendering the header when either label is present (and conditionally rendering eachTableHeadbased on its label).
{multipleAreas && primaryLabel && (
<TableHeader className="pointer-events-auto">
<TableRow className="border-none hover:bg-transparent uppercase font-mono">
<TableHead className="py-2 px-3 text-left h-8" />
<TableHead className="py-2 px-3 text-muted-foreground text-xs text-left h-8">
{primaryLabel}
</TableHead>
{secondaryLabel && (
<TableHead className="py-2 px-3 text-muted-foreground text-xs text-left h-8">
{secondaryLabel}
</TableHead>
)}
</TableRow>
</TableHeader>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const setBoundariesPanelOpen = useCallback( | ||
| (open: boolean) => { | ||
| if (open && !viewConfig.areaSetGroupCode) { | ||
| updateViewConfig({ areaSetGroupCode: AreaSetGroupCode.WMC24 }); | ||
| } | ||
| _setBoundariesPanelOpen(open); | ||
| }, | ||
| [_setBoundariesPanelOpen, updateViewConfig, viewConfig.areaSetGroupCode], | ||
| ); |
There was a problem hiding this comment.
setBoundariesPanelOpen(true) now updates areaSetGroupCode whenever it’s falsy. Since the map view default (and an explicit user choice via “No locality”) is null, opening the panel will always force WMC24 and makes it impossible to persist a null boundary selection across opens. Consider distinguishing between “unset” and “explicitly none” (e.g., only default when areaSetGroupCode is undefined, or gate this behavior behind an explicit user action / map type).
…defined, not null
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| const setBoundariesPanelOpen = useCallback( | ||
| (open: boolean) => { | ||
| if (open && viewConfig.areaSetGroupCode === undefined) { |
There was a problem hiding this comment.
The condition checks for undefined, but areaSetGroupCode can be both null and undefined in the codebase. When a user explicitly sets boundaries to "None" (via useBoundariesControl.tsx line 66, MapStyleSelector.tsx line 183, or VisualisationPanel.tsx line 259), the value becomes null. This means opening the boundaries panel after setting it to "None" won't trigger the default WMC24 assignment. Consider checking for both null and undefined using a falsy check like !viewConfig.areaSetGroupCode or explicitly checking for both values.
| if (open && viewConfig.areaSetGroupCode === undefined) { | |
| if (open && viewConfig.areaSetGroupCode == null) { |
No description provided.