1 // Show a problem summary on variant page or new problem preview
2 Vue
.component('my-problem-summary', {
3 props: ['prob','preview'],
5 <div class="row problem">
6 <div class="col-sm-12 col-md-6 diagram"
7 v-html="getDiagram(prob.fen)">
9 <div class="col-sm-12 col-md-6">
10 <p v-html="prob.instructions"></p>
11 <p v-if="preview" v-html="prob.solution"></p>
12 <p v-else class="problem-time">{{ timestamp2date(prob.added) }}</p>
13 <button v-if="!preview" @click="showProblem()">{{ translate("Solve") }}</button>
18 translate: function(text
) {
19 return translations
[text
];
21 getDiagram: function(fen
) {
22 const fenParsed
= V
.ParseFen(fen
);
24 position: fenParsed
.position
,
26 // No need for flags here
30 return getDate(new Date(ts
));
32 // Propagate "show problem" event to parent component (my-problems)
33 showProblem: function() {
34 this.$emit('show-problem');