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
6f9b4f5e
Commit
6f9b4f5e
authored
Aug 14, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/replay' into 'main'
Optimize/replay See merge request
!260
parents
129a7a01
673e87ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
20 deletions
+38
-20
src/infra/stream.ts
src/infra/stream.ts
+2
-1
src/ui/BuildDeck/DeckSelect.tsx
src/ui/BuildDeck/DeckSelect.tsx
+7
-14
src/ui/Match/ReplayModal.tsx
src/ui/Match/ReplayModal.tsx
+8
-5
src/ui/Shared/Uploader/index.tsx
src/ui/Shared/Uploader/index.tsx
+20
-0
src/ui/Shared/index.ts
src/ui/Shared/index.ts
+1
-0
No files found.
src/infra/stream.ts
View file @
6f9b4f5e
...
...
@@ -27,7 +27,8 @@ export class WebSocketStream {
};
ws
.
onclose
=
()
=>
{
console
.
info
(
"
Websocket closed.
"
);
controller
.
close
();
// 下面这行注释掉,因为虽然websocket关掉了,但是已经收到的数据可能还在处理中
// controller.close();
};
},
pull
(
_
)
{
...
...
src/ui/BuildDeck/DeckSelect.tsx
View file @
6f9b4f5e
...
...
@@ -3,15 +3,15 @@ import {
DeleteOutlined
,
DownloadOutlined
,
FileAddOutlined
,
InboxOutlined
,
PlusOutlined
,
}
from
"
@ant-design/icons
"
;
import
{
App
,
Button
,
Dropdown
,
MenuProps
,
Upload
,
Upload
Props
}
from
"
antd
"
;
import
{
App
,
Button
,
Dropdown
,
MenuProps
,
UploadProps
}
from
"
antd
"
;
import
React
,
{
useRef
,
useState
}
from
"
react
"
;
import
YGOProDeck
from
"
ygopro-deck-encode
"
;
import
{
deckStore
,
IDeck
}
from
"
@/stores
"
;
import
{
Uploader
}
from
"
../Shared
"
;
import
styles
from
"
./DeckSelect.module.scss
"
;
export
const
DeckSelect
:
React
.
FC
<
{
...
...
@@ -211,18 +211,11 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
};
return
(
<
div
>
<
Upload
.
Dragger
{
...
uploadProps
}
style=
{
{
width
:
"
100%
"
,
margin
:
"
20px 0 10px
"
}
}
>
<
p
className=
"ant-upload-drag-icon"
>
<
InboxOutlined
/>
</
p
>
<
p
className=
"ant-upload-text"
>
单击或拖动文件到此区域进行上传
</
p
>
<
p
className=
"ant-upload-hint"
>
仅支持后缀名为ydk的卡组文件。
</
p
>
</
Upload
.
Dragger
>
</
div
>
<
Uploader
{
...
uploadProps
}
text=
"单击或拖动文件到此区域进行上传"
hint=
"仅支持后缀名为ydk的卡组文件。"
/>
);
};
...
...
src/ui/Match/ReplayModal.tsx
View file @
6f9b4f5e
import
{
UploadOutlined
}
from
"
@ant-design/icons
"
;
import
{
Button
,
message
,
Modal
,
Upload
,
UploadProps
}
from
"
antd
"
;
import
{
Button
,
message
,
Modal
,
UploadProps
}
from
"
antd
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
{
Uploader
}
from
"
../Shared
"
;
import
{
init
}
from
"
./util
"
;
const
localStore
=
proxy
({
...
...
@@ -22,6 +22,7 @@ export const ReplayModal: React.FC = () => {
onChange
(
info
)
{
info
.
file
.
status
=
"
done
"
;
},
accept
:
"
.yrp3d
"
,
beforeUpload
(
file
,
_
)
{
const
reader
=
new
FileReader
();
reader
.
readAsArrayBuffer
(
file
);
...
...
@@ -78,9 +79,11 @@ export const ReplayModal: React.FC = () => {
}
onCancel=
{
()
=>
(
localStore
.
open
=
false
)
}
>
<
Upload
{
...
uploadProps
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
点击上传录像文件
</
Button
>
</
Upload
>
<
Uploader
{
...
uploadProps
}
text=
"单击或拖动文件到此区域进行上传"
hint=
"仅支持后缀名为yrp3d的录像文件。"
/>
</
Modal
>
);
};
...
...
src/ui/Shared/Uploader/index.tsx
0 → 100644
View file @
6f9b4f5e
import
{
InboxOutlined
}
from
"
@ant-design/icons
"
;
import
{
Upload
,
UploadProps
}
from
"
antd
"
;
import
React
from
"
react
"
;
export
const
Uploader
:
React
.
FC
<
UploadProps
&
{
text
?:
string
;
hint
?:
string
}
>
=
({
text
,
hint
,
...
uploadProps
})
=>
(
<
div
>
<
Upload
.
Dragger
{
...
uploadProps
}
style=
{
{
width
:
"
100%
"
,
margin
:
"
20px 0 10px
"
}
}
>
<
p
className=
"ant-upload-drag-icon"
>
<
InboxOutlined
/>
</
p
>
<
p
className=
"ant-upload-text"
>
{
text
}
</
p
>
<
p
className=
"ant-upload-hint"
>
{
hint
}
</
p
>
</
Upload
.
Dragger
>
</
div
>
);
src/ui/Shared/index.ts
View file @
6f9b4f5e
...
...
@@ -6,4 +6,5 @@ export * from "./Loading";
export
*
from
"
./Scrollbar
"
;
export
*
from
"
./Select
"
;
export
*
from
"
./SpecialButton
"
;
export
*
from
"
./Uploader
"
;
export
*
from
"
./YgoCard
"
;
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