-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show flags next to earthquake data sources
- Loading branch information
1 parent
ae5790f
commit e81a8b5
Showing
3 changed files
with
67 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const getFlagByCountry = (countryCode: string) => { | ||
if (!countryCode || countryCode.length !== 2 || !/^[a-zA-Z]+$/.test(countryCode)) { | ||
return "🏳️"; | ||
} | ||
|
||
const code = countryCode.toUpperCase(); | ||
const offset = 127397; | ||
const flag = Array.from(code) | ||
.map((letter) => String.fromCodePoint(letter.charCodeAt(0) + offset)) | ||
.join(""); | ||
|
||
return flag; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
{ | ||
"time": "1970-01-01T23:59:59Z", | ||
"time": "2024-09-05T19:26:27Z", | ||
"status": 200, | ||
"error": false, | ||
"path": "/api/v1/trace", | ||
"message": "Successfully read available data source list", | ||
"message": "Successfully read available data source properties", | ||
"data": [ | ||
{ | ||
"name": "null", | ||
"value": "null" | ||
"id": "hko", | ||
"country": "HK", | ||
"default": "en-US", | ||
"locales": { | ||
"en-US": "Hong Kong Observatory", | ||
"zh-TW": "天文台全球地震資訊網", | ||
"zh-CN": "天文台全球地震信息网" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters