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
56493c78
Commit
56493c78
authored
Aug 04, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/notification' into 'main'
optimize notification See merge request
!407
parents
739cf62b
fea8d981
Pipeline
#28891
passed with stages
in 10 minutes and 19 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
src/ui/Duel/Message/HintNotification/index.tsx
src/ui/Duel/Message/HintNotification/index.tsx
+31
-8
No files found.
src/ui/Duel/Message/HintNotification/index.tsx
View file @
56493c78
import
{
message
}
from
"
antd
"
;
import
{
MessageOutlined
}
from
"
@ant-design/icons
"
;
import
{
message
,
notification
}
from
"
antd
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
...
...
@@ -6,6 +7,7 @@ import { fetchStrings, Region } from "@/api";
import
{
Phase2StringCodeMap
}
from
"
@/common
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
HandResult
,
matStore
}
from
"
@/stores
"
;
import
{
useChat
}
from
"
@/ui/Shared
"
;
import
styles
from
"
./index.module.scss
"
;
...
...
@@ -13,16 +15,21 @@ const NeosConfig = useConfig();
let
globalMsgApi
:
ReturnType
<
typeof
message
.
useMessage
>
[
0
]
|
undefined
;
export
const
HintNotification
=
()
=>
{
const
s
nap
=
useSnapshot
(
matStore
);
const
hintState
=
s
nap
.
hint
;
const
toss
=
s
nap
.
tossResult
;
const
handResults
=
s
nap
.
handResults
;
const
currentPhase
=
s
nap
.
phase
.
currentPhase
;
const
error
=
s
nap
.
error
;
const
matS
nap
=
useSnapshot
(
matStore
);
const
hintState
=
matS
nap
.
hint
;
const
toss
=
matS
nap
.
tossResult
;
const
handResults
=
matS
nap
.
handResults
;
const
currentPhase
=
matS
nap
.
phase
.
currentPhase
;
const
error
=
matS
nap
.
error
;
const
{
dialogs
}
=
useChat
(
true
);
const
[
msgApi
,
msgContextHolder
]
=
message
.
useMessage
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
const
[
notiApi
,
notiContextHolder
]
=
notification
.
useNotification
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
globalMsgApi
=
msgApi
;
useEffect
(()
=>
{
if
(
hintState
&&
hintState
.
msg
)
{
...
...
@@ -68,7 +75,23 @@ export const HintNotification = () => {
}
},
[
error
]);
return
<>
{
msgContextHolder
}
</>;
useEffect
(()
=>
{
const
latest
=
dialogs
.
at
(
-
1
);
if
(
latest
)
{
notiApi
.
open
({
message
:
latest
.
name
,
description
:
latest
.
content
,
icon
:
<
MessageOutlined
/>,
});
}
},
[
dialogs
]);
return
(
<>
{
msgContextHolder
}
{
notiContextHolder
}
</>
);
};
// 防抖的waiting msg
...
...
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