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
88119219
Commit
88119219
authored
Jul 19, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 5%
parent
361c3398
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
117 deletions
+95
-117
src/ui/Duel/Message/SelectCardsModal/index.module.scss
src/ui/Duel/Message/SelectCardsModal/index.module.scss
+22
-11
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+72
-105
src/ui/Shared/YgoCard/index.tsx
src/ui/Shared/YgoCard/index.tsx
+1
-1
No files found.
src/ui/Duel/Message/SelectCardsModal/index.scss
→
src/ui/Duel/Message/SelectCardsModal/index.
module.
scss
View file @
88119219
.checkcard-container
{
.checkcard-container
{
position
:
relative
;
position
:
relative
;
// padding-left: 10px;
// &::after {
// position: absolute;
// width: 3px;
// height: 100%;
// content: "";
// z-index: 1;
// left: 0;
// top: 0;
// background-color: rgb(0, 54, 189);
// }
.btns
{
.btns
{
width
:
100%
;
width
:
100%
;
top
:
50%
;
top
:
50%
;
...
@@ -43,3 +32,25 @@
...
@@ -43,3 +32,25 @@
}
}
}
}
}
}
.check-group
{
display
:
grid
;
grid-template-columns
:
repeat
(
5
,
1fr
);
gap
:
10px
;
}
.check-card
{
width
:
100px
;
aspect-ratio
:
var
(
--
card-ratio
);
margin-inline-end
:
0
;
margin-block-end
:
0
;
flex-shrink
:
0
;
}
.card
{
width
:
100%
;
height
:
100%
;
position
:
absolute
;
left
:
0
;
top
:
0
;
}
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
88119219
import
"
./index.scss
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
Button
,
Card
,
Segmented
,
Space
,
Tooltip
}
from
"
antd
"
;
import
{
Button
,
Card
,
Segmented
,
Space
,
Tooltip
}
from
"
antd
"
;
import
{
CSSProperties
,
useEffect
,
useState
}
from
"
react
"
;
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
INTERNAL_Snapshot
as
Snapshot
,
useSnapshot
}
from
"
valtio
"
;
import
{
INTERNAL_Snapshot
as
Snapshot
,
useSnapshot
}
from
"
valtio
"
;
import
type
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
import
type
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
...
@@ -13,26 +11,7 @@ import { YgoCard } from "@/ui/Shared";
...
@@ -13,26 +11,7 @@ import { YgoCard } from "@/ui/Shared";
import
{
groupBy
}
from
"
../../utils
"
;
import
{
groupBy
}
from
"
../../utils
"
;
import
{
showCardModal
}
from
"
../CardModal
"
;
import
{
showCardModal
}
from
"
../CardModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
const
YgoCardStyle
=
{
width
:
"
100%
"
,
height
:
"
100%
"
,
position
:
"
absolute
"
,
left
:
0
,
top
:
0
,
};
const
CheckCardStyle
=
{
width
:
100
,
aspectRatio
:
5.9
/
8.6
,
marginInlineEnd
:
0
,
marginBlockEnd
:
0
,
flexShrink
:
0
,
};
const
CheckGroupStyle
=
{
display
:
"
grid
"
,
gridTemplateColumns
:
"
repeat(5, 1fr)
"
,
gap
:
10
,
};
export
interface
SelectCardsModalProps
{
export
interface
SelectCardsModalProps
{
isOpen
:
boolean
;
isOpen
:
boolean
;
...
@@ -148,11 +127,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -148,11 +127,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
</>
</>
}
}
>
>
<
div
className=
"check-container"
>
<
Space
direction=
"vertical"
style=
{
{
width
:
"
100%
"
,
overflow
:
"
hidden
"
}
}
>
<
Space
direction=
"vertical"
style=
{
{
width
:
"
100%
"
,
overflow
:
"
hidden
"
}
}
>
<
Selector
<
Selector
zoneOptions=
{
zoneOptions
}
zoneOptions=
{
zoneOptions
}
selectedZone=
{
selectedZone
}
selectedZone=
{
selectedZone
}
...
@@ -161,31 +136,27 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -161,31 +136,27 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
{
grouped
.
map
(
{
grouped
.
map
(
(
options
,
i
)
=>
(
options
,
i
)
=>
options
[
0
]
===
selectedZone
&&
(
options
[
0
]
===
selectedZone
&&
(
<
div
className=
"checkcard-container"
key=
{
i
}
>
<
div
className=
{
styles
[
"
checkcard-container
"
]
}
key=
{
i
}
>
<
CheckCard
.
Group
<
CheckCard
.
Group
onChange=
{
(
res
)
=>
{
onChange=
{
(
res
)
=>
{
setResult
((
isMultiple
?
res
:
[
res
])
as
any
);
setResult
((
isMultiple
?
res
:
[
res
])
as
any
);
}
}
}
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple=
{
isMultiple
}
multiple=
{
isMultiple
}
style=
{
CheckGroupStyle
}
className=
{
styles
[
"
check-group
"
]
}
>
>
{
options
[
1
].
map
((
card
,
j
)
=>
(
{
options
[
1
].
map
((
card
,
j
)
=>
(
<
Tooltip
<
Tooltip
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
j
}
>
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
j
}
>
{
/* 这儿必须有一个div,不然tooltip不生效 */
}
{
/* 这儿必须有一个div,不然tooltip不生效 */
}
<
div
>
<
div
>
<
CheckCard
<
CheckCard
cover=
{
cover=
{
<
YgoCard
<
YgoCard
code=
{
card
.
meta
.
id
}
code=
{
card
.
meta
.
id
}
style=
{
YgoCardStyle
as
CSSProperties
}
className=
{
styles
.
card
}
/>
/>
}
}
style=
{
CheckCardStyle
}
className=
{
styles
[
"
check-card
"
]
}
value=
{
card
}
value=
{
card
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
showCardModal
(
card
);
showCardModal
(
card
);
...
@@ -204,7 +175,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -204,7 +175,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
span
>
</
span
>
</
p
>
</
p
>
<
div
style=
{
CheckGroupStyle
}
>
<
div
className=
{
styles
[
"
check-group
"
]
}
>
{
selecteds
.
map
((
card
,
i
)
=>
(
{
selecteds
.
map
((
card
,
i
)
=>
(
<
Tooltip
<
Tooltip
title=
{
card
.
effectDesc
}
title=
{
card
.
effectDesc
}
...
@@ -214,12 +185,9 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -214,12 +185,9 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<
div
>
<
div
>
<
Card
<
Card
cover=
{
cover=
{
<
YgoCard
<
YgoCard
code=
{
card
.
meta
.
id
}
className=
{
styles
.
card
}
/>
code=
{
card
.
meta
.
id
}
style=
{
YgoCardStyle
as
CSSProperties
}
/>
}
}
style=
{
CheckCardStyle
}
className=
{
styles
[
"
check-card
"
]
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
showCardModal
(
card
);
showCardModal
(
card
);
}
}
}
}
...
@@ -229,7 +197,6 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -229,7 +197,6 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
))
}
))
}
</
div
>
</
div
>
</
Space
>
</
Space
>
</
div
>
</
NeosModal
>
</
NeosModal
>
);
);
};
};
...
...
src/ui/Shared/YgoCard/index.tsx
View file @
88119219
...
@@ -19,7 +19,7 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -19,7 +19,7 @@ export const YgoCard: React.FC<Props> = (props) => {
className
,
className
,
code
=
0
,
code
=
0
,
isBack
=
false
,
isBack
=
false
,
width
=
80
,
width
,
style
,
style
,
onClick
=
()
=>
{},
onClick
=
()
=>
{},
}
=
props
;
}
=
props
;
...
...
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