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
6 changes: 3 additions & 3 deletions VITTY/VITTY/Connect/View/ConnectPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct ConnectPage: View {
selectedTab = 0
}
communityPageViewModel.fetchCircleData(
from: "\(APIConstants.base_url)circles",
from: "\(APIConstants.base_urlv3)circles",
token: authViewModel.loggedInBackendUser?.token ?? "",
loading: true
)
Expand Down Expand Up @@ -177,15 +177,15 @@ struct ConnectPage: View {

if communityPageViewModel.circles.isEmpty || !hasLoadedInitialData {
communityPageViewModel.fetchCircleData(
from: "\(APIConstants.base_url)circles",
from: "\(APIConstants.base_urlv3)circles",
token: authViewModel.loggedInBackendUser?.token ?? "",
loading: shouldShowLoading
)
}

if communityPageViewModel.circleRequests.isEmpty || !hasLoadedInitialData {
friendRequestViewModel.fetchFriendRequests(
from: URL(string: "\(APIConstants.base_url)requests/")!,
from: URL(string: "\(APIConstants.base_urlv3)requests/")!,
authToken: authViewModel.loggedInBackendUser?.token ?? "",
loading: shouldShowLoading
)
Expand Down
90 changes: 61 additions & 29 deletions VITTY/VITTY/Home/View/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CampusUpdateService {
}
}

// MARK: - Campus Selection Dialog

import SwiftUI

struct CampusSelectionDialog: View {
Expand All @@ -59,7 +59,6 @@ struct CampusSelectionDialog: View {
@State private var showError: Bool = false
@State private var errorMessage: String = ""


private let campusOptions = [
("VIT Chennai", "chennai"),
("VIT Vellore", "vellore"),
Expand All @@ -68,22 +67,26 @@ struct CampusSelectionDialog: View {

var body: some View {
ZStack {
Color.black.opacity(0.4)
Color.black.opacity(0.5)
.ignoresSafeArea()
.onTapGesture {

}

VStack(spacing: 20) {

VStack(spacing: 24) {
// Header Section
VStack(spacing: 8) {
Text("Select Your Campus")
.font(.custom("Poppins-Bold", size: 20))
.foregroundColor(.primary)
.foregroundColor(.white)

Text("Please select your campus to continue")
.font(.custom("Poppins-Regular", size: 14))
.foregroundColor(.secondary)
.foregroundColor(.white.opacity(0.7))
.multilineTextAlignment(.center)
}


VStack(spacing: 12) {
ForEach(campusOptions, id: \.0) { campus in
Button(action: {
Expand All @@ -92,23 +95,31 @@ struct CampusSelectionDialog: View {
HStack {
Text(campus.0)
.font(.custom("Poppins-Medium", size: 16))
.foregroundColor(.primary)
.foregroundColor(.white)

Spacer()

if selectedCampus == campus.1 {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.blue)
.foregroundColor(Color("Accent"))
.font(.system(size: 20))
}
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
.padding(.vertical, 14)
.background(
RoundedRectangle(cornerRadius: 8)
RoundedRectangle(cornerRadius: 12)
.fill(selectedCampus == campus.1 ?
Color.blue.opacity(0.1) : Color.gray.opacity(0.1))
Color("Accent").opacity(0.15) : Color("Secondary").opacity(0.6))
)
.overlay(
RoundedRectangle(cornerRadius: 12)
.stroke(selectedCampus == campus.1 ?
Color("Accent") : Color.clear, lineWidth: 1)
)
}
.buttonStyle(PlainButtonStyle())
.disabled(isUpdating)
}
}

Expand All @@ -118,39 +129,61 @@ struct CampusSelectionDialog: View {
.font(.custom("Poppins-Regular", size: 12))
.foregroundColor(.red)
.padding(.horizontal)
.multilineTextAlignment(.center)
}


HStack(spacing: 16) {
Button("Update") {

if isUpdating {
ProgressView()
.progressViewStyle(CircularProgressViewStyle(tint: .white))
.scaleEffect(1.2)
}


HStack(spacing: 12) {

Button("Skip for now") {
isPresented = false
}
.disabled(isUpdating)
.padding(.horizontal, 20)
.padding(.vertical, 12)
.background(
RoundedRectangle(cornerRadius: 10)
.fill(Color("Secondary").opacity(0.8))
)
.foregroundColor(.white.opacity(0.8))
.font(.custom("Poppins-Medium", size: 14))


Button("Update Campus") {
Task {
await updateCampus()
}
}
.disabled(selectedCampus.isEmpty || isUpdating)
.padding(.horizontal, 32)
.padding(.horizontal, 20)
.padding(.vertical, 12)
.background(
RoundedRectangle(cornerRadius: 8)
RoundedRectangle(cornerRadius: 10)
.fill(selectedCampus.isEmpty || isUpdating ?
Color.gray.opacity(0.3) : Color.blue)
Color.gray.opacity(0.3) : Color("Accent"))
)
.foregroundColor(.white)
.font(.custom("Poppins-Medium", size: 16))
}

if isUpdating {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
.font(.custom("Poppins-Medium", size: 14))
}
.padding(.top, 8)
}
.padding(24)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color(UIColor.systemBackground))
RoundedRectangle(cornerRadius: 20)
.fill(Color("Background"))
.shadow(color: .black.opacity(0.3), radius: 20, x: 0, y: 10)
)
.padding(.horizontal, 40)
.padding(.horizontal, 32)
}
.animation(.easeInOut(duration: 0.3), value: isUpdating)
.animation(.easeInOut(duration: 0.3), value: showError)
}

private func updateCampus() async {
Expand All @@ -168,7 +201,6 @@ struct CampusSelectionDialog: View {
token: token
)


DispatchQueue.main.async {
authViewModel.updateUserCampus(selectedCampus)
isPresented = false
Expand Down
34 changes: 31 additions & 3 deletions VITTY/VITTY/Settings/View/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct SettingsView: View {
@Query private var timeTables: [TimeTable]

@StateObject private var viewModel = SettingsViewModel()
@StateObject private var settingsTipManager = SettingsTipManager()
@StateObject private var settingsTipManager = SettingsTipManager()

@State private var showDaySelection = false
@State private var selectedDay: String? = nil
Expand Down Expand Up @@ -160,8 +160,35 @@ struct SettingsView: View {
}

SettingsSectionView(title: "About") {
AboutLinkView(image: "github-icon", title: "GitHub Repository", url: URL(string: "https://github.com/GDGVIT/vitty-ios"))
AboutLinkView(image: "gdsc-logo", title: "GDSC VIT", url: URL(string: "https://dscvit.com/"))
VStack(alignment: .leading, spacing: 12) {
AboutLinkView(image: "github-icon", title: "GitHub Repository", url: URL(string: "https://github.com/GDGVIT/vitty-ios"))
AboutLinkView(image: "gdsc-logo", title: "GDSC VIT", url: URL(string: "https://dscvit.com/"))

// Support Email
HStack(spacing: 12) {
Image(systemName: "envelope.fill")
.foregroundColor(.white)
.frame(width: 30, height: 30)

VStack(alignment: .leading, spacing: 4) {
Text("Support")
.font(.system(size: 15, weight: .semibold))
.foregroundColor(.white)

Text("dscvit.vitty@gmail.com")
.font(.system(size: 12))
.foregroundColor(.gray.opacity(0.8))
}

Spacer()
}
.padding(.vertical, 6)
.onTapGesture {
if let url = URL(string: "mailto:dscvit.vitty@gmail.com") {
UIApplication.shared.open(url)
}
}
}
}
}
.scrollContentBackground(.hidden)
Expand Down Expand Up @@ -842,6 +869,7 @@ struct DeleteUserAlert: View {
}
}


struct SyncAlert: View {
let message: String
let isSuccess: Bool
Expand Down
Loading
Loading