feat: add all language filter in discover (#1598)

This commit is contained in:
pseudoyu
2024-11-14 10:12:35 +00:00
committed by GitHub
parent bd2d9d1175
commit cefdd6e36c
3 changed files with 8 additions and 3 deletions
@@ -24,12 +24,16 @@ import styles from "./recommendations.module.css"
import { RecommendationCard } from "./recommendations-card"
const LanguageOptions = [
{
name: "All",
value: "all",
},
{
name: "English",
value: "en",
},
{
name: "简体中文",
name: "中文",
value: "zh-CN",
},
] as const
@@ -56,7 +60,7 @@ export function Recommendations({
const { t } = useTranslation()
const lang = useGeneralSettingKey("language")
const defaultLang = ["zh-CN", "zh-HK", "zh-TW"].includes(lang ?? "") ? "zh-CN" : "en"
const defaultLang = !lang || ["zh-CN", "zh-HK", "zh-TW"].includes(lang) ? "all" : "en"
const [category, setCategory] = useState<DiscoverCategories>("all")
const [selectedLang, setSelectedLang] = useState<Language>(defaultLang)
+1 -1
View File
@@ -16,7 +16,7 @@ export const discover = {
query: {
category,
categories,
lang,
...(lang !== "all" && { lang }),
},
})
return res.data
+1
View File
@@ -6,6 +6,7 @@
- Set `Show Unread Only` as the default option.
- Merged the redirect page with the login page.
- Introduced entry conditions for actions.
- Added `all` language filter in dicover page.
## Improvements