Skip to content

Commit

Permalink
Updating theme across the board
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Oct 12, 2024
1 parent 4a2ca07 commit 156c629
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 121 deletions.
5 changes: 3 additions & 2 deletions mobile/mobile/ColorTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ struct ColorTheme {
static let darkDarkGrey = Color(white: 0.15)
static let superDarkGrey = Color(white: 0.1)

static let primary: Color = Color(red: 0.25, green: 0.6, blue: 1.0)
static let secondary: Color = Color(red: 0.27, green: 0.25, blue: 1.0)
static let primary: Color = Color(red: 0.28, green: 0.5, blue: 1.0) // #477eff
static let primaryLight: Color = Color(red: 0.55, green: 0.68, blue: 1.0) // #8caeff
static let indigo: Color = Color(red: 0.42, green: 0.28, blue: 1.0) // #6c47ff
}
13 changes: 0 additions & 13 deletions mobile/mobile/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ struct ContentView: View {
}
}

struct IsLoadingView: View {
var body: some View {
ColorTheme.white
.edgesIgnoringSafeArea(.all)

ProgressView("Loading...")
.progressViewStyle(CircularProgressViewStyle(tint: ColorTheme.superDarkGrey))
.padding(20)
.background(ColorTheme.white)
.cornerRadius(10)
}
}

struct ContentView_Previews: PreviewProvider {
@StateObject private var appState = AppState()

Expand Down
42 changes: 20 additions & 22 deletions mobile/mobile/DashboardNavbar.swift
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import SwiftUI

struct DashboardNavbar: View {
@State private var isDropdownOpen: Bool = false
var onLogout: () -> Void

var body: some View {
VStack(spacing: 0) {
HStack {
Text("Track")
.font(.title)
.fontWeight(.semibold)
.foregroundColor(ColorTheme.superDarkGrey)
+ Text("Flow")
.font(.title)
.fontWeight(.semibold)
.foregroundColor(ColorTheme.primary)
HStack {
Text("Track")
.font(.title)
.fontWeight(.semibold)
.foregroundColor(ColorTheme.white)
+ Text("Flow")
.font(.title)
.fontWeight(.semibold)
.foregroundColor(ColorTheme.primary)

Spacer()
Spacer()

Menu {
Button("Logout", action: onLogout)
} label: {
Image(systemName: "person.circle")
.resizable()
.frame(width: 30, height: 30)
.foregroundColor(ColorTheme.superDarkGrey)
}
Menu {
Button("Logout", action: onLogout)
} label: {
Image(systemName: "person.circle")
.resizable()
.frame(width: 30, height: 30)
.foregroundColor(ColorTheme.white)
}
.padding()
}
.background(ColorTheme.lightLightGrey)
.padding()
.background(ColorTheme.darkDarkGrey)
.cornerRadius(12)
}
}
61 changes: 17 additions & 44 deletions mobile/mobile/DashboardView.swift
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@
import Foundation
import SwiftUI

struct DashboardView: View {
@EnvironmentObject var appState: AppState
@State private var trainingWeekData: TrainingWeekData?
@State private var profileData: ProfileData?
@State private var isLoadingProfile: Bool = true
@State private var isLoadingTrainingWeek: Bool = true

var body: some View {
NavigationView {
ZStack(alignment: .top) {
ColorTheme.white.edgesIgnoringSafeArea(.all)

VStack(spacing: 0) {
ScrollView {
VStack(spacing: 24) {
DashboardNavbar(onLogout: handleLogout)

ScrollView {
VStack(spacing: 20) {
if isLoadingProfile || isLoadingTrainingWeek {
LoadingView()
}

if let profile = profileData {
ProfileView(data: profile)
} else if !isLoadingProfile {
Text("Error loading profile data")
}

if let data = trainingWeekData {
TrainingWeekView(data: data)
} else if !isLoadingTrainingWeek {
Text("No training data available")
.font(.headline)
.foregroundColor(ColorTheme.darkGrey)
}
}
.padding()

Text("Your Training Week")
.font(.system(size: 28, weight: .bold))
.foregroundColor(ColorTheme.white)

if isLoadingTrainingWeek {
LoadingView()
} else if let data = trainingWeekData {
TrainingWeekView(data: data)
} else {
Text("No training data available")
.font(.headline)
.foregroundColor(ColorTheme.lightGrey)
}
}
.padding()
}
.background(ColorTheme.superDarkGrey.edgesIgnoringSafeArea(.all))
.navigationBarHidden(true)
}
.onAppear(perform: fetchData)
Expand All @@ -53,25 +41,10 @@ struct DashboardView: View {

private func fetchData() {
guard let token = appState.jwtToken else {
isLoadingProfile = false
isLoadingTrainingWeek = false
return
}

// Fetch profile data
APIManager.shared.fetchProfileData(token: token) { result in
DispatchQueue.main.async {
self.isLoadingProfile = false
switch result {
case .success(let profile):
self.profileData = profile
case .failure(let error):
print("Error fetching profile data: \(error)")
}
}
}

// Fetch training week data
APIManager.shared.fetchTrainingWeekData(token: token) { result in
DispatchQueue.main.async {
self.isLoadingTrainingWeek = false
Expand Down
9 changes: 4 additions & 5 deletions mobile/mobile/LandingPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ struct Feature: Identifiable {
struct LandingPageView: View {
@ObservedObject var authManager: StravaAuthManager

// List of features
let features: [Feature] = [
Feature(
icon: "figure.run", title: "Personalized Plans",
Expand All @@ -36,15 +35,15 @@ struct LandingPageView: View {
HStack(spacing: 0) {
Text("Track")
.font(.system(size: 50, weight: .black))
.foregroundColor(ColorTheme.white)
.foregroundColor(ColorTheme.primaryLight)
Text("Flow")
.font(.system(size: 50, weight: .black))
.foregroundColor(ColorTheme.primary)
}

Text("Step into the Next Generation of Training")
.font(.title2)
.foregroundColor(.secondary)
.foregroundColor(ColorTheme.lightGrey)
.multilineTextAlignment(.center)
.padding(.horizontal)

Expand Down Expand Up @@ -83,10 +82,10 @@ struct LandingPageView: View {
.frame(maxWidth: .infinity)
.background(
LinearGradient(
gradient: Gradient(colors: [ColorTheme.secondary, ColorTheme.primary]),
gradient: Gradient(colors: [ColorTheme.primary, ColorTheme.primaryLight]),
startPoint: .leading, endPoint: .trailing)
)
.foregroundColor(.white)
.foregroundColor(ColorTheme.white)
.cornerRadius(12)
.shadow(radius: 5)
}
Expand Down
53 changes: 39 additions & 14 deletions mobile/mobile/LoadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ struct LoadingView: View {

var body: some View {
ZStack {
ColorTheme.white
ColorTheme.superDarkGrey
.edgesIgnoringSafeArea(.all)

VStack(spacing: 20) {
ProgressView()
.scaleEffect(2.0)
.progressViewStyle(CircularProgressViewStyle(tint: ColorTheme.superDarkGrey))
VStack(spacing: 40) {
brandingView

VStack(spacing: 30) {
ProgressView()
.scaleEffect(1.5)
.progressViewStyle(CircularProgressViewStyle(tint: ColorTheme.primary))

Text(loadingText)
.font(.caption)
.foregroundColor(ColorTheme.darkGrey)
Text(loadingText)
.font(.system(size: 16, weight: .light, design: .monospaced))
.foregroundColor(ColorTheme.primaryLight)

if showError {
Text(errorMessage)
.font(.caption)
.foregroundColor(ColorTheme.darkGrey)
.multilineTextAlignment(.center)
.padding()
if showError {
Text(errorMessage)
.font(.system(size: 14, weight: .regular, design: .monospaced))
.foregroundColor(ColorTheme.indigo)
.multilineTextAlignment(.center)
.padding()
}
}
}
.padding()
Expand All @@ -36,4 +40,25 @@ struct LoadingView: View {
}
}
}

private var brandingView: some View {
VStack(spacing: 16) {
Text("🏃‍♂️🎯")
.font(.system(size: 20))

HStack(spacing: 0) {
Text("Track")
.font(.system(size: 40, weight: .black))
.foregroundColor(ColorTheme.primaryLight)
Text("Flow")
.font(.system(size: 40, weight: .black))
.foregroundColor(ColorTheme.primary)
}

Text("Step into the Next Generation of Training")
.font(.system(size: 16, weight: .light))
.foregroundColor(ColorTheme.lightGrey)
.multilineTextAlignment(.center)
}
}
}
10 changes: 6 additions & 4 deletions mobile/mobile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ struct ProfileView: View {
VStack(alignment: .leading, spacing: 6) {
Text("\(data.firstname) \(data.lastname)")
.font(.system(size: 18, weight: .semibold))
.foregroundColor(ColorTheme.superDarkGrey)
.foregroundColor(ColorTheme.white)

Text(data.email)
.font(.system(size: 14))
.foregroundColor(ColorTheme.darkGrey)
.foregroundColor(ColorTheme.lightGrey)

HStack(spacing: 6) {
Circle()
.fill(data.isActive ? Color.green : Color.red)
.fill(data.isActive ? Color.cyan : Color.red)
.frame(width: 8, height: 8)

Text(data.isActive ? "Active" : "Inactive")
.font(.system(size: 12))
.foregroundColor(ColorTheme.darkGrey)
.foregroundColor(ColorTheme.lightGrey)
}
}
}
.padding(.vertical, 16)
.padding(.horizontal)
.background(ColorTheme.darkDarkGrey)
.cornerRadius(12)
}
}
Loading

0 comments on commit 156c629

Please sign in to comment.