X-Git-Url: https://git.auder.net/assets/icon_infos.svg?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2FproblemSummary.js;h=c0b409debc9bc8e1e2d8cb2ffd0b7d928ecdda5a;hb=c794dbb87592782913af0a09784ed25e019e4d10;hp=6003f08516db83417f9883cf620d207236b1e40a;hpb=da06a6eb0237123ce43fdb01cb06246b8b57f5e5;p=vchess.git diff --git a/public/javascripts/components/problemSummary.js b/public/javascripts/components/problemSummary.js index 6003f085..c0b409de 100644 --- a/public/javascripts/components/problemSummary.js +++ b/public/javascripts/components/problemSummary.js @@ -2,16 +2,27 @@ Vue.component('my-problem-summary', { props: ['prob'], template: ` -
-
- {{ getDiagram(prob.fen) }} -
-
- {{ prob.instructions.substr(0,32) }} -
-
- {{ prob.added }} -
+
+
+
+
{{ timestamp2date(prob.added) }}
`, + methods: { + getDiagram: function(fen) { + const fenParts = fen.split(" "); + return getDiagram({ + position: fenParts[0], + // No need for flags here + turn: fenParts[2], + }); + }, + timestamp2date(ts) { + return getDate(new Date(ts)); + }, + // Propagate "show problem" event to parent component (my-problems) + showProblem: function() { + this.$emit('show-problem'); + }, + }, })