Compare commits
	
		
			9 Commits
		
	
	
		
			d7067db1d6
			...
			f7c8c1c0a0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					f7c8c1c0a0 | ||
| 
						 | 
					73bf1ee6fc | ||
| 
						 | 
					c5906f42b7 | ||
| 
						 | 
					27a6ce7ce3 | ||
| 
						 | 
					82168755e2 | ||
| 
						 | 
					6c7716ec16 | ||
| 
						 | 
					d8b683d570 | ||
| 
						 | 
					1fdc8dbf45 | ||
| 
						 | 
					58e3488a9d | 
@ -91,7 +91,7 @@ struct TopBarView: View {
 | 
				
			|||||||
            .padding()
 | 
					            .padding()
 | 
				
			||||||
            .frame(height: 50) // Стандартная высота для нав. бара
 | 
					            .frame(height: 50) // Стандартная высота для нав. бара
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
//            Divider()
 | 
					            Divider()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        .background(Color(UIColor.systemBackground))
 | 
					        .background(Color(UIColor.systemBackground))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										53
									
								
								Shared/Services/ThemeManager.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								Shared/Services/ThemeManager.swift
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					import SwiftUI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Enum to represent the three theme options
 | 
				
			||||||
 | 
					enum Theme: String, CaseIterable {
 | 
				
			||||||
 | 
					    case system = "System"
 | 
				
			||||||
 | 
					    case light = "Light"
 | 
				
			||||||
 | 
					    case dark = "Dark"
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    var colorScheme: ColorScheme? {
 | 
				
			||||||
 | 
					        switch self {
 | 
				
			||||||
 | 
					        case .system:
 | 
				
			||||||
 | 
					            return nil
 | 
				
			||||||
 | 
					        case .light:
 | 
				
			||||||
 | 
					            return .light
 | 
				
			||||||
 | 
					        case .dark:
 | 
				
			||||||
 | 
					            return .dark
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Observable class to manage the theme state
 | 
				
			||||||
 | 
					class ThemeManager: ObservableObject {
 | 
				
			||||||
 | 
					    @AppStorage("selectedTheme") private var selectedThemeValue: String = Theme.system.rawValue
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    @Published var theme: Theme
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    init() {
 | 
				
			||||||
 | 
					        // Read directly from UserDefaults to avoid using self before initialization is complete.
 | 
				
			||||||
 | 
					        let storedThemeValue = UserDefaults.standard.string(forKey: "selectedTheme") ?? ""
 | 
				
			||||||
 | 
					        self.theme = Theme(rawValue: storedThemeValue) ?? .system
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    func setTheme(_ theme: Theme) {
 | 
				
			||||||
 | 
					        self.theme = theme
 | 
				
			||||||
 | 
					        selectedThemeValue = theme.rawValue
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    // This will be called from the button
 | 
				
			||||||
 | 
					    func toggleTheme(from currentSystemScheme: ColorScheme) {
 | 
				
			||||||
 | 
					        let newTheme: Theme
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        switch theme {
 | 
				
			||||||
 | 
					        case .system:
 | 
				
			||||||
 | 
					            // If system is active, toggle to the opposite of the current system theme
 | 
				
			||||||
 | 
					            newTheme = currentSystemScheme == .dark ? .light : .dark
 | 
				
			||||||
 | 
					        case .light:
 | 
				
			||||||
 | 
					            newTheme = .dark
 | 
				
			||||||
 | 
					        case .dark:
 | 
				
			||||||
 | 
					            newTheme = .light
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        setTheme(newTheme)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -33,8 +33,8 @@ struct CustomTabBar: View {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        .padding(.horizontal)
 | 
					        .padding(.horizontal)
 | 
				
			||||||
        .padding(.top, 1)
 | 
					        .padding(.top, 1)
 | 
				
			||||||
        .padding(.bottom, 18) // Добавляем отступ снизу
 | 
					        .padding(.bottom, 30) // Добавляем отступ снизу
 | 
				
			||||||
        .background(Color(.systemGray6))
 | 
					//        .background(Color(.systemGray6))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -132,5 +132,6 @@ struct MainView_Previews: PreviewProvider {
 | 
				
			|||||||
    static var previews: some View {
 | 
					    static var previews: some View {
 | 
				
			||||||
        let mockViewModel = LoginViewModel()
 | 
					        let mockViewModel = LoginViewModel()
 | 
				
			||||||
        MainView(viewModel: mockViewModel)
 | 
					        MainView(viewModel: mockViewModel)
 | 
				
			||||||
 | 
					            .environmentObject(ThemeManager())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,78 +1,21 @@
 | 
				
			|||||||
import SwiftUI
 | 
					import SwiftUI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct SideMenuView: View {
 | 
					// --- HELPER STRUCTS & EXTENSIONS ---
 | 
				
			||||||
    @Binding var isPresented: Bool
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var body: some View {
 | 
					// Dummy data for the account list
 | 
				
			||||||
        VStack(alignment: .leading, spacing: 0) {
 | 
					struct Account: Identifiable {
 | 
				
			||||||
            // Header
 | 
					    let id = UUID()
 | 
				
			||||||
            VStack(alignment: .leading) {
 | 
					    let name: String
 | 
				
			||||||
                Image(systemName: "person.circle.fill")
 | 
					    let username: String
 | 
				
			||||||
                    .resizable()
 | 
					    let isCurrent: Bool
 | 
				
			||||||
                    .frame(width: 60, height: 60)
 | 
					}
 | 
				
			||||||
                    .foregroundColor(.gray)
 | 
					 | 
				
			||||||
                Text("Your Name")
 | 
					 | 
				
			||||||
                    .font(.title2).bold()
 | 
					 | 
				
			||||||
                Text("@yourusername")
 | 
					 | 
				
			||||||
                    .font(.subheadline)
 | 
					 | 
				
			||||||
                    .foregroundColor(.secondary)
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .padding(20)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Menu Items
 | 
					// Custom Transition for older Xcode versions
 | 
				
			||||||
            ScrollView {
 | 
					extension AnyTransition {
 | 
				
			||||||
                VStack(alignment: .leading, spacing: 20) {
 | 
					    static var slideAndFade: AnyTransition {
 | 
				
			||||||
                    // Section 1
 | 
					        let insertion = AnyTransition.move(edge: .top).combined(with: .opacity)
 | 
				
			||||||
                    VStack(alignment: .leading, spacing: 15) {
 | 
					        let removal = AnyTransition.move(edge: .top).combined(with: .opacity)
 | 
				
			||||||
                        SideMenuButton(icon: "person.2.fill", title: "People You May Like", action: {})
 | 
					        return .asymmetric(insertion: insertion, removal: removal)
 | 
				
			||||||
                        SideMenuButton(icon: "star.fill", title: "Fun Fest", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "lightbulb.fill", title: "Creator Center", action: {})
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Divider()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    // Section 2
 | 
					 | 
				
			||||||
                    VStack(alignment: .leading, spacing: 15) {
 | 
					 | 
				
			||||||
                        Text("CATEGORY").font(.caption).foregroundColor(.secondary)
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "doc.text", title: "Drafts", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "bubble.left", title: "My Comments", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "clock", title: "History", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "arrow.down.circle", title: "My Downloads", action: {})
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Divider()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    // Section 3
 | 
					 | 
				
			||||||
                    VStack(alignment: .leading, spacing: 15) {
 | 
					 | 
				
			||||||
                        Text("SERVICES").font(.caption).foregroundColor(.secondary)
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "shippingbox", title: "Orders", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "cart", title: "Cart", action: {})
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "wallet.pass", title: "Wallet", action: {})
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
                    Divider()
 | 
					 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
                    // Section 4
 | 
					 | 
				
			||||||
                    VStack(alignment: .leading, spacing: 15) {
 | 
					 | 
				
			||||||
                        SideMenuButton(icon: "square.grid.2x2", title: "Applets", action: {})
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                .padding()
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Spacer()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Footer
 | 
					 | 
				
			||||||
            HStack(spacing: 20) {
 | 
					 | 
				
			||||||
                Spacer()
 | 
					 | 
				
			||||||
                SideMenuFooterButton(icon: "qrcode.viewfinder", title: "Scan", action: {})
 | 
					 | 
				
			||||||
                SideMenuFooterButton(icon: "questionmark.circle", title: "Help Center", action: {})
 | 
					 | 
				
			||||||
                SideMenuFooterButton(icon: "gear", title: "Settings", action: {})
 | 
					 | 
				
			||||||
                Spacer()
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .padding()
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        .background(Color(UIColor.systemBackground))
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -89,7 +32,7 @@ struct SideMenuButton: View {
 | 
				
			|||||||
                    .font(.title3)
 | 
					                    .font(.title3)
 | 
				
			||||||
                    .frame(width: 30)
 | 
					                    .frame(width: 30)
 | 
				
			||||||
                Text(title)
 | 
					                Text(title)
 | 
				
			||||||
                    .font(.headline)
 | 
					                    .font(.subheadline)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            .foregroundColor(.primary)
 | 
					            .foregroundColor(.primary)
 | 
				
			||||||
            .padding(.vertical, 8)
 | 
					            .padding(.vertical, 8)
 | 
				
			||||||
@ -108,9 +51,209 @@ struct SideMenuFooterButton: View {
 | 
				
			|||||||
                Image(systemName: icon)
 | 
					                Image(systemName: icon)
 | 
				
			||||||
                    .font(.title2)
 | 
					                    .font(.title2)
 | 
				
			||||||
                Text(title)
 | 
					                Text(title)
 | 
				
			||||||
                    .font(.caption)
 | 
					                    .font(.caption2)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            .foregroundColor(.primary)
 | 
					            .foregroundColor(.primary)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// --- MAIN VIEW ---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct SideMenuView: View {
 | 
				
			||||||
 | 
					    @EnvironmentObject var themeManager: ThemeManager
 | 
				
			||||||
 | 
					    @Environment(\.colorScheme) var colorScheme
 | 
				
			||||||
 | 
					    @Binding var isPresented: Bool
 | 
				
			||||||
 | 
					    @State private var isAccountListExpanded = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Adjustable paddings
 | 
				
			||||||
 | 
					    private let topPadding: CGFloat = 66
 | 
				
			||||||
 | 
					    private let bottomPadding: CGFloat = 34
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    // Dummy account data
 | 
				
			||||||
 | 
					    private let accounts: [Account] = [
 | 
				
			||||||
 | 
					        Account(name: "Your Name", username: "@yourusername", isCurrent: true),
 | 
				
			||||||
 | 
					        Account(name: "Second Account", username: "@second", isCurrent: false),
 | 
				
			||||||
 | 
					        Account(name: "Another One", username: "@another", isCurrent: false),
 | 
				
			||||||
 | 
					        Account(name: "Test User", username: "@test", isCurrent: false),
 | 
				
			||||||
 | 
					        Account(name: "Creative Profile", username: "@creative", isCurrent: false)
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    private var themeToggleButton: some View {
 | 
				
			||||||
 | 
					        Button(action: {
 | 
				
			||||||
 | 
					            themeManager.toggleTheme(from: colorScheme)
 | 
				
			||||||
 | 
					        }) {
 | 
				
			||||||
 | 
					            Image(systemName: iconName)
 | 
				
			||||||
 | 
					                .font(.title2)
 | 
				
			||||||
 | 
					                .foregroundColor(.primary)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private var iconName: String {
 | 
				
			||||||
 | 
					        let effectiveScheme: ColorScheme
 | 
				
			||||||
 | 
					        switch themeManager.theme {
 | 
				
			||||||
 | 
					        case .system:
 | 
				
			||||||
 | 
					            effectiveScheme = colorScheme
 | 
				
			||||||
 | 
					        case .light:
 | 
				
			||||||
 | 
					            effectiveScheme = .light
 | 
				
			||||||
 | 
					        case .dark:
 | 
				
			||||||
 | 
					            effectiveScheme = .dark
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        return effectiveScheme == .dark ? "sun.max.fill" : "moon.fill"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var body: some View {
 | 
				
			||||||
 | 
					        VStack(alignment: .leading, spacing: 0) {
 | 
				
			||||||
 | 
					            ScrollView {
 | 
				
			||||||
 | 
					                VStack(alignment: .leading, spacing: 0) { // Parent VStack
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    // --- Header ---
 | 
				
			||||||
 | 
					                    HStack(alignment: .top) {
 | 
				
			||||||
 | 
					                        Button(action: {  }) {
 | 
				
			||||||
 | 
					                            Image(systemName: "person.circle.fill")
 | 
				
			||||||
 | 
					                                .resizable()
 | 
				
			||||||
 | 
					                                .frame(width: 60, height: 60)
 | 
				
			||||||
 | 
					                                .foregroundColor(.gray)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        Spacer()
 | 
				
			||||||
 | 
					                        themeToggleButton
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .padding(.horizontal, 20)
 | 
				
			||||||
 | 
					                    .padding(.top, topPadding)
 | 
				
			||||||
 | 
					                    .padding(.bottom, 10)
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    // --- Header Button ---
 | 
				
			||||||
 | 
					                    Button(action: {
 | 
				
			||||||
 | 
					                        withAnimation(.spring()) {
 | 
				
			||||||
 | 
					                            isAccountListExpanded.toggle()
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }) {
 | 
				
			||||||
 | 
					                        HStack {
 | 
				
			||||||
 | 
					                            VStack(alignment: .leading) {
 | 
				
			||||||
 | 
					                                Text("Your Name")
 | 
				
			||||||
 | 
					                                    .font(.title3).bold()
 | 
				
			||||||
 | 
					                                Text("@yourusername")
 | 
				
			||||||
 | 
					                                    .font(.footnote)
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            .foregroundColor(.primary)
 | 
				
			||||||
 | 
					                            
 | 
				
			||||||
 | 
					                            Spacer()
 | 
				
			||||||
 | 
					                            
 | 
				
			||||||
 | 
					                            Image(systemName: isAccountListExpanded ? "chevron.up" : "chevron.down")
 | 
				
			||||||
 | 
					                                .font(.headline)
 | 
				
			||||||
 | 
					                                .foregroundColor(.secondary)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .padding(.horizontal, 20)
 | 
				
			||||||
 | 
					                    .padding(.bottom, 10)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    // --- Collapsible Account List in a clipped container ---
 | 
				
			||||||
 | 
					                    VStack {
 | 
				
			||||||
 | 
					                        if isAccountListExpanded {
 | 
				
			||||||
 | 
					                            VStack(alignment: .leading, spacing: 15) {
 | 
				
			||||||
 | 
					                                ForEach(accounts) { account in
 | 
				
			||||||
 | 
					                                    HStack {
 | 
				
			||||||
 | 
					                                        Button(action: {  }) {
 | 
				
			||||||
 | 
					                                            ZStack {
 | 
				
			||||||
 | 
					                                                Image(systemName: "person.circle.fill")
 | 
				
			||||||
 | 
					                                                    .resizable()
 | 
				
			||||||
 | 
					                                                    .frame(width: 32, height: 32) // Smaller icon
 | 
				
			||||||
 | 
					                                                    .foregroundColor(.secondary)
 | 
				
			||||||
 | 
					                                                
 | 
				
			||||||
 | 
					                                                if account.isCurrent {
 | 
				
			||||||
 | 
					                                                    Image(systemName: "checkmark.circle.fill")
 | 
				
			||||||
 | 
					                                                        .foregroundColor(.blue)
 | 
				
			||||||
 | 
					                                                        .background(Circle().fill(Color(UIColor.systemBackground)))
 | 
				
			||||||
 | 
					                                                        .font(.body) // Smaller checkmark
 | 
				
			||||||
 | 
					                                                        .offset(x: 11, y: 11) // Adjusted offset
 | 
				
			||||||
 | 
					                                                }
 | 
				
			||||||
 | 
					                                            }
 | 
				
			||||||
 | 
					                                            
 | 
				
			||||||
 | 
					                                            VStack(alignment: .leading) {
 | 
				
			||||||
 | 
					                                                Text(account.name).font(.footnote).bold() // Smaller text
 | 
				
			||||||
 | 
					                                                Text(account.username).font(.caption2)      // Smaller text
 | 
				
			||||||
 | 
					                                            }
 | 
				
			||||||
 | 
					                                            .foregroundColor(.primary)
 | 
				
			||||||
 | 
					                                        }
 | 
				
			||||||
 | 
					                                                                            
 | 
				
			||||||
 | 
					                                        Spacer()
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            .padding(.horizontal, 20)
 | 
				
			||||||
 | 
					                            .padding(.vertical, 10)
 | 
				
			||||||
 | 
					                            .transition(.slideAndFade)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .clipped()
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                    // Menu Items
 | 
				
			||||||
 | 
					                    VStack(alignment: .leading, spacing: 20) {
 | 
				
			||||||
 | 
					                        // Section 1
 | 
				
			||||||
 | 
					                        VStack(alignment: .leading, spacing: 7) {
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "person.2.fill", title: "People You May Like", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "star.fill", title: "Fun Fest", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "lightbulb.fill", title: "Creator Center", action: {})
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        Divider()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        // Section 2
 | 
				
			||||||
 | 
					                        VStack(alignment: .leading, spacing: 7) {
 | 
				
			||||||
 | 
					                            Text("CATEGORY").font(.caption2).foregroundColor(.secondary)
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "doc.text", title: "Drafts", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "bubble.left", title: "My Comments", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "clock", title: "History", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "arrow.down.circle", title: "My Downloads", action: {})
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        Divider()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        // Section 3
 | 
				
			||||||
 | 
					                        VStack(alignment: .leading, spacing: 7) {
 | 
				
			||||||
 | 
					                            Text("SERVICES").font(.caption2).foregroundColor(.secondary)
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "shippingbox", title: "Orders", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "cart", title: "Cart", action: {})
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "wallet.pass", title: "Wallet", action: {})
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        
 | 
				
			||||||
 | 
					                        Divider()
 | 
				
			||||||
 | 
					                        
 | 
				
			||||||
 | 
					                        // Section 4
 | 
				
			||||||
 | 
					                        VStack(alignment: .leading, spacing: 15) {
 | 
				
			||||||
 | 
					                            SideMenuButton(icon: "square.grid.2x2", title: "Applets", action: {})
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    .padding()
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                .frame(maxWidth: .infinity, alignment: .leading) // Align to the left
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .clipped()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Spacer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Footer
 | 
				
			||||||
 | 
					            HStack(spacing: 20) {
 | 
				
			||||||
 | 
					                Spacer()
 | 
				
			||||||
 | 
					                SideMenuFooterButton(icon: "qrcode.viewfinder", title: "Scan", action: {})
 | 
				
			||||||
 | 
					                SideMenuFooterButton(icon: "questionmark.circle", title: "Help Center", action: {})
 | 
				
			||||||
 | 
					                SideMenuFooterButton(icon: "gear", title: "Settings", action: {})
 | 
				
			||||||
 | 
					                Spacer()
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .padding()
 | 
				
			||||||
 | 
					            .padding(.bottom, bottomPadding)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        .background(Color(UIColor.systemBackground))
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// --- PREVIEW ---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct SideMenuView_Previews: PreviewProvider {
 | 
				
			||||||
 | 
					    static var previews: some View {
 | 
				
			||||||
 | 
					        SideMenuView(isPresented: .constant(true))
 | 
				
			||||||
 | 
					            .environmentObject(ThemeManager())
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,31 +7,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import SwiftUI
 | 
					import SwiftUI
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//@AppStorage("isLoggedIn") var isLoggedIn: Bool = false
 | 
					 | 
				
			||||||
//@AppStorage("isDarkMode") private var isDarkMode: Bool = false
 | 
					 | 
				
			||||||
//@AppStorage("currentUser") var currentUser: String = ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@main
 | 
					@main
 | 
				
			||||||
struct volnahubApp: App {
 | 
					struct volnahubApp: App {
 | 
				
			||||||
    @AppStorage("isDarkMode") private var isDarkMode: Bool = true
 | 
					    @StateObject private var themeManager = ThemeManager()
 | 
				
			||||||
    @StateObject private var viewModel = LoginViewModel()
 | 
					    @StateObject private var viewModel = LoginViewModel()
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    var body: some Scene {
 | 
					    var body: some Scene {
 | 
				
			||||||
        WindowGroup {
 | 
					        WindowGroup {
 | 
				
			||||||
            ZStack {
 | 
					            Group {
 | 
				
			||||||
                Color(isDarkMode ? .black : .white) // ✅ Фон в зависимости от темы
 | 
					                if viewModel.isLoading {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                if viewModel.isLoading{
 | 
					 | 
				
			||||||
                    SplashScreenView()
 | 
					                    SplashScreenView()
 | 
				
			||||||
                }else{
 | 
					                } else if viewModel.isLoggedIn {
 | 
				
			||||||
                    if viewModel.isLoggedIn {
 | 
					                    MainView(viewModel: viewModel)
 | 
				
			||||||
                        MainView(viewModel: viewModel)
 | 
					                } else {
 | 
				
			||||||
                    } else {
 | 
					                    LoginView(viewModel: viewModel)
 | 
				
			||||||
                        LoginView(viewModel: viewModel)
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            .preferredColorScheme(isDarkMode ? .dark : .light)
 | 
					            .environmentObject(themeManager)
 | 
				
			||||||
 | 
					            .preferredColorScheme(themeManager.theme.colorScheme)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@
 | 
				
			|||||||
		1A9B01662E4BFA3600887E0B /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A9B01652E4BFA3600887E0B /* Media.xcassets */; };
 | 
							1A9B01662E4BFA3600887E0B /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A9B01652E4BFA3600887E0B /* Media.xcassets */; };
 | 
				
			||||||
		1A9B016E2E4BFB9000887E0B /* NewHomeTabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A9B016D2E4BFB9000887E0B /* NewHomeTabViewModel.swift */; };
 | 
							1A9B016E2E4BFB9000887E0B /* NewHomeTabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A9B016D2E4BFB9000887E0B /* NewHomeTabViewModel.swift */; };
 | 
				
			||||||
		1A9B017C2E4C087F00887E0B /* SideMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A9B017B2E4C087F00887E0B /* SideMenuView.swift */; };
 | 
							1A9B017C2E4C087F00887E0B /* SideMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A9B017B2E4C087F00887E0B /* SideMenuView.swift */; };
 | 
				
			||||||
 | 
							1A9E4FB32E4D6A67002249D6 /* ThemeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A9E4FB22E4D6A67002249D6 /* ThemeManager.swift */; };
 | 
				
			||||||
		1AB4F8CD2E22E341002B6E40 /* AccountShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8CC2E22E341002B6E40 /* AccountShareSheet.swift */; };
 | 
							1AB4F8CD2E22E341002B6E40 /* AccountShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8CC2E22E341002B6E40 /* AccountShareSheet.swift */; };
 | 
				
			||||||
		1AB4F8F32E22EC9F002B6E40 /* FollowersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8F22E22EC9F002B6E40 /* FollowersView.swift */; };
 | 
							1AB4F8F32E22EC9F002B6E40 /* FollowersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8F22E22EC9F002B6E40 /* FollowersView.swift */; };
 | 
				
			||||||
		1AB4F8F72E22ECAC002B6E40 /* FollowingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8F62E22ECAC002B6E40 /* FollowingView.swift */; };
 | 
							1AB4F8F72E22ECAC002B6E40 /* FollowingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB4F8F62E22ECAC002B6E40 /* FollowingView.swift */; };
 | 
				
			||||||
@ -90,6 +91,7 @@
 | 
				
			|||||||
		1A9B01652E4BFA3600887E0B /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
 | 
							1A9B01652E4BFA3600887E0B /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
 | 
				
			||||||
		1A9B016D2E4BFB9000887E0B /* NewHomeTabViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewHomeTabViewModel.swift; sourceTree = "<group>"; };
 | 
							1A9B016D2E4BFB9000887E0B /* NewHomeTabViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewHomeTabViewModel.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		1A9B017B2E4C087F00887E0B /* SideMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideMenuView.swift; sourceTree = "<group>"; };
 | 
							1A9B017B2E4C087F00887E0B /* SideMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideMenuView.swift; sourceTree = "<group>"; };
 | 
				
			||||||
 | 
							1A9E4FB22E4D6A67002249D6 /* ThemeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThemeManager.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		1AB4F8CC2E22E341002B6E40 /* AccountShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountShareSheet.swift; sourceTree = "<group>"; };
 | 
							1AB4F8CC2E22E341002B6E40 /* AccountShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountShareSheet.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		1AB4F8F22E22EC9F002B6E40 /* FollowersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersView.swift; sourceTree = "<group>"; };
 | 
							1AB4F8F22E22EC9F002B6E40 /* FollowersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersView.swift; sourceTree = "<group>"; };
 | 
				
			||||||
		1AB4F8F62E22ECAC002B6E40 /* FollowingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingView.swift; sourceTree = "<group>"; };
 | 
							1AB4F8F62E22ECAC002B6E40 /* FollowingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingView.swift; sourceTree = "<group>"; };
 | 
				
			||||||
@ -227,6 +229,7 @@
 | 
				
			|||||||
		1A7940E52DF7B341002569DA /* Services */ = {
 | 
							1A7940E52DF7B341002569DA /* Services */ = {
 | 
				
			||||||
			isa = PBXGroup;
 | 
								isa = PBXGroup;
 | 
				
			||||||
			children = (
 | 
								children = (
 | 
				
			||||||
 | 
									1A9E4FB22E4D6A67002249D6 /* ThemeManager.swift */,
 | 
				
			||||||
				1A7940E12DF7B1C5002569DA /* KeychainService.swift */,
 | 
									1A7940E12DF7B1C5002569DA /* KeychainService.swift */,
 | 
				
			||||||
			);
 | 
								);
 | 
				
			||||||
			path = Services;
 | 
								path = Services;
 | 
				
			||||||
@ -450,6 +453,7 @@
 | 
				
			|||||||
				1A7940E22DF7B1C5002569DA /* KeychainService.swift in Sources */,
 | 
									1A7940E22DF7B1C5002569DA /* KeychainService.swift in Sources */,
 | 
				
			||||||
				1A7940A62DF77DF5002569DA /* User.swift in Sources */,
 | 
									1A7940A62DF77DF5002569DA /* User.swift in Sources */,
 | 
				
			||||||
				1A7940A22DF77DE9002569DA /* AuthService.swift in Sources */,
 | 
									1A7940A22DF77DE9002569DA /* AuthService.swift in Sources */,
 | 
				
			||||||
 | 
									1A9E4FB32E4D6A67002249D6 /* ThemeManager.swift in Sources */,
 | 
				
			||||||
				1AEE5EB32E21A85800A3DCA3 /* SearchTab.swift in Sources */,
 | 
									1AEE5EB32E21A85800A3DCA3 /* SearchTab.swift in Sources */,
 | 
				
			||||||
				1ACE61152E22FE2000B37AC5 /* PostDetailView.swift in Sources */,
 | 
									1ACE61152E22FE2000B37AC5 /* PostDetailView.swift in Sources */,
 | 
				
			||||||
				1ACE61192E22FF1400B37AC5 /* Post.swift in Sources */,
 | 
									1ACE61192E22FF1400B37AC5 /* Post.swift in Sources */,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user