49 lines
1.4 KiB
Swift
49 lines
1.4 KiB
Swift
//
|
|
// TalkView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 8/29/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TalkView: View {
|
|
|
|
@StateObject var viewModel = TalkViewModel()
|
|
|
|
var body: some View {
|
|
BaseView(isLoading: $viewModel.isLoading) {
|
|
if viewModel.talkRooms.isEmpty {
|
|
Text("대화 중인 톡이 없습니다")
|
|
.font(.custom(Font.preRegular.rawValue, size: 20))
|
|
.foregroundColor(.white)
|
|
} else {
|
|
ScrollView(.vertical, showsIndicators: false) {
|
|
VStack(spacing: 24) {
|
|
ForEach(0..<viewModel.talkRooms.count, id: \.self) {
|
|
let item = viewModel.talkRooms[$0]
|
|
TalkItemView(item: item)
|
|
.padding(.horizontal, 24)
|
|
.contentShape(Rectangle())
|
|
.onTapGesture {
|
|
AppState.shared
|
|
.setAppStep(
|
|
step: .chatRoom(id: item.chatRoomId)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
.padding(.vertical, 24)
|
|
}
|
|
}
|
|
}
|
|
.onAppear {
|
|
viewModel.getTalkRooms()
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
TalkView()
|
|
}
|