Session log — Quiz page redesign
← All session logs
Session log — Quiz page redesign
Summary
Hasmukh sent a screenshot showing the quiz page from yesterday's build looking unstyled, with options crammed onto a single line inside bare fieldset boxes. Investigated the cause, rebuilt the look from scratch, and shipped it. Pending Hasmukh's feedback on the new design.
Decisions
- Root cause was the stylesheet not being referenced in the page HTML at all. The existing pattern in EP Courses is to inline-inject the frontend stylesheet at render time via file_get_contents, rather than rely on the css_sitewide() registry. Adopted the same inline-injection pattern for the quiz stylesheet so the page can never render un-styled.
- Took the chance to rework the visual design properly, not just patch the loading bug. The screenshot revealed the old look would have been weak even with the styles loaded.
- Kept it mobile-first since S2L's audience is on budget smartphones. Tap targets at least 48px, options stack vertically not side by side, action bar sticks to the bottom on small screens.
- Tone shifted from test-like ("Not quite, keep trying.") to encouraging ("Well done." / "Keep going, you are getting there."). The quiz is a check, not an exam.
- Hasmukh said "Ok I will revert" which I misread as "I will roll back". He clarified he meant he'll come back with feedback after using it. No code changes from that.
Changes made
- Rewrote
css/ep-courses-quiz.cssend to end. New visual elements: navy-to-coral gradient hero header at the top of the quiz, small "pill" chips showing question count and pass mark, white question cards with a coloured circular number badge ("1", "2") and a soft shadow, full-width tappable answer rows with a circular letter badge on the left and a green tick on the right that fades in when selected, blue fill plus a soft glow on the selected option, and a redesigned results card with a pass/fail badge and a large percentage figure. - Rewrote
render_quiz_page()inincludes/class-ep-quiz.phpto produce the new HTML structure. Replaced fieldset/legend with article + h2 + roleradiogroup. Each option is now a label with three spans (letter, text, tick) plus a hidden native radio. - Added a private
inject_quiz_css()helper with a per-request static guard so the stylesheet is inlined once even if both the lesson page and the quiz page render in the same request. - Updated
render_take_quiz_button()so the "Take the check" panel on the last lesson uses the new orange-gradient CTA style and pulls in the inline CSS. - Updated
render_results_block()to match the new aesthetic, including a green tick next to each correct answer in the review section, big score figure, and friendlier copy. - Deployed
class-ep-quiz.phpandep-courses-quiz.cssto the VPS, restored s2l:s2l ownership, confirmed front page and the existing site still respond 200 with no new PHP errors.
Follow-ups
- Hasmukh to refresh the live quiz page in his browser and report back what works and what does not. The new design is not visible to guests (the page short-circuits to "please log in" before reaching the quiz renderer), so he needs to be signed in as a learner on a course where the quiz is enabled.
- Possible refinements depending on his feedback: typeface, accent colour, hero gradient direction, whether the pill chips are useful or noisy, copy tone.
- Still on the V2 list from yesterday: required-to-complete gating, quiz translations, quiz button on the course landing page as well as inside the player.