@@ -48,7 +48,7 @@ class CampusUpdateService {
4848 }
4949}
5050
51- // MARK: - Campus Selection Dialog
51+
5252import SwiftUI
5353
5454struct CampusSelectionDialog : View {
@@ -59,7 +59,6 @@ struct CampusSelectionDialog: View {
5959 @State private var showError : Bool = false
6060 @State private var errorMessage : String = " "
6161
62-
6362 private let campusOptions = [
6463 ( " VIT Chennai " , " chennai " ) ,
6564 ( " VIT Vellore " , " vellore " ) ,
@@ -68,22 +67,26 @@ struct CampusSelectionDialog: View {
6867
6968 var body : some View {
7069 ZStack {
71- Color . black. opacity ( 0.4 )
70+ Color . black. opacity ( 0.5 )
7271 . ignoresSafeArea ( )
72+ . onTapGesture {
73+
74+ }
7375
74- VStack ( spacing: 20 ) {
75-
76+ VStack ( spacing: 24 ) {
77+ // Header Section
7678 VStack ( spacing: 8 ) {
7779 Text ( " Select Your Campus " )
7880 . font ( . custom( " Poppins-Bold " , size: 20 ) )
79- . foregroundColor ( . primary )
81+ . foregroundColor ( . white )
8082
8183 Text ( " Please select your campus to continue " )
8284 . font ( . custom( " Poppins-Regular " , size: 14 ) )
83- . foregroundColor ( . secondary)
85+ . foregroundColor ( . white. opacity ( 0.7 ) )
86+ . multilineTextAlignment ( . center)
8487 }
8588
86-
89+
8790 VStack ( spacing: 12 ) {
8891 ForEach ( campusOptions, id: \. 0 ) { campus in
8992 Button ( action: {
@@ -92,23 +95,31 @@ struct CampusSelectionDialog: View {
9295 HStack {
9396 Text ( campus. 0 )
9497 . font ( . custom( " Poppins-Medium " , size: 16 ) )
95- . foregroundColor ( . primary )
98+ . foregroundColor ( . white )
9699
97100 Spacer ( )
98101
99102 if selectedCampus == campus. 1 {
100103 Image ( systemName: " checkmark.circle.fill " )
101- . foregroundColor ( . blue)
104+ . foregroundColor ( Color ( " Accent " ) )
105+ . font ( . system( size: 20 ) )
102106 }
103107 }
104108 . padding ( . horizontal, 16 )
105- . padding ( . vertical, 12 )
109+ . padding ( . vertical, 14 )
106110 . background (
107- RoundedRectangle ( cornerRadius: 8 )
111+ RoundedRectangle ( cornerRadius: 12 )
108112 . fill ( selectedCampus == campus. 1 ?
109- Color . blue. opacity ( 0.1 ) : Color . gray. opacity ( 0.1 ) )
113+ Color ( " Accent " ) . opacity ( 0.15 ) : Color ( " Secondary " ) . opacity ( 0.6 ) )
114+ )
115+ . overlay (
116+ RoundedRectangle ( cornerRadius: 12 )
117+ . stroke ( selectedCampus == campus. 1 ?
118+ Color ( " Accent " ) : Color . clear, lineWidth: 1 )
110119 )
111120 }
121+ . buttonStyle ( PlainButtonStyle ( ) )
122+ . disabled ( isUpdating)
112123 }
113124 }
114125
@@ -118,39 +129,61 @@ struct CampusSelectionDialog: View {
118129 . font ( . custom( " Poppins-Regular " , size: 12 ) )
119130 . foregroundColor ( . red)
120131 . padding ( . horizontal)
132+ . multilineTextAlignment ( . center)
121133 }
122134
123-
124- HStack ( spacing: 16 ) {
125- Button ( " Update " ) {
135+
136+ if isUpdating {
137+ ProgressView ( )
138+ . progressViewStyle ( CircularProgressViewStyle ( tint: . white) )
139+ . scaleEffect ( 1.2 )
140+ }
141+
142+
143+ HStack ( spacing: 12 ) {
144+
145+ Button ( " Skip for now " ) {
146+ isPresented = false
147+ }
148+ . disabled ( isUpdating)
149+ . padding ( . horizontal, 20 )
150+ . padding ( . vertical, 12 )
151+ . background (
152+ RoundedRectangle ( cornerRadius: 10 )
153+ . fill ( Color ( " Secondary " ) . opacity ( 0.8 ) )
154+ )
155+ . foregroundColor ( . white. opacity ( 0.8 ) )
156+ . font ( . custom( " Poppins-Medium " , size: 14 ) )
157+
158+
159+ Button ( " Update Campus " ) {
126160 Task {
127161 await updateCampus ( )
128162 }
129163 }
130164 . disabled ( selectedCampus. isEmpty || isUpdating)
131- . padding ( . horizontal, 32 )
165+ . padding ( . horizontal, 20 )
132166 . padding ( . vertical, 12 )
133167 . background (
134- RoundedRectangle ( cornerRadius: 8 )
168+ RoundedRectangle ( cornerRadius: 10 )
135169 . fill ( selectedCampus. isEmpty || isUpdating ?
136- Color . gray. opacity ( 0.3 ) : Color . blue )
170+ Color . gray. opacity ( 0.3 ) : Color ( " Accent " ) )
137171 )
138172 . foregroundColor ( . white)
139- . font ( . custom( " Poppins-Medium " , size: 16 ) )
140- }
141-
142- if isUpdating {
143- ProgressView ( )
144- . progressViewStyle ( CircularProgressViewStyle ( ) )
173+ . font ( . custom( " Poppins-Medium " , size: 14 ) )
145174 }
175+ . padding ( . top, 8 )
146176 }
147177 . padding ( 24 )
148178 . background (
149- RoundedRectangle ( cornerRadius: 16 )
150- . fill ( Color ( UIColor . systemBackground) )
179+ RoundedRectangle ( cornerRadius: 20 )
180+ . fill ( Color ( " Background " ) )
181+ . shadow ( color: . black. opacity ( 0.3 ) , radius: 20 , x: 0 , y: 10 )
151182 )
152- . padding ( . horizontal, 40 )
183+ . padding ( . horizontal, 32 )
153184 }
185+ . animation ( . easeInOut( duration: 0.3 ) , value: isUpdating)
186+ . animation ( . easeInOut( duration: 0.3 ) , value: showError)
154187 }
155188
156189 private func updateCampus( ) async {
@@ -168,7 +201,6 @@ struct CampusSelectionDialog: View {
168201 token: token
169202 )
170203
171-
172204 DispatchQueue . main. async {
173205 authViewModel. updateUserCampus ( selectedCampus)
174206 isPresented = false
0 commit comments