File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const CLOZE_TAG: &str = "CLOZE_DELETION";
2828
2929pub async fn get_handler ( State ( state) : State < ServerState > ) -> ( StatusCode , Html < String > ) {
3030 let mutable = state. mutable . lock ( ) . unwrap ( ) ;
31+ let undo_disabled = mutable. reviewed . is_empty ( ) ;
3132 let body = if mutable. finished {
3233 html ! {
3334 div. finished {
@@ -115,7 +116,11 @@ pub async fn get_handler(State(state): State<ServerState>) -> (StatusCode, Html<
115116 let card_controls = if mutable. reveal {
116117 html ! {
117118 form action="/" method="post" {
118- input id="undo" type ="submit" name="action" value="Undo" ;
119+ @if undo_disabled {
120+ input id="undo" type ="submit" name="action" value="Undo" disabled;
121+ } @else {
122+ input id="undo" type ="submit" name="action" value="Undo" ;
123+ }
119124 div. spacer { }
120125 input id="forgot" type ="submit" name="action" value="Forgot" ;
121126 input id="hard" type ="submit" name="action" value="Hard" ;
@@ -128,7 +133,11 @@ pub async fn get_handler(State(state): State<ServerState>) -> (StatusCode, Html<
128133 } else {
129134 html ! {
130135 form action="/" method="post" {
131- input id="undo" type ="submit" name="action" value="Undo" ;
136+ @if undo_disabled {
137+ input id="undo" type ="submit" name="action" value="Undo" disabled;
138+ } @else {
139+ input id="undo" type ="submit" name="action" value="Undo" ;
140+ }
132141 div. spacer { }
133142 input id="reveal" type ="submit" name="action" value="Reveal" ;
134143 div. spacer { }
You can’t perform that action at this time.
0 commit comments