From 9311137b703a161619fe87e32628be7fe2742dba Mon Sep 17 00:00:00 2001 From: HyoWon Choi Date: Wed, 21 Aug 2024 16:47:30 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=201=EC=B0=A8=20QA=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *[수정] 색상 및 폰트 수정 --- package-kuring/Sources/UIKit/BotUI/BotView.swift | 3 +++ package-kuring/Sources/UIKit/BotUI/ChatView.swift | 1 + 2 files changed, 4 insertions(+) diff --git a/package-kuring/Sources/UIKit/BotUI/BotView.swift b/package-kuring/Sources/UIKit/BotUI/BotView.swift index 609d70d..1ec86c4 100644 --- a/package-kuring/Sources/UIKit/BotUI/BotView.swift +++ b/package-kuring/Sources/UIKit/BotUI/BotView.swift @@ -81,6 +81,8 @@ public struct BotView: View { isPopoverVisible.toggle() } label: { Image("icon_info_circle", bundle: Bundle.bots) + .renderingMode(.template) + .foregroundStyle(Color.Kuring.gray200) } .popover(isPresented: $isPopoverVisible, arrowEdge: .top) { popoverContent @@ -112,6 +114,7 @@ public struct BotView: View { private var inputView: some View { HStack(alignment: .bottom, spacing: 12) { TextField("질문을 입력해주세요", text: $tempInputText, axis: .vertical) + .font(.system(size: 15, weight: .medium)) .lineLimit(5) .focused($isInputFocused) .padding(.horizontal) diff --git a/package-kuring/Sources/UIKit/BotUI/ChatView.swift b/package-kuring/Sources/UIKit/BotUI/ChatView.swift index 58cb96f..eebca4c 100644 --- a/package-kuring/Sources/UIKit/BotUI/ChatView.swift +++ b/package-kuring/Sources/UIKit/BotUI/ChatView.swift @@ -70,6 +70,7 @@ struct ChatView: View { let maxWidth = UIScreen.main.bounds.width * 0.7 return Text(message.text) + .font(.system(size: 15, weight: .medium)) .padding() .background(message.type == .question ? Color.Kuring.gray100 : Color.Kuring.primarySelected) From f7060db0758f033e9973331127f3d2f093089c2b Mon Sep 17 00:00:00 2001 From: HyoWon Choi Date: Wed, 21 Aug 2024 17:30:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=201=EC=B0=A8=20QA=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *[수정] 텍스트 복사 가능하게 수정 --- package-kuring/Sources/UIKit/BotUI/ChatView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/package-kuring/Sources/UIKit/BotUI/ChatView.swift b/package-kuring/Sources/UIKit/BotUI/ChatView.swift index eebca4c..859ac57 100644 --- a/package-kuring/Sources/UIKit/BotUI/ChatView.swift +++ b/package-kuring/Sources/UIKit/BotUI/ChatView.swift @@ -71,6 +71,7 @@ struct ChatView: View { return Text(message.text) .font(.system(size: 15, weight: .medium)) + .textSelection(.enabled) .padding() .background(message.type == .question ? Color.Kuring.gray100 : Color.Kuring.primarySelected) From 62d7c79b549e82905f8caf87188eef2cea7b5fe8 Mon Sep 17 00:00:00 2001 From: HyoWon Choi Date: Wed, 21 Aug 2024 18:06:25 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20ChatView=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/UIKit/BotUI/ChatView.swift | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/package-kuring/Sources/UIKit/BotUI/ChatView.swift b/package-kuring/Sources/UIKit/BotUI/ChatView.swift index 859ac57..fe87c1d 100644 --- a/package-kuring/Sources/UIKit/BotUI/ChatView.swift +++ b/package-kuring/Sources/UIKit/BotUI/ChatView.swift @@ -16,18 +16,26 @@ struct ChatView: View { @Query(FetchDescriptor()) var chatQuery: [ChatInfo] var body: some View { - ScrollView { - VStack(alignment: .center, spacing: 16) { - ForEach(store.chatHistory) { chat in - chatRow(for: chat) - if chat.type == .answer { - /// 질문 가능 횟수 - possibleCountText(for: calculateSendCount(for: chat.index)) + ScrollViewReader { proxy in + ScrollView { + LazyVStack(alignment: .center, spacing: 16) { + ForEach(store.chatHistory) { chat in + chatRow(for: chat) + if chat.type == .answer { + possibleCountText(for: calculateSendCount(for: chat.index)) + .id(chat.index) + } } + Spacer() + } + .padding(.bottom, 5) + } + .onChange(of: store.chatHistory) { _, value in + withAnimation { + proxy.scrollTo(value.last?.index, anchor: .center) + } - Spacer() } - .padding(.bottom, 5) } .onChange(of: self.chatQuery, initial: true) { _, newValue in store.send(.queryChanged(newValue))