X-Git-Url: https://git.auder.net/rpsls.js?a=blobdiff_plain;ds=inline;f=public%2Fjavascripts%2Fcomponents%2FproblemSummary.js;h=6b006cbbe241b8abd11833a20db72463e676647b;hb=a5d5668613d9a3d04c9a4f8b69122d02b7322137;hp=48a42533b6b59800a05af6bfed309e0a2593ef79;hpb=7931e479adf93c87771ded1892a0873af72ae46d;p=vchess.git
diff --git a/public/javascripts/components/problemSummary.js b/public/javascripts/components/problemSummary.js
index 48a42533..6b006cbb 100644
--- a/public/javascripts/components/problemSummary.js
+++ b/public/javascripts/components/problemSummary.js
@@ -1,34 +1,33 @@
-// Show a problem summary on variant page
+// Show a problem summary on variant page or new problem preview
Vue.component('my-problem-summary', {
- props: ['prob'],
+ props: ['prob','preview'],
template: `
-
-
-
-
{{ timestamp2datetime(prob.added) }}
+
+
+
+
+
+
+
{{ timestamp2date(prob.added) }}
+
`,
methods: {
getDiagram: function(fen) {
- const fenParts = fen.split(" ");
+ const fenParsed = V.ParseFen(fen);
return getDiagram({
- position: fenParts[0],
+ position: fenParsed.position,
+ turn: fenParsed.turn,
// No need for flags here
- turn: fenParts[2],
});
},
- timestamp2datetime(ts) {
- // TODO
- return ts;
+ timestamp2date(ts) {
+ return getDate(new Date(ts));
},
+ // Propagate "show problem" event to parent component (my-problems)
showProblem: function() {
- alert("show problem");
- //..........
- //TODO: send event with object prob.fen, prob.instructions, prob.solution
- //Event should propagate to game, which set mode=="problem" + other variables
- //click on a problem ==> land on variant page with mode==friend, FEN prefilled... ok
- // click on problem ==> masque problems, affiche game tab, launch new game Friend with
- // FEN + turn + flags + rappel instructions / solution on click sous l'échiquier
+ this.$emit('show-problem');
},
},
})