44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
package component
|
|
|
|
import (
|
|
"fmt"
|
|
common "forge.cadoles.com/wpetit/kouiz/internal/http/handler/webui/common/component"
|
|
"forge.cadoles.com/wpetit/kouiz/internal/store"
|
|
)
|
|
|
|
type HistoryPageVModel struct {
|
|
History []*store.QuizTurn
|
|
}
|
|
|
|
templ HistoryPage(vmodel HistoryPageVModel) {
|
|
@common.AppPage(common.WithPageOptions(
|
|
common.WithTitle("Historique"),
|
|
)) {
|
|
<h3 class="title">Historique</h3>
|
|
for _, turn := range vmodel.History {
|
|
<details>
|
|
<summary class="has-text-weight-bold is-clickable is-size-4">Tour #{ fmt.Sprintf("%d", turn.ID) }</summary>
|
|
<div class="pl-5">
|
|
for _, entry := range turn.Entries {
|
|
<details class="mt-3">
|
|
<summary class="has-text-weight-bold is-clickable is-size-5"><span>{ entry.Question }</span><span class="is-italic has-text-grey is-size-6">( { entry.Category.Theme } / { entry.Category.Name } / { store.DifficultyLevel(entry.Level) } )</span></summary>
|
|
<div class="content">
|
|
<ol class="mt-3">
|
|
for _, proposition := range entry.Propositions {
|
|
<li class={ templ.KV("has-text-success has-text-weight-bold", proposition == entry.Answer) }>{ proposition }</li>
|
|
}
|
|
</ol>
|
|
</div>
|
|
<div class="message is-small">
|
|
<div class="message-header">Le saviez vous ?</div>
|
|
<div class="message-body">{ entry.Anecdote }</div>
|
|
</div>
|
|
</details>
|
|
}
|
|
</div>
|
|
</details>
|
|
<hr/>
|
|
}
|
|
}
|
|
}
|