diff --git a/SodaLive/Resources/Assets.xcassets/img_sample.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/img_sample.imageset/Contents.json new file mode 100644 index 0000000..23d0274 --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/img_sample.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "img_sample.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/img_sample.imageset/img_sample.png b/SodaLive/Resources/Assets.xcassets/img_sample.imageset/img_sample.png new file mode 100644 index 0000000..046a95e Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/img_sample.imageset/img_sample.png differ diff --git a/SodaLive/Sources/App/AppStep.swift b/SodaLive/Sources/App/AppStep.swift index b73ffe9..8438f71 100644 --- a/SodaLive/Sources/App/AppStep.swift +++ b/SodaLive/Sources/App/AppStep.swift @@ -111,4 +111,6 @@ enum AppStep { case curationAll(title: String, curationId: Int) case contentRankingAll + + case creatorCommunityAll(creatorId: Int) } diff --git a/SodaLive/Sources/ContentView.swift b/SodaLive/Sources/ContentView.swift index 757bc19..811ff24 100644 --- a/SodaLive/Sources/ContentView.swift +++ b/SodaLive/Sources/ContentView.swift @@ -163,6 +163,9 @@ struct ContentView: View { case .contentRankingAll: ContentRankingAllView() + case .creatorCommunityAll(let creatorId): + CreatorCommunityAllView(creatorId: creatorId) + default: EmptyView() .frame(width: 0, height: 0, alignment: .topLeading) diff --git a/SodaLive/Sources/CustomView/IconAndTitleButton.swift b/SodaLive/Sources/CustomView/IconAndTitleButton.swift new file mode 100644 index 0000000..ffcae1b --- /dev/null +++ b/SodaLive/Sources/CustomView/IconAndTitleButton.swift @@ -0,0 +1,40 @@ +// +// IconAndTitleButton.swift +// SodaLive +// +// Created by klaus on 2023/12/15. +// + +import SwiftUI + +struct IconAndTitleButton: View { + + let iconName: String + let title: String + let onClick: () -> Void + + var body: some View { + HStack(spacing: 4) { + Image(iconName) + + Text(title) + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "d2d2d2")) + } + .padding(.horizontal, 13.3) + .padding(.vertical, 5.3) + .background(Color(hex: "ffffff").opacity(0.1)) + .cornerRadius(26.7) + .onTapGesture { onClick() } + } +} + +struct IconAndTitleButton_Previews: PreviewProvider { + static var previews: some View { + IconAndTitleButton( + iconName: "ic_audio_content_share", + title: "공유", + onClick: {} + ) + } +} diff --git a/SodaLive/Sources/CustomView/IconAndTitleToggleButton.swift b/SodaLive/Sources/CustomView/IconAndTitleToggleButton.swift new file mode 100644 index 0000000..2872f5e --- /dev/null +++ b/SodaLive/Sources/CustomView/IconAndTitleToggleButton.swift @@ -0,0 +1,45 @@ +// +// IconAndTitleToggleButton.swift +// SodaLive +// +// Created by klaus on 2023/12/15. +// + +import SwiftUI + +struct IconAndTitleToggleButton: View { + + @Binding var isChecked: Bool + + let title: String + let normalIconName: String + let checkedIconName: String + + let onClick: () -> Void + + var body: some View { + HStack(spacing: 4) { + Image(isChecked ? checkedIconName : normalIconName) + + Text("\(title)") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "d2d2d2")) + } + .padding(.horizontal, 13.3) + .padding(.vertical, 5.3) + .background(Color(hex: "ffffff").opacity(0.1)) + .cornerRadius(26.7) + .onTapGesture { onClick() } + } +} + +struct IconAndTitleToggleButton_Previews: PreviewProvider { + static var previews: some View { + IconAndTitleToggleButton( + isChecked: .constant(true), + title: "100", + normalIconName: "ic_audio_content_heart_normal", + checkedIconName: "ic_audio_content_heart_pressed" + ) {} + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift index 9da6481..805cf86 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift @@ -8,6 +8,9 @@ import SwiftUI struct CreatorCommunityMoreItemView: View { + + let onClick: () -> Void + var body: some View { VStack(spacing: 11) { Image("btn_item_more") @@ -18,11 +21,12 @@ struct CreatorCommunityMoreItemView: View { .font(.custom(Font.light.rawValue, size: 11)) .foregroundColor(Color(hex: "bbbbbb")) } + .onTapGesture { onClick() } } } struct CreatorCommunityMoreItemView_Previews: PreviewProvider { static var previews: some View { - CreatorCommunityMoreItemView() + CreatorCommunityMoreItemView {} } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllItemView.swift new file mode 100644 index 0000000..9cc1b2c --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllItemView.swift @@ -0,0 +1,80 @@ +// +// CreatorCommunityAllItemView.swift +// SodaLive +// +// Created by klaus on 2023/12/15. +// + +import SwiftUI + +struct CreatorCommunityAllItemView: View { + + @State var isExpandContent = true + + var body: some View { + VStack(spacing: 13.3) { + HStack(spacing: 0) { + Image("ic_place_holder") + .resizable() + .frame(width: 40, height: 40) + .clipShape(Circle()) + + VStack(alignment: .leading, spacing: 3) { + Text("민하나") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + + Text("1개월 전(수정됨)") + .font(.custom(Font.light.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "777777")) + } + .padding(.leading, 11) + + Spacer() + + Image("ic_seemore_vertical") + .padding(.trailing, 8.3) + .onTapGesture {} + } + + Text("너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "bbbbbb")) + .fixedSize(horizontal: false, vertical: true) + .frame(maxWidth: .infinity, alignment: .leading) + .lineLimit(isExpandContent ? Int.max : 3) + .onTapGesture { isExpandContent.toggle() } + + Image("img_sample") + .resizable() + .frame(maxWidth: .infinity) + .scaledToFit() + + HStack(spacing: 8) { + IconAndTitleToggleButton( + isChecked: .constant(true), + title: "252", + normalIconName: "ic_audio_content_heart_normal", + checkedIconName: "ic_audio_content_heart_pressed" + ) {} + IconAndTitleButton(iconName: "ic_audio_content_share", title: "공유") {} + } + .frame(maxWidth: .infinity, alignment: .leading) + + CreatorCommunityCommentView( + commentCount: 2, + commentList: [ + "내용 읽어보니까 결혼해도 될것 같은데", + "너무 조하유 앞으로도 좋은 라이브 많이 들려주세요" + ], + registerComment: { _ in } + ) + } + } +} + +struct CreatorCommunityAllItemView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityAllItemView() + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllView.swift new file mode 100644 index 0000000..db4b5d3 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/CreatorCommunityAllView.swift @@ -0,0 +1,37 @@ +// +// CreatorCommunityAllView.swift +// SodaLive +// +// Created by klaus on 2023/12/15. +// + +import SwiftUI + +struct CreatorCommunityAllView: View { + + let creatorId: Int + + var body: some View { + BaseView { + VStack(spacing: 0) { + DetailNavigationBar(title: "커뮤니티") + + ScrollView(.vertical, showsIndicators: false) { + LazyVStack(spacing: 26.7) { + CreatorCommunityAllItemView() + CreatorCommunityAllItemView() + CreatorCommunityAllItemView() + } + .padding(.horizontal, 13.3) + .padding(.vertical, 5.3) + } + } + } + } +} + +struct CreatorCommunityAllView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityAllView(creatorId: 0) + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/comment/CreatorCommunityCommentView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/comment/CreatorCommunityCommentView.swift new file mode 100644 index 0000000..d866592 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/all/comment/CreatorCommunityCommentView.swift @@ -0,0 +1,93 @@ +// +// CreatorCommunityCommentView.swift +// SodaLive +// +// Created by klaus on 2023/12/15. +// + +import SwiftUI + +struct CreatorCommunityCommentView: View { + let commentCount: Int + let commentList: [String] + + let registerComment: (String) -> Void + + @State private var comment = "" + + var body: some View { + VStack(alignment: .leading, spacing: 11) { + HStack(spacing: 5.3) { + Text("댓글") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(.white) + + Text("\(commentCount)") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "909090")) + + Spacer() + } + + HStack(spacing: 8) { + Image("ic_place_holder") + .resizable() + .frame(width: 33.3, height: 33.3) + .clipShape(Circle()) + + if commentCount > 0 { + Text(commentList[0]) + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "bbbbbb")) + .lineLimit(1) + .padding(.leading, 3) + } else { + HStack(spacing: 0) { + TextField("댓글을 입력해 보세요.", text: $comment) + .autocapitalization(.none) + .disableAutocorrection(true) + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + .accentColor(Color(hex: "3bb9f1")) + .keyboardType(.default) + .padding(.horizontal, 13.3) + + Spacer() + + Image("btn_message_send") + .resizable() + .frame(width: 35, height: 35) + .padding(6.7) + .onTapGesture { + hideKeyboard() + registerComment(comment) + } + } + .background(Color(hex: "232323")) + .cornerRadius(10) + .overlay( + RoundedRectangle(cornerRadius: 10) + .strokeBorder(lineWidth: 1) + .foregroundColor(Color(hex: "3bb9f1")) + ) + } + } + } + .padding(11) + .background(Color(hex: "ffffff").opacity(0.1)) + .cornerRadius(5.3) + } +} + +struct CreatorCommunityCommentView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityCommentView( + commentCount: 0, + commentList: [ + "내용 읽어보니까 결혼해도 될것 같은데", + "너무 조하유 앞으로도 좋은 라이브 많이 들려주세요" + ], + registerComment: { _ in } + ) + } +} diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 5e11460..3b6acf1 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -74,7 +74,11 @@ struct UserProfileView: View { CreatorCommunityItemView() .frame(width: 320) - CreatorCommunityMoreItemView() + CreatorCommunityMoreItemView { + AppState.shared.setAppStep( + step: .creatorCommunityAll(creatorId: userId) + ) + } } .padding(.horizontal, 15) }