49 lines
1.6 KiB
Plaintext
49 lines
1.6 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"
|
|
"strconv"
|
|
)
|
|
|
|
type ResultPageVModel struct {
|
|
Player *store.Player
|
|
PlayerRank int
|
|
Entry *store.QuizEntry
|
|
Won bool
|
|
}
|
|
|
|
templ ResultPage(vmodel ResultPageVModel) {
|
|
@common.AppPage(common.WithPageOptions(
|
|
common.WithTitle("Quiz"),
|
|
)) {
|
|
<div class="columns">
|
|
<div class="column">
|
|
<div class="content has-text-centered is-size-5">
|
|
if vmodel.Won {
|
|
<h3 class="title">Bien joué !</h3>
|
|
} else {
|
|
<h3 class="title">Dommage !</h3>
|
|
}
|
|
<p>La réponse attendue à la question <br/><span class="is-italic">"{ vmodel.Entry.Question }"</span> était <span class="is-italic">"{ vmodel.Entry.Answer }"</span>.</p>
|
|
if vmodel.Won {
|
|
<p>Vous avez gagné <strong>{ strconv.FormatInt(int64((vmodel.Entry.Level+1)*2), 10) } points</strong> !</p>
|
|
}
|
|
<p class="is-size-6 is-family-secondary has-text-grey">Vous avez actuellement { strconv.FormatInt(int64((vmodel.Player.Score)), 10) } points, ce qui vous place <a href={ common.BaseURL(ctx, common.WithPath("/quiz/leaderboard"), common.WithFragment(fmt.Sprintf("player-%d", vmodel.Player.ID))) }>en <strong>position #{ strconv.FormatInt(int64(vmodel.PlayerRank), 10) } du classement</strong>.</a></p>
|
|
</div>
|
|
</div>
|
|
<div class="column">
|
|
<div class="message is-info">
|
|
<div class="message-header">
|
|
Le saviez vous ?
|
|
</div>
|
|
<div class="message-body">
|
|
{ vmodel.Entry.Anecdote }
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|