feat: proper gramatical naming for news sources

This commit is contained in:
Jones8683
2025-08-19 12:24:03 +09:30
parent 3ca5a49769
commit 08586781ce
2 changed files with 32 additions and 16 deletions
+12 -11
View File
@@ -183,18 +183,19 @@
props: { props: {
state: $settingsState.newsSource, state: $settingsState.newsSource,
onChange: (value: string) => settingsState.newsSource = value, onChange: (value: string) => settingsState.newsSource = value,
options: [ options: [
{ value: "australia", label: "Australia" }, { value: "australia", label: "Australia" },
{ value: "usa", label: "USA" }, { value: "usa", label: "USA" },
{ value: "taiwan", label: "Taiwan" }, { value: "uk", label: "UK" },
{ value: "hong_kong", label: "Hong Kong" }, { value: "taiwan", label: "Taiwan" },
{ value: "panama", label: "Panama" }, { value: "hong_kong", label: "Hong Kong" },
{ value: "canada", label: "Canada" }, { value: "panama", label: "Panama" },
{ value: "singapore", label: "Singapore" }, { value: "canada", label: "Canada" },
{ value: "uk", label: "UK" }, { value: "singapore", label: "Singapore" },
{ value: "japan", label: "Japan" }, { value: "japan", label: "Japan" },
{ value: "netherlands", label: "Netherlands" } { value: "netherlands", label: "Netherlands" }
] ]
} }
} }
] as option} ] as option}
+20 -5
View File
@@ -18,12 +18,27 @@ export async function SendNewsPage() {
const main = document.getElementById("main"); const main = document.getElementById("main");
main!.innerHTML = ""; main!.innerHTML = "";
const displayCountry = (() => {
switch (settingsState.newsSource?.toLowerCase()) {
case "usa": return "the USA";
case "uk": return "the UK";
case "netherlands": return "the Netherlands";
default:
return settingsState.newsSource
? settingsState.newsSource
.split("_")
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ")
: "Australia";
}
})();
const html = stringToHTML(/* html */ ` const html = stringToHTML(/* html */ `
<div class="home-root"> <div class="home-root">
<div class="home-container" id="news-container"> <div class="home-container" id="news-container">
<h1 class="border">Latest Headlines in ${settingsState.newsSource ? settingsState.newsSource.charAt(0).toUpperCase() + settingsState.newsSource.slice(1) : "Australia"}</h1> <h1 class="border">Latest Headlines in ${displayCountry}</h1>
</div> </div>
</div>`); </div>`);
main!.append(html.firstChild!); main!.append(html.firstChild!);