X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2FproblemSummary.js;h=48a42533b6b59800a05af6bfed309e0a2593ef79;hp=6003f08516db83417f9883cf620d207236b1e40a;hb=7931e479adf93c87771ded1892a0873af72ae46d;hpb=da06a6eb0237123ce43fdb01cb06246b8b57f5e5 diff --git a/public/javascripts/components/problemSummary.js b/public/javascripts/components/problemSummary.js index 6003f085..48a42533 100644 --- a/public/javascripts/components/problemSummary.js +++ b/public/javascripts/components/problemSummary.js @@ -2,16 +2,33 @@ Vue.component('my-problem-summary', { props: ['prob'], template: ` -
-
- {{ getDiagram(prob.fen) }} -
-
- {{ prob.instructions.substr(0,32) }} -
-
- {{ prob.added }} -
+
+
+
+
{{ timestamp2datetime(prob.added) }}
`, + methods: { + getDiagram: function(fen) { + const fenParts = fen.split(" "); + return getDiagram({ + position: fenParts[0], + // No need for flags here + turn: fenParts[2], + }); + }, + timestamp2datetime(ts) { + // TODO + return ts; + }, + 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 + }, + }, })