parent
ef15072a22
commit
86b6e0c765
@ -0,0 +1,28 @@
|
||||
//
|
||||
// CurrentBetViewModel.swift
|
||||
// AllIn
|
||||
//
|
||||
// Created by Emre on 31/01/2024.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import DependencyInjection
|
||||
import Model
|
||||
|
||||
class CurrentBetViewModel: ObservableObject {
|
||||
|
||||
@Inject var manager: Manager
|
||||
|
||||
@Published private(set) var bets: [Bet] = []
|
||||
|
||||
init() {
|
||||
getItems()
|
||||
}
|
||||
|
||||
func getItems() {
|
||||
manager.getCurrentBets(withIndex: 0, withCount: 20) { bets in
|
||||
self.bets = bets
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
//
|
||||
// CurrentBetView.swift
|
||||
// AllIn
|
||||
//
|
||||
// Created by Emre on 31/01/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Model
|
||||
|
||||
struct CurrentBetView: View {
|
||||
|
||||
@StateObject private var viewModel = CurrentBetViewModel()
|
||||
@Binding var showMenu: Bool
|
||||
@State private var showingSheet = false
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
|
||||
TopBar(showMenu: self.$showMenu)
|
||||
ScrollView(showsIndicators: false) {
|
||||
Text("En cours")
|
||||
.textStyle(weight: .bold, color: AllInColors.grey500Color, size: 25)
|
||||
.padding([.top],15)
|
||||
VStack(spacing: 20){
|
||||
ForEach(viewModel.bets, id: \.id) { (bet: Bet) in
|
||||
ReviewCard(amountBetted: 110, isAWin: false)
|
||||
}
|
||||
}
|
||||
.padding([.trailing, .leading, .bottom],25)
|
||||
}
|
||||
.refreshable {
|
||||
viewModel.getItems()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.background(AllInColors.backgroundColor)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue