fix: 项目列表默认条数由20调整为10
This commit is contained in:
@@ -6,7 +6,7 @@ import type { ProjectSortOption, ProjectWithFlatTags } from '@/hooks/useProjects
|
||||
import { ProjectCard } from '@/components/project/ProjectCard'
|
||||
import { AISearchResults } from '@/components/search/AISearchResults'
|
||||
|
||||
const DEFAULT_PAGE_SIZE = 20
|
||||
const DEFAULT_PAGE_SIZE = 10
|
||||
const PAGE_SIZE_OPTIONS = [10, 20, 50] as const
|
||||
|
||||
type ProjectListItem = ProjectWithFlatTags
|
||||
|
||||
@@ -36,7 +36,7 @@ function normalizePageLimit(value?: string): (typeof PAGE_LIMIT_OPTIONS)[number]
|
||||
if (PAGE_LIMIT_OPTIONS.includes(parsedValue as (typeof PAGE_LIMIT_OPTIONS)[number])) {
|
||||
return parsedValue as (typeof PAGE_LIMIT_OPTIONS)[number]
|
||||
}
|
||||
return 20
|
||||
return 10
|
||||
}
|
||||
|
||||
export default async function ProjectsPage({
|
||||
|
||||
@@ -11,7 +11,7 @@ const ProjectsQuerySchema = z.object({
|
||||
projectType: z.string().trim().optional(),
|
||||
sort: z.enum(PROJECT_SORT_OPTIONS).default('latest'),
|
||||
page: z.coerce.number().int().positive().default(1),
|
||||
limit: z.coerce.number().int().positive().max(100).default(20),
|
||||
limit: z.coerce.number().int().positive().max(100).default(10),
|
||||
})
|
||||
|
||||
function parseSlugList(searchParams: URLSearchParams, key: string, repeatedKey: string): string[] {
|
||||
|
||||
@@ -93,7 +93,7 @@ export type FixedProjectTypeFilter = {
|
||||
export const PROJECT_SORT_OPTIONS = ['latest', 'stars_desc', 'stars_asc'] as const
|
||||
export type ProjectSortOption = (typeof PROJECT_SORT_OPTIONS)[number]
|
||||
const DEFAULT_PAGE = 1
|
||||
const DEFAULT_LIMIT = 20
|
||||
const DEFAULT_LIMIT = 10
|
||||
const MAX_LIMIT = 100
|
||||
|
||||
export function normalizeProjectSort(value?: string): ProjectSortOption {
|
||||
|
||||
Reference in New Issue
Block a user