70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
// R-P5 Interim-UI (AD-28) — shared BadgeFeedback color mappings for the
|
|
// integrations screens (status traffic light per D-P5: green active / yellow
|
|
// degraded / red broken / gray revoked|pending). Pure, client-safe.
|
|
|
|
import type { ConnectionStatus, SyncItemStatus, SyncLogSeverity, SyncStatus } from "@hivegrid/view-models";
|
|
|
|
type BadgeColor =
|
|
| "subtle-neutral"
|
|
| "subtle-positive"
|
|
| "subtle-negative"
|
|
| "subtle-warning"
|
|
| "subtle-information";
|
|
|
|
export function connectionStatusBadge(status: ConnectionStatus): BadgeColor {
|
|
switch (status) {
|
|
case "active":
|
|
return "subtle-positive";
|
|
case "degraded":
|
|
return "subtle-warning";
|
|
case "broken":
|
|
return "subtle-negative";
|
|
case "pending":
|
|
return "subtle-information";
|
|
case "revoked":
|
|
return "subtle-neutral";
|
|
}
|
|
}
|
|
|
|
export function syncStatusBadge(status: SyncStatus): BadgeColor {
|
|
switch (status) {
|
|
case "completed":
|
|
return "subtle-positive";
|
|
case "partial":
|
|
return "subtle-warning";
|
|
case "failed":
|
|
return "subtle-negative";
|
|
case "running":
|
|
return "subtle-information";
|
|
case "pending":
|
|
case "cancelled":
|
|
return "subtle-neutral";
|
|
}
|
|
}
|
|
|
|
export function syncItemStatusBadge(status: SyncItemStatus): BadgeColor {
|
|
switch (status) {
|
|
case "synced":
|
|
return "subtle-positive";
|
|
case "failed":
|
|
return "subtle-negative";
|
|
case "pending":
|
|
return "subtle-information";
|
|
case "skipped":
|
|
return "subtle-neutral";
|
|
}
|
|
}
|
|
|
|
export function syncLogSeverityBadge(severity: SyncLogSeverity): BadgeColor {
|
|
switch (severity) {
|
|
case "success":
|
|
return "subtle-positive";
|
|
case "error":
|
|
return "subtle-negative";
|
|
case "warning":
|
|
return "subtle-warning";
|
|
case "info":
|
|
return "subtle-information";
|
|
}
|
|
}
|