Improve submit achievements UI by adding a Preview Feature#464
Improve submit achievements UI by adding a Preview Feature#464KanishkaSingh-18 wants to merge 2 commits into
Conversation
|
@KanishkaSingh-18 is attempting to deploy a commit to the 007's projects Team on Vercel. A member of the Team first needs to authorize it. |
Thanks for creating a PR for your Issue!
|
|
Hey @Eswaramuthu Thanks! |
| position: fixed; | ||
| inset: 0; | ||
| display: flex; |
There was a problem hiding this comment.
CSS
.modal { display:flex } overrides hidden attribute, making modal always visible
Author stylesheets take precedence over the browser UA stylesheet's [hidden] { display:none }. So .modal { display:flex } wins and the overlay is rendered on every page load, not just when opened.
| position: fixed; | |
| inset: 0; | |
| display: flex; | |
| .modal:not([hidden]) { | |
| position: fixed; | |
| inset: 0; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| background: rgba(0,0,0,0.4); | |
| padding: 1rem; | |
| z-index: 9999; | |
| } |
Prompt to fix with AI
Copy this prompt into your AI coding assistant to fix this issue.
In `templates/submit_achievements.html`, lines 72–81, the CSS rule `.modal { display: flex; ... }` overrides the browser's built-in `[hidden] { display: none }` rule, causing the modal overlay to appear on every page load instead of only when opened. Fix: change the selector from `.modal` to `.modal:not([hidden])` so the flex layout only applies when the hidden attribute is absent. Keep all other declarations the same.
| var studentInput = form.querySelector('input[name="student_id"]'); | ||
| var fileInput = form.querySelector('input[type="file"][name="certificate"]'); |
There was a problem hiding this comment.
Null dereference on
form.querySelector when success page renders (no form in DOM)
When {% if success %} is true the form is not rendered, so both querySelector calls return null. form.querySelector(...) on line 115 then throws TypeError: Cannot read properties of null, crashing the entire script on the success page.
| var studentInput = form.querySelector('input[name="student_id"]'); | |
| var fileInput = form.querySelector('input[type="file"][name="certificate"]'); | |
| var studentInput = form ? form.querySelector('input[name="student_id"]') : null; | |
| var fileInput = form ? form.querySelector('input[type="file"][name="certificate"]') : null; |
Prompt to fix with AI
Copy this prompt into your AI coding assistant to fix this issue.
In `templates/submit_achievements.html`, lines 115–116, `form.querySelector(...)` is called without checking whether `form` is null. When the success message is displayed, no `<form>` exists in the DOM, so `form` is null and this throws a TypeError. Fix: add a null guard — change lines 115–116 to `var studentInput = form ? form.querySelector('input[name="student_id"]') : null;` and `var fileInput = form ? form.querySelector('input[type="file"][name="certificate"]') : null;`.
Confidence Score: 2/5 - Changes NeededNot safe to merge — this PR introduces a preview modal feature in Key Findings:
Files requiring special attention
|
EntelligenceAI PR SummaryRefactored
Confidence Score: 5/5 - Safe to MergeSafe to merge — this PR makes well-scoped, incremental improvements to Key Findings:
Files requiring special attention
|
|
Hi @Eswaramuthu , I hope you're doing well. I wanted to follow up on this PR. I addressed the requested changes and updated the PR around 3 weeks ago. Could you please review it when you have time? Please let me know if any further modifications are needed from my side. Thank you for your time and effort in maintaining the project! |
Which issue does this PR close?
Rationale for this change
Users didn't have to preview the achievement the details before submitting. This can lead to mistakes or multiple submissions. Adding a preview step can help users confirm everything is correct before the final submission, improving the overall experience.
What changes are included in this PR?
Are these changes tested?
Yes, I tested locally.
Checked the preview modal with different inputs, verified it shows the correct details and confirmed the final submission works as expected.
Are there any user-facing changes?
Yes, there is a new "preview" step before submitting achievements. Users will now see a summary of their entry in a modal and can confirm or go back to edit before submitting. This makes the process clearer and reduces accidental mistakes