misc_pterodactyl-panel/resources/scripts/components/server/ConflictStateRenderer.tsx
2023-01-17 15:25:28 -07:00

43 lines
1.8 KiB
TypeScript

import ServerInstallSvg from '@/assets/images/server_installing.svg';
import ServerErrorSvg from '@/assets/images/server_error.svg';
import ServerRestoreSvg from '@/assets/images/server_restore.svg';
import ScreenBlock from '@/components/elements/ScreenBlock';
import { ServerContext } from '@/state/server';
export default () => {
const status = ServerContext.useStoreState(state => state.server.data?.status || null);
const isTransferring = ServerContext.useStoreState(state => state.server.data?.isTransferring || false);
const isNodeUnderMaintenance = ServerContext.useStoreState(
state => state.server.data?.isNodeUnderMaintenance || false,
);
return status === 'installing' || status === 'install_failed' || status === 'reinstall_failed' ? (
<ScreenBlock
title={'Running Installer'}
image={ServerInstallSvg}
message={'Your server should be ready soon, please try again in a few minutes.'}
/>
) : status === 'suspended' ? (
<ScreenBlock
title={'Server Suspended'}
image={ServerErrorSvg}
message={'This server is suspended and cannot be accessed.'}
/>
) : isNodeUnderMaintenance ? (
<ScreenBlock
title={'Node under Maintenance'}
image={ServerErrorSvg}
message={'The node of this server is currently under maintenance.'}
/>
) : (
<ScreenBlock
title={isTransferring ? 'Transferring' : 'Restoring from Backup'}
image={ServerRestoreSvg}
message={
isTransferring
? 'Your server is being transferred to a new node, please check back later.'
: 'Your server is currently being restored from a backup, please check back in a few minutes.'
}
/>
);
};