From 59a851f8c86d97a9f2ef871abe71d8a48af6b1ea Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 7 Aug 2023 21:44:39 -0700 Subject: [PATCH] Add new version dialog --- src/renderer/app.tsx | 4 ++- src/renderer/is-updated-dialog.tsx | 51 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/renderer/is-updated-dialog.tsx diff --git a/src/renderer/app.tsx b/src/renderer/app.tsx index 571816e3..792d33cc 100644 --- a/src/renderer/app.tsx +++ b/src/renderer/app.tsx @@ -4,9 +4,11 @@ import { ModuleRegistry } from '@ag-grid-community/core'; import { InfiniteRowModelModule } from '@ag-grid-community/infinite-row-model'; import { MantineProvider } from '@mantine/core'; import { ModalsProvider } from '@mantine/modals'; +import isElectron from 'is-electron'; import { initSimpleImg } from 'react-simple-img'; import { BaseContextModal, toast } from './components'; import { useTheme } from './hooks'; +import { IsUpdatedDialog } from './is-updated-dialog'; import { AppRouter } from './router/app-router'; import { useHotkeySettings, @@ -19,7 +21,6 @@ import { ContextMenuProvider } from '/@/renderer/features/context-menu'; import { useHandlePlayQueueAdd } from '/@/renderer/features/player/hooks/use-handle-playqueue-add'; import { PlayQueueHandlerContext } from '/@/renderer/features/player'; import { AddToPlaylistContextModal } from '/@/renderer/features/playlists'; -import isElectron from 'is-electron'; import { getMpvProperties } from '/@/renderer/features/settings/components/playback/mpv-settings'; import { PlayerState, usePlayerStore, useQueueControls } from '/@/renderer/store'; import { PlaybackType, PlayerStatus } from '/@/renderer/types'; @@ -214,6 +215,7 @@ export const App = () => { + ); }; diff --git a/src/renderer/is-updated-dialog.tsx b/src/renderer/is-updated-dialog.tsx new file mode 100644 index 00000000..f0cdaf55 --- /dev/null +++ b/src/renderer/is-updated-dialog.tsx @@ -0,0 +1,51 @@ +import { useCallback } from 'react'; +import { Group, Stack } from '@mantine/core'; +import { useLocalStorage } from '@mantine/hooks'; +import { RiExternalLinkLine } from 'react-icons/ri'; +import { Button, Dialog, Text } from './components'; +import packageJson from '../../package.json'; + +export const IsUpdatedDialog = () => { + const { version } = packageJson; + + const [value, setValue] = useLocalStorage({ key: 'version' }); + + const handleDismiss = useCallback(() => { + setValue(version); + }, [setValue, version]); + + return ( + + + A new version of Feishin has been installed ({version}) + + + + + + + ); +};