Skip to content

Commit

Permalink
merge :: 잔류 신청 페이지 UI 퍼블리싱
Browse files Browse the repository at this point in the history
  • Loading branch information
DSMInhyeKang authored Feb 27, 2023
2 parents b2e9a18 + b97871b commit bc83b98
Show file tree
Hide file tree
Showing 42 changed files with 842 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public extension TargetDependency {
}

public extension TargetDependency.Project.Features {
static let RemainApplyFeature = TargetDependency.feature(name: "RemainApplyFeature")
static let StudyRoomFeature = TargetDependency.feature(name: "StudyRoomFeature")
static let SplashFeature = TargetDependency.feature(name: "SplashFeature")
static let MyPageFeature = TargetDependency.feature(name: "MyPageFeature")
static let NoticeFeature = TargetDependency.feature(name: "NoticeFeature")
Expand Down
10 changes: 8 additions & 2 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? tru
let settinges: Settings =
.settings(base: Environment.baseSetting,
configurations: [
.debug(name: .dev, xcconfig: isCI ? nil : .relativeToXCConfig(type: .dev, name: Environment.targetName)),
.release(name: .prod, xcconfig: isCI ? nil : .relativeToXCConfig(type: .prod, name: Environment.targetName))
.debug(name: .dev, xcconfig: isCI ? nil : .relativeToXCConfig(
type: .dev,
name: Environment.targetName)
),
.release(name: .prod, xcconfig: isCI ? nil : .relativeToXCConfig(
type: .prod,
name: Environment.targetName)
)
],
defaultSettings: .recommended)

Expand Down
8 changes: 8 additions & 0 deletions Projects/App/Sources/Application/DI/AppComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import RenewalPasswordFeature
import MainTabFeature
import HomeFeature
import ApplyFeature
import StudyRoomFeature
import RemainApplyFeature
import MyPageFeature
import NoticeFeature
import SplashFeature
Expand Down Expand Up @@ -112,4 +114,10 @@ public extension AppComponent {
var studyRoomListComponent: StudyRoomListComponent {
StudyRoomListComponent(parent: self)
}
var applyPageComponent: ApplyPageComponent {
ApplyPageComponent(parent: self)
}
var remainApplyComponent: RemainApplyComponent {
RemainApplyComponent(parent: self)
}
}
166 changes: 112 additions & 54 deletions Projects/App/Sources/Application/NeedleGenerated.swift

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Projects/Features/ApplyFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ let project = Project.makeModule(
name: "ApplyFeature",
product: .staticFramework,
dependencies: [
.Project.Features.BaseFeature
.Project.Features.BaseFeature,
.Project.Features.StudyRoomFeature,
.Project.Features.RemainApplyFeature
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI
import StudyRoomFeature
import RemainApplyFeature
import NeedleFoundation

public protocol ApplyPageDependency: Dependency {
var studyRoomListComponent: StudyRoomListComponent { get }
var remainApplyComponent: RemainApplyComponent { get }
}

public final class ApplyPageComponent: Component<ApplyPageDependency> {
public func makeView() -> some View {
ApplyPageView(
viewModel: ApplyPageViewModel(),
studyRoomListComponent: dependency.studyRoomListComponent,
remainApplyComponent: dependency.remainApplyComponent
)
}
}
103 changes: 103 additions & 0 deletions Projects/Features/ApplyFeature/Sources/ApplyPage/ApplyPageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import StudyRoomFeature
import RemainApplyFeature
import SwiftUI

struct ApplyPageView: View {
@AppStorage("StudyRoomState") var studyRoomState: String?
@AppStorage("RemainState") var remainState: String?
@StateObject var viewModel: ApplyPageViewModel
@Environment(\.tabbarHidden) var tabbarHidden

private let studyRoomListComponent: StudyRoomListComponent
private let remainApplyComponent: RemainApplyComponent

init(
viewModel: ApplyPageViewModel,
studyRoomListComponent: StudyRoomListComponent,
remainApplyComponent: RemainApplyComponent
) {
_viewModel = StateObject(wrappedValue: viewModel)
self.studyRoomListComponent = studyRoomListComponent
self.remainApplyComponent = remainApplyComponent
}

var body: some View {
NavigationView {
VStack {
Spacer()
.frame(height: 1)

ScrollView(showsIndicators: false) {
VStack(spacing: 30) {
Spacer()
.frame(height: 5)

applyListCellView(
name: "자습실",
content: """
자습실 사용이 필요한 경우, 자습실 신청을 통해서 원하는 자리를 신청해 보세요.
""",
buttonTitle: "자습실 신청하기",
applyState: studyRoomState,
onTapped: {
viewModel.isNavigateToStudy.toggle()
}
)

applyListCellView(
name: "잔류",
content: """
주말 기숙사 잔류 여부를 확인하고, 잔류 신청을 통해서 잔류 또는 귀가를 신청해 보세요.
""",
buttonTitle: "잔류 신청하기",
applyState: remainState,
onTapped: {
viewModel.isNavigateToRemain.toggle()
}
)
}
.padding(.horizontal, 24)
}
}
.navigationTitle("신청")
.navigationBarTitleDisplayMode(.inline)
.dmsBackground()
.onChange(of: viewModel.isNavigateToStudy) { newValue in
withAnimation {
tabbarHidden.wrappedValue = newValue
}
}
.onChange(of: viewModel.isNavigateToRemain) { newValue in
withAnimation {
tabbarHidden.wrappedValue = newValue
}
}
.navigate(
to: studyRoomListComponent.makeView(),
when: $viewModel.isNavigateToStudy
)
.navigate(
to: remainApplyComponent.makeView(),
when: $viewModel.isNavigateToRemain
)
.navigationViewStyle(.stack)
}
}

@ViewBuilder
func applyListCellView(
name: String,
content: String,
buttonTitle: String,
applyState: String?,
onTapped: @escaping () -> Void
) -> some View {
ApplyListCellView(
name: name,
content: content,
buttonTitle: buttonTitle,
applyState: applyState,
onTapped: onTapped
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import BaseFeature
import Combine

final class ApplyPageViewModel: BaseViewModel {
@Published var isNavigateToStudy: Bool = false
@Published var isNavigateToRemain: Bool = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import SwiftUI
import StudyRoomFeature
import RemainApplyFeature
import DesignSystem

struct ApplyListCellView: View {
@AppStorage("StudyRoomState") var studyRoomState: String?
@AppStorage("RemainState") var remainState: String?
var name: String
var content: String
var buttonTitle: String
var applyState: String?
var onTapped: () -> Void

init(
name: String,
content: String,
buttonTitle: String,
applyState: String?,
onTapped: @escaping () -> Void
) {
self.name = name
self.content = content
self.buttonTitle = buttonTitle
self.applyState = applyState
self.onTapped = onTapped
}

var body: some View {
VStack(alignment: .leading) {
HStack(alignment: .center) {
Text(name)
.dmsFont(.title(.title2), color: .GrayScale.gray7)
.frame(height: 32)
.padding(.vertical, 20)
.padding(.leading, 20)

Spacer()

Text(applyState ?? "")
.dmsFont(.etc(.button), color: .PrimaryVariant.primary)
.frame(height: 22)
.padding(.vertical, 6)
.padding(.horizontal, 14)
.background(Color.PrimaryVariant.lighten2)
.cornerRadius(24)
.padding(.trailing, 16)
.padding(.top, -2)
}

Text(content)
.dmsFont(.body(.body3), color: .GrayScale.gray9)
.multilineTextAlignment(.leading)
.padding(.horizontal, 20)

DMSWideButton(
text: buttonTitle,
color: .PrimaryVariant.primary,
action: onTapped
)
.padding(20)
}
.background(Color.System.surface)
.cornerRadius(10)
.dmsShadow(style: .surface)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MyPageFeature

public protocol MainTabDependency: Dependency {
var homeComponent: HomeComponent { get }
var studyRoomListComponent: StudyRoomListComponent { get }
var applyPageComponent: ApplyPageComponent { get }
var noticeListComponent: NoticeListComponent { get }
var myPageComponent: MyPageComponent { get }
}
Expand All @@ -16,7 +16,7 @@ public final class MainTabComponent: Component<MainTabDependency> {
public func makeView() -> some View {
MainTabView(
homeComponent: dependency.homeComponent,
studyRoomListComponent: dependency.studyRoomListComponent,
applyPageComponent: dependency.applyPageComponent,
noticeComponent: dependency.noticeListComponent,
myPageComponent: dependency.myPageComponent
)
Expand Down
8 changes: 4 additions & 4 deletions Projects/Features/MainTabFeature/Sources/MainTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ struct MainTabView: View {
}

private let homeComponent: HomeComponent
private let studyRoomListComponent: StudyRoomListComponent
private let applyPageComponent: ApplyPageComponent
private let noticeComponent: NoticeListComponent
private let myPageComponent: MyPageComponent

init(
homeComponent: HomeComponent,
studyRoomListComponent: StudyRoomListComponent,
applyPageComponent: ApplyPageComponent,
noticeComponent: NoticeListComponent,
myPageComponent: MyPageComponent
) {
self.homeComponent = homeComponent
self.studyRoomListComponent = studyRoomListComponent
self.applyPageComponent = applyPageComponent
self.noticeComponent = noticeComponent
self.myPageComponent = myPageComponent
}
Expand All @@ -49,7 +49,7 @@ struct MainTabView: View {
.tag(TabFlow.home)

if appState.features.studyRoomService {
studyRoomListComponent.makeView()
applyPageComponent.makeView()
.tag(TabFlow.apply)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct RewardPointDetailView: View {
.padding(.horizontal, 24)
.padding(.bottom, 24)

ScrollView {
ScrollView(showsIndicators: false) {
Spacer()
.frame(height: 10)
LazyVStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct NoticeDetailView: View {
@Environment(\.dismiss) var dismiss

var body: some View {
ScrollView {
ScrollView(showsIndicators: false) {
VStack {
VStack(alignment: .leading, spacing: 0) {
Text(viewModel.title)
Expand All @@ -29,7 +29,7 @@ struct NoticeDetailView: View {
.dmsFont(.body(.body2), color: .GrayScale.gray6)
.padding(.top, 24)

Spacer()
Spacer(minLength: 83)
}
}
.dmsToast(isShowing: $viewModel.isErrorOcuured, message: viewModel.errorMessage, style: .error)
Expand Down
Loading

0 comments on commit bc83b98

Please sign in to comment.