Skip to content

Commit 47b8c05

Browse files
committed
Hide pcode label on area cards instead of falling back to the boundary id
City corporation zones have no pcode, so the wizard fell back to the 36-character boundary UUID, which overflowed the narrow card. Make DraggableAreaCard's pcode prop optional and only render it when present.
1 parent 366cc0e commit 47b8c05

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

truecover-app/src/components/DraggableAreaCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { CSS } from '@dnd-kit/utilities';
88
interface DraggableAreaCardProps {
99
id: string;
1010
name: string;
11-
pcode: string;
11+
pcode?: string;
1212
population?: number;
1313
}
1414

@@ -40,7 +40,7 @@ export const DraggableAreaCard: React.FC<DraggableAreaCardProps> = ({
4040
`}
4141
>
4242
<div className="text-sm font-medium text-zinc-100">{name}</div>
43-
<div className="text-xs text-zinc-400">{pcode}</div>
43+
{pcode && <div className="text-xs text-zinc-400">{pcode}</div>}
4444
{population !== undefined && population > 0 && (
4545
<div className="text-xs text-cyan-400 mt-1">
4646
Pop: {population.toLocaleString()}

truecover-app/src/components/StratifiedClusterSamplingWizard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface WorkflowProgress {
2828

2929
interface AdminBoundary {
3030
id: string;
31-
pcode: string;
31+
pcode: string | null;
3232
name: string;
3333
level: number;
3434
population: number;
@@ -471,7 +471,7 @@ export const StratifiedClusterSamplingWizard: React.FC<
471471
key={id}
472472
id={id}
473473
name={area.name}
474-
pcode={area.pcode || area.id}
474+
pcode={area.pcode || undefined}
475475
population={area.population}
476476
/>
477477
) : null;
@@ -492,7 +492,7 @@ export const StratifiedClusterSamplingWizard: React.FC<
492492
key={id}
493493
id={id}
494494
name={area.name}
495-
pcode={area.pcode || area.id}
495+
pcode={area.pcode || undefined}
496496
population={area.population}
497497
/>
498498
) : null;
@@ -513,7 +513,7 @@ export const StratifiedClusterSamplingWizard: React.FC<
513513
key={id}
514514
id={id}
515515
name={area.name}
516-
pcode={area.pcode || area.id}
516+
pcode={area.pcode || undefined}
517517
population={area.population}
518518
/>
519519
) : null;
@@ -534,7 +534,7 @@ export const StratifiedClusterSamplingWizard: React.FC<
534534
key={id}
535535
id={id}
536536
name={area.name}
537-
pcode={area.pcode || area.id}
537+
pcode={area.pcode || undefined}
538538
population={area.population}
539539
/>
540540
) : null;
@@ -549,7 +549,7 @@ export const StratifiedClusterSamplingWizard: React.FC<
549549
return area ? (
550550
<div className="p-2 bg-zinc-800 border-2 border-cyan-500 rounded shadow-xl cursor-grabbing">
551551
<div className="text-sm font-medium text-zinc-100">{area.name}</div>
552-
<div className="text-xs text-zinc-400">{area.pcode || area.id}</div>
552+
{area.pcode && <div className="text-xs text-zinc-400">{area.pcode}</div>}
553553
{area.population !== undefined && area.population > 0 && (
554554
<div className="text-xs text-cyan-400 mt-1">
555555
Pop: {area.population.toLocaleString()}

0 commit comments

Comments
 (0)