X-Git-Url: https://git.auder.net/rpsls.js?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2FproblemSummary.js;h=08109effeafb7a8941d393116c0c88a837d7925a;hb=fd08ab2c5b8931bb8c95cf7e9f2f95122647f991;hp=6003f08516db83417f9883cf620d207236b1e40a;hpb=da06a6eb0237123ce43fdb01cb06246b8b57f5e5;p=vchess.git diff --git a/public/javascripts/components/problemSummary.js b/public/javascripts/components/problemSummary.js index 6003f085..08109eff 100644 --- a/public/javascripts/components/problemSummary.js +++ b/public/javascripts/components/problemSummary.js @@ -1,17 +1,33 @@ -// Show a problem summary on variant page -Vue.component('my-problem-summary', { - props: ['prob'], +// Preview a problem on variant page +Vue.component('my-problem-preview', { + props: ['prob','userid'], template: ` -
-
- {{ getDiagram(prob.fen) }} +
+
-
- {{ prob.instructions.substr(0,32) }} -
-
- {{ prob.added }} +
+

+

+

{{ timestamp2date(prob.added) }}

+
+ + +
`, + methods: { + getDiagram: function(fen) { + const fenParsed = V.ParseFen(fen); + return getDiagram({ + position: fenParsed.position, + turn: fenParsed.turn, + // No need for flags here + }); + }, + timestamp2date(ts) { + return getDate(new Date(ts)); + }, + }, })