larxius commited on
Commit
073ea6b
·
verified ·
1 Parent(s): 2f8096f

Update frontend/src/pages/Dashboard.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/pages/Dashboard.jsx +77 -29
frontend/src/pages/Dashboard.jsx CHANGED
@@ -626,42 +626,90 @@ export const Dashboard = () => {
626
  <h3 className="font-headline-md text-headline-md text-on-surface tracking-tight">Security Score</h3>
627
  <p className="font-body-sm text-body-sm text-on-surface-variant mt-xs">Overall system resilience</p>
628
  </div>
629
- <div className="flex-grow flex flex-col items-center justify-center py-xl">
630
- <div className="relative w-48 h-48 flex items-center justify-center">
631
- <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
632
- <circle cx="50" cy="50" fill="none" r="45" stroke="#e5eeff" strokeWidth="8"></circle>
633
- </svg>
634
- <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
635
- <circle
636
- className="transition-all duration-1000 ease-out"
637
- cx="50" cy="50" fill="none" r="45"
638
- stroke={!hasCompletedScans ? '#94a3b8' : score < 50 ? '#ba1a1a' : score < 80 ? '#bc4800' : '#004ac6'}
639
- strokeDasharray="283"
640
- strokeDashoffset={dashOffset}
641
- strokeLinecap="round"
642
- strokeWidth="8"
643
- />
644
- </svg>
645
- <div className="text-center flex flex-col items-center z-10">
646
- <span className={`font-display-lg text-display-lg tracking-tighter ${hasCompletedScans ? 'text-primary' : 'text-slate-400'}`}>
647
- {scoreDisplay}
648
- </span>
649
- <span className={`font-label-sm text-label-sm uppercase tracking-widest px-xs py-[2px] rounded-sm mt-xs ${scoreColorClass}`}>
650
- {scoreLabel}
651
- </span>
652
- <span className="font-label-sm text-label-sm text-on-surface-variant/70 mt-base">
653
- {scoreSubtext}
654
- </span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  </div>
656
  </div>
657
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  <div className="flex items-center justify-between text-body-sm font-body-sm border-t border-outline-variant pt-sm mt-sm">
659
  <span className="text-on-surface-variant">Live security posture</span>
660
  <span className={`font-medium flex items-center ${
661
- !hasCompletedScans ? 'text-slate-500' : score >= 80 ? 'text-green-600' : score >= 50 ? 'text-orange-600' : 'text-error'
662
  }`}>
663
  <span className="material-symbols-outlined text-[16px] mr-[2px]">
664
- {!hasCompletedScans ? 'sensors_off' : score >= 80 ? 'trending_up' : score >= 50 ? 'trending_flat' : 'trending_down'}
665
  </span>
666
  {!hasCompletedScans ? 'Pending Initial Scan' : score >= 80 ? 'Stable' : score >= 50 ? 'Needs Attention' : 'Critical Risk'}
667
  </span>
 
626
  <h3 className="font-headline-md text-headline-md text-on-surface tracking-tight">Security Score</h3>
627
  <p className="font-body-sm text-body-sm text-on-surface-variant mt-xs">Overall system resilience</p>
628
  </div>
629
+
630
+ {!hasCompletedScans ? (
631
+ <div className="flex-grow flex flex-col items-center justify-center py-md text-center">
632
+ <div className="relative w-44 h-44 flex items-center justify-center my-xs">
633
+ {/* Track Circle */}
634
+ <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
635
+ <circle cx="50" cy="50" fill="none" r="42" stroke="currentColor" strokeWidth="6" className="text-slate-200 dark:text-slate-700/60" />
636
+ </svg>
637
+ {/* Sleek Dashed Radar Ring */}
638
+ <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
639
+ <circle
640
+ cx="50" cy="50" fill="none" r="42"
641
+ stroke="#94a3b8"
642
+ strokeDasharray="6 4"
643
+ strokeWidth="6"
644
+ className="opacity-40"
645
+ />
646
+ </svg>
647
+
648
+ {/* Inner Content */}
649
+ <div className="text-center flex flex-col items-center justify-center z-10 px-xs">
650
+ <div className="w-8 h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center mb-1 text-slate-400 dark:text-slate-500 shadow-inner">
651
+ <span className="material-symbols-outlined text-[18px]">shield</span>
652
+ </div>
653
+ <span className="font-extrabold text-2xl tracking-tight text-slate-400 dark:text-slate-500 leading-none mb-1.5">
654
+ N/A
655
+ </span>
656
+ <span className="inline-block px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wider uppercase bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20">
657
+ NOT TESTED YET
658
+ </span>
659
+ </div>
660
+ </div>
661
+
662
+ {/* Subtext and Action */}
663
+ <div className="mt-1 flex flex-col items-center gap-2">
664
+ <p className="text-body-sm text-on-surface-variant font-medium">
665
+ No security audit performed on this workspace yet.
666
+ </p>
667
+ <button
668
+ onClick={() => navigate('/dashboard/new-scan')}
669
+ className="inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-xs cursor-pointer"
670
+ >
671
+ <span className="material-symbols-outlined text-[15px]">radar</span>
672
+ Run Initial Scan
673
+ </button>
674
  </div>
675
  </div>
676
+ ) : (
677
+ <div className="flex-grow flex flex-col items-center justify-center py-xl">
678
+ <div className="relative w-48 h-48 flex items-center justify-center">
679
+ <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
680
+ <circle cx="50" cy="50" fill="none" r="45" stroke="#e5eeff" strokeWidth="8"></circle>
681
+ </svg>
682
+ <svg className="w-full h-full absolute transform -rotate-90" viewBox="0 0 100 100">
683
+ <circle
684
+ className="transition-all duration-1000 ease-out"
685
+ cx="50" cy="50" fill="none" r="45"
686
+ stroke={score < 50 ? '#ba1a1a' : score < 80 ? '#bc4800' : '#004ac6'}
687
+ strokeDasharray="283"
688
+ strokeDashoffset={dashOffset}
689
+ strokeLinecap="round"
690
+ strokeWidth="8"
691
+ />
692
+ </svg>
693
+ <div className="text-center flex flex-col items-center z-10">
694
+ <span className="font-display-lg text-display-lg text-primary tracking-tighter">{score}</span>
695
+ <span className={`font-label-sm text-label-sm uppercase tracking-widest px-xs py-[2px] rounded-sm mt-xs ${scoreColorClass}`}>
696
+ {scoreLabel}
697
+ </span>
698
+ <span className="font-label-sm text-label-sm text-on-surface-variant/70 mt-base">
699
+ {score >= 80 ? 'System Protected' : 'Remediation Required'}
700
+ </span>
701
+ </div>
702
+ </div>
703
+ </div>
704
+ )}
705
+
706
  <div className="flex items-center justify-between text-body-sm font-body-sm border-t border-outline-variant pt-sm mt-sm">
707
  <span className="text-on-surface-variant">Live security posture</span>
708
  <span className={`font-medium flex items-center ${
709
+ !hasCompletedScans ? 'text-amber-600 dark:text-amber-400' : score >= 80 ? 'text-green-600' : score >= 50 ? 'text-orange-600' : 'text-error'
710
  }`}>
711
  <span className="material-symbols-outlined text-[16px] mr-[2px]">
712
+ {!hasCompletedScans ? 'hourglass_empty' : score >= 80 ? 'trending_up' : score >= 50 ? 'trending_flat' : 'trending_down'}
713
  </span>
714
  {!hasCompletedScans ? 'Pending Initial Scan' : score >= 80 ? 'Stable' : score >= 50 ? 'Needs Attention' : 'Critical Risk'}
715
  </span>