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
35225f7c
Commit
35225f7c
authored
May 12, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
group selectab actions
parent
463345c1
Pipeline
#21609
passed with stages
in 13 minutes and 6 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
23 deletions
+50
-23
src/ui/Duel/Message/SelectActionsModal.tsx
src/ui/Duel/Message/SelectActionsModal.tsx
+36
-23
src/ui/Duel/utils/groupBy.ts
src/ui/Duel/utils/groupBy.ts
+13
-0
src/ui/Duel/utils/index.ts
src/ui/Duel/utils/index.ts
+1
-0
No files found.
src/ui/Duel/Message/SelectActionsModal.tsx
View file @
35225f7c
...
@@ -2,7 +2,7 @@ import "@/styles/select-modal.scss";
...
@@ -2,7 +2,7 @@ import "@/styles/select-modal.scss";
import
{
MinusOutlined
,
ThunderboltOutlined
}
from
"
@ant-design/icons
"
;
import
{
MinusOutlined
,
ThunderboltOutlined
}
from
"
@ant-design/icons
"
;
import
{
CheckCard
,
CheckCardProps
}
from
"
@ant-design/pro-components
"
;
import
{
CheckCard
,
CheckCardProps
}
from
"
@ant-design/pro-components
"
;
import
{
Button
,
Card
,
Col
,
Popover
,
Row
}
from
"
antd
"
;
import
{
Button
,
Card
,
Col
,
Popover
,
Row
,
Tabs
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
...
@@ -10,10 +10,12 @@ import {
...
@@ -10,10 +10,12 @@ import {
fetchStrings
,
fetchStrings
,
sendSelectMultiResponse
,
sendSelectMultiResponse
,
sendSelectSingleResponse
,
sendSelectSingleResponse
,
ygopro
,
}
from
"
@/api
"
;
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
clearSelectActions
,
matStore
,
messageStore
}
from
"
@/stores
"
;
import
{
clearSelectActions
,
matStore
,
messageStore
}
from
"
@/stores
"
;
import
{
groupBy
}
from
"
../utils
"
;
import
{
DragModal
}
from
"
./DragModal
"
;
import
{
DragModal
}
from
"
./DragModal
"
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
...
@@ -58,6 +60,8 @@ export const SelectActionsModal = () => {
...
@@ -58,6 +60,8 @@ export const SelectActionsModal = () => {
?
response
.
length
==
1
?
response
.
length
==
1
:
response
.
length
>=
min
&&
response
.
length
<=
max
&&
levelMatched
;
:
response
.
length
>=
min
&&
response
.
length
<=
max
&&
levelMatched
;
const
grouped
=
groupBy
(
selectables
,
(
option
)
=>
option
.
location
?.
location
!
);
return
(
return
(
<>
<>
<
DragModal
<
DragModal
...
@@ -133,28 +137,37 @@ export const SelectActionsModal = () => {
...
@@ -133,28 +137,37 @@ export const SelectActionsModal = () => {
}
}
}
}
>
>
<
Row
>
<
Row
>
{
selectables
.
map
((
option
,
idx
)
=>
{
<
Tabs
return
(
type=
"card"
<
Col
span=
{
4
}
key=
{
idx
}
>
items=
{
grouped
.
map
((
group
,
idx
)
=>
{
<
HoverCheckCard
return
{
hoverContent=
{
option
.
effectDesc
}
label
:
fetchStrings
(
"
!system
"
,
group
[
0
]
+
1000
),
style=
{
{
width
:
120
}
}
key
:
idx
.
toString
(),
cover=
{
children
:
group
[
1
].
map
((
option
,
idx
)
=>
{
<
img
return
(
alt=
{
option
.
meta
.
id
.
toString
()
}
<
Col
span=
{
4
}
key=
{
idx
}
>
src=
{
<
HoverCheckCard
option
.
meta
.
id
hoverContent=
{
option
.
effectDesc
}
?
`${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
style=
{
{
width
:
120
}
}
:
`${NeosConfig.assetsPath}/card_back.jpg`
cover=
{
}
<
img
style=
{
{
width
:
100
}
}
alt=
{
option
.
meta
.
id
.
toString
()
}
/>
src=
{
}
option
.
meta
.
id
value=
{
option
}
?
`${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
/>
:
`${NeosConfig.assetsPath}/card_back.jpg`
</
Col
>
}
);
style=
{
{
width
:
100
}
}
})
}
/>
}
value=
{
option
}
/>
</
Col
>
);
}),
};
})
}
/>
</
Row
>
</
Row
>
<
p
>
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
p
>
<
p
>
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
p
>
<
Row
>
<
Row
>
...
...
src/ui/Duel/utils/groupBy.ts
0 → 100644
View file @
35225f7c
export
const
groupBy
=
<
K
,
V
>
(
array
:
readonly
V
[],
getKey
:
(
cur
:
V
,
idx
:
number
,
src
:
readonly
V
[])
=>
K
):
[
K
,
V
[]][]
=>
Array
.
from
(
array
.
reduce
((
map
,
cur
,
idx
,
src
)
=>
{
const
key
=
getKey
(
cur
,
idx
,
src
);
const
list
=
map
.
get
(
key
);
if
(
list
)
list
.
push
(
cur
);
else
map
.
set
(
key
,
[
cur
]);
return
map
;
},
new
Map
<
K
,
V
[]
>
())
);
src/ui/Duel/utils/index.ts
View file @
35225f7c
export
*
from
"
./groupBy
"
;
export
*
from
"
./interactTypeToString
"
;
export
*
from
"
./interactTypeToString
"
;
export
*
from
"
./zip
"
;
export
*
from
"
./zip
"
;
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