diff --git a/src/i18n.tsx b/src/i18n.tsx index ed437dc..1154da7 100644 --- a/src/i18n.tsx +++ b/src/i18n.tsx @@ -121,6 +121,9 @@ const zhDict: Dict = { favorites: "我的收藏", favoritesComingSoon: "功能即将推出", favoritesComingSoonDesc: "登入与收藏功能开发中,敬请期待。", + featureUnavailable: "未开放", + featureUnavailableDesc: "该功能暂未开放。", + confirm: "知道了", backToHome: "返回首页", }; @@ -236,6 +239,9 @@ const enDict: Dict = { favoritesComingSoon: "Coming Soon", favoritesComingSoonDesc: "Sign-in and favorites are in development. Stay tuned.", + featureUnavailable: "Not available yet", + featureUnavailableDesc: "This feature is not available yet.", + confirm: "Got it", backToHome: "Back to Home", }; diff --git a/src/layouts/PublicLayout.tsx b/src/layouts/PublicLayout.tsx index 0d1e75c..0c7ce6c 100644 --- a/src/layouts/PublicLayout.tsx +++ b/src/layouts/PublicLayout.tsx @@ -27,7 +27,10 @@ function navIsActive( case "browseAll": return pathname === "/browse" && !sp.has("sort"); case "categories": - return pathname === "/" && hash === "#categories"; + return ( + pathname === "/categories" || + (pathname === "/" && hash === "#categories") + ); case "browseLatest": return pathname === "/" && hash === "#latest"; case "browseRecommended": @@ -387,7 +390,7 @@ export function PublicLayout() { {t("all")} @@ -479,7 +482,7 @@ export function PublicLayout() { {t("all")} setOpen(false)} @@ -570,10 +573,10 @@ export function PublicLayout() { active={pathname === "/favorites"} /> diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index bd2a9e4..fe1a9cb 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -51,6 +51,7 @@ export function Home() { const [latestPosts, setLatestPosts] = useState([]); const [popular, setPopular] = useState([]); const [popularPosts, setPopularPosts] = useState([]); + const [categoryUnavailableOpen, setCategoryUnavailableOpen] = useState(false); const [err, setErr] = useState(null); const recRowRef = useRef(null); const categoryRowRef = useRef(null); @@ -66,9 +67,9 @@ export function Home() { Promise.all([ getJSON(`/api/categories${catQ}`), getJSON<{ items: Post[] }>(`/api/posts/recommended${postQ}&limit=12`), - getJSON<{ items: Post[] }>(`/api/posts/latest${postQ}&limit=8`), + getJSON<{ items: Post[] }>(`/api/posts/latest${postQ}&limit=5`), getJSON<{ items: Post[] }>( - `/api/posts${postQ}&sort=popular&limit=8`, + `/api/posts${postQ}&sort=popular&limit=5`, ).catch((): { items: Post[] } => ({ items: [] })), ]) .then(([c, r, l, p]) => { @@ -206,7 +207,7 @@ export function Home() {
@@ -224,9 +225,11 @@ export function Home() { className="grid w-full shrink-0 snap-start grid-cols-3 gap-2 px-4" > {page.map((c) => ( -
setCategoryUnavailableOpen(true)} + className="flex h-[88px] min-w-0 flex-col items-center justify-center gap-2 rounded-xl border border-[#27292E] bg-[#1D1E23] px-4 py-3 text-center outline-none transition hover:border-ark-gold/55 hover:bg-[#252630] focus-visible:ring-2 focus-visible:ring-ark-gold/80 focus-visible:ring-offset-2 focus-visible:ring-offset-ark-bg" > {cleanCategoryDisplayName(c.name)}
- + ))} ))} @@ -275,9 +278,11 @@ export function Home() {
{figmaOrderedCategories.map((c) => ( -
setCategoryUnavailableOpen(true)} + className="flex h-[88px] min-w-0 flex-col items-center justify-center gap-2 rounded-xl border border-[#27292E] bg-[#1D1E23] px-4 py-3 text-center outline-none transition hover:border-ark-gold/55 hover:bg-[#252630] focus-visible:ring-2 focus-visible:ring-ark-gold/80 focus-visible:ring-offset-2 focus-visible:ring-offset-ark-bg" > {cleanCategoryDisplayName(c.name)}
-
+ ))} @@ -296,7 +301,7 @@ export function Home() {
@@ -366,7 +371,7 @@ export function Home() { />
- {latestPosts.slice(0, 4).map((post) => ( + {latestPosts.slice(0, 5).map((post) => ( ))}
@@ -392,7 +397,7 @@ export function Home() { />
- {popularPosts.slice(0, 4).map((post) => ( + {popularPosts.slice(0, 5).map((post) => ( ))}
@@ -408,6 +413,38 @@ export function Home() { ))} + + {categoryUnavailableOpen ? ( +
setCategoryUnavailableOpen(false)} + > +
event.stopPropagation()} + > +
+ {t("featureUnavailable")} +
+

+ {t("featureUnavailableDesc")} +

+ +
+
+ ) : null} ); }