Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
919f75af
Commit
919f75af
authored
Dec 22, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update suspense loading
parent
17e90508
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
26 deletions
+14
-26
App.tsx
web/src/App.tsx
+2
-9
Root.tsx
web/src/layouts/Root.tsx
+5
-1
NotFound.tsx
web/src/pages/NotFound.tsx
+7
-16
No files found.
web/src/App.tsx
View file @
919f75af
import
{
useColorScheme
}
from
"@mui/joy"
;
import
{
useColorScheme
}
from
"@mui/joy"
;
import
{
Suspense
,
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
Outlet
}
from
"react-router-dom"
;
import
{
Outlet
}
from
"react-router-dom"
;
import
storage
from
"./helpers/storage"
;
import
storage
from
"./helpers/storage"
;
import
{
getSystemColorScheme
}
from
"./helpers/utils"
;
import
{
getSystemColorScheme
}
from
"./helpers/utils"
;
import
useNavigateTo
from
"./hooks/useNavigateTo"
;
import
useNavigateTo
from
"./hooks/useNavigateTo"
;
import
Loading
from
"./pages/Loading"
;
import
{
useGlobalStore
}
from
"./store/module"
;
import
{
useGlobalStore
}
from
"./store/module"
;
import
{
useUserV1Store
}
from
"./store/v1"
;
import
{
useUserV1Store
}
from
"./store/v1"
;
...
@@ -117,13 +116,7 @@ const App = () => {
...
@@ -117,13 +116,7 @@ const App = () => {
}
}
},
[
mode
]);
},
[
mode
]);
return
loading
?
(
return
loading
?
null
:
<
Outlet
/>;
<
Loading
/>
)
:
(
<
Suspense
fallback=
{
<
Loading
/>
}
>
<
Outlet
/>
</
Suspense
>
);
};
};
export
default
App
;
export
default
App
;
web/src/layouts/Root.tsx
View file @
919f75af
import
{
Suspense
}
from
"react"
;
import
{
Outlet
}
from
"react-router-dom"
;
import
{
Outlet
}
from
"react-router-dom"
;
import
Navigation
from
"@/components/Navigation"
;
import
Navigation
from
"@/components/Navigation"
;
import
useResponsiveWidth
from
"@/hooks/useResponsiveWidth"
;
import
useResponsiveWidth
from
"@/hooks/useResponsiveWidth"
;
import
Loading
from
"@/pages/Loading"
;
function
Root
()
{
function
Root
()
{
const
{
sm
}
=
useResponsiveWidth
();
const
{
sm
}
=
useResponsiveWidth
();
...
@@ -14,7 +16,9 @@ function Root() {
...
@@ -14,7 +16,9 @@ function Root() {
</
div
>
</
div
>
)
}
)
}
<
main
className=
"w-full h-auto flex-grow shrink flex flex-col justify-start items-center"
>
<
main
className=
"w-full h-auto flex-grow shrink flex flex-col justify-start items-center"
>
<
Outlet
/>
<
Suspense
fallback=
{
<
Loading
/>
}
>
<
Outlet
/>
</
Suspense
>
</
main
>
</
main
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/src/pages/NotFound.tsx
View file @
919f75af
import
{
Button
}
from
"@mui/joy"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
{
Link
}
from
"react-router-dom"
;
import
Icon
from
"@/components/Icon"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
const
NotFound
=
()
=>
{
const
NotFound
=
()
=>
{
const
t
=
useTranslate
();
return
(
return
(
<
div
className=
"w-full h-full overflow-y-auto overflow-x-hidden"
>
<
section
className=
"@container w-full max-w-5xl min-h-[100svh] flex flex-col justify-start items-center sm:pt-3 md:pt-6 pb-8"
>
<
div
className=
"w-full h-full flex flex-col justify-center items-center"
>
<
MobileHeader
/>
<
Icon
.
Meh
strokeWidth=
{
1
}
className=
"w-20 h-auto opacity-80 dark:text-gray-300"
/>
<
div
className=
"w-full px-4 grow flex flex-col justify-center items-center sm:px-6"
>
<
p
className=
"mt-4 text-5xl font-mono dark:text-gray-300"
>
404
</
p
>
<
p
className=
"font-medium"
>
{
"The page you are looking for can't be found."
}
</
p
>
<
Link
className=
"mt-4"
to=
"/"
>
<
p
className=
"mt-4 text-[8rem] font-mono dark:text-gray-300"
>
404
</
p
>
<
Button
variant=
"outlined"
startDecorator=
{
<
Icon
.
Home
className=
"w-4 h-auto"
/>
}
>
{
t
(
"router.go-to-home"
)
}
</
Button
>
</
Link
>
</
div
>
</
div
>
</
div
>
</
section
>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment