diff --git a/src/lib/types.ts b/src/lib/types.ts index ad107ee..a9fba66 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -760,6 +760,7 @@ export interface AnalyticsPointSchema { } export interface AnalyticsPointGroupSchema { + items: AnalyticsPointSchema[]; top_items: AnalyticsPointSchema[]; other_count: number; total_count: number; @@ -797,6 +798,7 @@ export interface AnalyticsPostPopularitySchema { } export interface AnalyticsPostPopularityGroupSchema { + items: AnalyticsPostPopularitySchema[]; top_items: AnalyticsPostPopularitySchema[]; other_count: number; total_count: number; diff --git a/src/views/AdminDashboard.tsx b/src/views/AdminDashboard.tsx index 3658c1e..12fb2f6 100644 --- a/src/views/AdminDashboard.tsx +++ b/src/views/AdminDashboard.tsx @@ -41,6 +41,8 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart"; +import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { api } from "@/lib/api"; @@ -152,6 +154,10 @@ function dataWithOtherNotice(group: AnalyticsPointGroupSchema) { return group.top_items; } +function fullGroupItems(group: AnalyticsPointGroupSchema) { + return group.items?.length ? group.items : group.top_items; +} + function StatCard({ title, value, @@ -309,13 +315,124 @@ function CustomValueTooltip({ ); } -function HighCardinalityNotice({ group }: { group: AnalyticsPointGroupSchema }) { +function FullResultsAction({ + group, + onOpen, +}: { + group: AnalyticsPointGroupSchema; + onOpen: () => void; +}) { if (group.total_count <= group.top_items.length) return null; return ( -
- نمایش {formatNumberPersian(group.top_items.length)} مورد برتر از {formatNumberPersian(group.total_count)} مورد؛{" "} - {formatNumberPersian(group.other_count)} مورد دیگر در نمودار فشرده نشدهاند. -
+