Commit | Line | Data |
---|---|---|
da06a6eb BA |
1 | // Show a problem summary on variant page |
2 | Vue.component('my-problem-summary', { | |
3 | props: ['prob'], | |
4 | template: ` | |
7931e479 BA |
5 | <div class="problem col-sm-12" @click="showProblem()"> |
6 | <div class="diagram" v-html="getDiagram(prob.fen)"></div> | |
7 | <div class="problem-instructions" v-html="prob.instructions.substr(0,32)"></div> | |
8 | <div class="problem-time">{{ timestamp2datetime(prob.added) }}</div> | |
da06a6eb BA |
9 | </div> |
10 | `, | |
7931e479 BA |
11 | methods: { |
12 | getDiagram: function(fen) { | |
13 | const fenParts = fen.split(" "); | |
14 | return getDiagram({ | |
15 | position: fenParts[0], | |
16 | // No need for flags here | |
17 | turn: fenParts[2], | |
18 | }); | |
19 | }, | |
20 | timestamp2datetime(ts) { | |
21 | // TODO | |
22 | return ts; | |
23 | }, | |
24 | showProblem: function() { | |
25 | alert("show problem"); | |
26 | //.......... | |
27 | //TODO: send event with object prob.fen, prob.instructions, prob.solution | |
28 | //Event should propagate to game, which set mode=="problem" + other variables | |
29 | //click on a problem ==> land on variant page with mode==friend, FEN prefilled... ok | |
30 | // click on problem ==> masque problems, affiche game tab, launch new game Friend with | |
31 | // FEN + turn + flags + rappel instructions / solution on click sous l'échiquier | |
32 | }, | |
33 | }, | |
da06a6eb | 34 | }) |