-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nick/neos 617 when navigating to the app after a while seems to just …
…land (#1080)
- Loading branch information
Showing
4 changed files
with
77 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,23 @@ | ||
'use client'; | ||
import AccountPageRedirect from '@/components/AccountPageRedirect'; | ||
import OverviewContainer from '@/components/containers/OverviewContainer'; | ||
import PageHeader from '@/components/headers/PageHeader'; | ||
import { useAccount } from '@/components/providers/account-provider'; | ||
import SkeletonTable from '@/components/skeleton/SkeletonTable'; | ||
import { Skeleton } from '@/components/ui/skeleton'; | ||
import Error from 'next/error'; | ||
import { useRouter } from 'next/navigation'; | ||
import { ReactElement, useEffect } from 'react'; | ||
import { ReactElement } from 'react'; | ||
|
||
export default function AccountPage(): ReactElement { | ||
const router = useRouter(); | ||
const { account, isLoading } = useAccount(); | ||
|
||
useEffect(() => { | ||
if (isLoading || !account?.name) { | ||
return; | ||
} | ||
router.push(`/${account.name}/jobs`); | ||
}, [isLoading, account?.name, account?.id]); | ||
|
||
if (isLoading) { | ||
return <Skeleton className="w-full h-full py-2" />; | ||
} | ||
|
||
if (!account) { | ||
return <Error statusCode={404} />; | ||
} | ||
|
||
const { account } = useAccount(); | ||
return ( | ||
<OverviewContainer | ||
Header={<PageHeader header={`Home - ${account.name}`} />} | ||
containerClassName="home-page" | ||
> | ||
<div className="flex flex-col gap-4"> | ||
<SkeletonTable /> | ||
</div> | ||
</OverviewContainer> | ||
<AccountPageRedirect> | ||
<OverviewContainer | ||
Header={<PageHeader header={`Home - ${account?.name}`} />} | ||
containerClassName="home-page" | ||
> | ||
<div className="flex flex-col gap-4"> | ||
<SkeletonTable /> | ||
</div> | ||
</OverviewContainer> | ||
</AccountPageRedirect> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
import AccountPageRedirect from '@/components/AccountPageRedirect'; | ||
import OverviewContainer from '@/components/containers/OverviewContainer'; | ||
import PageHeader from '@/components/headers/PageHeader'; | ||
import SkeletonTable from '@/components/skeleton/SkeletonTable'; | ||
import { ReactElement } from 'react'; | ||
import BaseLayout from './BaseLayout'; | ||
import AccountPage from './[account]/page'; | ||
|
||
export default function Home(): ReactElement { | ||
return ( | ||
<BaseLayout> | ||
<AccountPage /> | ||
<AccountPageRedirect> | ||
<OverviewContainer | ||
Header={<PageHeader header={`Home`} />} | ||
containerClassName="home-page" | ||
> | ||
<div className="flex flex-col gap-4"> | ||
<SkeletonTable /> | ||
</div> | ||
</OverviewContainer> | ||
</AccountPageRedirect> | ||
</BaseLayout> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use client'; | ||
|
||
import Error from 'next/error'; | ||
import { useRouter } from 'next/navigation'; | ||
import { ReactNode, useEffect } from 'react'; | ||
import { useAccount } from './providers/account-provider'; | ||
import { Skeleton } from './ui/skeleton'; | ||
|
||
interface Props { | ||
children: ReactNode; | ||
} | ||
|
||
export default function AccountPageRedirect(props: Props): JSX.Element { | ||
const { children } = props; | ||
|
||
const router = useRouter(); | ||
const { account, isLoading } = useAccount(); | ||
|
||
useEffect(() => { | ||
if (isLoading || !account?.name) { | ||
return; | ||
} | ||
router.push(`/${account.name}/jobs`); | ||
}, [isLoading, account?.name, account?.id]); | ||
|
||
if (isLoading) { | ||
return <Skeleton className="w-full h-full py-2" />; | ||
} | ||
|
||
if (!account) { | ||
return <Error statusCode={404} />; | ||
} | ||
|
||
return <>{children}</>; | ||
} |
7d3e9ad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
neosync-marketing – ./marketing
neosync-marketing-neosync.vercel.app
www.neosync.dev
neosync-marketing-git-main-neosync.vercel.app
neosync-marketing-app.vercel.app
neosync.dev