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
fde33120
Commit
fde33120
authored
Sep 09, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/overflow' into 'main'
修复决斗界面中内容太多溢出屏幕的问题 See merge request
!308
parents
bc7e60c7
5dd65348
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
76 deletions
+93
-76
src/service/duel/selectOption.ts
src/service/duel/selectOption.ts
+4
-0
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+54
-48
src/ui/Shared/Scrollbar/index.tsx
src/ui/Shared/Scrollbar/index.tsx
+35
-28
No files found.
src/service/duel/selectOption.ts
View file @
fde33120
...
...
@@ -3,6 +3,10 @@ import { displayOptionModal } from "@/ui/Duel/Message";
export
default
async
(
selectOption
:
ygopro
.
StocGameMessage
.
MsgSelectOption
)
=>
{
const
options
=
selectOption
.
options
;
if
(
options
.
length
===
0
)
{
console
.
warn
(
"
<MsgSelectOption>options is empty.
"
);
return
;
}
await
displayOptionModal
(
fetchStrings
(
Region
.
System
,
556
),
options
.
map
(({
code
,
response
})
=>
({
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
fde33120
...
...
@@ -7,7 +7,7 @@ import { INTERNAL_Snapshot as Snapshot, useSnapshot } from "valtio";
import
{
type
CardMeta
,
Region
,
type
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
CardType
,
isMe
,
matStore
}
from
"
@/stores
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
ScrollableArea
,
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
groupBy
}
from
"
../../utils
"
;
import
{
showCardModal
}
from
"
../CardModal
"
;
...
...
@@ -147,53 +147,59 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
selectedZone=
{
selectedZone
}
onChange=
{
setSelectedZone
as
any
}
/>
{
grouped
.
map
(
(
options
,
i
)
=>
options
[
0
]
===
selectedZone
&&
(
<
div
className=
{
styles
[
"
container
"
]
}
key=
{
i
}
>
<
CheckCard
.
Group
onChange=
{
(
res
:
any
)
=>
{
const
newRes
:
[
ygopro
.
CardZone
,
Option
[]][]
=
result
.
map
(
([
k
,
v
])
=>
[
k
,
k
===
selectedZone
?
res
:
v
],
);
setResult
(
newRes
);
}
}
value=
{
result
.
find
(([
k
,
_
])
=>
k
===
selectedZone
)?.[
1
]
??
([]
as
any
)
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple
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=
{
classnames
(
styles
[
"
check-card
"
],
{
[
styles
.
opponent
]:
card
.
location
?.
controller
!==
undefined
&&
!
isMe
(
card
.
location
.
controller
),
})
}
value=
{
card
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
CheckCard
.
Group
>
</
div
>
),
)
}
<
ScrollableArea
maxHeight=
"50vh"
>
{
grouped
.
map
(
(
options
,
i
)
=>
options
[
0
]
===
selectedZone
&&
(
<
div
className=
{
styles
[
"
container
"
]
}
key=
{
i
}
>
<
CheckCard
.
Group
onChange=
{
(
res
:
any
)
=>
{
const
newRes
:
[
ygopro
.
CardZone
,
Option
[]][]
=
result
.
map
(
([
k
,
v
])
=>
[
k
,
k
===
selectedZone
?
res
:
v
],
);
setResult
(
newRes
);
}
}
value=
{
result
.
find
(([
k
,
_
])
=>
k
===
selectedZone
)?.[
1
]
??
([]
as
any
)
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple
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=
{
classnames
(
styles
[
"
check-card
"
],
{
[
styles
.
opponent
]:
card
.
location
?.
controller
!==
undefined
&&
!
isMe
(
card
.
location
.
controller
),
})
}
value=
{
card
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
))
}
</
CheckCard
.
Group
>
</
div
>
),
)
}
</
ScrollableArea
>
<
p
>
<
span
>
{
/* TODO: 这里的字体可以调整下 */
}
...
...
src/ui/Shared/Scrollbar/index.tsx
View file @
fde33120
...
...
@@ -16,33 +16,40 @@ export const ScrollableArea = forwardRef<
elementProps
?:
React
.
HTMLAttributes
<
HTMLElement
>
;
className
?:
string
;
style
?:
React
.
CSSProperties
;
maxHeight
?:
string
;
// 如果不指定,默认"100%"
}
>
>
(({
scrollProps
=
{},
elementProps
,
className
,
style
,
children
},
ref
)
=>
{
const
{
options
=
{},
...
rest
}
=
scrollProps
;
>
(
(
{
scrollProps
=
{},
elementProps
,
className
,
style
,
children
,
maxHeight
},
ref
,
)
=>
{
const
{
options
=
{},
...
rest
}
=
scrollProps
;
return
(
<
OverlayScrollbarsComponent
options=
{
{
scrollbars
:
{
autoHide
:
"
scroll
"
,
theme
:
"
os-theme-light
"
,
},
overflow
:
{
x
:
"
hidden
"
,
y
:
"
scroll
"
,
},
...
options
,
}
}
defer
style=
{
{
height
:
"
100%
"
,
}
}
{
...
rest
}
ref=
{
ref
}
>
<
div
className=
{
className
}
style=
{
style
}
{
...
elementProps
}
>
{
children
}
</
div
>
</
OverlayScrollbarsComponent
>
);
});
return
(
<
OverlayScrollbarsComponent
options=
{
{
scrollbars
:
{
autoHide
:
"
scroll
"
,
theme
:
"
os-theme-light
"
,
},
overflow
:
{
x
:
"
hidden
"
,
y
:
"
scroll
"
,
},
...
options
,
}
}
defer
style=
{
{
height
:
"
100%
"
,
maxHeight
:
maxHeight
??
"
100%
"
,
}
}
{
...
rest
}
ref=
{
ref
}
>
<
div
className=
{
className
}
style=
{
style
}
{
...
elementProps
}
>
{
children
}
</
div
>
</
OverlayScrollbarsComponent
>
);
},
);
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