커뮤니티 게시물 전체보기, 좋아요, 댓글 추가 API 적용
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// CreateCommunityPostCommentRequest.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/20.
|
||||
//
|
||||
|
||||
struct CreateCommunityPostCommentRequest: Encodable {
|
||||
let comment: String
|
||||
let postId: Int
|
||||
let parentId: Int?
|
||||
}
|
@@ -6,12 +6,13 @@
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct CreatorCommunityCommentView: View {
|
||||
let commentCount: Int
|
||||
let commentList: [String]
|
||||
let commentItem: GetCommunityPostCommentListItem?
|
||||
|
||||
let registerComment: (String) -> Void
|
||||
let onClickWriteComment: (String) -> Void
|
||||
|
||||
@State private var comment = ""
|
||||
|
||||
@@ -30,18 +31,23 @@ struct CreatorCommunityCommentView: View {
|
||||
}
|
||||
|
||||
HStack(spacing: 8) {
|
||||
Image("ic_place_holder")
|
||||
.resizable()
|
||||
.frame(width: 33.3, height: 33.3)
|
||||
.clipShape(Circle())
|
||||
if let comment = commentItem {
|
||||
KFImage(URL(string: comment.profileUrl))
|
||||
.resizable()
|
||||
.frame(width: 33.3, height: 33.3)
|
||||
.clipShape(Circle())
|
||||
|
||||
if commentCount > 0 {
|
||||
Text(commentList[0])
|
||||
Text(comment.comment)
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.lineLimit(1)
|
||||
.padding(.leading, 3)
|
||||
} else {
|
||||
KFImage(URL(string: UserDefaults.string(forKey: .profileImage)))
|
||||
.resizable()
|
||||
.frame(width: 33.3, height: 33.3)
|
||||
.clipShape(Circle())
|
||||
|
||||
HStack(spacing: 0) {
|
||||
TextField("댓글을 입력해 보세요.", text: $comment)
|
||||
.autocapitalization(.none)
|
||||
@@ -60,7 +66,8 @@ struct CreatorCommunityCommentView: View {
|
||||
.padding(6.7)
|
||||
.onTapGesture {
|
||||
hideKeyboard()
|
||||
registerComment(comment)
|
||||
onClickWriteComment(comment)
|
||||
comment = ""
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "232323"))
|
||||
@@ -83,11 +90,16 @@ struct CreatorCommunityCommentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorCommunityCommentView(
|
||||
commentCount: 0,
|
||||
commentList: [
|
||||
"내용 읽어보니까 결혼해도 될것 같은데",
|
||||
"너무 조하유 앞으로도 좋은 라이브 많이 들려주세요"
|
||||
],
|
||||
registerComment: { _ in }
|
||||
commentItem: GetCommunityPostCommentListItem(
|
||||
id: 1,
|
||||
writerId: 1,
|
||||
nickname: "닉네임",
|
||||
profileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
comment: "댓글 테스트",
|
||||
date: "1시간전",
|
||||
replyCount: 0
|
||||
),
|
||||
onClickWriteComment: { _ in }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user