fix: alert ui incorrectly using termix css and fixed issue with alert system not loading

This commit is contained in:
LukeGus
2026-06-26 02:55:40 -05:00
parent 98195ec5c3
commit eb49f197ca
2 changed files with 23 additions and 18 deletions
+7 -1
View File
@@ -25,6 +25,7 @@ import { AdminSettingsPanel } from "@/sidebar/AdminSettingsPanel";
import { CredentialsPanel } from "@/sidebar/CredentialsPanel"; import { CredentialsPanel } from "@/sidebar/CredentialsPanel";
import { SplitView } from "@/shell/SplitView"; import { SplitView } from "@/shell/SplitView";
import { renderTabContent } from "@/shell/tabUtils"; import { renderTabContent } from "@/shell/tabUtils";
import { AlertManager } from "@/dashboard/panels/alerts/AlertManager";
import { TabBar } from "@/shell/TabBar"; import { TabBar } from "@/shell/TabBar";
import type { import type {
Tab, Tab,
@@ -207,6 +208,7 @@ export function AppShell({
const [hostsLoading, setHostsLoading] = useState(true); const [hostsLoading, setHostsLoading] = useState(true);
const [allHosts, setAllHosts] = useState<Host[]>([]); const [allHosts, setAllHosts] = useState<Host[]>([]);
const [isAdmin, setIsAdmin] = useState(false); const [isAdmin, setIsAdmin] = useState(false);
const [userId, setUserId] = useState<string | null>(null);
const [backgroundTabRecords, setBackgroundTabRecords] = useState< const [backgroundTabRecords, setBackgroundTabRecords] = useState<
OpenTabRecord[] OpenTabRecord[]
>([]); >([]);
@@ -246,7 +248,10 @@ export function AppShell({
useEffect(() => { useEffect(() => {
getUserInfo() getUserInfo()
.then((info) => setIsAdmin(info.is_admin)) .then((info) => {
setIsAdmin(info.is_admin);
setUserId(info.userId);
})
.catch(() => setIsAdmin(false)); .catch(() => setIsAdmin(false));
}, []); }, []);
@@ -1702,6 +1707,7 @@ export function AppShell({
}} }}
/> />
<TransferMonitor /> <TransferMonitor />
<AlertManager userId={userId} loggedIn={!!username} />
</> </>
); );
} }
+16 -17
View File
@@ -32,16 +32,19 @@ const getAlertIcon = (type?: string) => {
} }
}; };
const getAccentBarClass = (priority?: string, type?: string): string => { const getAccentBorderClass = (priority?: string, type?: string): string => {
if (priority === "critical" || type === "error") return "bg-destructive"; if (priority === "critical" || type === "error")
if (priority === "high" || type === "warning") return "bg-accent-brand"; return "border-t-2 border-t-destructive";
if (priority === "medium" || type === "success") return "bg-green-400"; if (priority === "high" || type === "warning")
return "bg-border"; return "border-t-2 border-t-accent-brand";
if (priority === "medium" || type === "success")
return "border-t-2 border-t-green-400";
return "";
}; };
const getPriorityBadgeVariant = ( const getPriorityBadgeVariant = (
priority?: string, priority?: string,
): "destructive" | "secondary" | "outline" => { ): "destructive" | "secondary" | "default" => {
switch (priority) { switch (priority) {
case "critical": case "critical":
case "high": case "high":
@@ -50,13 +53,13 @@ const getPriorityBadgeVariant = (
return "secondary"; return "secondary";
case "low": case "low":
default: default:
return "outline"; return "default";
} }
}; };
const getTypeBadgeVariant = ( const getTypeBadgeVariant = (
type?: string, type?: string,
): "destructive" | "secondary" | "outline" => { ): "destructive" | "secondary" | "default" => {
switch (type) { switch (type) {
case "error": case "error":
return "destructive"; return "destructive";
@@ -65,7 +68,7 @@ const getTypeBadgeVariant = (
case "success": case "success":
case "info": case "info":
default: default:
return "outline"; return "default";
} }
}; };
@@ -86,13 +89,9 @@ export function AlertCard({
}; };
return ( return (
<div className="w-full border border-edge rounded-md !bg-elevated overflow-hidden"> <div
<div className={`w-full border border-foreground/10 rounded-none bg-card overflow-hidden ${getAccentBorderClass(alert.priority, alert.type)}`}
className={ >
"h-1 w-full " + getAccentBarClass(alert.priority, alert.type)
}
/>
<div className="flex items-start justify-between px-4 pt-4 pb-2"> <div className="flex items-start justify-between px-4 pt-4 pb-2">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
{getAlertIcon(alert.type)} {getAlertIcon(alert.type)}
@@ -123,7 +122,7 @@ export function AlertCard({
</div> </div>
)} )}
<div className="mx-3 mb-3 border border-edge rounded-md px-3 py-3 !bg-canvas"> <div className="mx-3 mb-3 border border-foreground/10 px-3 py-3 bg-background">
<p className="text-sm text-muted-foreground leading-relaxed whitespace-pre-wrap"> <p className="text-sm text-muted-foreground leading-relaxed whitespace-pre-wrap">
{alert.message} {alert.message}
</p> </p>