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
love_飞影
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
Hide 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
{
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
{
width
:
100%
;
top
:
50%
;
...
...
@@ -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
{
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
type
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
...
...
@@ -13,26 +11,7 @@ import { YgoCard } from "@/ui/Shared";
import
{
groupBy
}
from
"
../../utils
"
;
import
{
showCardModal
}
from
"
../CardModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
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
,
};
import
styles
from
"
./index.module.scss
"
;
export
interface
SelectCardsModalProps
{
isOpen
:
boolean
;
...
...
@@ -148,88 +127,76 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
</>
}
>
<
div
className=
"check-container"
>
<
Space
direction=
"vertical"
style=
{
{
width
:
"
100%
"
,
overflow
:
"
hidden
"
}
}
>
<
Selector
zoneOptions=
{
zoneOptions
}
selectedZone=
{
selectedZone
}
onChange=
{
setSelectedZone
as
any
}
/>
{
grouped
.
map
(
(
options
,
i
)
=>
options
[
0
]
===
selectedZone
&&
(
<
div
className=
"checkcard-container"
key=
{
i
}
>
<
CheckCard
.
Group
onChange=
{
(
res
)
=>
{
setResult
((
isMultiple
?
res
:
[
res
])
as
any
);
}
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple=
{
isMultiple
}
style=
{
CheckGroupStyle
}
>
{
options
[
1
].
map
((
card
,
j
)
=>
(
<
Tooltip
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
j
}
>
{
/* 这儿必须有一个div,不然tooltip不生效 */
}
<
div
>
<
CheckCard
cover=
{
<
YgoCard
code=
{
card
.
meta
.
id
}
style=
{
YgoCardStyle
as
CSSProperties
}
/>
}
style=
{
CheckCardStyle
}
value=
{
card
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
CheckCard
.
Group
>
</
div
>
)
)
}
<
p
>
<
span
>
{
/* TODO: 这里的字体可以调整下 */
}
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
span
>
</
p
>
<
div
style=
{
CheckGroupStyle
}
>
{
selecteds
.
map
((
card
,
i
)
=>
(
<
Tooltip
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
grouped
.
length
+
i
}
>
<
div
>
<
Card
cover=
{
<
YgoCard
code=
{
card
.
meta
.
id
}
style=
{
YgoCardStyle
as
CSSProperties
}
/>
}
style=
{
CheckCardStyle
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
div
>
</
Space
>
</
div
>
<
Space
direction=
"vertical"
style=
{
{
width
:
"
100%
"
,
overflow
:
"
hidden
"
}
}
>
<
Selector
zoneOptions=
{
zoneOptions
}
selectedZone=
{
selectedZone
}
onChange=
{
setSelectedZone
as
any
}
/>
{
grouped
.
map
(
(
options
,
i
)
=>
options
[
0
]
===
selectedZone
&&
(
<
div
className=
{
styles
[
"
checkcard-container
"
]
}
key=
{
i
}
>
<
CheckCard
.
Group
onChange=
{
(
res
)
=>
{
setResult
((
isMultiple
?
res
:
[
res
])
as
any
);
}
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple=
{
isMultiple
}
className=
{
styles
[
"
check-group
"
]
}
>
{
options
[
1
].
map
((
card
,
j
)
=>
(
<
Tooltip
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
j
}
>
{
/* 这儿必须有一个div,不然tooltip不生效 */
}
<
div
>
<
CheckCard
cover=
{
<
YgoCard
code=
{
card
.
meta
.
id
}
className=
{
styles
.
card
}
/>
}
className=
{
styles
[
"
check-card
"
]
}
value=
{
card
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
CheckCard
.
Group
>
</
div
>
)
)
}
<
p
>
<
span
>
{
/* TODO: 这里的字体可以调整下 */
}
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
span
>
</
p
>
<
div
className=
{
styles
[
"
check-group
"
]
}
>
{
selecteds
.
map
((
card
,
i
)
=>
(
<
Tooltip
title=
{
card
.
effectDesc
}
placement=
"bottom"
key=
{
grouped
.
length
+
i
}
>
<
div
>
<
Card
cover=
{
<
YgoCard
code=
{
card
.
meta
.
id
}
className=
{
styles
.
card
}
/>
}
className=
{
styles
[
"
check-card
"
]
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
div
>
</
Space
>
</
NeosModal
>
);
};
...
...
src/ui/Shared/YgoCard/index.tsx
View file @
88119219
...
...
@@ -19,7 +19,7 @@ export const YgoCard: React.FC<Props> = (props) => {
className
,
code
=
0
,
isBack
=
false
,
width
=
80
,
width
,
style
,
onClick
=
()
=>
{},
}
=
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