|
|
@ -1,14 +1,9 @@
|
|
|
|
//
|
|
|
|
|
|
|
|
// ScoreBoardView.swift
|
|
|
|
|
|
|
|
// DouShouQi_App
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Created by Rémi REGNAULT on 21/05/2024.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import SwiftUI
|
|
|
|
import DouShouQiModel
|
|
|
|
import DouShouQiModel
|
|
|
|
|
|
|
|
|
|
|
|
struct ScoreBoardView: View {
|
|
|
|
struct ScoreBoardView: View {
|
|
|
|
|
|
|
|
@State private var topPlayers: [PlayerVM] = []
|
|
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
var body: some View {
|
|
|
|
VStack {
|
|
|
|
VStack {
|
|
|
|
HStack {
|
|
|
|
HStack {
|
|
|
@ -39,14 +34,23 @@ struct ScoreBoardView: View {
|
|
|
|
.frame(height: 2)
|
|
|
|
.frame(height: 2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlayerScoreResumeFrame(Name: "Nathan Verdier", Rank: 1, Wins: 19, Looses: 15)
|
|
|
|
ForEach(topPlayers.indices, id: \.self) { index in
|
|
|
|
PlayerScoreResumeFrame(Name: "Rayhan Hassou", Rank: 2, Wins: 17, Looses: 17)
|
|
|
|
let player = topPlayers[index]
|
|
|
|
PlayerScoreResumeFrame(Name: "Rémi Regnault", Rank: 3, Wins: 15, Looses: 19)
|
|
|
|
PlayerScoreResumeFrame(
|
|
|
|
|
|
|
|
Name: player.player.name,
|
|
|
|
|
|
|
|
Rank: index + 1,
|
|
|
|
|
|
|
|
Wins: player.win,
|
|
|
|
|
|
|
|
Looses: player.loose
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.padding(10)
|
|
|
|
.padding(10)
|
|
|
|
|
|
|
|
.onAppear {
|
|
|
|
|
|
|
|
topPlayers = PlayersVM.fetchTopPlayers()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|