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
5f6189bb
Commit
5f6189bb
authored
Jun 09, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle deck on copy
parent
a9963b62
Pipeline
#27615
passed with stages
in 7 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
src/ui/BuildDeck/DeckDatabase/DeckResults/index.tsx
src/ui/BuildDeck/DeckDatabase/DeckResults/index.tsx
+22
-1
No files found.
src/ui/BuildDeck/DeckDatabase/DeckResults/index.tsx
View file @
5f6189bb
...
@@ -2,10 +2,12 @@ import { CopyOutlined } from "@ant-design/icons";
...
@@ -2,10 +2,12 @@ import { CopyOutlined } from "@ant-design/icons";
import
{
Button
,
message
,
Pagination
,
Popover
}
from
"
antd
"
;
import
{
Button
,
message
,
Pagination
,
Popover
}
from
"
antd
"
;
import
React
,
{
memo
,
useEffect
}
from
"
react
"
;
import
React
,
{
memo
,
useEffect
}
from
"
react
"
;
import
{
type
INTERNAL_Snapshot
as
Snapshot
,
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
type
INTERNAL_Snapshot
as
Snapshot
,
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
YGOProDeck
from
"
ygopro-deck-encode
"
;
import
{
pullDecks
}
from
"
@/api
"
;
import
{
pullDecks
}
from
"
@/api
"
;
import
{
MdproDeck
}
from
"
@/api/mdproDeck/schema
"
;
import
{
MdproDeck
}
from
"
@/api/mdproDeck/schema
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
deckStore
}
from
"
@/stores
"
;
import
{
IconFont
}
from
"
@/ui/Shared
"
;
import
{
IconFont
}
from
"
@/ui/Shared
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
@@ -62,6 +64,8 @@ export const DeckResults: React.FC = memo(() => {
...
@@ -62,6 +64,8 @@ export const DeckResults: React.FC = memo(() => {
store
.
page
=
current
;
store
.
page
=
current
;
store
.
total
=
total
;
store
.
total
=
total
;
store
.
decks
=
records
;
store
.
decks
=
records
;
}
else
if
(
resp
?.
code
!==
0
)
{
message
.
error
(
resp
?.
message
);
}
else
{
}
else
{
message
.
error
(
"
翻页失败,请检查您的网络状况。
"
);
message
.
error
(
"
翻页失败,请检查您的网络状况。
"
);
}
}
...
@@ -101,7 +105,11 @@ const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
...
@@ -101,7 +105,11 @@ const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
<
Popover
<
Popover
placement=
"topRight"
placement=
"topRight"
content=
{
content=
{
<
Button
className=
{
styles
[
"
copy-btn
"
]
}
icon=
{
<
CopyOutlined
/>
}
>
<
Button
className=
{
styles
[
"
copy-btn
"
]
}
icon=
{
<
CopyOutlined
/>
}
onClick=
{
()
=>
copyMdproDeckToLocal
(
deck
)
}
>
复制
复制
</
Button
>
</
Button
>
}
}
...
@@ -120,6 +128,19 @@ const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
...
@@ -120,6 +128,19 @@ const MdproDeckBlock: React.FC<Snapshot<MdproDeck>> = (deck) => (
</
Popover
>
</
Popover
>
);
);
const
copyMdproDeckToLocal
=
async
(
mdproDeck
:
MdproDeck
)
=>
{
const
deck
=
YGOProDeck
.
fromYdkString
(
mdproDeck
.
deckYdk
);
if
(
!
(
deck
.
main
.
length
+
deck
.
extra
.
length
+
deck
.
side
.
length
===
0
))
{
const
deckName
=
mdproDeck
.
deckName
;
const
result
=
await
deckStore
.
add
({
deckName
,
...
deck
});
if
(
result
)
{
message
.
success
(
"
卡组复制成功!
"
);
}
}
else
{
message
.
error
(
"
卡组解析失败,请联系技术人员解决:<ccc@neos.moe>
"
);
}
};
function
truncateString
(
str
:
string
,
maxLen
:
number
):
string
{
function
truncateString
(
str
:
string
,
maxLen
:
number
):
string
{
const
length
=
Array
.
from
(
str
).
length
;
const
length
=
Array
.
from
(
str
).
length
;
...
...
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