mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: update codes
This commit is contained in:
parent
0ffc4cb4eb
commit
c9b1591dba
34
frontend/appflowy_web_app/src/components/error/NotFound.tsx
Normal file
34
frontend/appflowy_web_app/src/components/error/NotFound.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Container, Box, Typography, Button } from '@mui/material';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const NotFound = () => {
|
||||||
|
return (
|
||||||
|
<Container component='main' maxWidth='xs'>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
marginTop: 8,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant='h1' component='h1' color='error' gutterBottom>
|
||||||
|
404
|
||||||
|
</Typography>
|
||||||
|
<Typography variant='h5' component='h2' gutterBottom>
|
||||||
|
Page Not Found
|
||||||
|
</Typography>
|
||||||
|
<Typography variant='body1' color='textSecondary'>
|
||||||
|
Sorry, the page you're looking for doesn't exist.
|
||||||
|
</Typography>
|
||||||
|
<Button component={Link} to='https://appflowy.io' variant='contained' color='primary' sx={{ mt: 3 }}>
|
||||||
|
Go to AppFlowy.io
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NotFound;
|
@ -5,6 +5,7 @@ import { AFConfigContext } from '@/components/app/AppConfig';
|
|||||||
import CollabView from '@/components/publish/CollabView';
|
import CollabView from '@/components/publish/CollabView';
|
||||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||||
import { PublishViewHeader } from 'src/components/publish/header';
|
import { PublishViewHeader } from 'src/components/publish/header';
|
||||||
|
import NotFound from '@/components/error/NotFound';
|
||||||
|
|
||||||
export interface PublishViewProps {
|
export interface PublishViewProps {
|
||||||
namespace: string;
|
namespace: string;
|
||||||
@ -23,10 +24,6 @@ export function PublishView({ namespace, publishName }: PublishViewProps) {
|
|||||||
try {
|
try {
|
||||||
doc = await service?.getPublishView(namespace, publishName);
|
doc = await service?.getPublishView(namespace, publishName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!doc) {
|
|
||||||
setNotFound(true);
|
setNotFound(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -38,8 +35,8 @@ export function PublishView({ namespace, publishName }: PublishViewProps) {
|
|||||||
void openPublishView();
|
void openPublishView();
|
||||||
}, [openPublishView]);
|
}, [openPublishView]);
|
||||||
|
|
||||||
if (notFound) {
|
if (notFound && !doc) {
|
||||||
return <div className={'flex h-full w-full items-center justify-center'}>Not found</div>;
|
return <NotFound />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user