Store state of games VS computer
[vchess.git] / client / src / views / Problems.vue
index a9f9fcb..3a700ea 100644 (file)
@@ -1,8 +1,14 @@
 <template lang="pug">
 main
-  input#modalNewprob.modal(type="checkbox" @change="infoMsg=''")
-  div#newprobDiv(role="dialog" data-checkbox="modalNewprob")
-    .card(@keyup.enter="sendProblem()")
+  input#modalNewprob.modal(
+    type="checkbox"
+    @change="infoMsg=''"
+  )
+  div#newprobDiv(
+    role="dialog"
+    data-checkbox="modalNewprob"
+  )
+    .card
       label#closeNewprob.modal-close(for="modalNewprob")
       fieldset
         label(for="selectVariant") {{ st.tr["Variant"] }}
@@ -39,7 +45,7 @@ main
       button(@click="sendProblem()") {{ st.tr["Send"] }}
       #dialog.text-center {{ st.tr[infoMsg] }}
   .row(v-if="showOne")
-    .col-sm-12.col-md-10.col-md-offset-2
+    .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
       #topPage
         span.vname {{ curproblem.vname }}
         span.uname ({{ curproblem.uname }})
@@ -54,7 +60,7 @@ main
           @click="deleteProblem(curproblem)"
         )
           | {{ st.tr["Delete"] }}
-      p.clickable(
+      p.oneInstructions.clickable(
         v-html="parseHtml(curproblem.instruction)"
         @click="curproblem.showSolution=!curproblem.showSolution"
       )
@@ -93,7 +99,11 @@ main
           td {{ p.vname }}
           td {{ firstChars(p.instruction) }}
           td {{ p.id }}
-  BaseGame(v-if="showOne" :game="game" :vr="vr")
+  BaseGame(
+    v-if="showOne"
+    :game="game"
+    :vr="vr"
+  )
 </template>
 
 <script>
@@ -263,7 +273,7 @@ export default {
     },
     displayProblem: function(p) {
       return (
-        (this.selectedVar == 0 || p.vid == this.selectedVar) &&
+        (!this.selectedVar || p.vid == this.selectedVar) &&
         ((this.onlyMines && p.uid == this.st.user.id) ||
           (!this.onlyMines && p.uid != this.st.user.id))
       );
@@ -283,7 +293,7 @@ export default {
     sendProblem: function() {
       const error = checkProblem(this.curproblem);
       if (error) {
-        alert(error);
+        alert(this.st.tr[error]);
         return;
       }
       const edit = this.curproblem.id > 0;
@@ -310,7 +320,7 @@ export default {
       );
     },
     editProblem: function(prob) {
-      if (!prob.diag) this.setDiagram(prob); //possible because V is loaded at this stage
+      if (!prob.diag) this.setDiagram(prob); //V is loaded at this stage
       this.copyProblem(prob, this.curproblem);
       window.doClick("modalNewprob");
     },
@@ -330,13 +340,17 @@ export default {
 [type="checkbox"].modal+div .card
   max-width: 767px
   max-height: 100%
+
 #inputFen
   width: 100%
+
 textarea
   width: 100%
+
 #diagram
   margin: 0 auto
   max-width: 400px
+
 #controls
   margin: 0
   width: 100%
@@ -344,6 +358,11 @@ textarea
   & > *
     margin: 0
 
+p.oneInstructions
+  margin: 0
+  padding: 2px 5px
+  background-color: lightgreen
+
 #topPage
   span.vname
     font-weight: bold