aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Views/ChatView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-04 09:12:58 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-04 09:12:58 -0800
commit471546236b8991f61d26c0e3aa8ee48b83b983af (patch)
treeb74331a8c8ea61ee7e1eaedfc7bbd1686bbc4702 /Hotline/Views/ChatView.swift
parent885119acdd27bd53ed3096285c3eca3e2d99ad70 (diff)
Starting to hash out a server view and tabs. Added research pdfs. etc.
Diffstat (limited to 'Hotline/Views/ChatView.swift')
-rw-r--r--Hotline/Views/ChatView.swift63
1 files changed, 63 insertions, 0 deletions
diff --git a/Hotline/Views/ChatView.swift b/Hotline/Views/ChatView.swift
new file mode 100644
index 0000000..532a890
--- /dev/null
+++ b/Hotline/Views/ChatView.swift
@@ -0,0 +1,63 @@
+import SwiftUI
+
+struct ChatView: View {
+// @Binding private var input: String
+ @State var input: String = ""
+ @State private var scrollPos: Int?
+ @State private var contentHeight: CGFloat = 0
+
+ var body: some View {
+ VStack(spacing: 0) {
+ GeometryReader { geometry in
+ ScrollView(.vertical) {
+ ScrollViewReader { scrollReader in
+ VStack(alignment: .leading) {
+ Spacer()
+ LazyVStack(alignment: .leading, spacing: 10) {
+ HStack(alignment: .firstTextBaseline) {
+ Text("bolt:").bold().fontDesign(.monospaced).frame(minWidth: 60)
+ Text("hello!").fontDesign(.monospaced).textSelection(.enabled)
+ }
+ ForEach(0..<50) { i in
+ HStack(alignment: .firstTextBaseline) {
+ Text("mierau:").bold().fontDesign(.monospaced)
+ Text("g'day to you. what's going on this afternoon?")
+ .fontDesign(.monospaced)
+ .textSelection(.enabled)
+ }
+ }
+ Text("").font(.system(size: 0)).id("bottomScroll")
+ }
+ .padding()
+ }
+ // .frame(width: geometry.size.width)
+ .frame(minHeight: geometry.size.height)
+// .background(Color.red)
+ .onAppear() {
+ scrollReader.scrollTo("bottomScroll", anchor: .bottom)
+ }
+ // .onChange() {
+ // scrollReader.scrollTo(10000, anchor: .bottomTrailing)
+ // }
+ }
+ }
+ }
+
+ Divider()
+
+ HStack(alignment: .top) {
+ Image(systemName: "chevron.right")
+ TextField("This is a chat topic", text: $input, axis: .vertical)
+ .lineLimit(1...5)
+ .onSubmit {
+ // HotlineClient.shared.sendChat(message: self.input)
+ self.input = ""
+ }
+ }.padding()
+ }
+ }
+}
+
+#Preview {
+ ChatView()
+}