feat: replace corrections/tuner with dashboard module
Replace the corrections/adaptive-prompt-tuner feature with a new dashboard module providing server stats and user profile overview. Backend: - Add dashboard module (routes, service, repository) with stats + user list + user detail endpoints - Remove corrections module entirely - Wire dashboard router in app.ts Frontend: - Add dashboard feature (DashboardStats, UserSummaryList, UserProfileDetail components + useDashboard hook) - Remove tuner feature (CorrectionStats, CorrectionHistory, SubmitCorrection, useCorrections) - Update API client from corrections → dashboard types/fns - Rename tab 'tuner' → 'dashboard' - Update MobileTabBar, Header, Sidebar links Tests: - Expand backend placeholder test with dashboard assertions - Expand discord-gateway placeholder test with config/channel assertions AI moderation: - llmModerationClient: improve status/reply detection, expand safety categories, fix timer reset - userProfileLearner: fix isReply refinement - userProfileStore: add pending cache check - messageMetadata: add crosspost type mapping - migrate.ts: improve partial-index safety in schema push Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { useState } from "react";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../shared/ui";
|
||||
import { DashboardStatsContent } from "./components/DashboardStats";
|
||||
import { UserProfileDetail } from "./components/UserProfileDetail";
|
||||
import { UserSummaryList } from "./components/UserSummaryList";
|
||||
import {
|
||||
useDashboardUserDetail,
|
||||
useDashboardUsers,
|
||||
} from "./hooks/useDashboard";
|
||||
|
||||
export function DashboardPanel() {
|
||||
const [activeTab, setActiveTab] = useState("stats");
|
||||
const [selectedUserId, setSelectedUserId] = useState<string | null>(null);
|
||||
const {
|
||||
users,
|
||||
loading: usersLoading,
|
||||
error: usersError,
|
||||
search,
|
||||
setSearch,
|
||||
loadMore,
|
||||
hasMore,
|
||||
refetch: refetchUsers,
|
||||
} = useDashboardUsers();
|
||||
const {
|
||||
detail,
|
||||
loading: detailLoading,
|
||||
error: detailError,
|
||||
refetch: refetchDetail,
|
||||
} = useDashboardUserDetail(selectedUserId);
|
||||
|
||||
// Show user detail view
|
||||
if (selectedUserId) {
|
||||
return (
|
||||
<UserProfileDetail
|
||||
detail={detail}
|
||||
loading={detailLoading}
|
||||
error={detailError}
|
||||
onBack={() => {
|
||||
setSelectedUserId(null);
|
||||
}}
|
||||
onRefetch={refetchDetail}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
|
||||
<TabsList className="mb-6">
|
||||
<TabsTrigger value="stats">Stats</TabsTrigger>
|
||||
<TabsTrigger value="users">Users</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="stats">
|
||||
<DashboardStatsContent />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="users">
|
||||
<UserSummaryList
|
||||
users={users}
|
||||
loading={usersLoading}
|
||||
error={usersError}
|
||||
search={search}
|
||||
onSearchChange={setSearch}
|
||||
onLoadMore={loadMore}
|
||||
hasMore={hasMore}
|
||||
onRefetch={refetchUsers}
|
||||
onSelectUser={setSelectedUserId}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user