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
420831c0
Commit
420831c0
authored
Jun 09, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update small
parent
8dc296e4
Pipeline
#27605
passed with stages
in 7 minutes and 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
src/ui/BuildDeck/DeckDatabase/index.tsx
src/ui/BuildDeck/DeckDatabase/index.tsx
+22
-11
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+2
-2
No files found.
src/ui/BuildDeck/
Card
Database/index.tsx
→
src/ui/BuildDeck/
Deck
Database/index.tsx
View file @
420831c0
...
@@ -3,8 +3,9 @@ import {
...
@@ -3,8 +3,9 @@ import {
FilterOutlined
,
FilterOutlined
,
SearchOutlined
,
SearchOutlined
,
SortAscendingOutlined
,
SortAscendingOutlined
,
SwapOutlined
,
}
from
"
@ant-design/icons
"
;
}
from
"
@ant-design/icons
"
;
import
{
App
,
Button
,
Dropdown
,
Input
,
message
,
Pagination
}
from
"
antd
"
;
import
{
App
,
Button
,
Dropdown
,
Input
,
message
,
Pagination
,
Space
}
from
"
antd
"
;
import
{
MenuProps
}
from
"
antd/lib
"
;
import
{
MenuProps
}
from
"
antd/lib
"
;
import
{
isEqual
}
from
"
lodash-es
"
;
import
{
isEqual
}
from
"
lodash-es
"
;
import
{
OverlayScrollbarsComponentRef
}
from
"
overlayscrollbars-react
"
;
import
{
OverlayScrollbarsComponentRef
}
from
"
overlayscrollbars-react
"
;
...
@@ -28,21 +29,23 @@ import styles from "../index.module.scss";
...
@@ -28,21 +29,23 @@ import styles from "../index.module.scss";
import
{
editDeckStore
}
from
"
../store
"
;
import
{
editDeckStore
}
from
"
../store
"
;
/** 卡片库,选择卡片加入正在编辑的卡组 */
/** 卡片库,选择卡片加入正在编辑的卡组 */
export
const
Card
Database
:
React
.
FC
=
()
=>
{
export
const
Deck
Database
:
React
.
FC
=
()
=>
{
const
{
modal
}
=
App
.
useApp
();
const
{
modal
}
=
App
.
useApp
();
const
[
searchWord
,
setSearchWord
]
=
useState
(
""
);
const
[
searchWord
,
setSearchWord
]
=
useState
(
""
);
const
[
searchConditions
,
setSearchConditions
]
=
useState
<
FtsConditions
>
(
const
[
searchConditions
,
setSearchConditions
]
=
useState
<
FtsConditions
>
(
emptySearchConditions
,
emptySearchConditions
,
);
);
const
[
search
Result
,
setSearch
Result
]
=
useState
<
CardMeta
[]
>
([]);
const
[
search
CardResult
,
setSearchCard
Result
]
=
useState
<
CardMeta
[]
>
([]);
const
defaultSort
=
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
a
.
id
-
b
.
id
;
const
defaultSort
=
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
a
.
id
-
b
.
id
;
const
sortRef
=
useRef
<
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
number
>
(
defaultSort
);
const
sortRef
=
useRef
<
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
number
>
(
defaultSort
);
const
[
sortEdited
,
setSortEdited
]
=
useState
(
false
);
const
[
sortEdited
,
setSortEdited
]
=
useState
(
false
);
const
[
showMdproDecks
,
setShowMdproDecks
]
=
useState
(
false
);
const
setSortRef
=
(
sort
:
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
number
)
=>
{
const
setSortRef
=
(
sort
:
(
a
:
CardMeta
,
b
:
CardMeta
)
=>
number
)
=>
{
sortRef
.
current
=
sort
;
sortRef
.
current
=
sort
;
setSearch
Result
([...
search
Result
.
sort
(
sortRef
.
current
)]);
setSearch
CardResult
([...
searchCard
Result
.
sort
(
sortRef
.
current
)]);
setSortEdited
(
true
);
setSortEdited
(
true
);
};
};
...
@@ -73,7 +76,7 @@ export const CardDatabase: React.FC = () => {
...
@@ -73,7 +76,7 @@ export const CardDatabase: React.FC = () => {
const
result
=
searchCards
({
query
:
searchWord
,
conditions
})
const
result
=
searchCards
({
query
:
searchWord
,
conditions
})
.
filter
((
card
)
=>
!
isToken
(
card
.
data
.
type
??
0
))
.
filter
((
card
)
=>
!
isToken
(
card
.
data
.
type
??
0
))
.
sort
(
sortRef
.
current
);
// 衍生物不显示
.
sort
(
sortRef
.
current
);
// 衍生物不显示
setSearchResult
(()
=>
result
);
setSearch
Card
Result
(()
=>
result
);
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -121,7 +124,7 @@ export const CardDatabase: React.FC = () => {
...
@@ -121,7 +124,7 @@ export const CardDatabase: React.FC = () => {
return
(
return
(
<
div
className=
{
styles
.
container
}
ref=
{
dropRef
}
>
<
div
className=
{
styles
.
container
}
ref=
{
dropRef
}
>
<
div
className=
{
styles
.
title
}
>
<
Space
className=
{
styles
.
title
}
direction=
"horizontal"
>
<
Input
<
Input
placeholder=
"关键词(空格分隔)"
placeholder=
"关键词(空格分隔)"
bordered=
{
false
}
bordered=
{
false
}
...
@@ -136,8 +139,16 @@ export const CardDatabase: React.FC = () => {
...
@@ -136,8 +139,16 @@ export const CardDatabase: React.FC = () => {
onChange=
{
(
e
)
=>
setSearchWord
(
e
.
target
.
value
)
}
onChange=
{
(
e
)
=>
setSearchWord
(
e
.
target
.
value
)
}
onKeyUp=
{
(
e
)
=>
e
.
key
===
"
Enter
"
&&
handleSearch
()
}
onKeyUp=
{
(
e
)
=>
e
.
key
===
"
Enter
"
&&
handleSearch
()
}
allowClear
allowClear
style=
{
{
width
:
"
250%
"
}
}
/>
/>
</
div
>
<
Button
style=
{
{
marginRight
:
"
1rem
"
}
}
icon=
{
<
SwapOutlined
/>
}
onClick=
{
()
=>
setShowMdproDecks
(
!
showMdproDecks
)
}
>
{
showMdproDecks
?
"
卡片数据库
"
:
"
Mdpro在线卡组
"
}
</
Button
>
</
Space
>
<
div
className=
{
styles
[
"
select-btns
"
]
}
>
<
div
className=
{
styles
[
"
select-btns
"
]
}
>
<
Button
<
Button
block
block
...
@@ -165,7 +176,7 @@ export const CardDatabase: React.FC = () => {
...
@@ -165,7 +176,7 @@ export const CardDatabase: React.FC = () => {
<
span
>
<
span
>
排列
排列
<
span
className=
{
styles
[
"
search-count
"
]
}
>
<
span
className=
{
styles
[
"
search-count
"
]
}
>
(
{
searchResult
.
length
}
)
(
{
search
Card
Result
.
length
}
)
</
span
>
</
span
>
</
span
>
</
span
>
</
Button
>
</
Button
>
...
@@ -185,8 +196,8 @@ export const CardDatabase: React.FC = () => {
...
@@ -185,8 +196,8 @@ export const CardDatabase: React.FC = () => {
</
Button
>
</
Button
>
</
div
>
</
div
>
<
ScrollableArea
className=
{
styles
[
"
search-cards-container
"
]
}
ref=
{
ref
}
>
<
ScrollableArea
className=
{
styles
[
"
search-cards-container
"
]
}
ref=
{
ref
}
>
{
searchResult
.
length
?
(
{
search
Card
Result
.
length
?
(
<
SearchResults
results=
{
search
Result
}
scrollToTop=
{
scrollToTop
}
/>
<
CardResults
results=
{
searchCard
Result
}
scrollToTop=
{
scrollToTop
}
/>
)
:
(
)
:
(
<
div
className=
{
styles
.
empty
}
>
<
div
className=
{
styles
.
empty
}
>
<
IconFont
type=
"icon-empty"
size=
{
40
}
/>
<
IconFont
type=
"icon-empty"
size=
{
40
}
/>
...
@@ -199,7 +210,7 @@ export const CardDatabase: React.FC = () => {
...
@@ -199,7 +210,7 @@ export const CardDatabase: React.FC = () => {
};
};
/** 搜索区的搜索结果,使用memo避免重复渲染 */
/** 搜索区的搜索结果,使用memo避免重复渲染 */
const
Search
Results
:
React
.
FC
<
{
const
Card
Results
:
React
.
FC
<
{
results
:
CardMeta
[];
results
:
CardMeta
[];
scrollToTop
:
()
=>
void
;
scrollToTop
:
()
=>
void
;
}
>
=
memo
(({
results
,
scrollToTop
})
=>
{
}
>
=
memo
(({
results
,
scrollToTop
})
=>
{
...
...
src/ui/BuildDeck/index.tsx
View file @
420831c0
...
@@ -28,8 +28,8 @@ import {
...
@@ -28,8 +28,8 @@ import {
}
from
"
@/ui/Shared
"
;
}
from
"
@/ui/Shared
"
;
import
{
Type
}
from
"
@/ui/Shared/DeckZone
"
;
import
{
Type
}
from
"
@/ui/Shared/DeckZone
"
;
import
{
CardDatabase
}
from
"
./CardDatabase
"
;
import
{
CardDetail
}
from
"
./CardDetail
"
;
import
{
CardDetail
}
from
"
./CardDetail
"
;
import
{
DeckDatabase
}
from
"
./DeckDatabase
"
;
import
{
DeckSelect
}
from
"
./DeckSelect
"
;
import
{
DeckSelect
}
from
"
./DeckSelect
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
editDeckStore
}
from
"
./store
"
;
import
{
editDeckStore
}
from
"
./store
"
;
...
@@ -149,7 +149,7 @@ export const Component: React.FC = () => {
...
@@ -149,7 +149,7 @@ export const Component: React.FC = () => {
/>
/>
</
div
>
</
div
>
<
div
className=
{
styles
.
select
}
>
<
div
className=
{
styles
.
select
}
>
<
Card
Database
/>
<
Deck
Database
/>
</
div
>
</
div
>
</>
</>
)
:
(
)
:
(
...
...
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