(props: ImpactPanelProps)
| 162 | } |
| 163 | |
| 164 | export default function ImpactPanel(props: ImpactPanelProps): JSX.Element { |
| 165 | const model = props.model; |
| 166 | const tiles = model?.summaryTiles; |
| 167 | const rules = model === undefined ? [] : badgeRules(model); |
| 168 | const testCount = (model?.tests.covering.length ?? 0) + (model?.tests.missing.length ?? 0); |
| 169 | const unresolved = model?.risk === 'low' |
| 170 | && (model.completeness.total === 0 || model.completeness.unmeasured > 0); |
| 171 | |
| 172 | return ( |
| 173 | <div |
| 174 | className="atlas-impact" |
| 175 | data-testid="atlas-impact" |
| 176 | role="dialog" |
| 177 | aria-label={IMPACT_TITLE} |
| 178 | data-mode={props.mode} |
| 179 | data-status={props.status} |
| 180 | data-badge={unresolved ? 'unresolved' : model?.risk ?? ''} |
| 181 | data-tiles={tiles === undefined ? 0 : 5 + tiles.indirect.length} |
| 182 | data-direct={model?.direct.length ?? 0} |
| 183 | data-downstream={model?.downstream.reduce((sum, group) => sum + group.symbols.length, 0) ?? 0} |
| 184 | data-endpoints={model?.endpoints.length ?? 0} |
| 185 | > |
| 186 | <div className="atlas-impact-inner"> |
| 187 | <header className="atlas-impact-head"> |
| 188 | <h2 className="atlas-impact-title">{IMPACT_TITLE}</h2> |
| 189 | <button |
| 190 | type="button" |
| 191 | className="atlas-impact-close" |
| 192 | data-testid="atlas-impact-close" |
| 193 | aria-label={messages.impact.closeLabel} |
| 194 | onClick={props.onClose} |
| 195 | > |
| 196 | {messages.impact.close} |
| 197 | </button> |
| 198 | </header> |
| 199 | <p className="atlas-impact-subline">{IMPACT_SUBLINE}</p> |
| 200 | |
| 201 | <div className="atlas-impact-toolbar" data-testid="atlas-impact-toolbar"> |
| 202 | <span className="atlas-impact-toolbar-label">{IMPACT_MODE_LABEL}</span> |
| 203 | <Hint name="impact-mode-worktree" text={IMPACT_MODE_WORKING_TREE_TOOLTIP}> |
| 204 | <button |
| 205 | type="button" |
| 206 | className="atlas-impact-mode" |
| 207 | data-testid="atlas-impact-mode-worktree" |
| 208 | data-active={props.mode === 'worktree'} |
| 209 | aria-pressed={props.mode === 'worktree'} |
| 210 | onClick={() => props.onMode('worktree')} |
| 211 | > |
| 212 | {IMPACT_MODE_WORKING_TREE} |
| 213 | </button> |
| 214 | </Hint> |
| 215 | <Hint name="impact-mode-since-ref" text={IMPACT_MODE_SINCE_REF_TOOLTIP}> |
| 216 | <button |
| 217 | type="button" |
| 218 | className="atlas-impact-mode" |
| 219 | data-testid="atlas-impact-mode-since-ref" |
| 220 | data-active={props.mode === 'since-ref'} |
| 221 | aria-pressed={props.mode === 'since-ref'} |
nothing calls this directly
no test coverage detected