Added to auto-redirect to the no projects page

This commit is contained in:
Vladyslav Matsiiako
2023-01-15 16:06:44 -08:00
parent a2689002d3
commit 9a28e5b4bc
3 changed files with 273 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 122 KiB

View File

@ -1,19 +1,40 @@
import { useEffect } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
import Button from '~/components/basic/buttons/Button';
import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
import getWorkspaces from './api/workspace/getWorkspaces';
export default function NoProjects() {
const router = useRouter();
const redirectUser = async () => {
const workspaces = await getWorkspaces();
if (workspaces.length > 0) {
router.push('/dashboard/' + workspaces[0]._id);
}
}
useEffect(() => {
// on initial load - run auth check
(async () => {
await redirectUser()
})();
}, []);
return (
<div className='h-full flex flex-col items-center justify-center text-gray-300 text-lg text-center w-11/12 mr-auto'>
<div className='mb-4 mr-16'>
<div className='mb-6 mt-16 mr-16'>
<Image
src='/images/dragon-cant-find.png'
src='/images/dragon-cant-find.svg'
height={270}
width={436}
alt='google logo'
></Image>
</div>
<div className='p-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl'>
<div className='px-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl py-6'>
<div className='max-w-md'>
You are not part of any projects in this organization yet. When you
do, they will appear here.
@ -22,6 +43,9 @@ export default function NoProjects() {
Create a new project, or ask other organization members to give you
neccessary permissions.
</div>
<div className='mt-6 mx-2'>
<Button text="Check again" onButtonPressed={redirectUser} size="md" color="mineshaft"/>
</div>
</div>
</div>
);