On the road to problems to complete website :)
authorBenjamin Auder <benjamin.auder@somewhere>
Fri, 14 Dec 2018 23:20:15 +0000 (00:20 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Fri, 14 Dec 2018 23:20:15 +0000 (00:20 +0100)
public/javascripts/components/problems.js [new file with mode: 0644]
public/javascripts/variant.js [new file with mode: 0644]
views/index.pug
views/variant.pug

diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js
new file mode 100644 (file)
index 0000000..54b36ab
--- /dev/null
@@ -0,0 +1,14 @@
+//TODO: list problems as FEN (quickly rendered), by date, with possible filtering per variant(?)
+//click on a problem ==> land on variant page with mode==friend, FEN prefilled... ok
+
+// get 10 first problems, and buttons next<>previous send date + "before" or "after"
+// need database: sqlite !
+
+// form "new problem" fen(position/turn/flags[guess]), instructions, solution (mandatory)
+// ==> upload on server in sandbox
+//
+// Atomic rules, atomic game, atomic problems(list drawn position
+//   + summary(first chars of instructions) + timedate)... one big Vue ? with components
+//
+// click on problem ==> masque problems, affiche game tab, launch new game Friend with
+//   FEN + turn + flags + rappel instructions / solution on click sous l'échiquier
diff --git a/public/javascripts/variant.js b/public/javascripts/variant.js
new file mode 100644 (file)
index 0000000..f9d23d8
--- /dev/null
@@ -0,0 +1,7 @@
+new Vue({
+       el: "#variantPage",
+       data: { display: "" }, //do not show anything...
+       // TODO: listen event "show problem", avec le probleme stringifié en arg
+       // Alors: display=game, mode=friend, newGame(fen, turn, ...),
+       //   et set Instructions+Soluce
+});
index 188ec9c..521c125 100644 (file)
@@ -16,16 +16,7 @@ block content
                                div(role="dialog")
                                        #help.card
                                                label.modal-close(for="modal-help")
-                                               h3.blue.section Tips
-                                               p.section
-                                                       span.conditional-jump
-                                                               | On a variant page, read the rules by clicking on the title
-                                                               | "&lt;Variant&gt; rules". 
-                                                       span.conditional-jump
-                                                               | Try playing against a human: click the leftmost "new game" button. 
-                                                       | ...Then, while waiting you can play against a (rather weak) bot
-                                                       | or a friend.
-                                               // TODO? On the index page, try typing the first letters of a variant.
+                                               p.section First: watch #[a(href="/demo.webm") demo video] :)
                                                h3.blue.section Comments
                                                p.section.
                                                        All games start with a random assymetric position. #[br]
index a44a374..e744962 100644 (file)
@@ -8,11 +8,17 @@ block content
        .container#variantPage
                .row
                        .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
-                               h4.rulesTitle.text-center(v-on:click="displayRules=!displayRules")
+                               h4.rulesTitle.text-center(v-on:click="display='rules'")
                                        | #{variant} Rules
-                               my-rules(v-show="displayRules")
+                               my-rules(v-show="display=='rules'")
                        .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
-                               my-game
+                               h4.rulesTitle.text-center(v-on:click="display='game'")
+                                       | #{variant} Game
+                               my-game(v-show="display=='game'")
+                       .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
+                               h4.rulesTitle.text-center(v-on:click="display='problems'")
+                                       | #{variant} Problems
+                               my-game(v-show="display=='problems'")
 
 block javascripts
        script(src="/javascripts/utils/misc.js")
@@ -27,8 +33,4 @@ block javascripts
                const variant = "#{variant}";
        script(src="/javascripts/components/rules.js")
        script(src="/javascripts/components/game.js")
-       script.
-               new Vue({
-                       el: "#variantPage",
-                       data: { displayRules: false },
-               });
+       script(src="/javascripts/components/problems.js")