mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
Co-authored-by: neil <neil@neils-MacBook-Pro.local>
This commit is contained in:
parent
caffd2f347
commit
9ddfd15477
2 changed files with 18 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
|||
import type { GUIPackage } from '$libs/types';
|
||||
import { PackageStates } from '$libs/types';
|
||||
import { getPackage } from '@native';
|
||||
import { inc } from 'semver';
|
||||
import { notificationStore } from '$libs/stores';
|
||||
|
||||
|
||||
export let pkg: GUIPackage;
|
||||
|
@ -56,6 +56,9 @@
|
|||
await onClick();
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
notificationStore.add({
|
||||
message: `Package ${pkg.full_name} v${pkg.version} has been installed.`,
|
||||
});
|
||||
clearTimeout(fakeTimer);
|
||||
fakeLoadingProgress = 100;
|
||||
resolve(null);
|
||||
|
|
|
@ -38,6 +38,19 @@ export default function initNotificationStore() {
|
|||
return {
|
||||
notifications,
|
||||
subscribe,
|
||||
remove
|
||||
remove,
|
||||
add: (partialNotification: Partial<Notification>) => {
|
||||
if (!partialNotification.message) throw new Error("message is required");
|
||||
|
||||
const notification: Notification = {
|
||||
id: nanoid(4),
|
||||
i18n_key: partialNotification.i18n_key || "",
|
||||
type: NotificationType.MESSAGE,
|
||||
message: partialNotification.message || "",
|
||||
...partialNotification
|
||||
};
|
||||
|
||||
update((values) => [notification, ...values]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue