feat: separate popular browse navigation

This commit is contained in:
TerryM
2026-05-28 16:28:50 +08:00
parent fea6e1c93b
commit 6a998c0186
3 changed files with 49 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ export type PostStreamParams = {
type?: string;
language?: string;
q?: string;
sort?: string;
lang: Lang;
};
@@ -87,6 +88,7 @@ function buildRealUrl(params: PostStreamParams, cursor?: string): string {
if (q) sp.set("q", q);
if (params.scope.kind === "category") sp.set("category", params.scope.slug);
if (params.type && params.type !== "all") sp.set("type", params.type);
if (params.sort) sp.set("sort", params.sort);
if (params.language) sp.set("language", sourceLanguageQuery(params.language));
if (cursor) sp.set("cursor", cursor);
return `${q ? "/api/posts/search" : "/api/posts"}?${sp.toString()}`;
@@ -163,6 +165,7 @@ export function usePostStream(params: PostStreamParams): PostStreamResult {
params.type,
params.language,
params.q,
params.sort,
params.lang,
]);