Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/dashboard/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ export default function Dashboard() {
{displayReport.scores && (
<CriticalBanner
scores={displayReport.scores}
findingsCount={displayReport.topIssues.length}
onViewIssues={() => setActiveTab('issues')}
/>
)}
Expand Down
30 changes: 7 additions & 23 deletions src/dashboard/components/CriticalBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { AlertTriangle, CheckCircle } from 'lucide-react'
import { AlertTriangle } from 'lucide-react'
import { scoreLevel } from '@/lib/scoreLevel'

interface HealthScores {
Expand All @@ -12,9 +12,8 @@ interface HealthScores {
}

interface CriticalBannerProps {
scores: HealthScores
findingsCount: number
onViewIssues: () => void
scores: HealthScores
onViewIssues: () => void
}

const DIM_LABEL: Record<keyof HealthScores, string> = {
Expand All @@ -25,7 +24,10 @@ const DIM_LABEL: Record<keyof HealthScores, string> = {
architecture: 'Architecture',
}

export function CriticalBanner({ scores, findingsCount, onViewIssues }: CriticalBannerProps) {
// A dimension scoring in the critical band (≤ 25) is always surfaced as a
// critical alert — a 0/100 security score is critical whether or not there are
// separately-counted findings, so we never soften it into a reassuring banner.
export function CriticalBanner({ scores, onViewIssues }: CriticalBannerProps) {
const criticalDims = (Object.keys(scores) as (keyof HealthScores)[])
.filter(k => scoreLevel(scores[k]) === 'critical')

Expand All @@ -35,24 +37,6 @@ export function CriticalBanner({ scores, findingsCount, onViewIssues }: Critical
.map(d => `${DIM_LABEL[d]}: ${scores[d]}/100`)
.join(' · ')

const hasFindings = findingsCount > 0

if (!hasFindings) {
return (
<div
className="bg-green-600 text-white px-4 sm:px-6 py-2.5 flex items-center gap-3 text-sm font-medium"
role="status"
aria-label="Low health scores but no active findings"
data-testid="critical-banner"
>
<CheckCircle className="w-4 h-4 flex-shrink-0" aria-hidden="true" />
<strong className="font-bold tracking-wide">LOW SCORES</strong>
<span className="hidden sm:inline text-green-200">—</span>
<span className="text-green-100">{summary} · No active findings</span>
</div>
)
}

return (
<div
className="bg-red-600 text-white px-4 sm:px-6 py-2.5 flex items-center gap-3 text-sm font-medium"
Expand Down
Loading