isFirstOpen message

This commit is contained in:
FTCHD
2025-02-02 12:53:02 +02:00
parent 14251bb885
commit db4b863d50
2 changed files with 17 additions and 0 deletions
+6
View File
@@ -56,6 +56,9 @@ interface PersistedState {
setLicenseKey: (key: string | undefined) => void
licenseValid: boolean
setLicenseValid: (valid: boolean) => void
isFirstOpen: boolean
setIsFirstOpen: (isFirstOpen: boolean) => void
}
const getStorage = (store: LazyStore): StateStorage => ({
@@ -131,6 +134,9 @@ export const usePersistedStore = create<PersistedState>()(
setLicenseKey: (key: string | undefined) => set((_) => ({ licenseKey: key })),
licenseValid: false,
setLicenseValid: (valid: boolean) => set((_) => ({ licenseValid: valid })),
isFirstOpen: true,
setIsFirstOpen: (isFirstOpen: boolean) => set((_) => ({ isFirstOpen })),
}),
{
name: 'store',
+11
View File
@@ -205,5 +205,16 @@ initLoadingTray()
.then(() => waitForHydration())
.then(() => validateInstance())
.then(() => startRclone())
.then(async () => {
const firstOpen = usePersistedStore.getState().isFirstOpen
if (firstOpen) {
await message('Rclone has initialized, you can now find it in the tray menu!', {
title: 'Welcome',
kind: 'info',
okLabel: 'Got it',
})
usePersistedStore.setState({ isFirstOpen: false })
}
})
.then(() => initTray())
.catch(console.error)