Skip to content

fix: remove duplicate Create New Quiz modal on dashboard - #181

Open
lb1192176991-lab wants to merge 1 commit into
TheCodeHeist-Coder:mainfrom
lb1192176991-lab:fix/dashboard-duplicate-create-modal
Open

lb1192176991-lab wants to merge 1 commit into
TheCodeHeist-Coder:mainfrom
lb1192176991-lab:fix/dashboard-duplicate-create-modal

Conversation

@lb1192176991-lab

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes the leftover duplicate "Create New Quiz" modal on the dashboard. There were two complete modals, both mounted under the same showCreate condition and both at z-50, with the second painting over the first. The first was missing the required title input and the disabled submit button, so the visible modal appeared to enforce validation the hidden one did not.

What

  • Deleted the older modal block (form without required/disabled, no description field).
  • Kept the newer modal (autoFocus, description field, disabled submit button) and added required to its title input.
  • Hardened double-submit: the Create button is now disabled={!newTitle.trim() || titleLoading}, so a second click while the request is in flight cannot create a second quiz.
  • Scanned the file for other duplicated blocks from the same redesign — none remain.
  • Added Dashboard.test.tsx covering all three acceptance criteria.

Why

Fixes #179. Two live forms bound to the same handler and the same state made it possible to create a quiz twice, and the hidden modal's missing validation undermined the visible one. Mostly deletion, plus the two attribute guards.

Testing

  • npx vitest run src/screens/Dashboard.test.tsx — 3/3 pass (one modal in DOM, empty title prevented, double-submit prevented).
  • npx tsc -b — clean.
  • npx eslint src/screens/Dashboard.tsx src/screens/Dashboard.test.tsx — new test file clean; Dashboard.tsx shows 4 no-explicit-any errors on untouched lines that pre-exist on main (lines 12/152/207).
  • Full frontend suite npx vitest run — 33 passed, 1 failed (JoinQuiz.test.tsx); verified the failure exists on clean main without these changes.

Related issue

Closes #179

Type of change

  • Bug fix
  • Tests

Which services does this touch?

  • apps/frontend

How did you test this?

Ran the commands above locally on Windows (Node 20, pnpm 10). No visual change beyond one modal instead of two; no screenshot needed.

Checklist

  • I ran pnpm run lint (ran scoped eslint on the changed files instead — see Testing)
  • I ran pnpm run check-types (equivalent tsc -b in apps/frontend)
  • I ran pnpm run build
  • The app still starts with docker-compose up
  • I updated documentation if this changes behaviour or setup
  • I did not commit any .env file, API key or other secret

First pull request here? Unticked checkboxes reflect what I could not run on this machine (Docker/full build); happy to run anything else you'd like.

@TheCodeHeist-Coder

Copy link
Copy Markdown
Owner

@lb1192176991-lab Hii! There is some merge conflicts in main. So it's better to resolve these rather than a force pushed. When these resolved, i'll merge it .

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The dashboard renders two Create New Quiz modals at once

2 participants