-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from cboard-org/feature/capture-dashboard-url
Feature/Manage views and URLs
- Loading branch information
Showing
28 changed files
with
796 additions
and
425 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use client'; // Error components must be Client Components | ||
|
||
import { useRouter } from '@/navigation'; | ||
import { useEffect } from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { INITIAL_CONTENT_ID } from '@/dashboard/constants'; | ||
|
||
export default function Error({ | ||
error, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
useEffect(() => { | ||
// Log the error to an error reporting service | ||
console.error('err', error); | ||
setTimeout(() => { | ||
router.push(`/dashboard/${INITIAL_CONTENT_ID}`); | ||
}, 2000); | ||
}, [error, router]); | ||
|
||
return ( | ||
<Box | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignContent: 'center', | ||
alignItems: 'center', | ||
height: '100%', | ||
}} | ||
> | ||
<h1 style={{ color: 'red' }}>ERROR</h1> | ||
<p>{error.message}</p> | ||
<p>you will be redirected to the initial page</p> | ||
</Box> | ||
); | ||
} |
File renamed without changes.
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,13 +1,34 @@ | ||
import { NextIntlClientProvider, useMessages } from 'next-intl'; | ||
import BoardDisplayed from './BoardPage'; | ||
import pick from 'lodash.pick'; | ||
import { BoardRecord } from '@/commonTypes/Board'; | ||
import testBoards from '@/dashboard/@board/testBoard.json'; | ||
import IntlWrapperForAsync from '@/components/IntlWrapperForAsync/IntlWrapperForAsync'; | ||
import { INITIAL_CONTENT_ID, STASHED_CONTENT_ID } from '@/dashboard/constants'; | ||
|
||
export default function Page() { | ||
const messages = useMessages(); | ||
export default async function Page({ | ||
params: { id }, | ||
}: { | ||
params: { id: string }; | ||
}) { | ||
let board: BoardRecord | null = null; | ||
|
||
const preventFetch = id === INITIAL_CONTENT_ID || id === STASHED_CONTENT_ID; | ||
if (!preventFetch) { | ||
try { | ||
await fetch('https://postman-echo.com/delay/2', { | ||
cache: 'no-cache', | ||
}); | ||
board = testBoards[Number(id)]; | ||
if (!board) { | ||
throw new Error('board not found'); | ||
} | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
return ( | ||
<NextIntlClientProvider messages={pick(messages, 'Board')}> | ||
<BoardDisplayed /> | ||
</NextIntlClientProvider> | ||
<IntlWrapperForAsync propertyName="Board"> | ||
<BoardDisplayed remoteInitialBoard={board} id={id} /> | ||
</IntlWrapperForAsync> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.