start of binding DetailsView

pull/16/head
Emre KARTAL 1 year ago
parent 6eb3b2e8cd
commit b4992ba793

@ -37,14 +37,14 @@ struct ReviewCard: View {
HStack(){ HStack(){
Spacer() Spacer()
Text(amountBetted.description) Text(amountBetted.description)
.foregroundColor(AllInColors.whiteColor) .foregroundColor(.white)
.font(.system(size: 25)) .font(.system(size: 25))
.fontWeight(.bold) .fontWeight(.bold)
Image("allcoinWhiteIcon") Image("allcoinWhiteIcon")
.resizable() .resizable()
.frame(width: 20, height: 20, alignment: .bottom) .frame(width: 20, height: 20, alignment: .bottom)
Text(isAWin ? "Gagnés!" : "Perdus!") Text(isAWin ? "Gagnés!" : "Perdus!")
.foregroundColor(AllInColors.whiteColor) .foregroundColor(.white)
.font(.system(size: 25)) .font(.system(size: 25))
.fontWeight(.bold) .fontWeight(.bold)
Spacer() Spacer()

@ -15,7 +15,7 @@ class DetailsViewModel: ObservableObject {
@Inject var manager: Manager @Inject var manager: Manager
var id: String var id: String
@Published var bet: BetDetail? @Published var betDetail: BetDetail?
init(id: String) { init(id: String) {
self.id = id self.id = id
@ -24,7 +24,7 @@ class DetailsViewModel: ObservableObject {
func getItem(withId id: String) { func getItem(withId id: String) {
manager.getBet(withId: id) { bet in manager.getBet(withId: id) { bet in
self.bet = bet self.betDetail = bet
} }
} }
} }

@ -18,7 +18,7 @@ struct DetailsView: View {
VStack(alignment: .trailing) { VStack(alignment: .trailing) {
HStack{ HStack{
Spacer() Spacer()
Image("CloseiconRounded") Image("closeIcon")
.resizable() .resizable()
.padding(8) .padding(8)
.frame(maxWidth: 40, maxHeight: 40) .frame(maxWidth: 40, maxHeight: 40)
@ -35,32 +35,43 @@ struct DetailsView: View {
VStack(alignment: .leading,spacing: 5){ VStack(alignment: .leading,spacing: 5){
HStack{ HStack{
Spacer() Spacer()
Text("proposé par Lucas").font(.system(size: 10)).foregroundColor(AllInColors.grey800Color) Text("proposé par " + (viewModel.betDetail?.bet.author.username ?? "Unknown").capitalized)
.font(.system(size: 10))
.foregroundColor(AllInColors.grey800Color)
} }
Text("Etudes").font(.system(size: 15)).foregroundColor(AllInColors.grey800Color) Text(viewModel.betDetail?.bet.theme ?? "Not loaded")
Text("Emre va réussir son TP de CI/CD mercredi?").font(.system(size: 20)).fontWeight(.bold).padding(.bottom, 10) .font(.system(size: 15))
.foregroundColor(AllInColors.grey800Color)
Text(viewModel.betDetail?.bet.phrase ?? "Not loaded")
.font(.system(size: 20))
.fontWeight(.bold)
.padding(.bottom, 10)
HStack{ HStack{
Text("Commence le").frame(maxWidth: 100).font(.system(size: 15)).foregroundColor(AllInColors.grey800Color) Text("Commence le")
TextCapsule(date: Date()) .frame(maxWidth: 100)
.font(.system(size: 15))
.foregroundColor(AllInColors.grey800Color)
TextCapsule(date: viewModel.betDetail?.bet.endRegisterDate ?? Date())
Spacer() Spacer()
}.padding(.bottom, 10) }.padding(.bottom, 10)
HStack{ HStack{
Text("Fini le").frame(maxWidth: 100).font(.system(size: 15)).foregroundColor(AllInColors.grey800Color) Text("Fini le")
TextCapsule(date: Date()) .frame(maxWidth: 100)
.font(.system(size: 15))
.foregroundColor(AllInColors.grey800Color)
TextCapsule(date: viewModel.betDetail?.bet.endBetDate ?? Date())
Spacer() Spacer()
} }
} }
.frame(width: .infinity) .frame(width: .infinity)
.padding(.all,15).padding(.vertical, 10) .padding(.all,15).padding(.vertical, 10)
.background(AllInColors.componentBackgroundColor).cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0) .background(AllInColors.componentBackgroundColor)
.cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0)
ResultBanner() ResultBanner()
VStack(alignment: .leading, spacing: 2){ VStack(alignment: .leading, spacing: 2){
} }
.frame(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, maxHeight: .infinity) .frame(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, maxHeight: .infinity)
.padding([.bottom,.trailing,.leading],8) .padding([.bottom,.trailing,.leading],8)
@ -71,18 +82,14 @@ struct DetailsView: View {
} }
.frame(maxWidth: .infinity, maxHeight: geometry.size.height*0.98) .frame(maxWidth: .infinity, maxHeight: geometry.size.height*0.98)
.background(Color.white) .background(AllInColors.componentBackgroundColor)
.cornerRadius(15) .cornerRadius(15)
ParticipateButton().padding(10) ParticipateButton().padding(10)
} }
.transition(.slideInFromBottom(yOffset: 800)) .transition(.slideInFromBottom(yOffset: 800))
.background(Color.white)
.edgesIgnoringSafeArea(.bottom) .edgesIgnoringSafeArea(.bottom)
} }
} }
} }
struct DetailsView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

Loading…
Cancel
Save