Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Uplift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = ZGMCXU7X3U;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -946,7 +946,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEVELOPMENT_TEAM = ZGMCXU7X3U;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down
3 changes: 2 additions & 1 deletion Uplift/Utils/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ struct Constants {
static let gymDetailHorizontal: CGFloat = 24
static let gymDetailSpacing: CGFloat = 20
static let homeHorizontal: CGFloat = 16
static let tabBarHeight: CGFloat = 64
}

/// Shadows usde in Uplift's design system.
/// Shadows used in Uplift's design system.
enum Shadows {
static let normalDark = ShadowConfig(
color: Constants.Colors.black,
Expand Down
50 changes: 28 additions & 22 deletions Uplift/Views/Classes/ClassDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ struct ClassDetailView: View {

// MARK: - Properties

let classInstance: FitnessClassInstance

@ObservedObject var viewModel: ClassesView.ViewModel
@State var classInstance: FitnessClassInstance
@Environment(\.dismiss) private var dismiss
private let topViewId: String = "topId"
@ObservedObject var viewModel: ClassesView.ViewModel

// MARK: - Constants

Expand All @@ -38,28 +38,31 @@ struct ClassDetailView: View {

var body: some View {
NavigationStack {
ScrollView(.vertical, showsIndicators: false) {
scrollContent
}
.ignoresSafeArea(.all)
.padding(.bottom)
.navigationBarBackButtonHidden(true)
.toolbarBackground(.hidden, for: .navigationBar)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
NavBackButton(dismiss: dismiss)
ScrollViewReader { reader in
ScrollView(.vertical, showsIndicators: false) {
scrollContent(reader)
}
.ignoresSafeArea(.all)
.padding(.bottom)
.navigationBarBackButtonHidden(true)
.toolbarBackground(.hidden, for: .navigationBar)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
NavBackButton(dismiss: dismiss)
}
}
.background(Constants.Colors.white)
.onAppear {
viewModel.fetchAllClasses()
}
}
.background(Constants.Colors.white)
.onAppear {
viewModel.fetchAllClasses()
}
}
}

private var scrollContent: some View {
private func scrollContent(_ reader: ScrollViewProxy) -> some View {
VStack(spacing: 0) {
heroSection
.id(topViewId)
dateTimeSection
DividerLine()
// TODO: Function data is not in backend
Expand All @@ -70,7 +73,7 @@ struct ClassDetailView: View {
// DividerLine()
descriptionSection
DividerLine()
nextSessionsSection
nextSessionsSection(reader)
}
.padding(.bottom)
}
Expand Down Expand Up @@ -210,7 +213,7 @@ struct ClassDetailView: View {
.padding(textPadding)
}

private var nextSessionsSection: some View {
private func nextSessionsSection(_ reader: ScrollViewProxy) -> some View {
VStack(spacing: 24) {
Text("NEXT SESSIONS")
.font(Constants.Fonts.h2)
Expand All @@ -225,8 +228,11 @@ struct ClassDetailView: View {
}
} else {
ForEach(viewModel.nextSessions(classInstance: classInstance), id: \.self) { classInstance in
NavigationLink {
ClassDetailView(classInstance: classInstance, viewModel: viewModel)
Button {
withAnimation {
self.classInstance = classInstance
reader.scrollTo(topViewId)
}
} label: {
NextSessionCell(classInstance: classInstance, viewModel: viewModel)
}
Expand Down
2 changes: 1 addition & 1 deletion Uplift/Views/ClassesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct ClassesView: View {
calendarView
classesOnDay
}
.padding(.bottom, 32)
.padding(.bottom, 32 + Constants.Padding.tabBarHeight)
}
.refreshable {
viewModel.refreshClasses()
Expand Down
2 changes: 1 addition & 1 deletion Uplift/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct HomeView: View {
EdgeInsets(
top: 12,
leading: Constants.Padding.homeHorizontal,
bottom: 32,
bottom: 32 + Constants.Padding.tabBarHeight,
trailing: Constants.Padding.homeHorizontal
)
)
Expand Down
5 changes: 3 additions & 2 deletions Uplift/Views/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ struct MainView: View {
ClassesView()
.environmentObject(tabBarProp)
}

}
.overlay(alignment: .bottom) {
!tabBarProp.hidden ? tabBar.transition(.move(edge: .bottom)) : nil
}

Expand Down Expand Up @@ -75,7 +76,7 @@ struct MainView: View {

Spacer()
}
.frame(height: 64)
.frame(height: Constants.Padding.tabBarHeight)
.background(Constants.Colors.yellow)
.ignoresSafeArea(.all)
}
Expand Down