Skip to content

Commit

Permalink
Merge pull request #250 from GSM-MSG/243-modify-detail-prize-project-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsh153 authored Aug 24, 2023
2 parents 7bc29c6 + 87179c0 commit 74461b8
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import ViewUtil
import FoundationUtil

public struct SMSIconTextField<Content: View>: View {
@Binding var text: String
Expand Down Expand Up @@ -43,7 +44,7 @@ public struct SMSIconTextField<Content: View>: View {
.buttonWrapper {
text = ""
}
.conditional(!text.isEmpty && isOnClear)
.conditional(text.isNotEmpty && isOnClear)
}
.padding(.horizontal, 12)
.frame(height: 48)
Expand All @@ -58,7 +59,7 @@ public struct SMSIconTextField<Content: View>: View {
isFocused = true
}

ConditionView(isError && !errorText.isEmpty) {
ConditionView(isError && errorText.isNotEmpty) {
Text(errorText)
.padding(.leading, 8)
.smsFont(.caption1, color: .error(.e2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public struct SMSTextField: View {
.buttonWrapper {
text = ""
}
.conditional(!text.isEmpty && isOnClear)
.conditional(text.isNotEmpty && isOnClear)
}
.padding(.horizontal, 12)
.frame(height: 48)
Expand All @@ -53,7 +53,7 @@ public struct SMSTextField: View {
isFocused = true
}

ConditionView(isError && !errorText.isEmpty) {
ConditionView(isError && errorText.isNotEmpty) {
Text(errorText)
.padding(.leading, 8)
.smsFont(.caption1, color: .error(.e2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension AuthEndpoint: SMSEndpoint {

var jwtTokenType: JwtTokenType {
switch self {
case .withdrawal, .verifyIsExistUser:
case .withdrawal, .verifyIsExistUser, .logout:
return .accessToken

case .refresh:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ViewUtil
struct InputProjectInfoView: View {
@FocusState var projectContentIsFocused: Bool
@StateObject var container: MVIContainer<InputProjectInfoIntentProtocol, InputProjectInfoStateProtocol>
@Environment(\.screenSize) var screenSize
var intent: any InputProjectInfoIntentProtocol { container.intent }
var state: any InputProjectInfoStateProtocol { container.model }
private let techStackAppendBuildable: any TechStackAppendBuildable
Expand Down Expand Up @@ -60,6 +61,7 @@ struct InputProjectInfoView: View {
}
.padding([.top, .horizontal], 20)
}
.frame(minHeight: screenSize.height)
}
}
.imagePicker(
Expand Down Expand Up @@ -149,6 +151,8 @@ struct InputProjectInfoView: View {

projectContentTextEditor(index: index)

projectMyActivityTextEditor(index: index)

projectTechStack(geometry: geometry, index: index)

projectDuration(index: index)
Expand Down Expand Up @@ -267,15 +271,47 @@ private extension InputProjectInfoView {
)
.overlay(alignment: .topLeading) {
ConditionView(projectContent.isEmpty) {
SMSText("프로젝트 내용 입력", font: .body1)
SMSText("프로젝트 내용 서술", font: .body1)
.foregroundColor(.sms(.neutral(.n30)))
.padding([.top, .leading], 12)
.onTapGesture {
projectContentIsFocused = true
}
}
}
.titleWrapper("프로젝트 설명")
}

@ViewBuilder
func projectMyActivityTextEditor(index: Int) -> some View {
let projectMyActivity = state.projectList[safe: index]?.mainTask ?? ""
TextEditor(
text: Binding(
get: { projectMyActivity },
set: { intent.updateProjectMainTask(index: index, mainTask: $0) }
)
)
.smsFont(.body1, color: .system(.black))
.focused($projectContentIsFocused)
.colorMultiply(.sms(.neutral(.n10)))
.frame(minHeight: 48)
.cornerRadius(8)
.roundedStroke(
cornerRadius: 8,
color: projectContentIsFocused ? .sms(.primary(.p1)) : .clear,
lineWidth: projectContentIsFocused ? 1 : 0
)
.overlay(alignment: .topLeading) {
ConditionView(projectMyActivity.isEmpty) {
SMSText("주요 작업 내용 서술", font: .body1)
.foregroundColor(.sms(.neutral(.n30)))
.padding([.top, .leading], 12)
.onTapGesture {
projectContentIsFocused = true
}
}
}
.titleWrapper("내용")
.titleWrapper("주요 작업 서술")
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class InputWorkInfoModel: ObservableObject, InputWorkInfoStateProtocol {
@Published var formOfEmployment: FormOfEmployment = .fullTime
@Published var isPresentedFormOfEmployeementSheet: Bool = false
var salaryDisplay: String {
guard !salary.isEmpty else { return "상관없음" }
guard salary.isNotEmpty else { return "상관없음" }
return "\(numberFormatter.string(for: Int(salary)) ?? "0") 만원"
}
}
Expand Down
8 changes: 4 additions & 4 deletions Projects/Feature/MainFeature/Sources/Scene/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct MainView: View {
profileImageUrl: item.profileImageURL,
name: item.name,
major: item.major,
techStack: item.techStacks
techStacks: item.techStacks
)
.foregroundColor(.sms(.system(.black)))
.buttonWrapper {
Expand Down Expand Up @@ -186,11 +186,11 @@ struct MainView: View {
profileImageUrl: String,
name: String,
major: String,
techStack: [String]
techStacks: [String]
) -> some View {
HStack(spacing: 12) {
Group {
if !profileImageUrl.isEmpty, let imageURL = URL(string: profileImageUrl) {
if profileImageUrl.isNotEmpty, let imageURL = URL(string: profileImageUrl) {
LazyImage(url: imageURL) { state in
if let image = state.image {
image
Expand All @@ -212,7 +212,7 @@ struct MainView: View {
SMSText(major, font: .body2)
.padding(.bottom, 16)

techStackListView(techStack: techStack)
techStackListView(techStack: techStacks)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ struct MyPageProjectView: View {

projectContentTextEditor(index: index)

projectMyActivityTextEditor(index: index)

projectTechStack(geometry: geometry, index: index)

projectDuration(index: index)
Expand Down Expand Up @@ -219,15 +221,47 @@ private extension MyPageProjectView {
)
.overlay(alignment: .topLeading) {
ConditionView(projectContent.isEmpty) {
SMSText("프로젝트 내용 입력", font: .body1)
SMSText("프로젝트 내용 서술", font: .body1)
.foregroundColor(.sms(.neutral(.n30)))
.padding([.top, .leading], 12)
.onTapGesture {
projectContentIsFocused = true
}
}
}
.titleWrapper("프로젝트 설명")
}

@ViewBuilder
func projectMyActivityTextEditor(index: Int) -> some View {
let projectMyActivity = state.projectList[safe: index]?.mainTask ?? ""
TextEditor(
text: Binding(
get: { projectMyActivity },
set: { intent.updateProjectMainTask(index: index, mainTask: $0) }
)
)
.smsFont(.body1, color: .system(.black))
.focused($projectContentIsFocused)
.colorMultiply(.sms(.neutral(.n10)))
.frame(minHeight: 48)
.cornerRadius(8)
.roundedStroke(
cornerRadius: 8,
color: projectContentIsFocused ? .sms(.primary(.p1)) : .clear,
lineWidth: projectContentIsFocused ? 1 : 0
)
.overlay(alignment: .topLeading) {
ConditionView(projectMyActivity.isEmpty) {
SMSText("주요 작업 내용 서술", font: .body1)
.foregroundColor(.sms(.neutral(.n30)))
.padding([.top, .leading], 12)
.onTapGesture {
projectContentIsFocused = true
}
}
}
.titleWrapper("내용")
.titleWrapper("주요 작업 서술")
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct StudentDetailView: View {
ZStack(alignment: .topTrailing) {
VStack {
Group {
if let studentDetail, !studentDetail.profileImageURL.isEmpty {
if let studentDetail, studentDetail.profileImageURL.isNotEmpty {
LazyImage(url: URL(string: studentDetail.profileImageURL)) { state in
if let image = state.image {
image.resizable()
Expand Down Expand Up @@ -188,24 +188,32 @@ struct StudentDetailView: View {
studentInfoForTeacher(geometry: geometry, detailInfo: detailInfoByTeacher)
}

VStack(spacing: 8) {
ForEach(studentDetail?.prizes ?? [], id: \.self) { prize in
PrizeRowView(prize: prize)
ConditionView(state.userRole == .teacher) {
Spacer().frame(height: 40)
}

ConditionView(studentDetail?.prizes.isNotEmpty ?? false) {
VStack(spacing: 8) {
ForEach(studentDetail?.prizes ?? [], id: \.self) { prize in
PrizeRowView(prize: prize)
}
}
.studentDetailTitleWrapper(title: "수상")

Spacer().frame(height: 40)
}
.studentDetailTitleWrapper(title: "수상")

VStack(spacing: 32) {
ForEach(studentDetail?.projects ?? [], id: \.self) { project in
ProjectRowView(project: project)
ConditionView(studentDetail?.projects.isNotEmpty ?? false) {
VStack(spacing: 32) {
ForEach(studentDetail?.projects ?? [], id: \.self) { project in
ProjectRowView(project: project)
}
}
.studentDetailTitleWrapper(title: "프로젝트")
}
.studentDetailTitleWrapper(title: "프로젝트")
}

Color.sms(.system(.white))
.frame(height: 300)
.conditional(state.userRole != .teacher)
Spacer().frame(height: 120)
}
}
.padding(.horizontal, 20)
.background {
Expand Down Expand Up @@ -258,10 +266,10 @@ struct StudentDetailView: View {
value: detailInfo.regions.joined(separator: ", "),
geometry: geometry
)
.conditional(!detailInfo.regions.isEmpty)
.conditional(detailInfo.regions.isNotEmpty)

SMSSeparator(.neutral(.n20), height: 1)
.conditional(!detailInfo.languageCertificate.isEmpty)
.conditional(detailInfo.languageCertificate.isNotEmpty)
}

Group {
Expand All @@ -270,19 +278,17 @@ struct StudentDetailView: View {
}

SMSSeparator(.neutral(.n20), height: 1)
.conditional(!detailInfo.certificate.isEmpty)
.conditional(detailInfo.certificate.isNotEmpty)
}

studentInfoRowView(
name: "자격증",
value: detailInfo.certificate.joined(separator: "\n"),
geometry: geometry
)
.conditional(!detailInfo.certificate.isEmpty)

Spacer().frame(height: 120)
.conditional(detailInfo.certificate.isNotEmpty)
}
.studentDetailTitleWrapper(title: "수상")
.studentDetailTitleWrapper(title: "세부정보")
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import DesignSystem
import SwiftUI
import StudentDomainInterface
import ViewUtil

struct PrizeRowView: View {
let prize: PrizeEntity
Expand All @@ -16,17 +17,23 @@ struct PrizeRowView: View {

VStack(alignment: .leading, spacing: 8) {
HStack(alignment: .top) {
SMSText(prize.name)
.foregroundColor(.sms(.system(.black)))
ConditionView(prize.name.isNotEmpty) {
SMSText(prize.name)
.foregroundColor(.sms(.system(.black)))
}

Spacer()

SMSText(prize.date, font: .caption2)
.foregroundColor(.sms(.system(.black)))
ConditionView(prize.date.isNotEmpty) {
SMSText(prize.date, font: .caption2)
.foregroundColor(.sms(.system(.black)))
}
}

SMSText(prize.type, font: .caption2)
.foregroundColor(.sms(.neutral(.n40)))
ConditionView(prize.type.isNotEmpty) {
SMSText(prize.type, font: .caption2)
.foregroundColor(.sms(.neutral(.n40)))
}
}
.padding(8)
}
Expand Down
Loading

0 comments on commit 74461b8

Please sign in to comment.