Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BBeretta
Neos
Commits
2ba42c05
Commit
2ba42c05
authored
Feb 19, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use lazy loading in router
parent
a4f28261
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
10 deletions
+40
-10
package.json
package.json
+1
-0
src/ui/Login.tsx
src/ui/Login.tsx
+1
-1
src/ui/Neos.tsx
src/ui/Neos.tsx
+38
-9
No files found.
package.json
View file @
2ba42c05
...
...
@@ -35,6 +35,7 @@
"build"
:
"tsc && vite build"
,
"preview"
:
"vite preview"
,
"lint"
:
"eslint --ext .ts --ext .tsx src"
,
"fmt"
:
"eslint --ext .ts --ext .tsx src --fix"
,
"test"
:
"react-scripts test"
,
"eject"
:
"react-scripts eject"
},
...
...
src/ui/
JoinRoom
.tsx
→
src/ui/
Login
.tsx
View file @
2ba42c05
...
...
@@ -11,7 +11,7 @@ import React, { useState, ChangeEvent } from "react";
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
"
../styles/core.scss
"
;
export
default
function
JoinRoom
()
{
export
default
function
Login
()
{
const
[
player
,
setPlayer
]
=
useState
(
""
);
const
[
passWd
,
setPasswd
]
=
useState
(
""
);
const
[
ip
,
setIp
]
=
useState
(
""
);
...
...
src/ui/Neos.tsx
View file @
2ba42c05
import
React
from
"
react
"
;
import
JoinRoom
from
"
./JoinRoom
"
;
import
WaitRoomV2
from
"
./WaitRoom
"
;
import
MoraV2
from
"
./Mora
"
;
import
React
,
{
Suspense
}
from
"
react
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
NeosDuel
from
"
./Duel/main
"
;
const
Login
=
React
.
lazy
(()
=>
import
(
"
./Login
"
));
const
WaitRoom
=
React
.
lazy
(()
=>
import
(
"
./WaitRoom
"
));
const
Mora
=
React
.
lazy
(()
=>
import
(
"
./Mora
"
));
const
NeosDuel
=
React
.
lazy
(()
=>
import
(
"
./Duel/main
"
));
export
default
function
()
{
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
return
(
<
Routes
>
<
Route
path=
"/"
element=
{
<
JoinRoom
/>
}
/>
<
Route
path=
"/room/:player/:passWd/:ip"
element=
{
<
WaitRoomV2
/>
}
/>
<
Route
path=
"/mora/:player/:passWd/:ip"
element=
{
<
MoraV2
/>
}
/>
<
Route
path=
"/duel/:player/:passWd/:ip"
element=
{
<
NeosDuel
/>
}
/>
<
Route
path=
"/"
element=
{
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
Login
/>
</
Suspense
>
}
/>
<
Route
path=
"/room/:player/:passWd/:ip"
element=
{
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
WaitRoom
/>
</
Suspense
>
}
/>
<
Route
path=
"/room/:player/:passWd/:ip"
element=
{
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
Mora
/>
</
Suspense
>
}
/>
<
Route
path=
"/room/:player/:passWd/:ip"
element=
{
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
NeosDuel
/>
</
Suspense
>
}
/>
</
Routes
>
);
}
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