|
|
@ -1,7 +1,6 @@ |
|
|
import type React from 'react'; |
|
|
import type React from 'react'; |
|
|
import { useEffect } from 'react'; |
|
|
import { useEffect } from 'react'; |
|
|
|
|
|
|
|
|
import { AnimatePresence } from 'framer-motion'; |
|
|
|
|
|
import { MdUpgrade } from 'react-icons/md'; |
|
|
import { MdUpgrade } from 'react-icons/md'; |
|
|
import useSWR from 'swr'; |
|
|
import useSWR from 'swr'; |
|
|
|
|
|
|
|
|
@ -38,12 +37,12 @@ export interface Commit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface VersionInfoProps { |
|
|
export interface VersionInfoProps { |
|
|
visible: boolean; |
|
|
modalOpen: boolean; |
|
|
onClose: () => void; |
|
|
onClose: () => void; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export const VersionInfo = ({ |
|
|
export const VersionInfo = ({ |
|
|
visible, |
|
|
modalOpen, |
|
|
onClose, |
|
|
onClose, |
|
|
}: VersionInfoProps): JSX.Element => { |
|
|
}: VersionInfoProps): JSX.Element => { |
|
|
const appState = useAppSelector((state) => state.app); |
|
|
const appState = useAppSelector((state) => state.app); |
|
|
@ -67,13 +66,13 @@ export const VersionInfo = ({ |
|
|
dispatch(setUpdateAvaliable(true)); |
|
|
dispatch(setUpdateAvaliable(true)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, [data]); |
|
|
}, [data, dispatch]); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<AnimatePresence> |
|
|
|
|
|
{visible && ( |
|
|
|
|
|
<Modal |
|
|
<Modal |
|
|
|
|
|
open={modalOpen} |
|
|
title="Version Info" |
|
|
title="Version Info" |
|
|
|
|
|
bgDismiss |
|
|
actions={ |
|
|
actions={ |
|
|
// TODO: Check if version is hosted, and merge pwa update button here
|
|
|
// TODO: Check if version is hosted, and merge pwa update button here
|
|
|
appState.updateAvaliable && ( |
|
|
appState.updateAvaliable && ( |
|
|
@ -98,9 +97,7 @@ export const VersionInfo = ({ |
|
|
}`}
|
|
|
}`}
|
|
|
> |
|
|
> |
|
|
<div className="my-auto text-xs dark:text-gray-400"> |
|
|
<div className="my-auto text-xs dark:text-gray-400"> |
|
|
{new Date( |
|
|
{new Date(commit.commit.committer.date).toLocaleDateString()} |
|
|
commit.commit.committer.date, |
|
|
|
|
|
).toLocaleDateString()} |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<div className="my-auto font-mono text-sm"> |
|
|
<div className="my-auto font-mono text-sm"> |
|
|
{commit.sha.substring(0, 7)} |
|
|
{commit.sha.substring(0, 7)} |
|
|
@ -110,7 +107,5 @@ export const VersionInfo = ({ |
|
|
))} |
|
|
))} |
|
|
</div> |
|
|
</div> |
|
|
</Modal> |
|
|
</Modal> |
|
|
)} |
|
|
|
|
|
</AnimatePresence> |
|
|
|
|
|
); |
|
|
); |
|
|
}; |
|
|
}; |
|
|
|