AeThex-OS/temp-forge-extract/aethex-forge-main/client/lib/aethex-toast.ts
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

151 lines
4 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { toast } from "@/hooks/use-toast";
interface AethexToastOptions {
title?: string;
description?: string;
duration?: number;
accentColor?: string;
}
export const aethexToast = {
success: (options: AethexToastOptions) => {
const normalize = (d?: any) => {
if (d == null) return undefined;
if (typeof d === "string") return d;
if (typeof d === "object") {
if ((d as any).message) return String((d as any).message);
try {
return JSON.stringify(d);
} catch (e) {
return String(d);
}
}
return String(d);
};
return toast({
title: `${options.title || "Success"}`,
description: normalize(options.description),
duration: options.duration || 5000,
variant: "success" as any,
});
},
error: (options: AethexToastOptions) => {
const normalize = (d?: any) => {
if (d == null) return undefined;
if (typeof d === "string") return d;
if (typeof d === "object") {
if ((d as any).message) return String((d as any).message);
try {
return JSON.stringify(d);
} catch (e) {
return String(d);
}
}
return String(d);
};
return toast({
title: `${options.title || "Error"}`,
description: normalize(options.description),
duration: options.duration || 5000,
variant: "destructive",
});
},
warning: (options: AethexToastOptions) => {
const normalize = (d?: any) => {
if (d == null) return undefined;
if (typeof d === "string") return d;
if (typeof d === "object") {
if ((d as any).message) return String((d as any).message);
try {
return JSON.stringify(d);
} catch (e) {
return String(d);
}
}
return String(d);
};
return toast({
title: `⚠️ ${options.title || "Warning"}`,
description: normalize(options.description),
duration: options.duration || 5000,
variant: "warning" as any,
});
},
info: (options: AethexToastOptions) => {
const normalize = (d?: any) => {
if (d == null) return undefined;
if (typeof d === "string") return d;
if (typeof d === "object") {
if ((d as any).message) return String((d as any).message);
try {
return JSON.stringify(d);
} catch (e) {
return String(d);
}
}
return String(d);
};
return toast({
title: ` ${options.title || "Information"}`,
description: normalize(options.description),
duration: options.duration || 5000,
variant: "info" as any,
});
},
aethex: (options: AethexToastOptions) => {
return toast({
title: `${options.title || "AeThex OS"}`,
description: options.description,
duration: options.duration || 6000,
variant: "aethex" as any,
});
},
system: (message: string, accentColor?: string) => {
// If accentColor is provided, use arm variant
if (accentColor) {
return toast({
title: "🔧 AeThex OS",
description: message,
duration: 4000,
variant: "arm" as any,
accentColor: accentColor,
});
}
// Otherwise use default aethex variant
return toast({
title: "🔧 AeThex OS",
description: message,
duration: 4000,
variant: "aethex" as any,
});
},
arm: (options: AethexToastOptions & { accentColor: string }) => {
const normalize = (d?: any) => {
if (d == null) return undefined;
if (typeof d === "string") return d;
if (typeof d === "object") {
if ((d as any).message) return String((d as any).message);
try {
return JSON.stringify(d);
} catch (e) {
return String(d);
}
}
return String(d);
};
return toast({
title: options.title,
description: normalize(options.description),
duration: options.duration || 5000,
variant: "arm" as any,
accentColor: options.accentColor,
});
},
};