Apply new eslint rules; default to prettier for styling

This commit is contained in:
DaneEveritt 2022-06-26 15:13:52 -04:00
parent f22cce8881
commit dc84af9937
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
218 changed files with 3876 additions and 3564 deletions

View file

@ -9,24 +9,21 @@ import { SocketEvent } from '@/components/server/events';
import { useStoreState } from 'easy-peasy';
const SteamDiskSpaceFeature = () => {
const [ visible, setVisible ] = useState(false);
const [ loading ] = useState(false);
const [visible, setVisible] = useState(false);
const [loading] = useState(false);
const status = ServerContext.useStoreState(state => state.status.value);
const status = ServerContext.useStoreState((state) => state.status.value);
const { clearFlashes } = useFlash();
const { connected, instance } = ServerContext.useStoreState(state => state.socket);
const isAdmin = useStoreState(state => state.user.data!.rootAdmin);
const { connected, instance } = ServerContext.useStoreState((state) => state.socket);
const isAdmin = useStoreState((state) => state.user.data!.rootAdmin);
useEffect(() => {
if (!connected || !instance || status === 'running') return;
const errors = [
'steamcmd needs 250mb of free disk space to update',
'0x202 after update job',
];
const errors = ['steamcmd needs 250mb of free disk space to update', '0x202 after update job'];
const listener = (line: string) => {
if (errors.some(p => line.toLowerCase().includes(p))) {
if (errors.some((p) => line.toLowerCase().includes(p))) {
setVisible(true);
}
};
@ -36,41 +33,56 @@ const SteamDiskSpaceFeature = () => {
return () => {
instance.removeListener(SocketEvent.CONSOLE_OUTPUT, listener);
};
}, [ connected, instance, status ]);
}, [connected, instance, status]);
useEffect(() => {
clearFlashes('feature:steamDiskSpace');
}, []);
return (
<Modal visible={visible} onDismissed={() => setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}>
<Modal
visible={visible}
onDismissed={() => setVisible(false)}
closeOnBackground={false}
showSpinnerOverlay={loading}
>
<FlashMessageRender key={'feature:steamDiskSpace'} css={tw`mb-4`} />
{isAdmin ?
{isAdmin ? (
<>
<div css={tw`mt-4 sm:flex items-center`}>
<h2 css={tw`text-2xl mb-4 text-neutral-100 `}>Out of available disk space...</h2>
</div>
<p css={tw`mt-4`}>This server has run out of available disk space and cannot complete the install or update process.</p>
<p css={tw`mt-4`}>Ensure the machine has enough disk space by typing <code css={tw`font-mono bg-neutral-900 rounded py-1 px-2`}>df -h</code> on the machine hosting this server. Delete files or increase the available disk space to resolve the issue.</p>
<p css={tw`mt-4`}>
This server has run out of available disk space and cannot complete the install or update
process.
</p>
<p css={tw`mt-4`}>
Ensure the machine has enough disk space by typing{' '}
<code css={tw`font-mono bg-neutral-900 rounded py-1 px-2`}>df -h</code> on the machine hosting
this server. Delete files or increase the available disk space to resolve the issue.
</p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
:
) : (
<>
<div css={tw`mt-4 sm:flex items-center`}>
<h2 css={tw`text-2xl mb-4 text-neutral-100`}>Out of available disk space...</h2>
</div>
<p css={tw`mt-4`}>This server has run out of available disk space and cannot complete the install or update process. Please get in touch with the administrator(s) and inform them of disk space issues.</p>
<p css={tw`mt-4`}>
This server has run out of available disk space and cannot complete the install or update
process. Please get in touch with the administrator(s) and inform them of disk space issues.
</p>
<div css={tw`mt-8 sm:flex items-center justify-end`}>
<Button onClick={() => setVisible(false)} css={tw`w-full sm:w-auto border-transparent`}>
Close
</Button>
</div>
</>
}
)}
</Modal>
);
};