Update sorting options in home page and improve i18n translations

This commit is contained in:
2025-05-25 11:51:33 +08:00
parent b12ca4ce91
commit 0db2502732
2 changed files with 31 additions and 28 deletions

View File

@@ -158,6 +158,13 @@ export const i18nData = {
"Set the description of the tag.": "Set the description of the tag.", "Set the description of the tag.": "Set the description of the tag.",
"Use markdown format.": "Use markdown format.", "Use markdown format.": "Use markdown format.",
"Tag: ": "Tag: ", "Tag: ": "Tag: ",
"Select a Order": "Select a Order",
"Time Ascending": "Time Ascending",
"Time Descending": "Time Descending",
"Views Ascending": "Views Ascending",
"Views Descending": "Views Descending",
"Downloads Ascending": "Downloads Ascending",
"Downloads Descending": "Downloads Descending",
} }
}, },
"zh-CN": { "zh-CN": {
@@ -319,15 +326,13 @@ export const i18nData = {
"Set the description of the tag.": "设置标签的描述。", "Set the description of the tag.": "设置标签的描述。",
"Use markdown format.": "使用Markdown格式。", "Use markdown format.": "使用Markdown格式。",
"Tag: ": "标签: ", "Tag: ": "标签: ",
// 添加排序选项翻译
"Select a Order": "选择排序方式", "Select a Order": "选择排序方式",
"Latest": "最新", "Time Ascending": "时间升序",
"Oldest": "最早", "Time Descending": "时间降序",
"Most Viewed": "浏览最多", "Views Ascending": "浏览量升序",
"Least Viewed": "浏览最少", "Views Descending": "浏览量降序",
"Most Downloaded": "下载最多", "Downloads Ascending": "下载量升序",
"Least Downloaded": "下载最少", "Downloads Descending": "下载量降序",
} }
}, },
"zh-TW": { "zh-TW": {
@@ -489,15 +494,13 @@ export const i18nData = {
"Set the description of the tag.": "設置標籤的描述。", "Set the description of the tag.": "設置標籤的描述。",
"Use markdown format.": "使用Markdown格式。", "Use markdown format.": "使用Markdown格式。",
"Tag: ": "標籤: ", "Tag: ": "標籤: ",
// 添加排序选项翻译
"Select a Order": "選擇排序方式", "Select a Order": "選擇排序方式",
"Latest": "最新", "Time Ascending": "時間升序",
"Oldest": "最早", "Time Descending": "時間降序",
"Most Viewed": "瀏覽最多", "Views Ascending": "瀏覽量升序",
"Least Viewed": "瀏覽最少", "Views Descending": "瀏覽量降序",
"Most Downloaded": "下載最多", "Downloads Ascending": "下載量升序",
"Least Downloaded": "下載最少", "Downloads Descending": "下載量降序",
} }
} }
} }

View File

@@ -24,26 +24,26 @@ export default function HomePage() {
<select value={order} className="select w-52 select-info" onInput={(e) => { <select value={order} className="select w-52 select-info" onInput={(e) => {
const value = e.currentTarget.value; const value = e.currentTarget.value;
if (value === "0") { if (value === "0") {
setOrder(RSort.TimeDesc);
} else if (value === "1") {
setOrder(RSort.TimeAsc); setOrder(RSort.TimeAsc);
} else if (value === "1") {
setOrder(RSort.TimeDesc);
} else if (value === "2") { } else if (value === "2") {
setOrder(RSort.ViewsDesc);
} else if (value === "3") {
setOrder(RSort.ViewsAsc); setOrder(RSort.ViewsAsc);
} else if (value === "3") {
setOrder(RSort.ViewsDesc);
} else if (value === "4") { } else if (value === "4") {
setOrder(RSort.DownloadsDesc);
} else if (value === "5") {
setOrder(RSort.DownloadsAsc); setOrder(RSort.DownloadsAsc);
} else if (value === "5") {
setOrder(RSort.DownloadsDesc);
} }
}}> }}>
<option disabled>{t("Select a Order")}</option> <option disabled>{t("Select a Order")}</option>
<option value={0}>{t("Latest")}</option> <option value="0">{t("Time Ascending")}</option>
<option value={1}>{t("Oldest")}</option> <option value="1">{t("Time Descending")}</option>
<option value={2}>{t("Most Viewed")}</option> <option value="2">{t("Views Ascending")}</option>
<option value={3}>{t("Least Viewed")}</option> <option value="3">{t("Views Descending")}</option>
<option value={4}>{t("Most Downloaded")}</option> <option value="4">{t("Downloads Ascending")}</option>
<option value={5}>{t("Least Downloaded")}</option> <option value="5">{t("Downloads Descending")}</option>
</select> </select>
<span className={"flex-1"}/> <span className={"flex-1"}/>
<Button onClick={() => { <Button onClick={() => {