Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";

import React from "react";
import type { EvidenceWithStatus } from "../../actions/getEvidenceDashboard";
import { ChevronDown, ChevronUp } from "lucide-react";
import { useScrollPosition } from "../../hooks/useScrollPosition";
import { useAssigneeData } from "../../hooks/useAssigneeData";
import { AssigneeChartRow } from "./AssigneeChartRow";
import type { EvidenceWithStatus } from "../../data/getEvidenceDashboard";

interface AssigneeBarChartProps {
byAssignee?: Record<string, EvidenceWithStatus[]>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
"use client";

import React from "react";
import { HorizontalBarChart, type ChartDataItem } from "../HorizontalBarChart";
import { useI18n } from "@/locales/client";
import type { AssigneeData } from "../../hooks/useAssigneeData";
import {
STATUS_PRIORITY,
STATUS_COLORS,
STATUS_HEX_COLORS,
type StatusType,
STATUS_PRIORITY,
} from "../../constants/evidence-status";
import type { AssigneeData } from "../../hooks/useAssigneeData";
import { useStatusTranslation } from "../../hooks/useStatusTranslation";
import { HorizontalBarChart, type ChartDataItem } from "../HorizontalBarChart";

interface AssigneeChartRowProps {
assignee: AssigneeData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use client";

import React from "react";
import type { Departments } from "@prisma/client";
import type { EvidenceWithStatus } from "../../actions/getEvidenceDashboard";
import type { EvidenceWithStatus } from "../../data/getEvidenceDashboard";
import { ChevronDown, ChevronUp } from "lucide-react";
import { useScrollPosition } from "../../hooks/useScrollPosition";
import { useEvidenceData } from "../../hooks/useEvidenceData";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
"use client";

import React from "react";
import { useEvidenceDashboard } from "../hooks/useEvidenceDashboard";
import { DepartmentBarChart } from "./DepartmentChart/DepartmentBarChart";
import { AssigneeBarChart } from "./AssigneeChart/AssigneeBarChart";
import { FrameworkBarChart } from "./FrameworkChart/FrameworkBarChart";
import { Card, CardContent, CardHeader, CardTitle } from "@bubba/ui/card";
import { useI18n } from "@/locales/client";
import {
EvidenceOverviewSkeleton,
EvidenceErrorState,
EvidenceEmptyState,
} from "./EvidenceUIStates";
import { Card, CardContent, CardHeader, CardTitle } from "@bubba/ui/card";
import { EvidenceSummaryCards } from "../../list/components/EvidenceSummaryCards";
import type { EvidenceDashboardData } from "../data/getEvidenceDashboard";
import { AssigneeBarChart } from "./AssigneeChart/AssigneeBarChart";
import { DepartmentBarChart } from "./DepartmentChart/DepartmentBarChart";
import { EvidenceEmptyState } from "./EvidenceUIStates";
import { FrameworkBarChart } from "./FrameworkChart/FrameworkBarChart";

export const EvidenceOverview = () => {
const { data, isLoading, error } = useEvidenceDashboard();
export const EvidenceOverview = ({
evidence,
}: {
evidence: EvidenceDashboardData | null;
}) => {
const t = useI18n();

if (isLoading) {
return <EvidenceOverviewSkeleton />;
}

if (error) {
return <EvidenceErrorState message={error.message} />;
}

if (!data) {
if (!evidence) {
return <EvidenceEmptyState />;
}

const { byDepartment, byAssignee, byFramework, unassigned } = evidence;

return (
<div className="space-y-8">
{/* Evidence summary statistics cards */}
Expand All @@ -42,7 +34,7 @@ export const EvidenceOverview = () => {
<CardTitle>{t("evidence.dashboard.by_department")}</CardTitle>
</CardHeader>
<CardContent>
<DepartmentBarChart byDepartment={data.byDepartment} />
<DepartmentBarChart byDepartment={byDepartment} />
</CardContent>
</Card>

Expand All @@ -51,10 +43,7 @@ export const EvidenceOverview = () => {
<CardTitle>{t("evidence.dashboard.by_assignee")}</CardTitle>
</CardHeader>
<CardContent>
<AssigneeBarChart
byAssignee={data.byAssignee}
unassigned={data.unassigned}
/>
<AssigneeBarChart byAssignee={byAssignee} unassigned={unassigned} />
</CardContent>
</Card>

Expand All @@ -63,7 +52,7 @@ export const EvidenceOverview = () => {
<CardTitle>{t("evidence.dashboard.by_framework")}</CardTitle>
</CardHeader>
<CardContent>
<FrameworkBarChart byFramework={data.byFramework} />
<FrameworkBarChart byFramework={byFramework} />
</CardContent>
</Card>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"use client";

import React from "react";
import type { EvidenceWithStatus } from "../../actions/getEvidenceDashboard";
import { ChevronDown, ChevronUp } from "lucide-react";
import { useScrollPosition } from "../../hooks/useScrollPosition";
import type { EvidenceWithStatus } from "../../data/getEvidenceDashboard";
import { useFrameworkData } from "../../hooks/useFrameworkData";
import { useScrollPosition } from "../../hooks/useScrollPosition";
import { FrameworkChartRow } from "./FrameworkChartRow";

interface FrameworkBarChartProps {
Expand Down
Loading