Files
KAFM-Project/components/dashboard/intelligence/aiAndPredictive.tsx
2026-07-29 14:39:55 +05:30

210 lines
9.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
Zap,
AlertTriangle,
Activity,
Plus,
Sparkles,
ShieldAlert,
} from "lucide-react";
import Button from "@/components/common/button";
import StatCard from "@/components/common/dashStatCard";
import InfoBanner from '@/components/common/infoBanner';
import {Card} from '@/components/common/cardWrapper'; // Assuming Card wrapper location
import { CardHeader } from '@/components/common/cardHeader'; // Assuming CardHeader location
export default function AiPredictivePortal() {
return (
<div className="my-15 text-slate-100 font-sans">
{/* --- HEADER SECTION --- */}
<div className="flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-6">
<div>
<div className="flex items-center gap-2 text-[12px] font-bold tracking-widest uppercase font-mono">
<span className="text-teal-400">Apple One HQ Tower</span>
<span className="text-slate-600"></span>
<span className="text-slate-400">INTELLIGENCE</span>
<span className="text-slate-600"></span>
<span className="text-slate-400">AI</span>
</div>
<h1 className="text-2xl font-bold text-white tracking-tight mt-2">
AI & predictive intelligence
</h1>
<p className="text-sm font-medium text-slate-400 mt-2 max-w-xl leading-relaxed">
Real-time asset metrics, fault detection & diagnosis, predictive maintenance alerts and energy-saving intelligence continuously learning.
</p>
</div>
{/* --- HEADER BUTTONS --- */}
<div className="flex items-center gap-3 self-start md:mt-10">
<Button className="bg-[#0b1727] hover:bg-slate-800/60 text-slate-200 border border-slate-800 text-xs px-4 py-2 rounded-lg flex items-center gap-2 font-semibold transition-colors">
<Sparkles className="w-4 h-4 text-slate-300" />
<span>Model insights</span>
</Button>
<Button className="bg-[#2dd4bf] hover:bg-teal-300 text-slate-950 font-bold text-xs px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<Plus className="w-4 h-4 stroke-[3]" />
<span>Action alert</span>
</Button>
</div>
</div>
{/* --- STAT CARDS --- */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
{/* Card 1: Predicted failures */}
<StatCard
variant="icon"
title="Predicted failures"
value="1"
icon={ShieldAlert}
badgeText="≤ 30 days"
badgeClassName="text-rose-400 lowercase font-mono"
iconContainerClassName="bg-rose-950/40 border-rose-800/30 text-rose-400"
/>
{/* Card 2: Savings opportunity */}
<StatCard
variant="icon"
title="Savings opportunity"
value="₹3.5 L"
icon={Zap}
badgeText="per month"
badgeClassName="text-emerald-400 lowercase font-mono"
iconContainerClassName="bg-emerald-950/40 border-emerald-800/30 text-emerald-400"
/>
{/* Card 3: Active anomalies */}
<StatCard
variant="icon"
title="Active anomalies"
value="4"
icon={AlertTriangle}
badgeText="flagged"
badgeClassName="text-amber-400 lowercase font-mono"
iconContainerClassName="bg-amber-950/40 border-amber-800/30 text-amber-400"
/>
{/* Card 4: Model confidence */}
<StatCard
variant="icon"
title="Model confidence"
value="87%"
icon={Activity}
badgeText="average"
badgeClassName="text-slate-400 lowercase font-mono"
iconContainerClassName="bg-blue-950/50 border-blue-800/30 text-blue-400"
/>
</div>
{/* --- CARDS SECTION BELOW STATCARDS --- */}
<div className="grid grid-cols-1 lg:grid-cols-12 gap-6 mb-6">
{/* Left Card: Predictive maintenance alerts */}
<Card className="lg:col-span-7 bg-[#0b1727] border border-slate-800/80 p-5 rounded-xl">
<CardHeader
title="Predictive maintenance alerts"
subtitle="ML · condition-based"
/>
<div className="divide-y divide-slate-800/60 mt-4">
<div className="py-3 flex items-start justify-between">
<div className="flex items-start gap-3">
<span className="w-2 h-2 rounded-full bg-rose-500 mt-2 shrink-0" />
<div>
<h4 className="text-sm font-semibold text-slate-100">Chiller-02 compressor</h4>
<p className="text-xs text-slate-400 mt-0.5">Bearing wear likely failure in ~18 days</p>
</div>
</div>
<div className="text-right">
<span className="text-xs font-semibold text-rose-400">91%</span>
<p className="text-[10px] text-slate-500">confidence</p>
</div>
</div>
<div className="py-3 flex items-start justify-between">
<div className="flex items-start gap-3">
<span className="w-2 h-2 rounded-full bg-amber-400 mt-2 shrink-0" />
<div>
<h4 className="text-sm font-semibold text-slate-100">AHU-07 drive belt</h4>
<p className="text-xs text-slate-400 mt-0.5">Vibration trend rising inspect within 10 days</p>
</div>
</div>
<div className="text-right">
<span className="text-xs font-semibold text-amber-400">78%</span>
<p className="text-[10px] text-slate-500">confidence</p>
</div>
</div>
<div className="py-3 flex items-start justify-between">
<div className="flex items-start gap-3">
<span className="w-2 h-2 rounded-full bg-amber-400 mt-2 shrink-0" />
<div>
<h4 className="text-sm font-semibold text-slate-100">DG-01 fuel system</h4>
<p className="text-xs text-slate-400 mt-0.5">Efficiency drop 6% filter service due</p>
</div>
</div>
<div className="text-right">
<span className="text-xs font-semibold text-amber-400">84%</span>
<p className="text-[10px] text-slate-500">confidence</p>
</div>
</div>
<div className="py-3 flex items-start justify-between">
<div className="flex items-start gap-3">
<span className="w-2 h-2 rounded-full bg-blue-400 mt-2 shrink-0" />
<div>
<h4 className="text-sm font-semibold text-slate-100">Lift-03 door motor</h4>
<p className="text-xs text-slate-400 mt-0.5">Cycle-time anomaly monitor</p>
</div>
</div>
<div className="text-right">
<span className="text-xs font-semibold text-blue-400">64%</span>
<p className="text-[10px] text-slate-500">confidence</p>
</div>
</div>
</div>
</Card>
{/* Right Card: Energy intelligence */}
<Card className="lg:col-span-5 bg-[#0b1727] border border-slate-800/80 p-5 rounded-xl">
<CardHeader
title="Energy intelligence"
subtitle="forecast savings"
/>
<div className="mt-4">
<div className="grid grid-cols-12 text-[11px] font-semibold text-slate-400 uppercase tracking-wider pb-2 border-b border-slate-800/60">
<div className="col-span-4">Area</div>
<div className="col-span-5">Recommendation</div>
<div className="col-span-3 text-right">Saving</div>
</div>
<div className="divide-y divide-slate-800/60 text-xs">
<div className="grid grid-cols-12 py-3.5 items-center">
<div className="col-span-4 font-semibold text-slate-200">HVAC scheduling</div>
<div className="col-span-5 text-slate-400">Shift pre-cooling to off-peak</div>
<div className="col-span-3 text-right font-medium text-emerald-400">1.8 L/mo</div>
</div>
<div className="grid grid-cols-12 py-3.5 items-center">
<div className="col-span-4 font-semibold text-slate-200">Lighting</div>
<div className="col-span-5 text-slate-400">Daylight dimming zones L2L5</div>
<div className="col-span-3 text-right font-medium text-emerald-400">0.6 L/mo</div>
</div>
<div className="grid grid-cols-12 py-3.5 items-center">
<div className="col-span-4 font-semibold text-slate-200">Chiller staging</div>
<div className="col-span-5 text-slate-400">Optimise sequencing logic</div>
<div className="col-span-3 text-right font-medium text-emerald-400">1.1 L/mo</div>
</div>
</div>
</div>
</Card>
</div>
<div className="mt-5">
<InfoBanner
boldText='How it works:'
normalText='IoT/BMS sensor streams feed fault-detection models → predictions surface as alerts → one click raises a condition-based PM work order → verified completion feeds back to improve the model.'
/>
</div>
</div>
);
}