A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: dashboard charts
dextmorgn232ce14dcdaa
diff --git a/flowsint-web/src/app/dashboard/investigations/page.tsx b/flowsint-web/src/app/dashboard/investigations/page.tsxnew file mode 100644index 00000000..dc86a708--- /dev/null+++ b/flowsint-web/src/app/dashboard/investigations/page.tsx@@ -0,0 +1,226 @@+"use client"++import { useState } from "react"+import { Button } from "@/components/ui/button"+import { Input } from "@/components/ui/input"+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"+import { ChevronDown, FolderLockIcon, Grid, List, MoreHorizontal, PlusIcon, RotateCwIcon, Search, SlidersHorizontal } from "lucide-react"+import { useQuery } from "@tanstack/react-query"+import { notFound } from "next/navigation"+import Loader from "@/components/loader"+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"+import { format, formatDistanceToNow } from "date-fns"+import Link from "next/link"+import { Investigation } from "@/types/investigation"+import RecentSketches from "@/components/dashboard/recent-sketches"+import NewInvestigation from "@/components/dashboard/new-investigation"+import { AvatarList } from "@/components/avatar-list"+import { cn } from "@/lib/utils"+import { SubNav } from "@/components/dashboard/sub-nav"+import { Card } from "@/components/ui/card"+import StatusBadge from "@/components/investigations/status-badge"+import { Profile } from "@/types"+import { SectionCards } from "@/components/investigations/section-cards"+const DashboardPage = () => {+ const [searchQuery, setSearchQuery] = useState("")+ const [viewMode, setViewMode] = useState<"grid" | "list">("grid")++ const { data, isLoading, refetch, isRefetching } = useQuery({+ queryKey: ["dashboard", "investigations"],+ queryFn: async () => {+ const res = await fetch(`/api/investigations`)+ if (!res.ok || res.status === 404) {+ notFound()+ }+ return res.json()+ },+ refetchOnWindowFocus: true,+ })+ const investigations = data?.investigations || []+ const filteredInvestigations = investigations.filter(+ (investigation: Investigation) => searchQuery === "" || investigation.name?.toLowerCase().includes(searchQuery.toLowerCase()),+ )++ return (+ <>+ <div className="sticky z-40 bg-card w-full hidden md:flex top-[48px] border-b">+ <SubNav />+ </div>+ <div className="w-full space-y-8 container mx-auto py-12 px-8">+ <div className="flex items-center justify-between w-full gap-4">+ <div className="relative flex-1">+ <div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">+ <Search className="h-4 w-4 " />+ </div>+ <Input+ type="text"+ placeholder="Search investigations and investigations..."+ className="pl-10 pr-16 py-2 h-10 text-sm bg-card"+ />+ <div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">+ <div className="flex items-center gap-1 text-xs">+ <kbd className="px-1.5 py-0.5 bg-background border rounded">⌘</kbd>+ <kbd className="px-1.5 py-0.5 bg-background border rounded">K</kbd>+ </div>+ </div>+ </div>+ <div className="flex items-center gap-2">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="outline" className="flex items-center bg-card gap-2 h-10">+ <span>Sort by activity</span>+ <ChevronDown className="h-4 w-4" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem>Sort by name</DropdownMenuItem>+ <DropdownMenuItem>Sort by date created</DropdownMenuItem>+ <DropdownMenuItem>Sort by last updated</DropdownMenuItem>+ <DropdownMenuItem>Sort by activity</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <div className="flex items-center border bg-card rounded-md overflow-hidden">+ <Button+ variant="ghost"+ size="icon"+ className={`rounded-none ${viewMode === "grid" ? "bg-background" : ""}`}+ onClick={() => setViewMode("grid")}+ >+ <Grid className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className={`rounded-none ${viewMode === "list" ? "bg-background" : ""}`}+ onClick={() => setViewMode("list")}+ >+ <List className="h-4 w-4" />+ </Button>+ </div>+ <NewInvestigation>+ <Button className="gap-2">+ <PlusIcon className="h-4 w-4" /> New+ </Button>+ </NewInvestigation>+ </div>+ </div>+ <div>+ <RecentSketches limit={8} />+ </div>+ <div className="flex items-center gap-2 justify-between mb-6">+ <div className="flex items-center gap-2">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="outline" size="sm" className="gap-2">+ <SlidersHorizontal className="h-4 w-4 opacity-60" />+ <span className="hidden sm:inline">Sort by</span>+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem>Name</DropdownMenuItem>+ <DropdownMenuItem>Date created</DropdownMenuItem>+ <DropdownMenuItem>Date modified</DropdownMenuItem>+ <DropdownMenuItem>Size</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ <Button onClick={() => refetch()} disabled={isLoading || isRefetching} variant={"outline"} size="sm" className="gap-2">+ <RotateCwIcon className={cn("h-4 w-4", isLoading || isRefetching && "animate-spin")} /> Refresh+ </Button>+ </div>+ </div>+ {isLoading ? (+ <div className="flex justify-center items-center py-12">+ <Loader />+ </div>+ ) : (+ <Card className="border rounded-md bg-card shadow-xs">+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Name</TableHead>+ <TableHead className="hidden md:table-cell">Status</TableHead>+ <TableHead className="hidden md:table-cell">Size</TableHead>+ <TableHead className="hidden sm:table-cell">Last modified</TableHead>+ <TableHead className="hidden sm:table-cell">Members</TableHead>+ <TableHead className="hidden sm:table-cell">Creation</TableHead>+ <TableHead className="w-[50px]"></TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {filteredInvestigations.length === 0 ? (+ <TableRow>+ <TableCell colSpan={7} className="text-center py-8 text-muted-foreground">+ {searchQuery !== "" ? "No investigations found" :+ <div className="flex items-center flex-col gap-3">No investigations yet+ <div className="mt-4">+ <NewInvestigation noDropDown>+ <Button size="sm" className="gap-2">+ <PlusIcon className="h-4 w-4" /> Create a new investigation+ </Button>+ </NewInvestigation>+ </div>+ </div>}+ </TableCell>+ </TableRow>+ ) : (+ filteredInvestigations.map((investigation: Investigation) => (+ <TableRow key={investigation.id}>+ <TableCell>+ <Link href={`dashboard/investigations/${investigation.id}`} className="flex items-center gap-2 hover:underline font-medium">+ <FolderLockIcon className="h-5 w-5 text-muted-foreground opacity-60" />+ <span>{investigation.name}</span>+ </Link>+ </TableCell>+ <TableCell className="hidden md:table-cell text-muted-foreground">+ <StatusBadge status={investigation.status as string} />+ </TableCell>+ <TableCell className="hidden md:table-cell text-muted-foreground">+ {(investigation.sketches?.length || 0) > 0 ? `${investigation.sketches.length} items` : "Empty"}+ </TableCell>+ <TableCell className="hidden sm:table-cell text-muted-foreground">+ {formatDistanceToNow(new Date(investigation.last_updated_at), { addSuffix: true })}+ </TableCell>+ <TableCell className="hidden sm:table-cell text-muted-foreground">+ <AvatarList+ size="md"+ users={+ investigation?.members?.map(member => ({+ ...member.profile,+ owner: member.profile.id === investigation.owner_id,+ })) || []+ }+ />+ </TableCell>+ <TableCell className="hidden sm:table-cell text-muted-foreground">+ {format(new Date(investigation.created_at), "dd.MM.yyyy")}+ </TableCell>+ <TableCell>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon" className="h-10 w-8">+ <MoreHorizontal className="h-4 w-4" />+ <span className="sr-only">Actions</span>+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem>Open</DropdownMenuItem>+ <DropdownMenuItem>Rename</DropdownMenuItem>+ <DropdownMenuItem>Share</DropdownMenuItem>+ <DropdownMenuItem className="text-destructive">Delete</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>+ ))+ )}+ </TableBody>+ </Table>+ </Card>+ )}+ </div>+ </>+ )+}++export default DashboardPage+diff --git a/flowsint-web/src/app/dashboard/page.tsx b/flowsint-web/src/app/dashboard/page.tsxindex 08bec188..feb6d8ed 100644--- a/flowsint-web/src/app/dashboard/page.tsx+++ b/flowsint-web/src/app/dashboard/page.tsx@@ -4,7 +4,7 @@ import { useState } from "react"import { Button } from "@/components/ui/button"import { Input } from "@/components/ui/input"import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"-import { ChevronDown, FolderLockIcon, Grid, List, MoreHorizontal, PlusIcon, RotateCwIcon, Search, SlidersHorizontal } from "lucide-react"+import { ChevronDown, FolderLockIcon, Grid, List, MoreHorizontal, PlusIcon, RotateCwIcon, Search, SlidersHorizontal, TrendingDownIcon, TrendingUpIcon } from "lucide-react"import { useQuery } from "@tanstack/react-query"import { notFound } from "next/navigation"import Loader from "@/components/loader"@@ -17,9 +17,12 @@ import NewInvestigation from "@/components/dashboard/new-investigation"import { AvatarList } from "@/components/avatar-list"import { cn } from "@/lib/utils"import { SubNav } from "@/components/dashboard/sub-nav"-import { Card } from "@/components/ui/card"+import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"import StatusBadge from "@/components/investigations/status-badge"-import { Profile } from "@/types"+import { InvestigationGraph } from "@/components/dashboard/charts/investigation-chart"+import { Badge } from "@/components/ui/badge"+import { MetricsChart } from "@/components/dashboard/charts/metrics-chart"+import { SectionCards } from "@/components/investigations/section-cards"const DashboardPage = () => {const [searchQuery, setSearchQuery] = useState("")const [viewMode, setViewMode] = useState<"grid" | "list">("grid")@@ -45,69 +48,29 @@ const DashboardPage = () => {<div className="sticky z-40 bg-card w-full hidden md:flex top-[48px] border-b"><SubNav /></div>- <div className="w-full space-y-8 container mx-auto py-12 px-8">- <div className="flex items-center justify-between w-full gap-4">- <div className="relative flex-1">- <div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">- <Search className="h-4 w-4 " />- </div>- <Input- type="text"- placeholder="Search investigations and investigations..."- className="pl-10 pr-16 py-2 h-10 text-sm bg-card"- />- <div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">- <div className="flex items-center gap-1 text-xs">- <kbd className="px-1.5 py-0.5 bg-background border rounded">⌘</kbd>- <kbd className="px-1.5 py-0.5 bg-background border rounded">K</kbd>- </div>- </div>+ <div className="w-full space-y-4 container mx-auto py-12 px-8">+ <div className="flex grow items-center justify-between w-full gap-4">+ <h1 className="font-bold text-2xl">Overview</h1>+ <NewInvestigation>+ <Button className="gap-2">+ <PlusIcon className="h-4 w-4" /> New+ </Button>+ </NewInvestigation>+ </div>+ <SectionCards />+ <div className="grid lg:grid-cols-5 gap-4 w-full">+ <div className="lg:col-span-2 col-span-1 h-full">+ <MetricsChart /></div>-- <div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="outline" className="flex items-center bg-card gap-2 h-10">- <span>Sort by activity</span>- <ChevronDown className="h-4 w-4" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem>Sort by name</DropdownMenuItem>- <DropdownMenuItem>Sort by date created</DropdownMenuItem>- <DropdownMenuItem>Sort by last updated</DropdownMenuItem>- <DropdownMenuItem>Sort by activity</DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>-- <div className="flex items-center border bg-card rounded-md overflow-hidden">- <Button- variant="ghost"- size="icon"- className={`rounded-none ${viewMode === "grid" ? "bg-background" : ""}`}- onClick={() => setViewMode("grid")}- >- <Grid className="h-4 w-4" />- </Button>- <Button- variant="ghost"- size="icon"- className={`rounded-none ${viewMode === "list" ? "bg-background" : ""}`}- onClick={() => setViewMode("list")}- >- <List className="h-4 w-4" />- </Button>- </div>- <NewInvestigation>- <Button className="gap-2">- <PlusIcon className="h-4 w-4" /> New- </Button>- </NewInvestigation>+ {/* <div className="col-span-1 h-full">+ <MetricsChart />+ </div> */}+ <div className="lg:col-span-3 col-span-1 h-full">+ <InvestigationGraph /></div></div>- <div>- <RecentSketches limit={4} />- </div>+ <h2 className="font-bold text-2xl mt-8">Recent sketches</h2>+ <RecentSketches limit={4} /><div className="flex items-center gap-2 justify-between mb-6"><div className="flex items-center gap-2"><DropdownMenu>diff --git a/flowsint-web/src/components/dashboard/charts/investigation-chart.tsx b/flowsint-web/src/components/dashboard/charts/investigation-chart.tsxnew file mode 100644index 00000000..752c3b88--- /dev/null+++ b/flowsint-web/src/components/dashboard/charts/investigation-chart.tsx@@ -0,0 +1,263 @@+"use client"++import * as React from "react"+import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"++import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from "@/components/ui/card"+import {+ ChartConfig,+ ChartContainer,+ ChartLegend,+ ChartLegendContent,+ ChartTooltip,+ ChartTooltipContent,+} from "@/components/ui/chart"+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select"+const chartData = [+ { date: "2024-04-01", desktop: 222, mobile: 150 },+ { date: "2024-04-02", desktop: 97, mobile: 180 },+ { date: "2024-04-03", desktop: 167, mobile: 120 },+ { date: "2024-04-04", desktop: 242, mobile: 260 },+ { date: "2024-04-05", desktop: 373, mobile: 290 },+ { date: "2024-04-06", desktop: 301, mobile: 340 },+ { date: "2024-04-07", desktop: 245, mobile: 180 },+ { date: "2024-04-08", desktop: 409, mobile: 320 },+ { date: "2024-04-09", desktop: 59, mobile: 110 },+ { date: "2024-04-10", desktop: 261, mobile: 190 },+ { date: "2024-04-11", desktop: 327, mobile: 350 },+ { date: "2024-04-12", desktop: 292, mobile: 210 },+ { date: "2024-04-13", desktop: 342, mobile: 380 },+ { date: "2024-04-14", desktop: 137, mobile: 220 },+ { date: "2024-04-15", desktop: 120, mobile: 170 },+ { date: "2024-04-16", desktop: 138, mobile: 190 },+ { date: "2024-04-17", desktop: 446, mobile: 360 },+ { date: "2024-04-18", desktop: 364, mobile: 410 },+ { date: "2024-04-19", desktop: 243, mobile: 180 },+ { date: "2024-04-20", desktop: 89, mobile: 150 },+ { date: "2024-04-21", desktop: 137, mobile: 200 },+ { date: "2024-04-22", desktop: 224, mobile: 170 },+ { date: "2024-04-23", desktop: 138, mobile: 230 },+ { date: "2024-04-24", desktop: 387, mobile: 290 },+ { date: "2024-04-25", desktop: 215, mobile: 250 },+ { date: "2024-04-26", desktop: 75, mobile: 130 },+ { date: "2024-04-27", desktop: 383, mobile: 420 },+ { date: "2024-04-28", desktop: 122, mobile: 180 },+ { date: "2024-04-29", desktop: 315, mobile: 240 },+ { date: "2024-04-30", desktop: 454, mobile: 380 },+ { date: "2024-05-01", desktop: 165, mobile: 220 },+ { date: "2024-05-02", desktop: 293, mobile: 310 },+ { date: "2024-05-03", desktop: 247, mobile: 190 },+ { date: "2024-05-04", desktop: 385, mobile: 420 },+ { date: "2024-05-05", desktop: 481, mobile: 390 },+ { date: "2024-05-06", desktop: 498, mobile: 520 },+ { date: "2024-05-07", desktop: 388, mobile: 300 },+ { date: "2024-05-08", desktop: 149, mobile: 210 },+ { date: "2024-05-09", desktop: 227, mobile: 180 },+ { date: "2024-05-10", desktop: 293, mobile: 330 },+ { date: "2024-05-11", desktop: 335, mobile: 270 },+ { date: "2024-05-12", desktop: 197, mobile: 240 },+ { date: "2024-05-13", desktop: 197, mobile: 160 },+ { date: "2024-05-14", desktop: 448, mobile: 490 },+ { date: "2024-05-15", desktop: 473, mobile: 380 },+ { date: "2024-05-16", desktop: 338, mobile: 400 },+ { date: "2024-05-17", desktop: 499, mobile: 420 },+ { date: "2024-05-18", desktop: 315, mobile: 350 },+ { date: "2024-05-19", desktop: 235, mobile: 180 },+ { date: "2024-05-20", desktop: 177, mobile: 230 },+ { date: "2024-05-21", desktop: 82, mobile: 140 },+ { date: "2024-05-22", desktop: 81, mobile: 120 },+ { date: "2024-05-23", desktop: 252, mobile: 290 },+ { date: "2024-05-24", desktop: 294, mobile: 220 },+ { date: "2024-05-25", desktop: 201, mobile: 250 },+ { date: "2024-05-26", desktop: 213, mobile: 170 },+ { date: "2024-05-27", desktop: 420, mobile: 460 },+ { date: "2024-05-28", desktop: 233, mobile: 190 },+ { date: "2024-05-29", desktop: 78, mobile: 130 },+ { date: "2024-05-30", desktop: 340, mobile: 280 },+ { date: "2024-05-31", desktop: 178, mobile: 230 },+ { date: "2024-06-01", desktop: 178, mobile: 200 },+ { date: "2024-06-02", desktop: 470, mobile: 410 },+ { date: "2024-06-03", desktop: 103, mobile: 160 },+ { date: "2024-06-04", desktop: 439, mobile: 380 },+ { date: "2024-06-05", desktop: 88, mobile: 140 },+ { date: "2024-06-06", desktop: 294, mobile: 250 },+ { date: "2024-06-07", desktop: 323, mobile: 370 },+ { date: "2024-06-08", desktop: 385, mobile: 320 },+ { date: "2024-06-09", desktop: 438, mobile: 480 },+ { date: "2024-06-10", desktop: 155, mobile: 200 },+ { date: "2024-06-11", desktop: 92, mobile: 150 },+ { date: "2024-06-12", desktop: 492, mobile: 420 },+ { date: "2024-06-13", desktop: 81, mobile: 130 },+ { date: "2024-06-14", desktop: 426, mobile: 380 },+ { date: "2024-06-15", desktop: 307, mobile: 350 },+ { date: "2024-06-16", desktop: 371, mobile: 310 },+ { date: "2024-06-17", desktop: 475, mobile: 520 },+ { date: "2024-06-18", desktop: 107, mobile: 170 },+ { date: "2024-06-19", desktop: 341, mobile: 290 },+ { date: "2024-06-20", desktop: 408, mobile: 450 },+ { date: "2024-06-21", desktop: 169, mobile: 210 },+ { date: "2024-06-22", desktop: 317, mobile: 270 },+ { date: "2024-06-23", desktop: 480, mobile: 530 },+ { date: "2024-06-24", desktop: 132, mobile: 180 },+ { date: "2024-06-25", desktop: 141, mobile: 190 },+ { date: "2024-06-26", desktop: 434, mobile: 380 },+ { date: "2024-06-27", desktop: 448, mobile: 490 },+ { date: "2024-06-28", desktop: 149, mobile: 200 },+ { date: "2024-06-29", desktop: 103, mobile: 160 },+ { date: "2024-06-30", desktop: 446, mobile: 400 },+]++const chartConfig = {+ visitors: {+ label: "Investigations",+ },+ desktop: {+ label: "Active",+ color: "var(--chart-1)",+ },+ mobile: {+ label: "Closed",+ color: "var(--chart-2)",+ },+} satisfies ChartConfig++export function InvestigationGraph() {+ const [timeRange, setTimeRange] = React.useState("90d")++ const filteredData = chartData.filter((item) => {+ const date = new Date(item.date)+ const referenceDate = new Date("2024-06-30")+ let daysToSubtract = 90+ if (timeRange === "30d") {+ daysToSubtract = 30+ } else if (timeRange === "7d") {+ daysToSubtract = 7+ }+ const startDate = new Date(referenceDate)+ startDate.setDate(startDate.getDate() - daysToSubtract)+ return date >= startDate+ })++ return (+ <Card className="bg-card h-full">+ <CardHeader className="flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row">+ <div className="grid flex-1 gap-1 text-center sm:text-left">+ <CardTitle>Investigation statuses</CardTitle>+ <CardDescription>+ Showing total investigation statuses for the last 3 months+ </CardDescription>+ </div>+ <Select value={timeRange} onValueChange={setTimeRange}>+ <SelectTrigger+ className="w-[160px] rounded-lg sm:ml-auto"+ aria-label="Select a value"+ >+ <SelectValue placeholder="Last 3 months" />+ </SelectTrigger>+ <SelectContent className="rounded-xl">+ <SelectItem value="90d" className="rounded-lg">+ Last 3 months+ </SelectItem>+ <SelectItem value="30d" className="rounded-lg">+ Last 30 days+ </SelectItem>+ <SelectItem value="7d" className="rounded-lg">+ Last 7 days+ </SelectItem>+ </SelectContent>+ </Select>+ </CardHeader>+ <CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">+ <ChartContainer+ config={chartConfig}+ className="aspect-auto h-[220px] w-full"+ >+ <AreaChart data={filteredData}>+ <defs>+ <linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">+ <stop+ offset="5%"+ stopColor="var(--color-desktop)"+ stopOpacity={0.8}+ />+ <stop+ offset="95%"+ stopColor="var(--color-desktop)"+ stopOpacity={0.1}+ />+ </linearGradient>+ <linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">+ <stop+ offset="5%"+ stopColor="var(--color-mobile)"+ stopOpacity={0.8}+ />+ <stop+ offset="95%"+ stopColor="var(--color-mobile)"+ stopOpacity={0.1}+ />+ </linearGradient>+ </defs>+ <CartesianGrid vertical={false} />+ <XAxis+ dataKey="date"+ tickLine={false}+ axisLine={false}+ tickMargin={8}+ minTickGap={32}+ tickFormatter={(value) => {+ const date = new Date(value)+ return date.toLocaleDateString("en-US", {+ month: "short",+ day: "numeric",+ })+ }}+ />+ <ChartTooltip+ cursor={false}+ content={+ <ChartTooltipContent+ labelFormatter={(value) => {+ return new Date(value).toLocaleDateString("en-US", {+ month: "short",+ day: "numeric",+ })+ }}+ indicator="dot"+ />+ }+ />+ <Area+ dataKey="mobile"+ type="natural"+ fill="url(#fillMobile)"+ stroke="var(--color-mobile)"+ stackId="a"+ />+ <Area+ dataKey="desktop"+ type="natural"+ fill="url(#fillDesktop)"+ stroke="var(--color-desktop)"+ stackId="a"+ />+ <ChartLegend content={<ChartLegendContent />} />+ </AreaChart>+ </ChartContainer>+ </CardContent>+ </Card>+ )+}diff --git a/flowsint-web/src/components/dashboard/charts/metrics-chart.tsx b/flowsint-web/src/components/dashboard/charts/metrics-chart.tsxnew file mode 100644index 00000000..19ed72aa--- /dev/null+++ b/flowsint-web/src/components/dashboard/charts/metrics-chart.tsx@@ -0,0 +1,78 @@+"use client"++import { TrendingUp } from "lucide-react"+import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"++import {+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+} from "@/components/ui/card"+import {+ ChartConfig,+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/components/ui/chart"+const chartData = [+ { month: "January", desktop: 186, mobile: 80 },+ { month: "February", desktop: 305, mobile: 200 },+ { month: "March", desktop: 237, mobile: 120 },+ { month: "April", desktop: 73, mobile: 190 },+ { month: "May", desktop: 209, mobile: 130 },+ { month: "June", desktop: 214, mobile: 140 },+]++const chartConfig = {+ desktop: {+ label: "Active",+ color: "var(--chart-1)",+ },+ mobile: {+ label: "Closed",+ color: "var(--chart-2)",+ },+} satisfies ChartConfig++export function MetricsChart() {+ return (+ <Card className="bg-card h-full">+ <CardHeader className="flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row">+ <div className="grid flex-1 gap-1 text-center sm:text-left">+ <CardTitle>Investigation statuses</CardTitle>+ <CardDescription>+ Showing total investigation statuses for the last 3 months+ </CardDescription>+ </div>+ </CardHeader>+ <CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">+ <ChartContainer className="max-h-[180px] w-full" config={chartConfig}>+ <BarChart accessibilityLayer data={chartData}>+ <CartesianGrid vertical={false} />+ <XAxis+ dataKey="month"+ tickLine={false}+ tickMargin={10}+ axisLine={false}+ tickFormatter={(value) => value.slice(0, 3)}+ />+ <ChartTooltip+ cursor={false}+ content={<ChartTooltipContent indicator="dashed" />}+ />+ <Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />+ <Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />+ </BarChart>+ </ChartContainer>+ </CardContent>+ <CardFooter className="flex-col items-start gap-2 text-sm">+ <div className="leading-none text-muted-foreground">+ Showing total visitors for the last 6 months+ </div>+ </CardFooter>+ </Card>+ )+}diff --git a/flowsint-web/src/components/investigations/section-cards.tsx b/flowsint-web/src/components/investigations/section-cards.tsxindex 5fcb9265..a8206884 100644--- a/flowsint-web/src/components/investigations/section-cards.tsx+++ b/flowsint-web/src/components/investigations/section-cards.tsx@@ -11,11 +11,11 @@ import {export function SectionCards() {return (- <div className="*:data-[slot=card]:shadow-xs grid-cols-2 xl:grid-cols-4 grid grid-cols-1 gap-4">+ <div className="shadow-xs grid-cols-2 xl:grid-cols-4 grid grid-cols-1 gap-4"><Card className="bg-card"><CardHeader className="relative">- <CardDescription>Total sketches</CardDescription>- <CardTitle className="@[250px]/card:text-3xl text-2xl font-semibold tabular-nums">+ <CardDescription>Active investigations</CardDescription>+ <CardTitle className="md:text-4xl text-2xl font-semibold tabular-nums">23</CardTitle><div className="absolute right-4 top-4">@@ -30,14 +30,14 @@ export function SectionCards() {Trending up this month <TrendingUpIcon className="size-4" /></div><div className="text-muted-foreground">- New sketches created+ New investigations created</div></CardFooter></Card><Card className="bg-card"><CardHeader className="relative">- <CardDescription>New entities</CardDescription>- <CardTitle className="@[250px]/card:text-3xl text-2xl font-semibold tabular-nums">+ <CardDescription>Total investigations</CardDescription>+ <CardTitle className="md:text-4xl text-2xl font-semibold tabular-nums">237</CardTitle><div className="absolute right-4 top-4">@@ -52,15 +52,15 @@ export function SectionCards() {Down 20% this period <TrendingDownIcon className="size-4" /></div><div className="text-muted-foreground">- Entities found+ Investigations created</div></CardFooter></Card><Card className="bg-card"><CardHeader className="relative">- <CardDescription>Verified accounts</CardDescription>- <CardTitle className="@[250px]/card:text-3xl text-2xl font-semibold tabular-nums">- 45+ <CardDescription>Nodes created</CardDescription>+ <CardTitle className="md:text-4xl text-2xl font-semibold tabular-nums">+ 4 532</CardTitle><div className="absolute right-4 top-4"><Badge variant="outline" className="flex gap-1 rounded-lg text-xs">@@ -71,16 +71,16 @@ export function SectionCards() {</CardHeader><CardFooter className="flex-col items-start gap-1 text-sm"><div className="line-clamp-1 flex gap-2 font-medium">- Social accounts discovered <TrendingUpIcon className="size-4" />+ Nodes created <TrendingUpIcon className="size-4" /></div>- <div className="text-muted-foreground">Amount of verified social accounts</div>+ <div className="text-muted-foreground">Amount of nodes created this period</div></CardFooter></Card><Card className="bg-card"><CardHeader className="relative"><CardDescription>Collaborators</CardDescription>- <CardTitle className="@[250px]/card:text-3xl text-2xl font-semibold tabular-nums">- 3+ <CardTitle className="md:text-4xl text-2xl font-semibold tabular-nums">+ 8</CardTitle><div className="absolute right-4 top-4"><Badge variant="outline" className="flex gap-1 rounded-lg text-xs">