Skip to content

Commit

Permalink
feat: loader (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustDev authored Apr 29, 2024
1 parent 5baa3dd commit b408d59
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
{
"identity" : "swift-markdown-ui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/gonzalezreal/swift-markdown-ui",
"location" : "https://github.com/AugustDev/swift-markdown-ui",
"state" : {
"revision" : "ae799d015a5374708f7b4c85f3294c05f2a564e2",
"version" : "2.3.0"
"branch" : "main",
"revision" : "acb83e45394334a04ba0cf3487e4d07f4709eeb4"
}
},
{
Expand Down
20 changes: 15 additions & 5 deletions Enchanted/UI/Shared/Chat/Components/ChatMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import SwiftUI
import MarkdownUI
import Splash
import ActivityIndicatorView

struct ChatMessageView: View {
@Environment(\.colorScheme) var colorScheme
var message: MessageSD
var showLoader: Bool = false
@Binding var editMessage: MessageSD?
@State private var mouseHover = false

Expand Down Expand Up @@ -196,6 +198,7 @@ struct ChatMessageView: View {

}
.frame(width: 24, height: 24)

} else {
Image("logo-nobg")
.resizable()
Expand All @@ -204,11 +207,18 @@ struct ChatMessageView: View {
}

VStack(alignment: .leading) {
Text(message.role.capitalized)
.font(.system(size: 16))
.fontWeight(.medium)
.padding(.bottom, 2)
.frame(height: 27)
HStack {
Text(message.role.capitalized)
.font(.system(size: 16))
.fontWeight(.medium)
.padding(.bottom, 2)
.frame(height: 27)

ActivityIndicatorView(isVisible: .constant(true), type: .rotatingDots(count: 5))
.frame(width: 20, height: 20)
.rotationEffect(.degrees(-90))
.showIf(showLoader)
}

Markdown(message.content)
.textSelection(.enabled)
Expand Down
1 change: 1 addition & 0 deletions Enchanted/UI/Shared/Chat/Components/MessageListVIew.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct MessageListView: View {
ForEach(messages) { message in
ChatMessageView(
message: message,
showLoader: conversationState == .loading && messages.last == message,
editMessage: $editMessage
)
.listRowInsets(EdgeInsets())
Expand Down

0 comments on commit b408d59

Please sign in to comment.