pmtool / src /components /asset-management /SystemDetailsExample.tsx
devarshia5's picture
Upload 487 files
d97b8f9 verified
Raw
History Blame Contribute Delete
4.94 kB
import React from 'react';
import { useSystemDetailsByAsset } from '@/hooks/asset-management/useSystemDetails';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { LoadingSpinner } from './shared';
import { Monitor, Cpu, HardDrive, MemoryStick, Palette } from 'lucide-react';
interface SystemDetailsExampleProps {
assetId: number;
}
const SystemDetailsExample: React.FC<SystemDetailsExampleProps> = ({ assetId }) => {
const { data: systemDetails, isLoading, error } = useSystemDetailsByAsset(assetId);
if (isLoading) {
return (
<Card>
<CardContent className="p-6">
<LoadingSpinner size="md" text="Loading system details..." />
</CardContent>
</Card>
);
}
if (error) {
return (
<Card>
<CardContent className="p-6">
<div className="text-center text-red-600">
Error loading system details: {error.message}
</div>
</CardContent>
</Card>
);
}
if (!systemDetails) {
return (
<Card>
<CardContent className="p-6">
<div className="text-center text-muted-foreground">
No system details found for this asset.
</div>
</CardContent>
</Card>
);
}
return (
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Monitor className="h-5 w-5" />
System Details
<Badge variant="outline">ID: {systemDetails.systemDetailsID}</Badge>
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="space-y-3">
<div className="flex items-center gap-2">
<Monitor className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">System Model</div>
<div className="text-sm text-muted-foreground">{systemDetails.systemModel}</div>
</div>
</div>
<div className="flex items-center gap-2">
<Cpu className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Processor</div>
<div className="text-sm text-muted-foreground">{systemDetails.processor}</div>
</div>
</div>
<div className="flex items-center gap-2">
<MemoryStick className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Installed RAM</div>
<div className="text-sm text-muted-foreground">{systemDetails.installedRAM}</div>
</div>
</div>
<div className="flex items-center gap-2">
<Palette className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Graphics</div>
<div className="text-sm text-muted-foreground">{systemDetails.graphics}</div>
</div>
</div>
</div>
<div className="space-y-3">
<div className="flex items-center gap-2">
<Monitor className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Screen Resolution</div>
<div className="text-sm text-muted-foreground">{systemDetails.screenResolution}</div>
</div>
</div>
<div className="flex items-center gap-2">
<HardDrive className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Disk Model</div>
<div className="text-sm text-muted-foreground">{systemDetails.diskModel}</div>
</div>
</div>
<div className="flex items-center gap-2">
<HardDrive className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Disk Size</div>
<div className="text-sm text-muted-foreground">{systemDetails.diskSize}</div>
</div>
</div>
<div className="flex items-center gap-2">
<Monitor className="h-4 w-4 text-muted-foreground" />
<div>
<div className="text-sm font-medium">Manufacturer</div>
<div className="text-sm text-muted-foreground">{systemDetails.manufacturer}</div>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
);
};
export default SystemDetailsExample;