diff options
author | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-05 16:52:02 +0300 |
---|---|---|
committer | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-05 16:52:02 +0300 |
commit | b5f3dd055ecc25120df65f6655808d8a8897f1a3 (patch) | |
tree | 797efcf2bd68d93272f287ee77ad04bba11b1a64 /components/feedback.html | |
parent | 3374cb0fb2ce024eb5da78dc63c7313db8ec4c95 (diff) |
feat: extract feedback into template partial and add Correct field
Diffstat (limited to 'components/feedback.html')
-rw-r--r-- | components/feedback.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/components/feedback.html b/components/feedback.html new file mode 100644 index 0000000..0eda969 --- /dev/null +++ b/components/feedback.html @@ -0,0 +1,33 @@ +{{define "feedback"}} +{{if .Correct}} +<div class="correct-feedback"> + <div class="correct-answer">Correct!</div> + <div class="explanation">{{.Explanation}}</div> + {{if .ShowNext}} + <button + hx-get="/next-question?current_id={{.ID}}" + hx-target="#ancestor" + hx-swap="outerHTML" + class="next-button" + data-testid="next-button"> + Next Question → + </button> + {{end}} +</div> +{{else}} +<div class="error-feedback"> + <div class="wrong-answer">Try Again</div> + <div class="explanation">{{.Explanation}}</div> + {{if .ShowNext}} + <button + hx-get="/next-question?current_id={{.ID}}" + hx-target="#ancestor" + hx-swap="outerHTML" + class="next-button" + data-testid="next-button"> + Next Question → + </button> + {{end}} +</div> +{{end}} +{{end}} |