parent
35a0056f86
commit
602ae91c40
|
After Width: | Height: | Size: 68 KiB |
@ -0,0 +1,353 @@ |
|||||||
|
{ |
||||||
|
"colors" : [ |
||||||
|
{ |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "fr" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "light" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearances" : [ |
||||||
|
{ |
||||||
|
"appearance" : "luminosity", |
||||||
|
"value" : "dark" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"appearance" : "contrast", |
||||||
|
"value" : "high" |
||||||
|
} |
||||||
|
], |
||||||
|
"color" : { |
||||||
|
"color-space" : "srgb", |
||||||
|
"components" : { |
||||||
|
"alpha" : "1.000", |
||||||
|
"blue" : "58", |
||||||
|
"green" : "35", |
||||||
|
"red" : "25" |
||||||
|
} |
||||||
|
}, |
||||||
|
"idiom" : "universal", |
||||||
|
"locale" : "en" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
}, |
||||||
|
"properties" : { |
||||||
|
"localizable" : true |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"filename" : "PadelClub_logo_fondclair_transparent.png", |
||||||
|
"idiom" : "universal" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 80 KiB |
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"filename" : "PadelClub_logo_fondfonce.png", |
||||||
|
"idiom" : "universal" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 96 KiB |
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"filename" : "PadelClub_logo_fondfonce_transparent.png", |
||||||
|
"idiom" : "universal" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 73 KiB |
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"filename" : "PadelClub_small.png", |
||||||
|
"idiom" : "universal" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,49 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> |
||||||
|
<device id="retina6_12" orientation="portrait" appearance="light"/> |
||||||
|
<dependencies> |
||||||
|
<deployment identifier="iOS"/> |
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/> |
||||||
|
<capability name="Named colors" minToolsVersion="9.0"/> |
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
||||||
|
</dependencies> |
||||||
|
<scenes> |
||||||
|
<!--View Controller--> |
||||||
|
<scene sceneID="EHf-IW-A2E"> |
||||||
|
<objects> |
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> |
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> |
||||||
|
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/> |
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
||||||
|
<subviews> |
||||||
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PadelClub_logo_fondfonce_transparent" translatesAutoresizingMaskIntoConstraints="NO" id="Lsd-2D-TDo"> |
||||||
|
<rect key="frame" x="64" y="-628.66666666666663" width="265" height="2134.3333333333335"/> |
||||||
|
</imageView> |
||||||
|
</subviews> |
||||||
|
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/> |
||||||
|
<color key="backgroundColor" name="LaunchScreenBackground"/> |
||||||
|
<color key="tintColor" name="AccentColor"/> |
||||||
|
<constraints> |
||||||
|
<constraint firstItem="Lsd-2D-TDo" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="7Tm-4j-KPz"/> |
||||||
|
<constraint firstItem="Lsd-2D-TDo" firstAttribute="width" secondItem="Ze5-6b-2t3" secondAttribute="height" multiplier="265:852" id="Nhb-n4-HGG"/> |
||||||
|
<constraint firstItem="Lsd-2D-TDo" firstAttribute="centerY" secondItem="Bcu-3y-fUS" secondAttribute="centerY" id="xOG-dI-NIb"/> |
||||||
|
</constraints> |
||||||
|
</view> |
||||||
|
</viewController> |
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> |
||||||
|
</objects> |
||||||
|
<point key="canvasLocation" x="52.671755725190835" y="374.64788732394368"/> |
||||||
|
</scene> |
||||||
|
</scenes> |
||||||
|
<color key="tintColor" name="LaunchScreenBackground"/> |
||||||
|
<resources> |
||||||
|
<image name="PadelClub_logo_fondfonce_transparent" width="1926" height="2134"/> |
||||||
|
<namedColor name="AccentColor"> |
||||||
|
<color red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
||||||
|
</namedColor> |
||||||
|
<namedColor name="LaunchScreenBackground"> |
||||||
|
<color red="0.098039215686274508" green="0.13725490196078433" blue="0.22745098039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
||||||
|
</namedColor> |
||||||
|
</resources> |
||||||
|
</document> |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
// |
||||||
|
// NavigationDestination.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import Foundation |
||||||
|
|
||||||
|
enum NavigationDestination: CaseIterable, Identifiable { |
||||||
|
var id: Self { |
||||||
|
self |
||||||
|
} |
||||||
|
|
||||||
|
case activity |
||||||
|
case eventList |
||||||
|
case toolbox |
||||||
|
case tournamentOrganizer |
||||||
|
case umpire |
||||||
|
case padelClub |
||||||
|
|
||||||
|
var title: String { |
||||||
|
switch self { |
||||||
|
case .activity: |
||||||
|
return "Activité" |
||||||
|
case .eventList: |
||||||
|
return "Journal" |
||||||
|
case .toolbox: |
||||||
|
return "Outils" |
||||||
|
case .tournamentOrganizer: |
||||||
|
return "Gestionnaire" |
||||||
|
case .umpire: |
||||||
|
return "Juge-Arbitre" |
||||||
|
case .padelClub: |
||||||
|
return "Padel Club" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var image: String { |
||||||
|
switch self { |
||||||
|
case .activity: |
||||||
|
return "calendar" |
||||||
|
case .eventList: |
||||||
|
return "book.closed" |
||||||
|
case .toolbox: |
||||||
|
return "wrench.and.screwdriver" |
||||||
|
case .tournamentOrganizer: |
||||||
|
return "squares.below.rectangle" |
||||||
|
case .umpire: |
||||||
|
return "person.bust" |
||||||
|
case .padelClub: |
||||||
|
return "shield" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,118 @@ |
|||||||
|
// |
||||||
|
// ActivityView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct ActivityView: View { |
||||||
|
@State private var searchText: String = "" |
||||||
|
@State private var agendaDestination: AgendaDestination = .activity |
||||||
|
|
||||||
|
@State private var filterEnabled: Bool = false |
||||||
|
@State private var presentToolbar: Bool = false |
||||||
|
|
||||||
|
var tournaments: [Tournament] { |
||||||
|
switch agendaDestination { |
||||||
|
case .activity: |
||||||
|
[] |
||||||
|
case .history: |
||||||
|
DataStore.fakeTournaments |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func _activityStatus() -> String { |
||||||
|
if tournaments.isEmpty && filterEnabled == false { |
||||||
|
"Aucune activité" |
||||||
|
} else { |
||||||
|
"\(tournaments.count) tournois" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
NavigationStack { |
||||||
|
List { |
||||||
|
Section { |
||||||
|
AgendaDestinationPickerView(agendaDestination: $agendaDestination) |
||||||
|
} |
||||||
|
|
||||||
|
if tournaments.isEmpty { |
||||||
|
if searchText.isEmpty == false { |
||||||
|
ContentUnavailableView.search(text: searchText) |
||||||
|
} else if filterEnabled { |
||||||
|
ContentUnavailableView { |
||||||
|
Text("Aucun résultat") |
||||||
|
} description: { |
||||||
|
Text("Description du filtre") |
||||||
|
} actions: { |
||||||
|
RowButtonView(title: "supprimer le filtre") { |
||||||
|
filterEnabled.toggle() |
||||||
|
} |
||||||
|
} |
||||||
|
} else { |
||||||
|
ContentUnavailableView { |
||||||
|
Label("Aucune activité", systemImage: "shield.slash") |
||||||
|
} description: { |
||||||
|
Text("Aucun événement n'est prévu dans votre agenda.") |
||||||
|
} actions: { |
||||||
|
RowButtonView(title: "Créer un nouvel évenement") { |
||||||
|
let tournament = Tournament(name: "P100", club_id: "", category: 0, playerCount: 24) |
||||||
|
try? DataStore.shared.tournaments.append(contentOfs: [tournament]) |
||||||
|
|
||||||
|
} |
||||||
|
RowButtonView(title: "Importer vos tournois Tenup") { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} else { |
||||||
|
EventListView(tournaments: tournaments) |
||||||
|
} |
||||||
|
} |
||||||
|
.searchable(text: $searchText) |
||||||
|
.onAppear { presentToolbar = true } |
||||||
|
.onDisappear { presentToolbar = false } |
||||||
|
.toolbar { |
||||||
|
if presentToolbar { |
||||||
|
ToolbarItem(placement: .status) { |
||||||
|
VStack { |
||||||
|
if filterEnabled { |
||||||
|
Text("filtre actif") |
||||||
|
.font(.footnote) |
||||||
|
} |
||||||
|
|
||||||
|
Text(_activityStatus()) |
||||||
|
.foregroundStyle(.secondary) |
||||||
|
.font(.footnote) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
ToolbarItemGroup(placement: .bottomBar) { |
||||||
|
Button { |
||||||
|
filterEnabled.toggle() |
||||||
|
} label: { |
||||||
|
Label("Vues", systemImage: "line.3.horizontal.decrease.circle") |
||||||
|
.symbolVariant(filterEnabled ? .fill : .none) |
||||||
|
} |
||||||
|
Button { |
||||||
|
|
||||||
|
} label: { |
||||||
|
Label("Ajouter", systemImage: "plus") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.navigationTitle(NavigationDestination.activity.title) |
||||||
|
.navigationDestination(for: Tournament.self) { tournament in |
||||||
|
TournamentView(tournament: tournament) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
ActivityView() |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
// |
||||||
|
// AgendaDestination.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 01/03/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import Foundation |
||||||
|
|
||||||
|
enum AgendaDestination: CaseIterable, Identifiable { |
||||||
|
var id: Self { self } |
||||||
|
|
||||||
|
case activity |
||||||
|
case history |
||||||
|
|
||||||
|
var localizedTitleKey: String { |
||||||
|
switch self { |
||||||
|
case .activity: |
||||||
|
return "En cours" |
||||||
|
case .history: |
||||||
|
return "Terminé" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var systemImage: String { |
||||||
|
switch self { |
||||||
|
case .activity: |
||||||
|
return "squares.leading.rectangle" |
||||||
|
case .history: |
||||||
|
return "book.closed" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
// |
||||||
|
// 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)) |
||||||
|
} |
||||||
@ -0,0 +1,72 @@ |
|||||||
|
// |
||||||
|
// EmptyActivityView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 01/03/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
struct RowButtonView: View { |
||||||
|
let title: String |
||||||
|
var systemImage: String? = nil |
||||||
|
var image: String? = nil |
||||||
|
let action: () -> () |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
Button { |
||||||
|
action() |
||||||
|
} label: { |
||||||
|
HStack { |
||||||
|
Spacer() |
||||||
|
if let systemImage { |
||||||
|
Image(systemName: systemImage) |
||||||
|
} |
||||||
|
if let image { |
||||||
|
Image(image) |
||||||
|
.resizable() |
||||||
|
.scaledToFit() |
||||||
|
.frame(width: 32, height: 32) |
||||||
|
} |
||||||
|
Text(title) |
||||||
|
.foregroundColor(.white) |
||||||
|
.frame(height: 32) |
||||||
|
Spacer() |
||||||
|
} |
||||||
|
.font(.headline) |
||||||
|
} |
||||||
|
.frame(maxWidth: .infinity) |
||||||
|
.buttonStyle(.borderedProminent) |
||||||
|
.tint(.launchScreenBackground) |
||||||
|
.listRowBackground(Color.clear) |
||||||
|
.listRowInsets(EdgeInsets(.zero)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct EmptyActivityView: View { |
||||||
|
var body: some View { |
||||||
|
NavigationStack { |
||||||
|
List { |
||||||
|
WelcomeView() |
||||||
|
|
||||||
|
Section { |
||||||
|
RowButtonView(title: "Créer votre premier événement", action: { |
||||||
|
let tournament = Tournament(name: "P100", club_id: "", category: 0, playerCount: 24) |
||||||
|
try? DataStore.shared.tournaments.append(contentOfs: [tournament]) |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
Section { |
||||||
|
RowButtonView(title: "Importer vos tournois Tenup", action: { |
||||||
|
|
||||||
|
}) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
EmptyActivityView() |
||||||
|
} |
||||||
@ -0,0 +1,77 @@ |
|||||||
|
// |
||||||
|
// EventListView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct EventListView: View { |
||||||
|
|
||||||
|
let tournaments: [Tournament] |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
Section { |
||||||
|
ForEach(tournaments) { tournament in |
||||||
|
|
||||||
|
NavigationLink(value: tournament) { |
||||||
|
TournamentCellView(tournament: tournament) |
||||||
|
} |
||||||
|
.contextMenu { |
||||||
|
Button { |
||||||
|
|
||||||
|
} label: { |
||||||
|
Label("Voir dans le gestionnaire", systemImage: "line.diagonal.arrow") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.onDelete(perform: { indexSet in |
||||||
|
for index in indexSet { |
||||||
|
try? DataStore.shared.tournaments.delete(instance: tournaments[index]) |
||||||
|
} |
||||||
|
}) |
||||||
|
} header: { |
||||||
|
Text(Date().formatted(.dateTime.month().year())) |
||||||
|
}.headerProminence(.increased) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
EventListView(tournaments: []) |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
.overlay(alignment: .bottom) { |
||||||
|
Button { |
||||||
|
} label: { |
||||||
|
Circle() |
||||||
|
.fill(Color.white) |
||||||
|
.frame(width: 64) |
||||||
|
.overlay( |
||||||
|
Image(systemName: "plus") |
||||||
|
.font(.title2) |
||||||
|
.padding() |
||||||
|
) |
||||||
|
.shadow(radius: /*@START_MENU_TOKEN@*/10/*@END_MENU_TOKEN@*/) |
||||||
|
} |
||||||
|
.buttonStyle(.plain) |
||||||
|
.padding() |
||||||
|
} |
||||||
|
|
||||||
|
Button { |
||||||
|
} label: { |
||||||
|
RoundedRectangle(cornerRadius: 20, style: .continuous) |
||||||
|
.fill(Color.white) |
||||||
|
.frame(height: 64) |
||||||
|
.overlay( |
||||||
|
Text("Créer un nouvel évenement") |
||||||
|
.font(.title2) |
||||||
|
.padding() |
||||||
|
) |
||||||
|
.shadow(radius: 10) |
||||||
|
} |
||||||
|
.buttonStyle(.plain) |
||||||
|
.padding() |
||||||
|
|
||||||
|
*/ |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
// |
||||||
|
// MainView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct MainView: View { |
||||||
|
@StateObject var dataStore = DataStore.shared |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
TabView { |
||||||
|
if dataStore.tournaments.isEmpty { |
||||||
|
EmptyActivityView() |
||||||
|
.tabItem(for: .activity) |
||||||
|
} else { |
||||||
|
ActivityView() |
||||||
|
.tabItem(for: .activity) |
||||||
|
} |
||||||
|
TournamentOrganizerView() |
||||||
|
.tabItem(for: .tournamentOrganizer) |
||||||
|
ToolboxView() |
||||||
|
.tabItem(for: .toolbox) |
||||||
|
UmpireView() |
||||||
|
.tabItem(for: .umpire) |
||||||
|
PadelClubView() |
||||||
|
.tabItem(for: .padelClub) |
||||||
|
} |
||||||
|
.environmentObject(dataStore) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
fileprivate extension View { |
||||||
|
func tabItem(for navigationDestination: NavigationDestination) -> some View { |
||||||
|
modifier(TabItemModifier(navigationDestination: navigationDestination)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
fileprivate struct TabItemModifier: ViewModifier { |
||||||
|
let navigationDestination: NavigationDestination |
||||||
|
|
||||||
|
func body(content: Content) -> some View { |
||||||
|
content |
||||||
|
.tabItem { |
||||||
|
Label(navigationDestination.title, systemImage: navigationDestination.image) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
MainView() |
||||||
|
} |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
// |
||||||
|
// OrganizedTournamentView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct OrganizedTournamentView: View { |
||||||
|
let tournament: Tournament |
||||||
|
@State private var navigationPath: [Screen] = [] |
||||||
|
|
||||||
|
init(tournament: Tournament) { |
||||||
|
self.tournament = tournament |
||||||
|
_navigationPath = State(wrappedValue: tournament.navigationPath) |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
NavigationStack(path: $navigationPath) { |
||||||
|
TournamentView(tournament: tournament, presentationContext: .organizer) |
||||||
|
.onChange(of: navigationPath) { |
||||||
|
tournament.navigationPath = navigationPath |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,83 @@ |
|||||||
|
// |
||||||
|
// TournamentOrganizerView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct TournamentOrganizerView: View { |
||||||
|
@State private var selectedTournamentId: String? |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
VStack(spacing: 0) { |
||||||
|
ForEach(DataStore.fakeTournaments) { tournament in |
||||||
|
if tournament.id == selectedTournamentId { |
||||||
|
OrganizedTournamentView(tournament: tournament) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if selectedTournamentId == nil { |
||||||
|
NavigationStack { |
||||||
|
ContentUnavailableView("Aucun tournoi sélectionné", systemImage: "rectangle.slash", description: Text("Utilisez l'accès rapide ci-dessous pour éditer un tournoi et passer rapidement d'un tournoi à l'autre.")) |
||||||
|
.navigationTitle("Gestionnaire de tournois") |
||||||
|
.navigationBarTitleDisplayMode(.inline) |
||||||
|
} |
||||||
|
} |
||||||
|
Divider() |
||||||
|
HStack { |
||||||
|
ScrollView(.horizontal) { |
||||||
|
HStack { |
||||||
|
ForEach(DataStore.fakeTournaments) { tournament in |
||||||
|
TournamentButtonView(tournament: tournament, selectedId: $selectedTournamentId) |
||||||
|
} |
||||||
|
} |
||||||
|
.padding() |
||||||
|
.buttonStyle(.plain) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct TournamentButtonView: View { |
||||||
|
let tournament: Tournament |
||||||
|
@Binding var selectedId: String? |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
Button { |
||||||
|
if selectedId == tournament.id { |
||||||
|
tournament.navigationPath.removeAll() |
||||||
|
selectedId = nil |
||||||
|
// if tournament.navigationPath.isEmpty { |
||||||
|
// selectedId = nil |
||||||
|
// } else { |
||||||
|
// tournament.navigationPath.removeLast() |
||||||
|
// } |
||||||
|
} else { |
||||||
|
selectedId = tournament.id |
||||||
|
} |
||||||
|
} label: { |
||||||
|
TournamentCellView(tournament: tournament) |
||||||
|
.padding(8) |
||||||
|
.overlay( |
||||||
|
RoundedRectangle(cornerRadius: 20) |
||||||
|
.stroke(Color.black, lineWidth: 2) |
||||||
|
) |
||||||
|
.fixedSize(horizontal: false, vertical: true) |
||||||
|
} |
||||||
|
.overlay(alignment: .top) { |
||||||
|
if selectedId == tournament.id { |
||||||
|
Image(systemName: "ellipsis") |
||||||
|
.offset(y: -10) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
TournamentOrganizerView() |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
// |
||||||
|
// PadelClubView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 01/03/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct PadelClubView: View { |
||||||
|
var body: some View { |
||||||
|
NavigationStack { |
||||||
|
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) |
||||||
|
.navigationTitle(NavigationDestination.padelClub.title) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
PadelClubView() |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
// |
||||||
|
// ToolboxView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct ToolboxView: View { |
||||||
|
var body: some View { |
||||||
|
NavigationStack { |
||||||
|
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) |
||||||
|
.navigationTitle(NavigationDestination.toolbox.title) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
ToolboxView() |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
// |
||||||
|
// UmpireView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 01/03/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct UmpireView: View { |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
NavigationStack { |
||||||
|
List { |
||||||
|
NavigationLink { |
||||||
|
MainUserView() |
||||||
|
} label: { |
||||||
|
Label("Mon compte", systemImage: "person.circle.fill") |
||||||
|
} |
||||||
|
NavigationLink { |
||||||
|
SubscriptionView() |
||||||
|
} label: { |
||||||
|
Label("Abonnement", systemImage: "tennisball.circle.fill") |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
UmpireView() |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
// |
||||||
|
// WelcomeView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 01/03/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct WelcomeView: View { |
||||||
|
var body: some View { |
||||||
|
Image(.padelClubLogoFondfonce) |
||||||
|
.resizable() |
||||||
|
.scaledToFit() |
||||||
|
.buttonStyle(.borderedProminent) |
||||||
|
.tint(.launchScreenBackground) |
||||||
|
.listRowBackground(Color.clear) |
||||||
|
.listRowInsets(EdgeInsets(.zero)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
WelcomeView() |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
// |
||||||
|
// InscriptionManagerView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct InscriptionManagerView: View { |
||||||
|
let tournament: Tournament |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
List { |
||||||
|
Text(tournament.playerCount.formatted()) |
||||||
|
} |
||||||
|
.navigationTitle("Inscriptions") |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
// |
||||||
|
// DateBoxView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct DateBoxView: View { |
||||||
|
let date: Date |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
VStack(alignment: .center, spacing: -2) { |
||||||
|
Text(date.formatted(.dateTime.weekday(.abbreviated))) |
||||||
|
.font(.caption2) |
||||||
|
Text(date.formatted(.dateTime.day())) |
||||||
|
.font(.title) |
||||||
|
Text(date.formatted(.dateTime.month(.abbreviated))) |
||||||
|
.font(.caption2) |
||||||
|
Text(date.formatted(.dateTime.year())) |
||||||
|
.font(.caption2) |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#Preview { |
||||||
|
DateBoxView(date: Date()) |
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
// |
||||||
|
// TournamentCellView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
struct TournamentCellView: View { |
||||||
|
|
||||||
|
let tournament: Tournament |
||||||
|
let color: Color = .black |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
HStack(alignment: .top) { |
||||||
|
DateBoxView(date: Date()) |
||||||
|
Rectangle() |
||||||
|
.fill(color) |
||||||
|
.frame(width: 2) |
||||||
|
VStack(alignment: .leading, spacing: -2) { |
||||||
|
Text("Homme") |
||||||
|
.font(.caption2) |
||||||
|
Text(tournament.name) |
||||||
|
.font(.title) |
||||||
|
Text("Senior") |
||||||
|
.font(.caption2) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,72 @@ |
|||||||
|
// |
||||||
|
// TournamentView.swift |
||||||
|
// PadelClub |
||||||
|
// |
||||||
|
// Created by Razmig Sarkissian on 29/02/2024. |
||||||
|
// |
||||||
|
|
||||||
|
import SwiftUI |
||||||
|
|
||||||
|
enum Screen: String, Codable { |
||||||
|
case inscription |
||||||
|
case groupStage |
||||||
|
} |
||||||
|
|
||||||
|
enum PresentationContext { |
||||||
|
case agenda |
||||||
|
case organizer |
||||||
|
} |
||||||
|
|
||||||
|
struct TournamentView: View { |
||||||
|
@State var tournament: Tournament |
||||||
|
var presentationContext: PresentationContext = .agenda |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
List { |
||||||
|
InscriptionManagerRowView(tournament: tournament) |
||||||
|
NavigationLink(value: Screen.groupStage) { |
||||||
|
Text("Poules") |
||||||
|
.badge(2) |
||||||
|
} |
||||||
|
} |
||||||
|
.navigationDestination(for: Screen.self, destination: { screen in |
||||||
|
switch screen { |
||||||
|
case .inscription: |
||||||
|
InscriptionManagerView(tournament: tournament) |
||||||
|
case .groupStage: |
||||||
|
Text("Poules \(screen.rawValue)") |
||||||
|
} |
||||||
|
}) |
||||||
|
.navigationTitle(tournament.name) |
||||||
|
.toolbar { |
||||||
|
if presentationContext == .agenda { |
||||||
|
ToolbarItem(placement: .topBarTrailing) { |
||||||
|
Menu { |
||||||
|
Button { |
||||||
|
|
||||||
|
} label: { |
||||||
|
Label("Voir dans le gestionnaire", systemImage: "line.diagonal.arrow") |
||||||
|
} |
||||||
|
} label: { |
||||||
|
Label("Options", systemImage: "ellipsis.circle") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
struct InscriptionManagerRowView: View { |
||||||
|
let tournament: Tournament |
||||||
|
var body: some View { |
||||||
|
NavigationLink(value: Screen.inscription) { |
||||||
|
Text("Inscriptions") |
||||||
|
.badge(tournament.playerCount) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
// |
||||||
|
//#Preview { |
||||||
|
// TournamentView(tournament: Tournament(name: "", club_id: "", category: 0, playerCount: 0)) |
||||||
|
//} |
||||||
Loading…
Reference in new issue