Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend-react
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
YAPEX
frontend-react
Commits
3b3fc39d
Commit
3b3fc39d
authored
5 years ago
by
Janis Daniel Dähne
Browse files
Options
Downloads
Patches
Plain Diff
- some 404 chat styling
parent
de45a7f2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/404internal/Chat404.tsx
+36
-12
36 additions, 12 deletions
src/components/404internal/Chat404.tsx
src/components/404internal/style.styl
+1
-0
1 addition, 0 deletions
src/components/404internal/style.styl
with
37 additions
and
12 deletions
src/components/404internal/Chat404.tsx
+
36
−
12
View file @
3b3fc39d
...
...
@@ -108,10 +108,13 @@ class Chat404 extends React.Component<Props, State> {
getTypingTimeInMsFromMsg
(
message
:
string
):
number
{
// tslint:disable-next-line
const
randomWait
=
this
.
rnd
(
100
,
500
)
//
const randomWait = this.rnd(100, 500)
// tslint:disable-next-line
return
message
.
split
(
'
'
).
length
*
0.4
*
1000
+
randomWait
// return message.split(' ').length * 0.4 * 1000 + randomWait //this is realistic but we don't want to wait that long
// tslint:disable-next-line
return
this
.
rnd
(
1000
,
1500
)
}
/**
...
...
@@ -125,6 +128,7 @@ class Chat404 extends React.Component<Props, State> {
const
randomWait
=
this
.
rnd
(
500
,
800
)
// tslint:disable-next-line
return
message
.
split
(
'
'
).
length
/
4
*
1000
+
randomWait
// return 1
}
async
displayAllMessages
():
Promise
<
void
>
{
...
...
@@ -143,6 +147,12 @@ class Chat404 extends React.Component<Props, State> {
return
{
currentConversation
:
[...
prevState
.
currentConversation
,
message
],
}
as
State
},
()
=>
{
//scroll after the new state is set (and rendered?)
if
(
this
.
state
.
isAutoScrollBotEnabled
)
{
this
.
scrollToBottom
()
}
})
message
=
{
...
...
@@ -150,11 +160,6 @@ class Chat404 extends React.Component<Props, State> {
withLoading
:
false
}
as
ChatMessage
if
(
this
.
state
.
isAutoScrollBotEnabled
)
{
this
.
scrollToBottom
()
}
await
wait
(
this
.
getTypingTimeInMsFromMsg
(
message
.
message
))
//remove old message and insert new with changed props
...
...
@@ -163,6 +168,12 @@ class Chat404 extends React.Component<Props, State> {
currentConversation
:
[...
prevState
.
currentConversation
.
filter
(
(
value
,
index1
)
=>
index1
!==
prevState
.
currentConversation
.
length
-
1
),
message
],
}
as
State
},
()
=>
{
//scroll after the new state is set (and rendered?)
if
(
this
.
state
.
isAutoScrollBotEnabled
)
{
this
.
scrollToBottom
()
}
})
await
wait
(
this
.
getReadTimeInMsFromMsg
(
message
.
message
))
...
...
@@ -174,11 +185,14 @@ class Chat404 extends React.Component<Props, State> {
return
{
currentConversation
:
[...
prevState
.
currentConversation
,
message
],
}
as
State
},
()
=>
{
//scroll after the new state is set (and rendered?)
if
(
this
.
state
.
isAutoScrollBotEnabled
)
{
this
.
scrollToBottom
()
}
})
if
(
this
.
state
.
isAutoScrollBotEnabled
)
{
this
.
scrollToBottom
()
}
await
wait
(
this
.
getReadTimeInMsFromMsg
(
message
.
message
))
...
...
@@ -201,7 +215,9 @@ class Chat404 extends React.Component<Props, State> {
404
</
div
>
<
div
className
=
{
`down-button clickable
${
this
.
state
.
isAutoScrollBotEnabled
?
'
is-enabled
'
:
''
}
`
}
onClick
=
{
()
=>
{
<
div
className
=
{
`down-button clickable
${
this
.
state
.
isAutoScrollBotEnabled
?
'
is-enabled
'
:
''
}
`
}
onClick
=
{
()
=>
{
this
.
setState
((
prevState
,
props
)
=>
({
...
prevState
,
isAutoScrollBotEnabled
:
!
prevState
.
isAutoScrollBotEnabled
...
...
@@ -473,6 +489,14 @@ const conversion: ReadonlyArray<ChatMessage> = [
name
:
'
Janis
'
,
withLoading
:
true
,
message
:
'
Super, find ich gut.
'
}
},
{
kind
:
'
user-entered
'
,
message
:
'
Janis hat den Chat verlassen
'
},
{
kind
:
'
user-entered
'
,
message
:
'
Steffen hat den Chat verlassen
'
},
]
This diff is collapsed.
Click to expand it.
src/components/404internal/style.styl
+
1
−
0
View file @
3b3fc39d
...
...
@@ -87,6 +87,7 @@
&.foreign-message {
background-color white
align-self: flex-start
max-width 49%
.user-name {
color: #ff603e
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment