mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 07:51:14 +00:00
feat: add release date sorting options and internationalization support
This commit is contained in:
@@ -179,6 +179,8 @@ export const i18nData = {
|
|||||||
"Views Descending": "浏览量降序",
|
"Views Descending": "浏览量降序",
|
||||||
"Downloads Ascending": "下载量升序",
|
"Downloads Ascending": "下载量升序",
|
||||||
"Downloads Descending": "下载量降序",
|
"Downloads Descending": "下载量降序",
|
||||||
|
"Release Date Ascending": "发布日期升序",
|
||||||
|
"Release Date Descending": "发布日期降序",
|
||||||
"File Url": "文件链接",
|
"File Url": "文件链接",
|
||||||
"Provide a file url for the server to download, and the file will be moved to the selected storage.":
|
"Provide a file url for the server to download, and the file will be moved to the selected storage.":
|
||||||
"提供一个文件链接供服务器下载,文件将被移动到选定的存储中。",
|
"提供一个文件链接供服务器下载,文件将被移动到选定的存储中。",
|
||||||
@@ -446,6 +448,8 @@ export const i18nData = {
|
|||||||
"Views Descending": "瀏覽量降序",
|
"Views Descending": "瀏覽量降序",
|
||||||
"Downloads Ascending": "下載量升序",
|
"Downloads Ascending": "下載量升序",
|
||||||
"Downloads Descending": "下載量降序",
|
"Downloads Descending": "下載量降序",
|
||||||
|
"Release Date Ascending": "發布日期升序",
|
||||||
|
"Release Date Descending": "發布日期降序",
|
||||||
"File Url": "檔案連結",
|
"File Url": "檔案連結",
|
||||||
"Provide a file url for the server to download, and the file will be moved to the selected storage.":
|
"Provide a file url for the server to download, and the file will be moved to the selected storage.":
|
||||||
"提供一個檔案連結供伺服器下載,檔案將被移動到選定的儲存中。",
|
"提供一個檔案連結供伺服器下載,檔案將被移動到選定的儲存中。",
|
||||||
|
|||||||
@@ -197,6 +197,8 @@ export enum RSort {
|
|||||||
ViewsDesc = 3,
|
ViewsDesc = 3,
|
||||||
DownloadsAsc = 4,
|
DownloadsAsc = 4,
|
||||||
DownloadsDesc = 5,
|
DownloadsDesc = 5,
|
||||||
|
ReleaseDateAsc = 6,
|
||||||
|
ReleaseDateDesc = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ActivityType {
|
export enum ActivityType {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ export default function HomePage() {
|
|||||||
t("Views Descending"),
|
t("Views Descending"),
|
||||||
t("Downloads Ascending"),
|
t("Downloads Ascending"),
|
||||||
t("Downloads Descending"),
|
t("Downloads Descending"),
|
||||||
|
t("Release Date Ascending"),
|
||||||
|
t("Release Date Descending"),
|
||||||
]}
|
]}
|
||||||
current={order}
|
current={order}
|
||||||
onSelected={(index) => {
|
onSelected={(index) => {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func handleListResources(c fiber.Ctx) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewRequestError("Invalid sort parameter")
|
return model.NewRequestError("Invalid sort parameter")
|
||||||
}
|
}
|
||||||
if sortInt < 0 || sortInt > 5 {
|
if sortInt < 0 || sortInt > 7 {
|
||||||
return model.NewRequestError("Sort parameter out of range")
|
return model.NewRequestError("Sort parameter out of range")
|
||||||
}
|
}
|
||||||
sort := model.RSort(sortInt)
|
sort := model.RSort(sortInt)
|
||||||
|
|||||||
@@ -99,6 +99,10 @@ func GetResourceList(page, pageSize int, sort model.RSort) ([]model.Resource, in
|
|||||||
order = "downloads ASC"
|
order = "downloads ASC"
|
||||||
case model.RSortDownloadsDesc:
|
case model.RSortDownloadsDesc:
|
||||||
order = "downloads DESC"
|
order = "downloads DESC"
|
||||||
|
case model.RSortReleaseDateAsc:
|
||||||
|
order = "release_date ASC"
|
||||||
|
case model.RSortReleaseDateDesc:
|
||||||
|
order = "release_date DESC"
|
||||||
default:
|
default:
|
||||||
order = "modified_time DESC" // Default sort order
|
order = "modified_time DESC" // Default sort order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ const (
|
|||||||
RSortViewsDesc
|
RSortViewsDesc
|
||||||
RSortDownloadsAsc
|
RSortDownloadsAsc
|
||||||
RSortDownloadsDesc
|
RSortDownloadsDesc
|
||||||
|
RSortReleaseDateAsc
|
||||||
|
RSortReleaseDateDesc
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user