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
e8ac3d50
Commit
e8ac3d50
authored
Aug 08, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: popover 2
parent
fa6626f6
Pipeline
#22953
failed with stages
in 11 minutes and 28 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
12 deletions
+51
-12
src/ui/NewWaitRoom/Popover.tsx
src/ui/NewWaitRoom/Popover.tsx
+8
-4
src/ui/NewWaitRoom/index.tsx
src/ui/NewWaitRoom/index.tsx
+43
-8
No files found.
src/ui/NewWaitRoom/Popover.tsx
View file @
e8ac3d50
...
...
@@ -16,9 +16,9 @@ export enum Tp {
Second
=
2
,
}
export
const
MoraPopover
:
React
.
FC
<
React
.
PropsWithChildren
>
=
({
children
,
})
=>
{
export
const
MoraPopover
:
React
.
FC
<
React
.
PropsWithChildren
<
{
onSelect
?:
(
result
:
Mora
)
=>
void
}
>
>
=
({
children
,
onSelect
})
=>
{
const
[
open
,
setOpen
]
=
useState
(
false
);
// 需要在mora的service之中,emit一个事件,让这个组件监听到,然后打开popover
...
...
@@ -28,6 +28,7 @@ export const MoraPopover: React.FC<React.PropsWithChildren> = ({
const
onClick
=
(
result
:
Mora
)
=>
{
result
;
// 这里send猜拳的结果给服务器
onSelect
?.(
result
);
setOpen
(
false
);
};
...
...
@@ -63,7 +64,9 @@ export const MoraPopover: React.FC<React.PropsWithChildren> = ({
);
};
export
const
TpPopover
:
React
.
FC
<
React
.
PropsWithChildren
>
=
({
children
})
=>
{
export
const
TpPopover
:
React
.
FC
<
React
.
PropsWithChildren
<
{
onSelect
?:
(
result
:
Tp
)
=>
void
}
>
>
=
({
children
,
onSelect
})
=>
{
const
[
open
,
setOpen
]
=
useState
(
false
);
// 需要在mora的service之中,emit一个事件,让这个组件监听到,然后打开popover
...
...
@@ -73,6 +76,7 @@ export const TpPopover: React.FC<React.PropsWithChildren> = ({ children }) => {
const
onClick
=
(
result
:
Tp
)
=>
{
result
;
// 这里send结果给服务器
onSelect
?.(
result
);
setOpen
(
false
);
};
...
...
src/ui/NewWaitRoom/index.tsx
View file @
e8ac3d50
...
...
@@ -23,7 +23,7 @@ import { Background, IconFont, Select, SpecialButton } from "@/ui/Shared";
import
{
Chat
}
from
"
./Chat
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
Mora
Popover
,
TpPopover
}
from
"
./Popover
"
;
import
{
Mora
,
MoraPopover
,
Tp
,
TpPopover
}
from
"
./Popover
"
;
const
NeosConfig
=
useConfig
();
...
...
@@ -50,6 +50,9 @@ export const Component: React.FC = () => {
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
const
room
=
useSnapshot
(
roomStore
);
const
[
myMora
,
setMyMora
]
=
useState
<
Mora
>
();
const
[
opponentMora
,
setOpponentMora
]
=
useState
<
Mora
>
();
return
(
<
ConfigProvider
theme=
{
theme
}
>
<
div
...
...
@@ -85,7 +88,8 @@ export const Component: React.FC = () => {
avatar=
{
user
?.
avatar_url
}
btn=
{
<>
<
Button
{
/* 根据stage显示结果 */
}
{
/* <Button
size="large"
className={styles["btn-join"]}
onClick={() => {
...
...
@@ -103,13 +107,41 @@ export const Component: React.FC = () => {
{room.getMePlayer()?.state === PlayerState.NO_READY
? "决斗准备"
: "取消准备"}
</
Button
>
</Button> */
}
<
div
style=
{
{
marginLeft
:
"
auto
"
}
}
>
{
/* 根据是否有了猜拳结果而显示 */
}
<
Avatar
style=
{
{
marginLeft
:
"
auto
"
}
}
size=
{
48
}
icon=
{
<
IconFont
type=
"icon-hand-rock"
/>
}
/>
{
/* <Skeleton.Avatar active size={48} /> */
}
</
div
>
</>
}
/>
<
PlayerZone
who=
{
Who
.
Op
}
player=
{
room
.
getOpPlayer
()
}
/>
<
PlayerZone
who=
{
Who
.
Op
}
player=
{
room
.
getOpPlayer
()
}
btn=
{
<
div
style=
{
{
marginLeft
:
"
auto
"
}
}
>
{
/* 根据是否有了猜拳结果而显示 */
}
{
/* <Avatar
style={{ marginLeft: "auto" }}
size={48}
icon={<IconFont type="icon-hand-rock" />}
/> */
}
<
Skeleton
.
Avatar
active
size=
{
48
}
/>
</
div
>
<
ActionButton
/>
}
/>
</
div
>
<
ActionButton
onMoraSelect=
{
setMyMora
}
onTpSelect=
{
()
=>
{
// 暂时不知道需不需要 先放着
}
}
/>
</
div
>
</
div
>
</
div
>
...
...
@@ -245,10 +277,13 @@ const SideButtons: React.FC<{
);
};
const
ActionButton
:
React
.
FC
=
()
=>
{
const
ActionButton
:
React
.
FC
<
{
onMoraSelect
:
(
mora
:
Mora
)
=>
void
;
onTpSelect
:
(
tp
:
Tp
)
=>
void
;
}
>
=
({
onMoraSelect
,
onTpSelect
})
=>
{
return
(
<
MoraPopover
>
<
TpPopover
>
<
MoraPopover
onSelect=
{
onMoraSelect
}
>
<
TpPopover
onSelect=
{
onTpSelect
}
>
<
SpecialButton
className=
{
styles
[
"
btns-action
"
]
}
disabled=
{
false
}
>
<>
<
IconFont
type=
"icon-play"
size=
{
12
}
/>
...
...
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