Skip to content

Commit

Permalink
change update modal and toast
Browse files Browse the repository at this point in the history
  • Loading branch information
CheatCod committed May 21, 2023
1 parent 4d119b8 commit a82f001
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/components/DashboardLayout/DashboardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,26 @@ export default function DashboardLayout() {
const [showMajorVersionModal, setShowMajorVersionModal] = useState(false);
const [showCoreErrorModal, setShowCoreErrorModal] = useState(false);
const dashboardVersion = packageinfo.version;

// open the error modal is coreConnectionStatus is error for more than 3 seconds
useEffect(() => {
if (coreConnectionStatus === 'error') {
const timeout = setTimeout(() => {
setShowCoreErrorModal(true);
}, 3000);
return () => clearTimeout(timeout);
}else{
} else {
setShowCoreErrorModal(false);
}
}, [coreConnectionStatus]);

const versionMismatchModal = !coreInfoLoading && (
<ConfirmDialog
title={`Major Version Mismatch`}
title={`Update Required!`}
type={'danger'}
isOpen={showMajorVersionModal}
onClose={() => setShowMajorVersionModal(false)}
closeButtonText={'I understand, continue without updating'}
>
<div>
<b>Core Version: </b>
Expand All @@ -58,8 +59,18 @@ export default function DashboardLayout() {
{dashboardVersion}
</div>
<br />
Your dashboard and core have a version mismatch! Please consider
updating to stay up to date with our latest changes.
<p className="text-red-200">
Your dashboard and core is incompatible!
</p>
This can cause unexpected behavior. Please update your core to the latest
version. Visit{' '}
<a
href="https://github.com/Lodestone-Team/lodestone/wiki/Updating"
className="text-blue-200"
>
the wiki
</a>{' '}
for more information.
</ConfirmDialog>
);

Expand Down Expand Up @@ -93,8 +104,12 @@ export default function DashboardLayout() {
setShowMajorVersionModal(true);
else if (patch(clientVersion) !== patch(dashboardVersion))
toast.warn(
`There is a patch version mismatch! Core: ${clientVersion}, Dashboard: ${dashboardVersion}`,
{ toastId: 'patchVersionMismatch' }
`Version mismatch! Is your core out of date? Core: ${clientVersion}, Dashboard: ${dashboardVersion}`,
{
toastId: 'patchVersionMismatch',
autoClose: 10000,
position: 'top-center',
}
);
}
}, [coreInfo?.version]);
Expand Down

0 comments on commit a82f001

Please sign in to comment.