Skip to content

Commit

Permalink
Merge branch 'develop' into network/#95-signup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nya128 committed Jan 22, 2025
2 parents d9f0209 + 5c13c23 commit 86c72cc
Show file tree
Hide file tree
Showing 51 changed files with 1,346 additions and 283 deletions.
3 changes: 2 additions & 1 deletion Gongbaek_iOS/Gongbaek_iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
membershipExceptions = (
Global/Component/BottomSheet/.gitkeep,
Network/Service/DTO/Filling/.gitkeep,
Presentation/Home/ViewModel/.gitkeep,
);
target = 954A490A2D2DA7AE00FD6964 /* Gongbaek_iOS */;
};
Expand Down Expand Up @@ -286,6 +285,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Gongbaek_iOS/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Gongbaek-iOS-Info.plist";
Expand Down Expand Up @@ -315,6 +315,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Gongbaek_iOS/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Gongbaek-iOS-Info.plist";
Expand Down
81 changes: 71 additions & 10 deletions Gongbaek_iOS/Gongbaek_iOS/Global/Component/Bar/ApplyBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,88 @@ import SwiftUI
// MARK: TODO - Model 분리 예정

struct ApplyModel {
var isActivated: Bool
var currentPeopleCount: Int
var maxPeopleCount: Int
var buttonText: String
var isHost: Bool
var meetingStatus: String
var isApply: Bool
var onTap: (() -> Void)?
}

struct ApplyBar: View {
var applyData: ApplyModel
@Binding var applyData: ApplyModel

//TODO: buttonText, isActivated, buttonAction ViewModel로 분리

private var buttonText: String {
guard let state = RecruitingState(applyData.meetingStatus) else {
return "알 수 없는 상태"
}

if applyData.isHost {
return state == .CLOSED ? "종료된 모임입니다." : "삭제하기"
}

switch state {
case .CLOSED:
return "종료된 모임입니다."
case .RECRUITED:
return applyData.isApply ? "취소하기" : "인원 마감"
case .RECRUITING:
return applyData.isApply ? "취소하기" : "신청하기"
}
}

private var isActivated: Bool {
guard let state = RecruitingState(applyData.meetingStatus) else {
return false
}

if applyData.isHost {
return state != .CLOSED
}

switch state {
case .CLOSED:
return false
case .RECRUITED:
return applyData.isApply
case .RECRUITING:
return true
}
}

private var buttonAction: (() -> Void)? {
guard let state = RecruitingState(applyData.meetingStatus) else {
return nil
}

if applyData.isHost {
return state == .CLOSED ? nil : { print("삭제하기 처리") } //TODO: viewModel에서 action으로 변경
}

switch state {
case .CLOSED:
return nil
case .RECRUITED:
return applyData.isApply ? { print("신청 취소 처리") } : nil //TODO: viewModel에서 action으로 변경
case .RECRUITING:
return applyData.isApply ? { print("신청 취소 처리") } : { print("모임 신청 처리") } //TODO: viewModel에서 action으로 변경
}
}

var body: some View {
HStack(spacing: 16) {
Text("\(applyData.currentPeopleCount) / \(applyData.maxPeopleCount)")
.pretendardFont(.title2_sb_18)
.padding(16)
.foregroundStyle(applyData.isActivated ? .gray01 : .grayWhite)
.foregroundStyle(isActivated ? .gray01 : .grayWhite)
.background(
RoundedRectangle(cornerRadius: 6)
.fill(applyData.isActivated ? .gray09 : .gray04)
.fill(isActivated ? .gray09 : .gray04)
)

BasicButton(text: applyData.buttonText, isActivated: applyData.isActivated, onTap: applyData.onTap)
BasicButton(text: buttonText, isActivated: isActivated, onTap: applyData.onTap)
}
.padding(.vertical, 20)
.padding(.horizontal, 16)
Expand All @@ -41,12 +101,13 @@ struct ApplyBar: View {

#Preview {
ApplyBar(
applyData: ApplyModel(
isActivated: true,
applyData: .constant(ApplyModel(
currentPeopleCount: 3,
maxPeopleCount: 4,
buttonText: "엘렐레",
isHost: false,
meetingStatus: "RECRUITING",
isApply: false,
onTap: nil
)
)
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@

import SwiftUI

enum MyFillType: String, CaseIterable {
case recruit = "내가 모집한"
enum MyFillingType: String, CaseIterable {
case register = "내가 모집한"
case apply = "내가 신청한"
}

struct MyFillSegmentControlBar: View {
//@Binding var recruit의binding될_데이터: binding될_데이터
//@Binding var apply의binding될_데이터: binding될_데이터
@State private var selectedIndex = 0
@ObservedObject var viewModel: MyFillingViewModel

var body: some View {
VStack(spacing: 0) {
HStack(spacing: 0) {
ForEach(MyFillType.allCases.indices, id: \.self) { index in
let type = MyFillType.allCases[index]
ForEach(MyFillingType.allCases.indices, id: \.self) { index in
let type = MyFillingType.allCases[index]
let isSelected = selectedIndex == index

Button {
selectedIndex = index
fetchMeetings(for: type)
} label: {
ZStack(alignment: .bottom) {
Text(type.rawValue)
Expand All @@ -45,20 +45,22 @@ struct MyFillSegmentControlBar: View {
selectedView()
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.onAppear {
fetchMeetings(for: MyFillingType.register) // 기본값 설정
}
}

@ViewBuilder
private func selectedView() -> some View {
let type = MeetingDetailType.allCases[selectedIndex]
let type = MyFillingType.allCases[selectedIndex]
switch type {
case .meetingInfo:
Color.black//MeetingInfoView(ownerInfo: $ownerInfo, meetingDetail: $meetingDetailData)
case .comment:
Color.gray02 //CommentView(commentData: dummyCommentData)
case .register, .apply:
MyFillingList()
}
}

private func fetchMeetings(for type: MyFillingType) {
viewModel.fetchMeetings(category: type)
}
}

#Preview {
MyFillSegmentControlBar()
}
21 changes: 21 additions & 0 deletions Gongbaek_iOS/Gongbaek_iOS/Global/Component/Box/TitleTextBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ struct TitleTextBox: View {
}
}

struct HomeTitleTextBox: View {
let title: String
var subtitle: String
var highlightSubtitleText: String = ""

var body: some View {
VStack(alignment: .leading, spacing: 4) {
Text(title)
.pretendardFont(.title2_b_18)

HighlightTextView(
text: subtitle,
textColor: .gray06,
font: .body2_m_14,
highlightFont: .body2_b_14,
highlightString: highlightSubtitleText
)
}
}
}

#Preview {
TitleTextBox(
title: "공갱갱히히 공강시간에 원하는 모임 만들기",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// HomeMatchMemberListCell.swift
// Gongbaek_iOS
//
// Created by 김나연 on 1/21/25.
//

import SwiftUI

struct HomeMatchMemberListCell: View {
let data: PerfectMatchMemberModel

var body: some View {
VStack(spacing: 9) {
HStack {
HStack(spacing: 10) {
Image(ProfileImageMap.allCases[data.profileImage].rawValue)
.resizable()
.renderingMode(.original)
.scaledToFill()
.frame(width: 48, height: 48)

memberProfile()
}

Spacer()
chatButton()
}
divider()
}
.padding(.top, 10)
}

private func memberProfile() -> some View {
VStack(alignment: .leading, spacing: 2) {
HStack(spacing: 2) {
Text(data.nickname)
.pretendardFont(.body2_sb_14)
.foregroundStyle(.gray09)

Image(data.sex == "MAN" ? .icMale20 : .icFemale20)
.resizable()
.renderingMode(.original)
.scaledToFit()
.frame(width: 20, height: 20)
}

MajorChip(
major: data.major,
targetObject: .suggestedUserProfile
)
}
}

private func chatButton() -> some View {
Button {
// TODO: 추후 스프린트 구현 예정
} label: {
Text("채팅하기")
.pretendardFont(.caption2_b_12)
.foregroundStyle(.grayWhite)
.padding(.horizontal, 10)
.padding(.vertical, 4)
}
.buttonStyle(.plain)
.background(.mainOrange)
.clipShape(RoundedRectangle(cornerRadius: 4))
}

private func divider() -> some View {
Rectangle()
.fill(.gray02)
.frame(height: 1)
}
}

#Preview {
HomeMatchMemberListCell(data:
PerfectMatchMemberModel(
profileImage: 1,
nickname: "나여니",
sex: "FEMALE",
major: "컴퓨터공학과"
)
)
}
Loading

0 comments on commit 86c72cc

Please sign in to comment.