feat(frontend): use offline global birth place hierarchy

This commit is contained in:
Jesse_Chen
2026-08-30 15:18:19 +08:00
parent f9a00dc568
commit 5c1d095f69
238 changed files with 655 additions and 42 deletions
+14
View File
@@ -0,0 +1,14 @@
# World location data
`public/data/world-locations/*.json` is a generated, country-split snapshot used by the profile form. The browser loads the country index first, then loads only the selected country's region/city file. Overseas locations intentionally use cascading selection instead of free-text search.
- Source repository: `dr5hn/countries-states-cities-database`
- Release: `v3.2-export.7`
- Upstream export: `json-countries+states+cities.json.gz`
- License: ODbL-1.0
- Refresh command: `npm run data:world`
- Generated: 229 countries, 5,308 regions, 152,970 cities
The generated coordinates are administrative/city-centre coordinates. The source timezone is only a candidate. Before saving a profile, the app still resolves the historical IANA timezone and UTC offset through `/api/locations/timezone`; an unresolved timezone is not saved as a usable location.
Countries without a state/region record in this upstream export are omitted from the selectable index rather than guessed from a search result or fabricated coordinates.
File diff suppressed because one or more lines are too long
+47
View File
@@ -0,0 +1,47 @@
import source from "./world-countries.json";
export type WorldCountry = {
code: string;
name: string;
nativeName?: string;
regionCount: number;
};
export type WorldCountryIndex = {
source: {
repository: string;
release: string;
url: string;
license: string;
};
countries: WorldCountry[];
};
export type WorldCity = {
code: string;
name: string;
nativeName?: string;
latitude: number;
longitude: number;
timezone: string;
};
export type WorldRegion = {
code: string;
name: string;
nativeName?: string;
latitude: number;
longitude: number;
timezone: string;
cities: WorldCity[];
};
export type WorldCountryData = {
code: string;
name: string;
nativeName?: string;
regions: WorldRegion[];
};
export const worldCountryIndex = source as WorldCountryIndex;
export const worldCountries = worldCountryIndex.countries;