Updated Incident Management Overview Cards linear-gradient

This commit is contained in:
aa123456
2025-07-17 16:36:00 +07:00
parent 2de3a17967
commit 88877a9fc0
2 changed files with 32 additions and 5 deletions
@@ -18,6 +18,7 @@ interface OverviewCardProps {
valueClassName?: string; valueClassName?: string;
isLoading?: boolean; isLoading?: boolean;
color?: string; color?: string;
gradient?: string;
} }
export const OverviewCard = ({ export const OverviewCard = ({
@@ -30,11 +31,15 @@ export const OverviewCard = ({
valueClassName, valueClassName,
isLoading = false, isLoading = false,
color = "blue", color = "blue",
gradient,
}: OverviewCardProps) => { }: OverviewCardProps) => {
const { theme } = useTheme(); const { theme } = useTheme();
// Map color prop to gradient colors // Map color prop to gradient colors
const getGradientBackground = () => { const getGradientBackground = () => {
if (gradient) {
return gradient;
}
const colors = { const colors = {
blue: theme === 'dark' blue: theme === 'dark'
? "linear-gradient(135deg, rgba(25, 118, 210, 0.8) 0%, rgba(66, 165, 245, 0.6) 100%)" ? "linear-gradient(135deg, rgba(25, 118, 210, 0.8) 0%, rgba(66, 165, 245, 0.6) 100%)"
@@ -3,6 +3,7 @@ import React from 'react';
import { AlertCircle, CheckCircle, Clock, AlertTriangle, Flag } from 'lucide-react'; import { AlertCircle, CheckCircle, Clock, AlertTriangle, Flag } from 'lucide-react';
import { useLanguage } from '@/contexts/LanguageContext'; import { useLanguage } from '@/contexts/LanguageContext';
import { OverviewCard } from '../common/OverviewCard'; import { OverviewCard } from '../common/OverviewCard';
import { useTheme } from '@/contexts/ThemeContext';
interface OverviewStatsProps { interface OverviewStatsProps {
unresolved: number; unresolved: number;
@@ -24,6 +25,7 @@ export const OverviewCards: React.FC<OverviewCardsProps> = ({
initialized initialized
}) => { }) => {
const { t } = useLanguage(); const { t } = useLanguage();
const { theme } = useTheme();
return ( return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-6"> <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-6">
@@ -32,35 +34,55 @@ export const OverviewCards: React.FC<OverviewCardsProps> = ({
value={overviewStats.unresolved.toString()} value={overviewStats.unresolved.toString()}
icon={<AlertCircle className="h-5 w-5 text-white" />} icon={<AlertCircle className="h-5 w-5 text-white" />}
isLoading={loading && initialized} isLoading={loading && initialized}
color="red" gradient={
theme === "dark"
? "linear-gradient(135deg, #4b3b37 0%, rgba(239, 83, 80, 0.6) 100%)"
: "linear-gradient(135deg, #4b3b37 0%, rgba(239, 83, 80, 0.6) 100%)"
}
/> />
<OverviewCard <OverviewCard
title={t('criticalIssues')} title={t('criticalIssues')}
value={overviewStats.critical.toString()} value={overviewStats.critical.toString()}
icon={<AlertTriangle className="h-5 w-5 text-white" />} icon={<AlertTriangle className="h-5 w-5 text-white" />}
isLoading={loading && initialized} isLoading={loading && initialized}
color="amber" gradient={
theme === "dark"
? "linear-gradient(135deg, #4b3b37 0%, rgba(255, 183, 77, 0.6) 100%)"
: "linear-gradient(135deg, #4b3b37 0%, rgba(255, 183, 77, 0.6) 100%)"
}
/> />
<OverviewCard <OverviewCard
title={t('highPriority')} title={t('highPriority')}
value={overviewStats.highPriority.toString()} value={overviewStats.highPriority.toString()}
icon={<Flag className="h-5 w-5 text-white" />} icon={<Flag className="h-5 w-5 text-white" />}
isLoading={loading && initialized} isLoading={loading && initialized}
color="orange" gradient={
theme === "dark"
? "linear-gradient(135deg, #4b3b37 0%, rgba(255, 109, 0, 0.6) 100%)"
: "linear-gradient(135deg, #4b3b37 0%, rgba(255, 109, 0, 0.6) 100%)"
}
/> />
<OverviewCard <OverviewCard
title={t('resolvedIncidents')} title={t('resolvedIncidents')}
value={overviewStats.resolved.toString()} value={overviewStats.resolved.toString()}
icon={<CheckCircle className="h-5 w-5 text-white" />} icon={<CheckCircle className="h-5 w-5 text-white" />}
isLoading={loading && initialized} isLoading={loading && initialized}
color="green" gradient={
theme === "dark"
? "linear-gradient(135deg, #4b3b37 0%, rgba(102, 187, 106, 0.6) 100%)"
: "linear-gradient(135deg, #4b3b37 0%, rgba(102, 187, 106, 0.6) 100%)"
}
/> />
<OverviewCard <OverviewCard
title={t('avgResolutionTime')} title={t('avgResolutionTime')}
value={overviewStats.avgResolutionTime} value={overviewStats.avgResolutionTime}
icon={<Clock className="h-5 w-5 text-white" />} icon={<Clock className="h-5 w-5 text-white" />}
isLoading={loading && initialized} isLoading={loading && initialized}
color="blue" gradient={
theme === "dark"
? "linear-gradient(135deg, #4b3b37 0%, rgba(66, 165, 245, 0.6) 100%)"
: "linear-gradient(135deg, #4b3b37 0%, rgba(66, 165, 245, 0.6) 100%)"
}
/> />
</div> </div>
); );