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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
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
Pipeline
#20266
passed with stages
in 4 minutes and 32 seconds
Changes
3
Pipelines
1
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 @@
...
@@ -35,6 +35,7 @@
"build"
:
"tsc && vite build"
,
"build"
:
"tsc && vite build"
,
"preview"
:
"vite preview"
,
"preview"
:
"vite preview"
,
"lint"
:
"eslint --ext .ts --ext .tsx src"
,
"lint"
:
"eslint --ext .ts --ext .tsx src"
,
"fmt"
:
"eslint --ext .ts --ext .tsx src --fix"
,
"test"
:
"react-scripts test"
,
"test"
:
"react-scripts test"
,
"eject"
:
"react-scripts eject"
"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";
...
@@ -11,7 +11,7 @@ import React, { useState, ChangeEvent } from "react";
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
"
../styles/core.scss
"
;
import
"
../styles/core.scss
"
;
export
default
function
JoinRoom
()
{
export
default
function
Login
()
{
const
[
player
,
setPlayer
]
=
useState
(
""
);
const
[
player
,
setPlayer
]
=
useState
(
""
);
const
[
passWd
,
setPasswd
]
=
useState
(
""
);
const
[
passWd
,
setPasswd
]
=
useState
(
""
);
const
[
ip
,
setIp
]
=
useState
(
""
);
const
[
ip
,
setIp
]
=
useState
(
""
);
...
...
src/ui/Neos.tsx
View file @
2ba42c05
import
React
from
"
react
"
;
import
React
,
{
Suspense
}
from
"
react
"
;
import
JoinRoom
from
"
./JoinRoom
"
;
import
WaitRoomV2
from
"
./WaitRoom
"
;
import
MoraV2
from
"
./Mora
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
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
()
{
export
default
function
()
{
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
return
(
return
(
<
Routes
>
<
Routes
>
<
Route
path=
"/"
element=
{
<
JoinRoom
/>
}
/>
<
Route
<
Route
path=
"/room/:player/:passWd/:ip"
element=
{
<
WaitRoomV2
/>
}
/>
path=
"/"
<
Route
path=
"/mora/:player/:passWd/:ip"
element=
{
<
MoraV2
/>
}
/>
element=
{
<
Route
path=
"/duel/:player/:passWd/:ip"
element=
{
<
NeosDuel
/>
}
/>
<
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
>
</
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