Update button size, add time that's added
This commit is contained in:
		| @@ -9,26 +9,47 @@ import SwiftUI | ||||
|  | ||||
| struct AnkiView: View { | ||||
|     @EnvironmentObject var model: WordAXModelView | ||||
|     @State var showDescription = false | ||||
|     @State var showDescription = true | ||||
|     var word: WordAX.Word? { | ||||
|         model.getWordToDisplay() | ||||
|     } | ||||
|     var body: some View { | ||||
|         if word != nil { | ||||
|             VStack { | ||||
|                 WordView(word: word!, showDescription: $showDescription) | ||||
|                 if showDescription { | ||||
| //                    Text("How did you do?") | ||||
| //                        .font(.subheadline) | ||||
| //                        .foregroundStyle(.gray) | ||||
|             GeometryReader { geometry in | ||||
|                 VStack { | ||||
|                     WordView(word: word!, showDescription: $showDescription) | ||||
|                     if showDescription { | ||||
|                         //                    Text("How did you do?") | ||||
|                         //                        .font(.subheadline) | ||||
|                         //                        .foregroundStyle(.gray) | ||||
|                         HStack(alignment: .center) { | ||||
|                             NextRepetitionButtonView(buttonText: "Novice", nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: word!.nextSpacedRepetitionMilestone)), wordId: word!.id, showDescription: $showDescription) | ||||
|                             //                            .padding(.leading) | ||||
|                             NextRepetitionButtonView(buttonText: "Expert", nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: word!.nextSpacedRepetitionMilestone), wordId: word!.id, showDescription: $showDescription) | ||||
|                             NextRepetitionButtonView(buttonText: "Master", nextMilestone: word!.nextSpacedRepetitionMilestone, wordId: word!.id, showDescription: $showDescription) | ||||
|                             //                            .padding(.trailing) | ||||
|                             NextRepetitionButtonView( | ||||
|                                 buttonText: "Easy", | ||||
|                                 nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: word!.nextSpacedRepetitionMilestone)), | ||||
|                                 wordId: word!.id, | ||||
|                                 width: geometry.size.width, | ||||
|                                 color: .green, | ||||
|                                 geometry: geometry, | ||||
|                                 showDescription: $showDescription) | ||||
|                             NextRepetitionButtonView( | ||||
|                                 buttonText: "Normal", | ||||
|                                 nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.getNext(milestone: word!.nextSpacedRepetitionMilestone), | ||||
|                                 wordId: word!.id, | ||||
|                                 width:geometry.size.width, | ||||
|                                 color: .orange, | ||||
|                                 geometry: geometry, | ||||
|                                 showDescription: $showDescription) | ||||
|                             NextRepetitionButtonView( | ||||
|                                 buttonText: "Hard", | ||||
|                                 nextMilestone: word!.nextSpacedRepetitionMilestone, | ||||
|                                 wordId: word!.id, | ||||
|                                 width: geometry.size.width, | ||||
|                                 color: .red, | ||||
|                                 geometry: geometry, | ||||
|                                 showDescription: $showDescription) | ||||
|                         } | ||||
|                         .padding([.bottom, .trailing, .leading]) | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|   | ||||
| @@ -11,20 +11,32 @@ struct NextRepetitionButtonView: View { | ||||
|     let buttonText: String | ||||
|     let nextMilestone: WordAX.SpacedRepetitionMilestoneEnum? | ||||
|     let wordId: Int | ||||
|     let width: CGFloat | ||||
|     let color: Color | ||||
|     let geometry: GeometryProxy | ||||
|     let newText: String = "1h" | ||||
| //            { colorScheme == .light ? .cyan : .darkCyan } | ||||
|     @Binding var showDescription: Bool | ||||
|     @EnvironmentObject var model: WordAXModelView | ||||
|     @Environment(\.colorScheme) var colorScheme | ||||
|     var body: some View { | ||||
|         Button(action: { | ||||
|             model.ankiButtonClicked(wordId: wordId, milestone: nextMilestone) | ||||
|             self.showDescription = false | ||||
|         }) { | ||||
|             Text(buttonText) | ||||
|                 .padding() | ||||
|             Button(action: { | ||||
|                 model.ankiButtonClicked(wordId: wordId, milestone: nextMilestone) | ||||
|                 self.showDescription = false | ||||
|             }) { | ||||
|                 VStack { | ||||
|                     Text(buttonText) | ||||
|                     Text(">" + newText) | ||||
|                         .font(.footnote) | ||||
|                         .bold() | ||||
|                 } | ||||
|                 .padding(.vertical, geometry.size.height / 80) | ||||
|                 .foregroundColor(colorScheme == .light ? .black : .white) | ||||
|                 .background(colorScheme == .light ? .cyan : .darkCyan) | ||||
|                 .clipShape(RoundedRectangle(cornerRadius: 50)) | ||||
|         } | ||||
|                 .frame(maxWidth: width) | ||||
|             } | ||||
|             .background(color) | ||||
|             .buttonStyle(.plain) | ||||
|             .clipShape(RoundedRectangle(cornerRadius: 10)) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -35,8 +47,8 @@ extension ShapeStyle where Self == Color { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #Preview { | ||||
|     @State var showDescription = false | ||||
|     return NextRepetitionButtonView(buttonText: "Excellent", nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.OneDay, wordId: 0, showDescription: $showDescription) | ||||
|         .environmentObject(WordAXModelView()) | ||||
| } | ||||
| //#Preview { | ||||
| //    @State var showDescription = false | ||||
| //    return NextRepetitionButtonView(buttonText: "Excellent", nextMilestone: WordAX.SpacedRepetitionMilestoneEnum.OneDay, wordId: 0, showDescription: $showDescription) | ||||
| //        .environmentObject(WordAXModelView()) | ||||
| //} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user