changed documents management to documents

This commit is contained in:
Khalim Conn-Kowlessar 2026-04-20 16:49:06 +00:00
parent 2536f3eb8e
commit a0b12673f3

View file

@ -9,7 +9,13 @@ import {
TabsTrigger,
} from "@/app/shadcn_components/ui/tabs";
import { Card, CardContent } from "@/app/shadcn_components/ui/card";
import { BarChart2, Table2, FolderOpen, Wrench, AlertTriangle } from "lucide-react";
import {
BarChart2,
Table2,
FolderOpen,
Wrench,
AlertTriangle,
} from "lucide-react";
import DrillDownTable from "./DrillDownTable";
import PropertyTable from "./PropertyTable";
import DocumentTable from "./DocumentTable";
@ -40,9 +46,9 @@ export default function LiveTracker({
userEmail,
}: LiveTrackerProps) {
// ── Tab state ────────────────────────────────────────────────────────
const [activeTab, setActiveTab] = useState<"analytics" | "properties" | "documents" | "measures">(
"analytics",
);
const [activeTab, setActiveTab] = useState<
"analytics" | "properties" | "documents" | "measures"
>("analytics");
// ── Project selector (shared across both tabs) ───────────────────────
const projectCodes = projects.map((p) => p.projectCode);
@ -81,7 +87,10 @@ export default function LiveTracker({
setOpenTable({
stage,
data: filteredDeals,
columns: (columns || ["dealname", "landlordPropertyId"]) as (keyof ClassifiedDeal)[],
columns: (columns || [
"dealname",
"landlordPropertyId",
]) as (keyof ClassifiedDeal)[],
columnLabels: (columnLabels || {
dealname: "Address Ref.",
landlordPropertyId: "Property Ref.",
@ -90,7 +99,11 @@ export default function LiveTracker({
});
};
const handleOpenDrawer = (uprn: string | null, landlordPropertyId: string | null, dealname: string | null) => {
const handleOpenDrawer = (
uprn: string | null,
landlordPropertyId: string | null,
dealname: string | null,
) => {
setDrawerState({ open: true, uprn, landlordPropertyId, dealname });
};
@ -108,7 +121,11 @@ export default function LiveTracker({
<div className="space-y-4 w-full">
<Tabs
value={activeTab}
onValueChange={(v) => setActiveTab(v as "analytics" | "properties" | "documents" | "measures")}
onValueChange={(v) =>
setActiveTab(
v as "analytics" | "properties" | "documents" | "measures",
)
}
>
{/* Tab bar */}
<TabsList className="h-10 p-1 bg-brandlightblue/10 border border-brandblue/10 rounded-xl mb-6">
@ -127,7 +144,9 @@ export default function LiveTracker({
Properties
<span
className={`ml-1 min-w-[18px] h-[18px] px-1 rounded-full bg-amber-500 text-white text-[10px] font-bold flex items-center justify-center leading-none transition-opacity ${
pendingRemovalCount > 0 ? "opacity-100" : "opacity-0 pointer-events-none"
pendingRemovalCount > 0
? "opacity-100"
: "opacity-0 pointer-events-none"
}`}
aria-hidden={pendingRemovalCount === 0}
>
@ -139,7 +158,7 @@ export default function LiveTracker({
className="flex items-center gap-2 rounded-lg text-sm font-medium px-4 data-[state=active]:bg-white data-[state=active]:text-brandblue data-[state=active]:shadow-sm transition-all"
>
<FolderOpen className="h-3.5 w-3.5" />
Document Management
Documents
</TabsTrigger>
<TabsTrigger
value="measures"
@ -196,11 +215,14 @@ export default function LiveTracker({
</div>
)}
<div className={`flex items-center gap-2.5 px-4 py-3 rounded-xl border border-amber-200 bg-amber-50 text-amber-800 text-sm ${pendingRemovalCount === 0 ? "hidden" : ""}`}>
<div
className={`flex items-center gap-2.5 px-4 py-3 rounded-xl border border-amber-200 bg-amber-50 text-amber-800 text-sm ${pendingRemovalCount === 0 ? "hidden" : ""}`}
>
<AlertTriangle className="h-4 w-4 text-amber-500 shrink-0" />
<span>
<span className="font-semibold">{pendingRemovalCount}</span>{" "}
{pendingRemovalCount === 1 ? "property has" : "properties have"} an outstanding removal request
{pendingRemovalCount === 1 ? "property has" : "properties have"}{" "}
an outstanding removal request
</span>
</div>
<PropertyTable
@ -225,7 +247,11 @@ export default function LiveTracker({
>
{projectCodes.map((code) =>
code === "__ALL__" ? (
<option key="__ALL__" value="__ALL__" style={{ fontWeight: 700 }}>
<option
key="__ALL__"
value="__ALL__"
style={{ fontWeight: 700 }}
>
All Projects
</option>
) : (
@ -261,7 +287,11 @@ export default function LiveTracker({
>
{projectCodes.map((code) =>
code === "__ALL__" ? (
<option key="__ALL__" value="__ALL__" style={{ fontWeight: 700 }}>
<option
key="__ALL__"
value="__ALL__"
style={{ fontWeight: 700 }}
>
All Projects
</option>
) : (
@ -377,9 +407,16 @@ export default function LiveTracker({
uprn={drawerState.uprn}
landlordPropertyId={drawerState.landlordPropertyId}
dealname={drawerState.dealname}
docStatus={drawerState.uprn ? docStatusMap[drawerState.uprn] : undefined}
docStatus={
drawerState.uprn ? docStatusMap[drawerState.uprn] : undefined
}
onClose={() =>
setDrawerState({ open: false, uprn: null, landlordPropertyId: null, dealname: null })
setDrawerState({
open: false,
uprn: null,
landlordPropertyId: null,
dealname: null,
})
}
/>