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
baichixing
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
mycard/Neos!407
parents
739cf62b
fea8d981
Changes
1
Show 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
React
,
{
useEffect
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
...
@@ -6,6 +7,7 @@ import { fetchStrings, Region } from "@/api";
...
@@ -6,6 +7,7 @@ import { fetchStrings, Region } from "@/api";
import
{
Phase2StringCodeMap
}
from
"
@/common
"
;
import
{
Phase2StringCodeMap
}
from
"
@/common
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
HandResult
,
matStore
}
from
"
@/stores
"
;
import
{
HandResult
,
matStore
}
from
"
@/stores
"
;
import
{
useChat
}
from
"
@/ui/Shared
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
@@ -13,16 +15,21 @@ const NeosConfig = useConfig();
...
@@ -13,16 +15,21 @@ const NeosConfig = useConfig();
let
globalMsgApi
:
ReturnType
<
typeof
message
.
useMessage
>
[
0
]
|
undefined
;
let
globalMsgApi
:
ReturnType
<
typeof
message
.
useMessage
>
[
0
]
|
undefined
;
export
const
HintNotification
=
()
=>
{
export
const
HintNotification
=
()
=>
{
const
s
nap
=
useSnapshot
(
matStore
);
const
matS
nap
=
useSnapshot
(
matStore
);
const
hintState
=
s
nap
.
hint
;
const
hintState
=
matS
nap
.
hint
;
const
toss
=
s
nap
.
tossResult
;
const
toss
=
matS
nap
.
tossResult
;
const
handResults
=
s
nap
.
handResults
;
const
handResults
=
matS
nap
.
handResults
;
const
currentPhase
=
s
nap
.
phase
.
currentPhase
;
const
currentPhase
=
matS
nap
.
phase
.
currentPhase
;
const
error
=
s
nap
.
error
;
const
error
=
matS
nap
.
error
;
const
{
dialogs
}
=
useChat
(
true
);
const
[
msgApi
,
msgContextHolder
]
=
message
.
useMessage
({
const
[
msgApi
,
msgContextHolder
]
=
message
.
useMessage
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
});
const
[
notiApi
,
notiContextHolder
]
=
notification
.
useNotification
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
globalMsgApi
=
msgApi
;
globalMsgApi
=
msgApi
;
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
hintState
&&
hintState
.
msg
)
{
if
(
hintState
&&
hintState
.
msg
)
{
...
@@ -68,7 +75,23 @@ export const HintNotification = () => {
...
@@ -68,7 +75,23 @@ export const HintNotification = () => {
}
}
},
[
error
]);
},
[
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
// 防抖的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