diff --git a/apps/onelauncher/frontend/src/components/overlay/NotificationToasts.tsx b/apps/onelauncher/frontend/src/components/overlay/NotificationToasts.tsx
index 923fdde2..e0824b22 100644
--- a/apps/onelauncher/frontend/src/components/overlay/NotificationToasts.tsx
+++ b/apps/onelauncher/frontend/src/components/overlay/NotificationToasts.tsx
@@ -1,7 +1,7 @@
import type { NotificationData } from '@/hooks/useNotification';
import useNotifications from '@/hooks/useNotification';
-import { Button } from '@onelauncher/common/components';
-import { XIcon } from '@untitled-theme/icons-react';
+import { Button, Show } from '@onelauncher/common/components';
+import { InfoCircleIcon, XIcon } from '@untitled-theme/icons-react';
import { useCallback, useEffect, useState } from 'react';
import { twMerge } from 'tailwind-merge';
@@ -15,6 +15,8 @@ interface NotificationToastProps {
onRemove: (id: string) => void;
}
+const fractionEnded = (fraction: number | undefined) => fraction !== undefined && fraction >= 0.97;
+
function NotificationToast({ notification, onRemove }: NotificationToastProps) {
const [isVisible, setIsVisible] = useState(false);
const [isRemoving, setIsRemoving] = useState(false);
@@ -41,22 +43,13 @@ function NotificationToast({ notification, onRemove }: NotificationToastProps) {
}, [notification.fraction, handleRemove]);
return (
-
-
-
-
- {notification.title}
-
-
- {notification.message}
-
+
+
+
+
+
+ {notification.title}
+ {notification.message}
- {notification.fraction !== undefined && (
-
);
}
diff --git a/apps/onelauncher/frontend/src/components/overlay/popups/NotificationPopup.tsx b/apps/onelauncher/frontend/src/components/overlay/popups/NotificationPopup.tsx
index 76e59e92..c1e9c9b7 100644
--- a/apps/onelauncher/frontend/src/components/overlay/popups/NotificationPopup.tsx
+++ b/apps/onelauncher/frontend/src/components/overlay/popups/NotificationPopup.tsx
@@ -1,8 +1,7 @@
import type { NotificationData } from '@/hooks/useNotification';
import useNotifications from '@/hooks/useNotification';
-import { Button, Menu, Popup } from '@onelauncher/common/components';
+import { Button, Popup } from '@onelauncher/common/components';
import { XIcon } from '@untitled-theme/icons-react';
-import { Popover } from 'react-aria-components';
interface NotificationItemProps {
id: string;
@@ -60,7 +59,7 @@ function NotificationPopup() {
);
return (
-
+
Notifications
{notificationEntries.length > 0 && (
@@ -86,7 +85,7 @@ function NotificationPopup() {
))}
-
+
);
}
diff --git a/apps/onelauncher/frontend/src/hooks/useNotification.tsx b/apps/onelauncher/frontend/src/hooks/useNotification.tsx
index 3e7a7de7..3d4f4fe8 100644
--- a/apps/onelauncher/frontend/src/hooks/useNotification.tsx
+++ b/apps/onelauncher/frontend/src/hooks/useNotification.tsx
@@ -26,7 +26,7 @@ interface NotificationContextValue {
const defaultContextValue: NotificationContextValue = {
notifications: {},
- setNotifications: () => {},
+ setNotifications: () => { },
};
const NotificationContext = createContext
(defaultContextValue);
@@ -42,13 +42,29 @@ export const NotificationProvider = memo(({ children }: NotificationProviderProp
let cleanup: (() => void) | undefined;
bindings.events.ingress.on((e) => {
- setNotifications(prev => ({
- ...prev,
- [e.id]: {
- title: `${e.ingress_type}`,
- message: e.message,
- },
- }));
+ if (typeof e.ingress_type === 'object') {
+ if ('PrepareCluster' in e.ingress_type) {
+ const { cluster_name } = e.ingress_type.PrepareCluster;
+ setNotifications(prev => ({
+ ...prev,
+ [e.id]: {
+ title: `Preparing ${cluster_name}`,
+ message: e.message,
+ fraction: e.percent ?? undefined,
+ },
+ }));
+ }
+ }
+ else {
+ setNotifications(prev => ({
+ ...prev,
+ [e.id]: {
+ title: `${e.ingress_type}`,
+ message: e.message,
+ fraction: e.percent ?? undefined,
+ },
+ }));
+ }
}).then((u) => {
cleanup = u;
}).catch(console.error);
@@ -81,10 +97,10 @@ function useNotifications(): HookReturn {
console.warn('useNotifications: Using default context (likely due to HMR or missing provider)');
return {
list: {},
- set: () => {},
- create: () => {},
- remove: () => {},
- clear: () => {},
+ set: () => { },
+ create: () => { },
+ remove: () => { },
+ clear: () => { },
};
}
throw new Error('useNotifications must be used within a NotificationProvider');
diff --git a/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx b/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx
index 364edbc0..f722320c 100644
--- a/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx
+++ b/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx
@@ -12,7 +12,7 @@ import { createFileRoute } from '@tanstack/react-router';
import { convertFileSrc } from '@tauri-apps/api/core';
import { open } from '@tauri-apps/plugin-dialog';
import { Edit02Icon, FolderIcon, ImagePlusIcon, Share07Icon, Tool02Icon, Trash01Icon } from '@untitled-theme/icons-react';
-import { useEffect, useState } from 'react';
+import { useState } from 'react';
import { twMerge } from 'tailwind-merge';
import Sidebar from '../settings/route';
diff --git a/apps/onelauncher/frontend/src/routes/app/index.tsx b/apps/onelauncher/frontend/src/routes/app/index.tsx
index d39a6aa9..36637c63 100644
--- a/apps/onelauncher/frontend/src/routes/app/index.tsx
+++ b/apps/onelauncher/frontend/src/routes/app/index.tsx
@@ -11,7 +11,6 @@ import { createFileRoute, Link } from '@tanstack/react-router';
import { convertFileSrc } from '@tauri-apps/api/core';
import { PlayIcon } from '@untitled-theme/icons-react';
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
-import { useEffect } from 'react';
export const Route = createFileRoute('/app/')({
component: RouteComponent,