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
7efd4870
Commit
7efd4870
authored
Aug 09, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize: chat
parent
6bffabe4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
src/ui/WaitRoom/Chat.module.scss
src/ui/WaitRoom/Chat.module.scss
+1
-3
src/ui/WaitRoom/Chat.tsx
src/ui/WaitRoom/Chat.tsx
+11
-4
No files found.
src/ui/WaitRoom/Chat.module.scss
View file @
7efd4870
...
...
@@ -16,10 +16,8 @@
}
.dialogs
{
position
:
absolute
;
padding
:
8px
0
;
overflow-y
:
scroll
;
scroll-behavior
:
smooth
;
max-height
:
85vh
;
.item
{
vertical-align
:
baseline
;
.name
{
...
...
src/ui/WaitRoom/Chat.tsx
View file @
7efd4870
...
...
@@ -20,9 +20,8 @@ export const Chat: React.FC = () => {
const
chat
=
useSnapshot
(
chatStore
);
useEffect
(()
=>
{
if
(
chatStore
.
sender
>=
0
&&
chatStore
.
message
.
length
!=
0
)
{
const
now
=
new
Date
();
const
sender
=
chatStore
.
sender
;
if
(
chatStore
.
sender
>=
0
&&
chatStore
.
message
.
length
!==
0
)
{
const
{
sender
}
=
chatStore
;
const
name
=
sender
<
roomStore
.
players
.
length
?
roomStore
.
players
[
sender
]?.
name
??
"
?
"
...
...
@@ -33,7 +32,7 @@ export const Chat: React.FC = () => {
...
prev
,
{
name
:
name
,
time
:
`
${
now
.
getHours
()}
:
${
now
.
getMinutes
()}
:
${
now
.
getSeconds
()}
`
,
time
:
formatTimeToHHMMSS
()
,
content
:
chatStore
.
message
,
},
]);
...
...
@@ -81,3 +80,11 @@ const DialogItem: React.FC<ChatItem> = ({ name, time, content }) => {
</
div
>
);
};
function
formatTimeToHHMMSS
()
{
const
now
=
new
Date
();
const
hours
=
String
(
now
.
getHours
()).
padStart
(
2
,
"
0
"
);
const
minutes
=
String
(
now
.
getMinutes
()).
padStart
(
2
,
"
0
"
);
const
seconds
=
String
(
now
.
getSeconds
()).
padStart
(
2
,
"
0
"
);
return
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
}
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