Skip to content

Commit 2a3529a

Browse files
authored
Load source geography name (state / town name) for top bar (#418)
1 parent 583eff7 commit 2a3529a

5 files changed

Lines changed: 5 additions & 6 deletions

File tree

app/src/app/components/Topbar/MapHeader.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ export const MapHeader: React.FC = () => {
1212
const mapDocument = useMapStore(state => state.mapDocument);
1313
const mapMetadata = useMapMetadata(mapDocument?.document_id);
1414

15-
const mapTableName = useMapStore(
16-
state =>
17-
state.userMaps.find(userMap => userMap.document_id === state.mapDocument?.document_id)
18-
?.name ?? ''
19-
);
2015
const handleMetadataChange = async (updates: Partial<DocumentMetadata>) => {
2116
await saveMap({
2217
...(mapMetadata || DEFAULT_MAP_METADATA),
@@ -37,7 +32,7 @@ export const MapHeader: React.FC = () => {
3732
handleMetadataChange={handleMetadataChange}
3833
/>
3934
<Text size="2" className="text-gray-500">
40-
{mapTableName || ''}
35+
{mapDocument?.map_module || ''}
4136
</Text>
4237
</Flex>
4338
);

app/src/app/utils/api/apiHandlers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface DocumentObject extends StatusObject {
5353
child_layer: string | null;
5454
tiles_s3_path: string | null;
5555
num_districts: number | null;
56+
map_module: string | null;
5657
created_at: string;
5758
updated_at: string | null;
5859
extent: [number, number, number, number]; // [minx, miny, maxx, maxy]

backend/app/core/dependencies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def get_document_public(
9696
DistrictrMap.parent_layer.label("parent_layer"), # pyright: ignore
9797
DistrictrMap.child_layer.label("child_layer"), # pyright: ignore
9898
DistrictrMap.tiles_s3_path.label("tiles_s3_path"), # pyright: ignore
99+
DistrictrMap.name.label("map_module"), # pyright: ignore
99100
DistrictrMap.num_districts.label("num_districts"), # pyright: ignore
100101
DistrictrMap.extent.label("extent"), # pyright: ignore
101102
DistrictrMap.map_type.label("map_type"), # pyright: ignore

backend/app/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ async def create_document(
259259
DistrictrMap.parent_layer.label("parent_layer"), # pyright: ignore
260260
DistrictrMap.child_layer.label("child_layer"), # pyright: ignore
261261
DistrictrMap.tiles_s3_path.label("tiles_s3_path"), # pyright: ignore
262+
DistrictrMap.name.label("map_module"), # pyright: ignore
262263
DistrictrMap.num_districts.label("num_districts"), # pyright: ignore
263264
DistrictrMap.extent.label("extent"), # pyright: ignore
264265
DistrictrMap.map_type.label("map_type"), # pyright: ignore

backend/app/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class DocumentPublic(BaseModel):
196196
access: DocumentShareStatus = DocumentShareStatus.edit
197197
color_scheme: list[str] | None = None
198198
map_type: str
199+
map_module: str | None = None
199200

200201

201202
class DocumentCreatePublic(DocumentPublic):

0 commit comments

Comments
 (0)