remove obsolete agendadestinationpicker view

multistore
Razmig Sarkissian 2 years ago
parent 797caf55a2
commit af97c40270
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 6
      PadelClub/ViewModel/AgendaDestination.swift
  3. 3
      PadelClub/Views/Components/GenericDestinationPickerView.swift
  4. 2
      PadelClub/Views/GroupStage/GroupStagesView.swift
  5. 15
      PadelClub/Views/Navigation/Agenda/ActivityView.swift
  6. 39
      PadelClub/Views/Navigation/Agenda/AgendaDestinationPickerView.swift
  7. 2
      PadelClub/Views/Round/RoundsView.swift

@ -173,7 +173,6 @@
FFC1E10C2BAC7FB0008D6F59 /* ClubImportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC1E10B2BAC7FB0008D6F59 /* ClubImportView.swift */; };
FFC83D4F2BB807D100750834 /* RoundsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC83D4E2BB807D100750834 /* RoundsView.swift */; };
FFC83D512BB8087E00750834 /* RoundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFC83D502BB8087E00750834 /* RoundView.swift */; };
FFD783FD2B91B9ED000F62A6 /* AgendaDestinationPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD783FC2B91B9ED000F62A6 /* AgendaDestinationPickerView.swift */; };
FFD783FF2B91BA42000F62A6 /* PadelClubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD783FE2B91BA42000F62A6 /* PadelClubView.swift */; };
FFD784022B91C1B4000F62A6 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD784012B91C1B4000F62A6 /* WelcomeView.swift */; };
FFD784042B91C280000F62A6 /* EmptyActivityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD784032B91C280000F62A6 /* EmptyActivityView.swift */; };
@ -402,7 +401,6 @@
FFC1E10B2BAC7FB0008D6F59 /* ClubImportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClubImportView.swift; sourceTree = "<group>"; };
FFC83D4E2BB807D100750834 /* RoundsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundsView.swift; sourceTree = "<group>"; };
FFC83D502BB8087E00750834 /* RoundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundView.swift; sourceTree = "<group>"; };
FFD783FC2B91B9ED000F62A6 /* AgendaDestinationPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgendaDestinationPickerView.swift; sourceTree = "<group>"; };
FFD783FE2B91BA42000F62A6 /* PadelClubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PadelClubView.swift; sourceTree = "<group>"; };
FFD784002B91BF79000F62A6 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
FFD784012B91C1B4000F62A6 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
@ -897,7 +895,6 @@
FFD784012B91C1B4000F62A6 /* WelcomeView.swift */,
FF59FFB22B90EFAC0061EFF9 /* EventListView.swift */,
FF5D0D8A2BB4D1E3005CB568 /* CalendarView.swift */,
FFD783FC2B91B9ED000F62A6 /* AgendaDestinationPickerView.swift */,
);
path = Agenda;
sourceTree = "<group>";
@ -1162,7 +1159,6 @@
FF1CBC1D2BB53DC10036DAAB /* Calendar+Extensions.swift in Sources */,
FF967CF22BAECC0B00A9A3BD /* TeamScore.swift in Sources */,
FF5D0D762BB428B2005CB568 /* ListRowViewModifier.swift in Sources */,
FFD783FD2B91B9ED000F62A6 /* AgendaDestinationPickerView.swift in Sources */,
FF6EC9002B94794700EA7F5A /* PresentationContext.swift in Sources */,
FFDB1C6D2BB2A02000F1E467 /* AppSettings.swift in Sources */,
FF0EC5202BB16F680056B6D1 /* SwiftParser.swift in Sources */,

@ -7,7 +7,7 @@
import Foundation
enum AgendaDestination: CaseIterable, Identifiable {
enum AgendaDestination: CaseIterable, Identifiable, Selectable {
var id: Self { self }
case activity
@ -30,6 +30,10 @@ enum AgendaDestination: CaseIterable, Identifiable {
}
}
func selectionLabel() -> String {
localizedTitleKey
}
var systemImage: String {
switch self {
case .activity:

@ -14,10 +14,12 @@ protocol Selectable {
struct GenericDestinationPickerView<T: Identifiable & Selectable>: View {
@Binding var selectedDestination: T?
let destinations: [T]
let nilDestinationIsValid: Bool
var body: some View {
ScrollView(.horizontal) {
HStack {
if nilDestinationIsValid {
Button {
selectedDestination = nil
} label: {
@ -30,6 +32,7 @@ struct GenericDestinationPickerView<T: Identifiable & Selectable>: View {
.opacity(selectedDestination == nil ? 1.0 : 0.5)
}
.buttonStyle(.plain)
}
ForEach(destinations) { destination in
Button {

@ -18,7 +18,7 @@ struct GroupStagesView: View {
var body: some View {
VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $selectedGroupStage, destinations: tournament.groupStages())
GenericDestinationPickerView(selectedDestination: $selectedGroupStage, destinations: tournament.groupStages(), nilDestinationIsValid: true)
switch selectedGroupStage {
case .none:
GroupStageSettingsView()

@ -11,7 +11,7 @@ struct ActivityView: View {
@EnvironmentObject var dataStore: DataStore
@State private var searchText: String = ""
@State private var agendaDestination: AgendaDestination = .activity
@State private var agendaDestination: AgendaDestination? = .activity
@State private var filterEnabled: Bool = false
@State private var presentToolbar: Bool = false
@ -40,7 +40,7 @@ struct ActivityView: View {
}
var tournaments: [FederalTournamentHolder] {
switch agendaDestination {
switch agendaDestination! {
case .activity:
runningTournaments
case .history:
@ -52,12 +52,10 @@ struct ActivityView: View {
var body: some View {
NavigationStack {
VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $agendaDestination, destinations: AgendaDestination.allCases, nilDestinationIsValid: false)
List {
Section {
AgendaDestinationPickerView(agendaDestination: $agendaDestination)
}
switch agendaDestination {
switch agendaDestination! {
case .activity:
EventListView(tournaments: runningTournaments, viewStyle: viewStyle)
case .history:
@ -179,6 +177,7 @@ struct ActivityView: View {
}
}
}
}
private func _gatherFederalTournaments() {
isGatheringFederalTournaments = true
@ -192,7 +191,7 @@ struct ActivityView: View {
@ViewBuilder
private func _dataEmptyView() -> some View {
switch agendaDestination {
switch agendaDestination! {
case .activity:
_runningEmptyView()
case .history:

@ -1,39 +0,0 @@
//
// AgendaDestinationPickerView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 01/03/2024.
//
import SwiftUI
struct AgendaDestinationPickerView: View {
@Binding var agendaDestination: AgendaDestination
var body: some View {
HStack {
ForEach(AgendaDestination.allCases) { screen in
Button {
agendaDestination = screen
} label: {
Label(screen.localizedTitleKey, systemImage: screen.systemImage)
}
.padding()
.background {
Capsule(style: .continuous)
.fill(.white)
.opacity(screen == agendaDestination ? 1.0 : 0.5)
}
.labelStyle(.titleOnly)
.buttonStyle(.plain)
}
}
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
.listRowBackground(Color.clear)
}
}
#Preview {
AgendaDestinationPickerView(agendaDestination: .constant(.activity))
}

@ -18,7 +18,7 @@ struct RoundsView: View {
var body: some View {
VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $selectedRound, destinations: tournament.rounds())
GenericDestinationPickerView(selectedDestination: $selectedRound, destinations: tournament.rounds(), nilDestinationIsValid: true)
switch selectedRound {
case .none:
RoundSettingsView()

Loading…
Cancel
Save