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
99930ac5
Commit
99930ac5
authored
Aug 23, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: basic logic
parent
7a9e9f0c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
116 additions
and
2 deletions
+116
-2
src/env.d.ts
src/env.d.ts
+6
-1
src/main.tsx
src/main.tsx
+2
-0
src/ui/BuildDeck/CardDetail.module.scss
src/ui/BuildDeck/CardDetail.module.scss
+1
-1
src/ui/Duel/Message/NewYesNoModal/index.tsx
src/ui/Duel/Message/NewYesNoModal/index.tsx
+33
-0
src/ui/Duel/Message/YesNoModal/index.tsx
src/ui/Duel/Message/YesNoModal/index.tsx
+2
-0
src/ui/Duel/Message/index.ts
src/ui/Duel/Message/index.ts
+1
-0
src/ui/Shared/Modal/index.module.scss
src/ui/Shared/Modal/index.module.scss
+9
-0
src/ui/Shared/Modal/index.tsx
src/ui/Shared/Modal/index.tsx
+61
-0
src/ui/Shared/index.ts
src/ui/Shared/index.ts
+1
-0
No files found.
src/env.d.ts
View file @
99930ac5
...
@@ -13,9 +13,11 @@ interface ImportMeta {
...
@@ -13,9 +13,11 @@ interface ImportMeta {
}
}
/* eslint @typescript-eslint/no-unused-vars: 0 */
/* eslint @typescript-eslint/no-unused-vars: 0 */
import
type
{
MessageInstance
}
from
"
antd/es/message/interface
"
;
import
type
{
ModalStaticFunctions
}
from
"
antd/es/modal/confirm
"
;
import
type
{
NotificationInstance
}
from
"
antd/es/notification/interface
"
;
import
{
EventEmitter
}
from
"
eventemitter3
"
;
import
{
EventEmitter
}
from
"
eventemitter3
"
;
/* eslint no-var: 0 */
declare
global
{
declare
global
{
var
myExtraDeckCodes
:
number
[]
=
[];
var
myExtraDeckCodes
:
number
[]
=
[];
interface
Console
{
interface
Console
{
...
@@ -24,6 +26,9 @@ declare global {
...
@@ -24,6 +26,9 @@ declare global {
backgroundColor
?:
string
,
backgroundColor
?:
string
,
)
=>
(...
args
:
Parameters
<
console
.
log
>
)
=>
void
;
)
=>
(...
args
:
Parameters
<
console
.
log
>
)
=>
void
;
}
}
var
message
:
MessageInstance
;
var
notification
:
NotificationInstance
;
var
modal
:
ModalStaticFunctions
;
}
}
declare
module
"
react-router-dom
"
{
declare
module
"
react-router-dom
"
{
...
...
src/main.tsx
View file @
99930ac5
...
@@ -28,6 +28,7 @@ import ReactDOM from "react-dom/client";
...
@@ -28,6 +28,7 @@ import ReactDOM from "react-dom/client";
import
{
theme
}
from
"
@/ui/theme
"
;
import
{
theme
}
from
"
@/ui/theme
"
;
import
{
NeosRouter
}
from
"
./ui/NeosRouter
"
;
import
{
NeosRouter
}
from
"
./ui/NeosRouter
"
;
import
{
ModalContext
}
from
"
./ui/Shared
"
;
const
root
=
ReactDOM
.
createRoot
(
const
root
=
ReactDOM
.
createRoot
(
document
.
getElementById
(
"
root
"
)
as
HTMLElement
,
document
.
getElementById
(
"
root
"
)
as
HTMLElement
,
...
@@ -38,6 +39,7 @@ root.render(
...
@@ -38,6 +39,7 @@ root.render(
<
App
>
<
App
>
<
ProConfigProvider
dark
>
<
ProConfigProvider
dark
>
<
NeosRouter
/>
<
NeosRouter
/>
<
ModalContext
/>
</
ProConfigProvider
>
</
ProConfigProvider
>
</
App
>
</
App
>
</
ConfigProvider
>,
</
ConfigProvider
>,
...
...
src/ui/BuildDeck/CardDetail.module.scss
View file @
99930ac5
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
0
0
30px
0
#ffffff
54
;
0
0
30px
0
#ffffff
54
;
backdrop-filter
:
blur
(
20px
);
backdrop-filter
:
blur
(
20px
);
@include
utils
.
noise-bg
;
@include
utils
.
noise-bg
;
padding
:
1
5
px
;
padding
:
1
8px
16
px
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
position
:
relative
;
position
:
relative
;
...
...
src/ui/Duel/Message/NewYesNoModal/index.tsx
0 → 100644
View file @
99930ac5
import
{
Button
}
from
"
antd
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
{
Footer
,
genModal
,
ReactFcWithOnResult
,
Title
}
from
"
@/ui/Shared
"
;
interface
Props
{
msg
:
string
;
}
interface
Result
{
isOk
:
boolean
;
}
const
Content
:
ReactFcWithOnResult
<
Props
,
Result
>
=
({
msg
,
onResult
})
=>
{
const
{
hint
}
=
useSnapshot
(
matStore
);
const
preHintMsg
=
hint
?.
esHint
??
""
;
return
(
<>
<
Title
>
{
`${preHintMsg} ${msg}`
}
</
Title
>
<
Footer
>
<
Button
onClick=
{
()
=>
onResult
({
isOk
:
false
})
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
()
=>
onResult
({
isOk
:
true
})
}
>
确认
</
Button
>
</
Footer
>
</>
);
};
export
const
showYesNoModal
=
genModal
({
Content
});
// @ts-ignore
window
.
showYesNoModal
=
showYesNoModal
;
src/ui/Duel/Message/YesNoModal/index.tsx
View file @
99930ac5
...
@@ -21,6 +21,8 @@ export const YesNoModal: React.FC = () => {
...
@@ -21,6 +21,8 @@ export const YesNoModal: React.FC = () => {
const
preHintMsg
=
hint
?.
esHint
||
""
;
const
preHintMsg
=
hint
?.
esHint
||
""
;
console
.
warn
({
preHintMsg
,
msg
});
return
(
return
(
<
NeosModal
<
NeosModal
title=
{
`${preHintMsg} ${msg}`
}
title=
{
`${preHintMsg} ${msg}`
}
...
...
src/ui/Duel/Message/index.ts
View file @
99930ac5
...
@@ -5,6 +5,7 @@ export * from "./CardModal";
...
@@ -5,6 +5,7 @@ export * from "./CardModal";
export
*
from
"
./CheckCounterModal
"
;
export
*
from
"
./CheckCounterModal
"
;
export
*
from
"
./EndModal
"
;
export
*
from
"
./EndModal
"
;
export
*
from
"
./HintNotification
"
;
export
*
from
"
./HintNotification
"
;
export
*
from
"
./NewYesNoModal
"
;
export
*
from
"
./OptionModal
"
;
export
*
from
"
./OptionModal
"
;
export
*
from
"
./PositionModal
"
;
export
*
from
"
./PositionModal
"
;
export
*
from
"
./SelectActionsModal
"
;
export
*
from
"
./SelectActionsModal
"
;
...
...
src/ui/Shared/Modal/index.module.scss
0 → 100644
View file @
99930ac5
.title
{
color
:
red
;
}
.footer
{
display
:
flex
;
justify-content
:
flex-end
;
gap
:
12px
;
}
src/ui/Shared/Modal/index.tsx
0 → 100644
View file @
99930ac5
import
{
App
}
from
"
antd
"
;
import
type
{
ModalFunc
}
from
"
antd/es/modal/confirm
"
;
import
styles
from
"
./index.module.scss
"
;
export
const
ModalContext
:
React
.
FC
=
()
=>
{
const
{
message
,
notification
,
modal
}
=
App
.
useApp
();
window
.
message
=
message
;
window
.
notification
=
notification
;
window
.
modal
=
modal
as
any
;
return
<></>;
};
type
PropsWithOnResult
<
Props
extends
{},
Result
extends
{}
>
=
Props
&
{
onResult
:
(
result
:
Result
)
=>
void
;
};
export
type
ReactFcWithOnResult
<
Props
extends
{},
Result
extends
{}
>
=
React
.
FC
<
PropsWithOnResult
<
Props
,
Result
>
>
;
export
const
Title
:
React
.
FC
<
React
.
PropsWithChildren
>
=
({
children
})
=>
(
<
div
className=
{
styles
.
title
}
>
{
children
}
</
div
>
);
export
const
Footer
:
React
.
FC
<
React
.
PropsWithChildren
>
=
({
children
})
=>
(
<
div
className=
{
styles
.
footer
}
>
{
children
}
</
div
>
);
/**
* 目的是通过传入不同的 Content 组件和配置选项,生成不同类型的弹窗,并在弹窗的 Content 中处理回调,最终返回一个 Promise 来处理弹窗的结果。
*/
export
const
genModal
=
<
Props
extends
{},
Result
extends
{}
>
(
{
Content
,
type
=
"
confirm
"
,
...
rest
}
:
{
Content
:
React
.
ComponentType
<
PropsWithOnResult
<
Props
,
Result
>>
;
type
?:
"
confirm
"
|
"
info
"
|
"
success
"
|
"
error
"
;
}
&
Omit
<
Parameters
<
ModalFunc
>
[0],
"content" | "onCancel" | "onOk" | "footer" | "title"
>
) =
>
{
return
(
props
:
Props
)
=>
new
Promise
<
Result
>
((
rs
)
=>
{
const
{
destroy
}
=
modal
[
type
]({
content
:
(
<
Content
onResult=
{
(
result
)
=>
{
rs
(
result
);
destroy
();
}
}
{
...
props
}
/>
),
footer
:
null
,
centered
:
true
,
...
rest
,
});
});
}
;
src/ui/Shared/index.ts
View file @
99930ac5
...
@@ -3,6 +3,7 @@ export * from "./CardEffectText";
...
@@ -3,6 +3,7 @@ export * from "./CardEffectText";
export
*
from
"
./css
"
;
export
*
from
"
./css
"
;
export
*
from
"
./IconFont
"
;
export
*
from
"
./IconFont
"
;
export
*
from
"
./Loading
"
;
export
*
from
"
./Loading
"
;
export
*
from
"
./Modal
"
;
export
*
from
"
./Scrollbar
"
;
export
*
from
"
./Scrollbar
"
;
export
*
from
"
./Select
"
;
export
*
from
"
./Select
"
;
export
*
from
"
./SpecialButton
"
;
export
*
from
"
./SpecialButton
"
;
...
...
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