-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding a loading ring element for history and refactoring messages
- Loading branch information
1 parent
3cf2572
commit dcd328b
Showing
17 changed files
with
318 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@keyframes loading-spinner { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 0 additions & 87 deletions
87
component/src/views/chat/input/buttons/submit/loadingIcon.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
component/src/views/chat/messages/history/loadingHistory.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.loading-history-message-full-view { | ||
position: absolute; | ||
height: 70%; | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.loading-history-message-small { | ||
scale: 0.6; | ||
height: 20px; | ||
margin-bottom: 30px; | ||
} | ||
|
||
.loading-history-message { | ||
margin-top: 0px; | ||
width: 100%; | ||
max-width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
background-color: unset; | ||
} | ||
|
||
.loading-history { | ||
width: 70px; | ||
} | ||
|
||
.loading-history div { | ||
position: absolute; | ||
width: 57px; | ||
height: 57px; | ||
margin: 7px; | ||
border: 5px solid; | ||
border-radius: 50%; | ||
animation: loading-spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; | ||
border-color: rgb(219, 219, 219) transparent transparent transparent; | ||
} | ||
|
||
.loading-history div:nth-child(1) { | ||
animation-delay: -0.45s; | ||
} | ||
|
||
.loading-history div:nth-child(2) { | ||
animation-delay: -0.3s; | ||
} | ||
|
||
.loading-history div:nth-child(3) { | ||
animation-delay: -0.15s; | ||
} |
34 changes: 34 additions & 0 deletions
34
component/src/views/chat/messages/history/loadingHistory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {MessageElements, Messages} from '../messages'; | ||
import {MessageUtils} from '../messageUtils'; | ||
|
||
export class LoadingHistory { | ||
public static readonly CLASS = 'loading-history-message'; | ||
private static readonly FULL_VIEW_CLASS = 'loading-history-message-full-view'; | ||
private static readonly SMALL_CLASS = 'loading-history-message-small'; | ||
|
||
private static generateLoadingRingElement() { | ||
const loadingRingElement = document.createElement('div'); | ||
loadingRingElement.classList.add('loading-history'); | ||
loadingRingElement.appendChild(document.createElement('div')); | ||
loadingRingElement.appendChild(document.createElement('div')); | ||
loadingRingElement.appendChild(document.createElement('div')); | ||
loadingRingElement.appendChild(document.createElement('div')); | ||
return loadingRingElement; | ||
} | ||
|
||
public static addLoadHistoryMessage(messages: Messages, isInitial = true) { | ||
const messageElements = messages.createMessageElements('', MessageUtils.AI_ROLE); | ||
const {outerContainer, bubbleElement} = messageElements; | ||
bubbleElement.classList.add(LoadingHistory.CLASS); | ||
const loadingRingElement = LoadingHistory.generateLoadingRingElement(); | ||
bubbleElement.appendChild(loadingRingElement); | ||
const viewClass = isInitial ? LoadingHistory.FULL_VIEW_CLASS : LoadingHistory.SMALL_CLASS; | ||
messageElements.outerContainer.classList.add(viewClass); | ||
messages.elementRef.prepend(outerContainer); | ||
return messageElements; | ||
} | ||
|
||
public static changeFullViewToSmall(messageElements?: MessageElements) { | ||
messageElements?.outerContainer.classList.replace(LoadingHistory.FULL_VIEW_CLASS, LoadingHistory.SMALL_CLASS); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.