You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1001 B
36 lines
1001 B
//
|
|
// NavigationViewModel.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 03/04/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
import PadelClubData
|
|
|
|
@Observable
|
|
class NavigationViewModel {
|
|
var path = NavigationPath()
|
|
var toolboxPath = NavigationPath()
|
|
var accountPath: [MyAccountView.AccountScreen] = []
|
|
var ongoingPath = NavigationPath()
|
|
var selectedTab: TabDestination?
|
|
var agendaDestination: AgendaDestination? = .activity
|
|
var organizerTournament: Tournament?
|
|
|
|
func isTournamentAlreadyOpenInOrganizer(_ tournament: Tournament) -> Bool {
|
|
organizerTournament?.id == tournament.id
|
|
}
|
|
|
|
func closeTournamentFromOrganizer(_ tournament: Tournament) {
|
|
tournament.navigationPath.removeAll()
|
|
organizerTournament = nil
|
|
}
|
|
|
|
func openTournamentInOrganizer(_ tournament: Tournament) {
|
|
organizerTournament = tournament
|
|
if selectedTab != .tournamentOrganizer {
|
|
selectedTab = .tournamentOrganizer
|
|
}
|
|
}
|
|
}
|
|
|