refactor(fe): align dashboard with backend & gateway data flow
- API/WS clients: same-origin by default, drop dead imphnen hardcode
- chatbot history: map BE rows {user_message,bot_response,created_at}
- message_deleted WS payload: object {id,deleted_at}, not bare string
- dashboard: wire top-channels chart + live mod queue from /api/review,
add Users & Channels tabs consuming /api/dashboard/users|channels
- recordings: live WS sync via voice_recording_uploaded; duration_bytes optional
- remove dead widgets with no BE data source (trend chart, heatmap)
This commit is contained in:
@@ -22,12 +22,11 @@ export function useUsers(search?: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useChannels(guildId: string, search?: string) {
|
||||
export function useChannels(guildId?: string, search?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["dashboard-channels", guildId, search ?? ""],
|
||||
queryKey: ["dashboard-channels", guildId ?? "__all__", search ?? ""],
|
||||
queryFn: () => dashboardApi.listChannels(20, search, guildId || undefined),
|
||||
select: (data) => data.data,
|
||||
enabled: !!guildId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ export function useMessagesWsSync(ws: WsHook, guildId: string) {
|
||||
});
|
||||
const unsub3 = ws.on("message_deleted", (data) => {
|
||||
qc.setQueryData<MessageRecord[]>(key, (old) =>
|
||||
old ? old.filter((m) => m.id !== (data as unknown as string)) : old,
|
||||
old ? old.filter((m) => m.id !== (data as { id: string }).id) : old,
|
||||
);
|
||||
});
|
||||
const unsub4 = ws.on("message_analyzed", (data) => {
|
||||
|
||||
Reference in New Issue
Block a user