Skip to content

Leoncie's branch#17

Merged
Yvette-Manishimwe merged 9 commits into
mainfrom
Leoncie's-Branch
May 13, 2026
Merged

Leoncie's branch#17
Yvette-Manishimwe merged 9 commits into
mainfrom
Leoncie's-Branch

Conversation

@Umutoni23
Copy link
Copy Markdown
Collaborator

@Umutoni23 Umutoni23 commented May 13, 2026

Summary by CodeRabbit

  • New Features
    • Introduced Question Bank admin interface for managing questions
    • Full CRUD operations: create new questions, edit existing ones, view details, and remove questions
    • Filter questions by status and difficulty level
    • Search functionality to locate specific questions
    • Paginated list display for efficient browsing of large question datasets

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

This PR adds a Question Bank admin feature with in-memory CRUD operations. It updates the admin sidebar with a new QuestionMarkIcon, creates a new admin route, and implements a full-featured question management page with modals for create/edit, details view, and deletion, plus search, filtering, and pagination.

Changes

Question Bank Management

Layer / File(s) Summary
Admin Navigation: Icon and Route
app/admin/page.tsx, app/admin/questions/page.tsx
Adds QuestionMarkIcon component and updates the "Manage Questions" card to use it; creates a new admin page that routes to QuestionBankPage.
Question Bank Types and Data
app/pages/QuestionBankPage.tsx (types, data, helpers, subcomponents)
Defines Difficulty, Language, Question, and QuestionFormValues types; provides hardcoded initial questions; includes formatting helpers and foundational UI subcomponents (sticky header, difficulty badges, status filter dropdown, question cards, select inputs).
CRUD Modal Components
app/pages/QuestionBankPage.tsx (create/edit, delete, details modals)
Create/edit modal with controlled form state, per-field updates, and difficulty validation; delete confirmation modal; details modal displaying metadata, description, and starter code.
List Rendering and Form Helpers
app/pages/QuestionBankPage.tsx (helpers and list)
toFormValues helper to map question data to form values; QuestionList component rendering paginated question cards or empty state.
Main Page State and Orchestration
app/pages/QuestionBankPage.tsx (QuestionBankPage)
State management for questions, modal lifecycle control (create, edit, details, delete), search/filter/pagination computation, and local state updates on save and deletion.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Header as UI: Header & Filters
    participant CardList as UI: Question List
    participant Modals as Modals<br/>(Create/Edit/Details/Delete)
    participant State as Page State

    User->>Header: Set search or filter
    Header->>State: Update search/filter
    State->>State: Compute filtered questions & pagination
    State->>CardList: Render filtered paginated cards
    
    User->>CardList: Click action (create/view/edit/delete)
    CardList->>State: Trigger modal open
    State->>Modals: Open target modal

    alt Create or Edit
        Modals->>Modals: Collect form input & validate
        User->>Modals: Submit
        Modals->>State: Save question
        State->>State: Update local questions, close modals
    else View Details
        User->>Modals: Close
        Modals->>State: Close details modal
    else Delete
        User->>Modals: Confirm delete
        Modals->>State: Remove question
        State->>State: Update questions, close related modals
    end
    
    State->>CardList: Re-render list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Yvette-Manishimwe

Poem

🐰 A question bank hops into place,
With modals dancing, filtering with grace,
From admin links to cards so neat,
Search and paginate—the feature's complete!
CRUD operations in memory reside,
With delete, edit, and details as your guide.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Leoncie's branch' is a personal branch name, not a meaningful description of the changes made (adding question bank UI components and admin page). Rename the title to describe the main change, such as 'Add question bank management page with CRUD operations' or 'Implement admin questions page with question bank UI'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Leoncie's-Branch

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/pages/QuestionBankPage.tsx`:
- Around line 1112-1136: The modal container div that renders the dialog (the
outermost fixed inset-0 div) is missing proper ARIA semantics; add role="dialog"
and aria-modal="true" to that div and set aria-labelledby to the heading by
giving the h2 that renders {title} a stable id (e.g., modal-title-<unique> or
modal-title-question-bank) so screen readers can associate the title with the
dialog; apply the same pattern to the other modal containers in this file (the
modal at the other occurrences referenced by the title variable and onClose
handler) to ensure each modal has role="dialog", aria-modal="true", and an
aria-labelledby that points to its heading id.
- Line 1253: In QuestionBankPage, replace the unclear delete confirmation text
("If you want to delete this question click on Ok if not Cancel.") with a
concise, user-friendly message; locate the confirmation string in the
delete-confirmation/modal code within QuestionBankPage and update it to
something like: "Are you sure you want to delete this question? Click OK to
delete or Cancel to keep it." Ensure the updated string is used wherever the
delete confirmation is rendered.
- Line 1302: Update the Tailwind important modifier syntax used in the className
string (currently using "!border-red-600 !bg-red-600 !text-white
hover:!bg-red-700") to the Tailwind v4 suffix form by moving each leading "!" to
the end of the utility (e.g., "border-red-600!" and "bg-red-600!"), and do the
same for the hover state (e.g., "hover:bg-red-700!"); adjust the className value
where it is set in the QuestionBankPage JSX element to use these suffix-form
utilities.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c7d71cf5-8ebf-4272-b322-26c3b3ee59c9

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef8923 and 5120bdf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • app/admin/page.tsx
  • app/admin/questions/page.tsx
  • app/pages/QuestionBankPage.tsx

Comment on lines +1112 to +1136
<div className="fixed inset-0 z-50 flex items-center justify-center bg-zinc-950/45 px-4 py-8">
<div className="w-full max-w-xl rounded-3xl bg-white shadow-2xl">
<div className="flex items-start justify-between border-b border-zinc-200 px-5 py-3.5">
<div>
<h2 className="text-lg font-semibold text-zinc-900">{title}</h2>
<p className="mt-0.5 text-sm text-zinc-500">
Fill in the required question fields and save your update.
</p>
</div>
<button
type="button"
aria-label="Close modal"
onClick={onClose}
className="inline-flex h-10 w-10 items-center justify-center rounded-full text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900"
>
<svg
viewBox="0 0 24 24"
className="h-5 w-5"
fill="none"
stroke="currentColor"
strokeWidth="2"
aria-hidden="true"
>
<path
d="M18 6L6 18"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add proper dialog semantics to all modal containers.

These modals are missing role="dialog" + aria-modal="true" and accessible title association, which weakens screen-reader navigation and context.

Suggested fix pattern
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-zinc-950/45 px-4 py-8">
-   <div className="w-full max-w-xl rounded-3xl bg-white shadow-2xl">
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-zinc-950/45 px-4 py-8">
+   <div
+     role="dialog"
+     aria-modal="true"
+     aria-labelledby="question-modal-title"
+     className="w-full max-w-xl rounded-3xl bg-white shadow-2xl"
+   >
...
-     <h2 className="text-lg font-semibold text-zinc-900">{title}</h2>
+     <h2 id="question-modal-title" className="text-lg font-semibold text-zinc-900">{title}</h2>

Also applies to: 1245-1260, 1318-1333

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/QuestionBankPage.tsx` around lines 1112 - 1136, The modal container
div that renders the dialog (the outermost fixed inset-0 div) is missing proper
ARIA semantics; add role="dialog" and aria-modal="true" to that div and set
aria-labelledby to the heading by giving the h2 that renders {title} a stable id
(e.g., modal-title-<unique> or modal-title-question-bank) so screen readers can
associate the title with the dialog; apply the same pattern to the other modal
containers in this file (the modal at the other occurrences referenced by the
title variable and onClose handler) to ensure each modal has role="dialog",
aria-modal="true", and an aria-labelledby that points to its heading id.

Delete Question
</h2>
<p className="mt-1 text-sm text-zinc-500">
If you want to delete this question click on Ok if not Cancel.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify delete confirmation copy.

Current sentence is hard to read; simplify for clear user intent.

Suggested copy update
- If you want to delete this question click on Ok if not Cancel.
+ Click OK to delete this question, or Cancel to keep it.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
If you want to delete this question click on Ok if not Cancel.
Click OK to delete this question, or Cancel to keep it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/QuestionBankPage.tsx` at line 1253, In QuestionBankPage, replace
the unclear delete confirmation text ("If you want to delete this question click
on Ok if not Cancel.") with a concise, user-friendly message; locate the
confirmation string in the delete-confirmation/modal code within
QuestionBankPage and update it to something like: "Are you sure you want to
delete this question? Click OK to delete or Cancel to keep it." Ensure the
updated string is used wherever the delete confirmation is rendered.

<Button
tone="zinc"
onClick={onConfirm}
className="!border-red-600 !bg-red-600 !text-white hover:!bg-red-700"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify old Tailwind important-modifier usage in TS/TSX files
rg -nP --type=ts --type=tsx '(^|[[:space:]"'\''])![a-z0-9-]+|:[[:space:]]*!([a-z0-9-]+)' -C2

Repository: SheCanCODE-Capstone-Projects/Assessment_Platfrom_fe

Length of output: 123


🏁 Script executed:

cd /tmp && find /tmp -name "package*.json" -type f 2>/dev/null | head -5

Repository: SheCanCODE-Capstone-Projects/Assessment_Platfrom_fe

Length of output: 77


🏁 Script executed:

cat package.json | grep -i tailwind

Repository: SheCanCODE-Capstone-Projects/Assessment_Platfrom_fe

Length of output: 154


🏁 Script executed:

cat package-lock.json 2>/dev/null | grep -A2 '"tailwindcss"' | head -10

Repository: SheCanCODE-Capstone-Projects/Assessment_Platfrom_fe

Length of output: 250


🌐 Web query:

Tailwind CSS v4 important modifier syntax breaking change documentation

💡 Result:

In Tailwind CSS v4, the important modifier syntax for individual utility classes has changed from prefix !utility (e.g., !bg-red-500) in v3 to postfix utility! (e.g., bg-red-500!).[1][2][3][4] This positions the ! consistently at the end of the class name, even with variants (e.g., hover:bg-red-500! instead of hover:!bg-red-500).[2][1] The old prefix syntax remains supported for backward compatibility but is deprecated and should be updated using the @tailwindcss/upgrade tool, which is idempotent for v4 projects.[1][4][2] Official documentation explicitly covers this in the upgrade guide: "In v3 you could mark a utility as important by placing an ! at the beginning of the utility name (but after any variants). In v4 you should place the ! at the very end of the class name instead: <div class="flex! bg-red-500! hover:bg-red-600/50!"> The old way is still supported for compatibility but is deprecated."[1] Additionally, the global important configuration has breaking changes: v3's important: true or important: '#app' in tailwind.config.js is backward-compatible but deprecated; v4 prefers @import "tailwindcss" important; or wrapping utilities in a selector.[5][6][7] A related breaking change is that the global important flag now applies !important to @apply directives, unlike v3.[8][9] Primary sources: Tailwind CSS official upgrade guide[1] and GitHub discussions/PRs from Tailwind team members.[3][2][4]

Citations:


🏁 Script executed:

#!/bin/bash
# Search for Tailwind version and important modifier syntax
# Fixed: use -g for glob patterns instead of --type=tsx
rg -nP '![a-z0-9\-]+' --glob='*.ts' --glob='*.tsx' -C2 | head -50

Repository: SheCanCODE-Capstone-Projects/Assessment_Platfrom_fe

Length of output: 3441


Tailwind v4 important modifier syntax is outdated here.

Line 1302 uses the pre-v4 prefix syntax (!border-red-600, hover:!bg-red-700). Tailwind v4 changed to suffix form (border-red-600!, hover:bg-red-700!). The old syntax is deprecated but still works due to backward compatibility—update to the modern syntax.

Suggested fix
- className="!border-red-600 !bg-red-600 !text-white hover:!bg-red-700"
+ className="border-red-600! bg-red-600! text-white! hover:bg-red-700!"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className="!border-red-600 !bg-red-600 !text-white hover:!bg-red-700"
className="border-red-600! bg-red-600! text-white! hover:bg-red-700!"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/pages/QuestionBankPage.tsx` at line 1302, Update the Tailwind important
modifier syntax used in the className string (currently using "!border-red-600
!bg-red-600 !text-white hover:!bg-red-700") to the Tailwind v4 suffix form by
moving each leading "!" to the end of the utility (e.g., "border-red-600!" and
"bg-red-600!"), and do the same for the hover state (e.g., "hover:bg-red-700!");
adjust the className value where it is set in the QuestionBankPage JSX element
to use these suffix-form utilities.

@Yvette-Manishimwe Yvette-Manishimwe merged commit 7bde3ca into main May 13, 2026
1 check passed
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.

2 participants