fix: ui fixes

This commit is contained in:
gosangam
2026-06-16 15:49:23 +05:30
parent 41367a8b27
commit 5342123fba
8 changed files with 388 additions and 34 deletions
+26
View File
@@ -78,6 +78,20 @@ export type Me = {
role: string;
};
export type Stats = {
users: number;
users_last_7_days: number;
posts: number;
posts_last_7_days: number;
collections: number;
public_collections: number;
bookmarks: number;
reshares: number;
feedback: number;
feedback_last_7_days: number;
feedback_by_category: { category: string; count: number }[];
};
export type AdminUser = {
id: string;
email: string | null;
@@ -88,6 +102,7 @@ export type AdminUser = {
plan: string;
email_verified_at: string | null;
banned_at: string | null;
post_count: number;
created_at: string;
};
@@ -124,6 +139,7 @@ export type AdminFeedback = {
message: string;
contact_email: string | null;
created_at: string;
acknowledged_at: string | null;
resolved_at: string | null;
replied_at: string | null;
reply_message: string | null;
@@ -207,6 +223,10 @@ export const api = {
},
// Admin resources
async stats(): Promise<Stats> {
const { data } = await call<Stats>("/admin/stats");
return data;
},
users(q: string, limit: number, offset: number) {
return listed<AdminUser>(`/admin/users${qs({ q, limit, offset })}`);
},
@@ -255,6 +275,12 @@ export const api = {
body: JSON.stringify({ message }),
});
},
acknowledgeFeedback(id: string) {
return call(`/admin/feedback/${id}/acknowledge`, { method: "POST" });
},
resolveFeedback(id: string) {
return call(`/admin/feedback/${id}/resolve`, { method: "POST" });
},
reports(type: ReportType, q: string, limit: number, offset: number) {
return listed<AdminReport>(`/admin/reports${qs({ type, q, limit, offset })}`);
},