2020-09-27 09:51:29 +02:00
|
|
|
import React from 'react';
|
2020-08-07 11:27:12 +02:00
|
|
|
import Layout from 'components/layout/Layout';
|
2020-09-29 05:23:42 +02:00
|
|
|
import TestConsole from 'components/pages/TestConsole';
|
2020-09-27 09:51:29 +02:00
|
|
|
import useRequireLogin from 'hooks/useRequireLogin';
|
2022-08-09 19:27:35 +02:00
|
|
|
import useUser from 'hooks/useUser';
|
2020-07-24 04:56:55 +02:00
|
|
|
|
2022-10-27 21:14:34 +02:00
|
|
|
export default function ConsolePage({ enabled, pageDisabled }) {
|
2020-09-27 09:51:29 +02:00
|
|
|
const { loading } = useRequireLogin();
|
2022-08-09 19:27:35 +02:00
|
|
|
const { user } = useUser();
|
2020-08-08 02:19:42 +02:00
|
|
|
|
2022-10-27 21:14:34 +02:00
|
|
|
if (pageDisabled || loading || !enabled || !user?.isAdmin) {
|
2020-09-27 09:51:29 +02:00
|
|
|
return null;
|
2020-09-18 22:40:46 +02:00
|
|
|
}
|
|
|
|
|
2020-07-24 04:56:55 +02:00
|
|
|
return (
|
2022-10-13 01:29:44 +02:00
|
|
|
<Layout>
|
2020-09-29 05:23:42 +02:00
|
|
|
<TestConsole />
|
2020-09-27 09:51:29 +02:00
|
|
|
</Layout>
|
2020-07-24 04:56:55 +02:00
|
|
|
);
|
|
|
|
}
|
2022-10-22 06:33:23 +02:00
|
|
|
|
|
|
|
export async function getServerSideProps() {
|
|
|
|
return {
|
2022-10-27 21:14:34 +02:00
|
|
|
props: {
|
|
|
|
pageDisabled: !!process.env.DISABLE_UI,
|
|
|
|
enabled: !!process.env.ENABLE_TEST_CONSOLE,
|
|
|
|
},
|
2022-10-22 06:33:23 +02:00
|
|
|
};
|
|
|
|
}
|