feat(life): add search and move post composer to modal

Support searching life posts by content
Move post creation and editing to a modal dialog
Add search toolbar and update empty states
This commit is contained in:
2026-05-01 23:48:57 +08:00
parent c03d4271e1
commit 866d7add16
7 changed files with 142 additions and 24 deletions

View File

@@ -197,6 +197,7 @@ export interface LifePostsPage {
export interface LifePostsParams {
cursor?: string | null;
limit?: number;
search?: string;
}
export interface LifeComment {
@@ -465,7 +466,7 @@ export const api = {
dailyChecklist: () => getJson<DailyChecklistItem[]>('/api/daily-checklist'),
lifePosts: (params: LifePostsParams = {}) =>
getJson<LifePostsPage>(
`/api/life-posts${buildQuery({ cursor: params.cursor ?? undefined, limit: params.limit })}`
`/api/life-posts${buildQuery({ cursor: params.cursor ?? undefined, limit: params.limit, search: params.search?.trim() })}`
),
createLifePost: (payload: LifePostPayload) => sendJson<LifePost>('/api/life-posts', 'POST', payload),
updateLifePost: (id: string | number, payload: LifePostPayload) =>