|
|
|
@ -6,6 +6,9 @@ struct DetailsView: View {
|
|
|
|
|
@Binding var isModalPresented: Bool
|
|
|
|
|
@Binding var isModalParticipated: Bool
|
|
|
|
|
@State var progressValue: Float = 0.2
|
|
|
|
|
var id: String
|
|
|
|
|
@StateObject private var viewModel: DetailsViewModel
|
|
|
|
|
|
|
|
|
|
var isFinished: Bool {
|
|
|
|
|
viewModel.betDetail?.finalAnswer == nil ? false : true
|
|
|
|
|
}
|
|
|
|
@ -46,10 +49,7 @@ struct DetailsView: View {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var id: String
|
|
|
|
|
@StateObject private var viewModel: DetailsViewModel
|
|
|
|
|
|
|
|
|
|
init(isModalPresented: Binding<Bool>, isModalParticipated: Binding<Bool>,id: String) {
|
|
|
|
|
init(isModalPresented: Binding<Bool>, isModalParticipated: Binding<Bool>, id: String) {
|
|
|
|
|
self._isModalPresented = isModalPresented
|
|
|
|
|
self._isModalParticipated = isModalParticipated
|
|
|
|
|
self.id = id
|
|
|
|
@ -61,7 +61,11 @@ struct DetailsView: View {
|
|
|
|
|
ZStack(alignment: .bottom) {
|
|
|
|
|
VStack(alignment: .center) {
|
|
|
|
|
HStack{
|
|
|
|
|
Text(StatusValues.0).font(.system(size: 25)).fontWeight(.bold).padding(.bottom, 10).foregroundStyle(Color.black).opacity(0.4)
|
|
|
|
|
Text(StatusValues.0)
|
|
|
|
|
.font(.system(size: 25))
|
|
|
|
|
.fontWeight(.bold).padding(.bottom, 10)
|
|
|
|
|
.foregroundStyle(Color.black)
|
|
|
|
|
.opacity(0.4)
|
|
|
|
|
Spacer()
|
|
|
|
|
Image("closeIcon")
|
|
|
|
|
.resizable()
|
|
|
|
@ -75,6 +79,7 @@ struct DetailsView: View {
|
|
|
|
|
.padding(.horizontal, 15)
|
|
|
|
|
.background(StatusValues.1)
|
|
|
|
|
.transition(.slideInFromBottom(yOffset:0))
|
|
|
|
|
|
|
|
|
|
VStack(spacing: 0) {
|
|
|
|
|
VStack(alignment: .leading,spacing: 5){
|
|
|
|
|
HStack{
|
|
|
|
@ -114,11 +119,13 @@ struct DetailsView: View {
|
|
|
|
|
.padding(.all,15).padding(.vertical, 10)
|
|
|
|
|
.background(AllInColors.componentBackgroundColor)
|
|
|
|
|
.cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0)
|
|
|
|
|
|
|
|
|
|
if isFinished {
|
|
|
|
|
ResultBanner()
|
|
|
|
|
}
|
|
|
|
|
VStack(alignment: .leading, spacing: 5) {
|
|
|
|
|
BetLineLoading(participations: viewModel.betDetail?.participations ?? []).padding(.vertical,15)
|
|
|
|
|
BetLineLoading(participations: viewModel.betDetail?.participations ?? [])
|
|
|
|
|
.padding(.vertical,15)
|
|
|
|
|
Text("Liste des participants")
|
|
|
|
|
.font(.system(size: 18))
|
|
|
|
|
.foregroundStyle(AllInColors.grey100Color)
|
|
|
|
@ -143,12 +150,15 @@ struct DetailsView: View {
|
|
|
|
|
.background(AllInColors.componentBackgroundColor)
|
|
|
|
|
.cornerRadius(15)
|
|
|
|
|
|
|
|
|
|
ParticipateButton(isOpen: $isModalPresented, isParticapatedOpen: $isModalParticipated,bet: viewModel.betDetail?.bet ).padding(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ParticipateButton(isOpen: $isModalPresented, isParticapatedOpen: $isModalParticipated, bet: viewModel.betDetail?.bet)
|
|
|
|
|
.padding(10)
|
|
|
|
|
}
|
|
|
|
|
.sheet(isPresented: $isModalParticipated) {
|
|
|
|
|
ParticipationModal().presentationDetents([.fraction(0.55)])
|
|
|
|
|
ParticipationModal(answer: $viewModel.answer, mise: $viewModel.mise, description: viewModel.betDetail?.bet.phrase ?? "Not loaded", participationAddedCallback: {
|
|
|
|
|
viewModel.addParticipate()
|
|
|
|
|
isModalParticipated.toggle()
|
|
|
|
|
})
|
|
|
|
|
.presentationDetents([.fraction(0.55)])
|
|
|
|
|
}
|
|
|
|
|
.edgesIgnoringSafeArea(.bottom)
|
|
|
|
|
}
|
|
|
|
|