Skip to content

feat: implement qr generation for classroom invite link#602

Merged
knoxiboy merged 1 commit into
knoxiboy:mainfrom
mayannkkk19:feat/implement-classroom-qr-generation
Jun 13, 2026
Merged

feat: implement qr generation for classroom invite link#602
knoxiboy merged 1 commit into
knoxiboy:mainfrom
mayannkkk19:feat/implement-classroom-qr-generation

Conversation

@mayannkkk19

@mayannkkk19 mayannkkk19 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

User description

Description

Adds QR code generation for classroom invitation links.
When a teacher generates a secure invite link, a corresponding QR code is displayed in a dedicated QR section.
The QR code can be downloaded as a PNG image

Related Issue

Closes #184

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update (README, guides, comments)
  • Style / UI change (no logic change)
  • Code refactor (no behavior change)
  • Test addition or update
  • Breaking change (fix or feature that would cause existing functionality to change)

Screenshots (if UI change)

image

How Has This Been Tested?

  • Tested locally with npm run dev
  • Verified on mobile viewport (375px)
  • Verified on desktop viewport (1440px)

Checklist

  • I have tested my changes locally (npm run dev)
  • My code follows the existing code style (TypeScript, Tailwind, no any types)
  • I have not introduced unrelated changes (each PR should address one issue)
  • I have added comments where necessary
  • My branch is up to date with main
  • I have linked the related issue above
  • Screenshots are included (if this is a UI change)

Summary by CodeRabbit

  • New Features
    • Classroom invite links now display QR codes for simplified sharing, making it easier to join sessions from mobile devices or other cameras.
    • Added ability to download invite QR codes as PNG image files for offline distribution, printing, or embedding in other communications.

CodeAnt-AI Description

Add QR-based sharing for classroom invites

What Changed

  • Classroom invite links now show a QR code that students can scan to join directly
  • Teachers can download the QR code as a PNG for printing or sharing offline
  • The invite panel now highlights the secure link, shows when it expires, and keeps the existing class code as a fallback

Impact

✅ Faster classroom joining
✅ Easier in-person invite sharing
✅ Fewer copy-and-paste invite mistakes

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

@mayannkkk19 is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c770eedc-5d87-46ad-a24b-d9bc66232175

📥 Commits

Reviewing files that changed from the base of the PR and between 1a52e15 and f61ef39.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/app/rooms/[id]/page.tsx
💤 Files with no reviewable changes (1)
  • src/app/rooms/[id]/page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

Walkthrough

This PR adds QR code generation and download capabilities to classroom invite links. Two new dependencies (html-to-image and qrcode.react) are added. The classroom settings modal now shows the invite URL with a QR code and a "Download QR" button that saves the QR as classroom-invite-qr.png.

Changes

QR Code Classroom Invite

Layer / File(s) Summary
QR Code dependencies and download helper
package.json, src/app/rooms/[id]/page.tsx
Adds html-to-image and qrcode.react to dependencies; imports QRCodeCanvas; implements downloadQr that converts the QR canvas (invite-qr) to a PNG data URL and downloads it as classroom-invite-qr.png.
Invite link UI with QR display
src/app/rooms/[id]/page.tsx
Replaces the invite-link area in the classroom settings modal with a two-column "Secure Invite Link" panel: left shows invite URL and copy control; right renders QRCodeCanvas for the invite URL and adds a "Download QR" button wired to downloadQr.

Sequence Diagram

sequenceDiagram
  participant Teacher as Teacher (UI)
  participant QRCanvas as QR Canvas Element
  participant HtmlToImage as html-to-image
  participant Browser as Browser Download

  Teacher->>QRCanvas: Click "Download QR" (triggers downloadQr)
  QRCanvas->>HtmlToImage: provide canvas element
  HtmlToImage->>Browser: return PNG data URL
  Browser->>Browser: start download classroom-invite-qr.png
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

frontend, quality:clean, type:design, mentor:knoxiboy

Suggested reviewers

  • knoxiboy
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
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.
Linked Issues check ❓ Inconclusive The PR implements QR code generation and download, but acceptance criteria cannot be fully verified: the /join/[code] route implementation and 'Copy Invite Link' button are not shown in the provided summary. Verify that /join/[code] route is implemented elsewhere in the PR, the 'Copy Invite Link' button exists, and mobile-friendly QR display is properly handled. Check full PR diff for these missing components.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: implement qr generation for classroom invite link' accurately reflects the main change—adding QR code generation for classroom invitations.
Out of Scope Changes check ✅ Passed All changes directly support the QR code generation feature: new dependencies (html-to-image, qrcode.react) and UI implementation with download functionality align with issue #184.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

@coderabbitai review

@mayannkkk19

mayannkkk19 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Hey @knoxiboy, could you please review the changes?

I noticed there was already a /join/[token]/page.tsx route for invite-based classroom joining. For issue #184, I implemented QR generation inside rooms/[id]/page.tsx, where a QR code is generated once a secure invite link is created. I also added the ability to download the QR as a PNG.

Before proceeding further, I'd appreciate your guidance on whether this is the preferred approach, or if you'd like the QR-related logic to be integrated differently with the existing /join/[token] flow.

Thanks!

Repository owner deleted a comment from github-actions Bot Jun 6, 2026
@knoxiboy
knoxiboy marked this pull request as ready for review June 7, 2026 18:09
@knoxiboy

knoxiboy commented Jun 7, 2026

Copy link
Copy Markdown
Owner

@mayannkkk19 solve the ci test failure

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/app/rooms/[id]/page.tsx (1)

299-304: ⚡ Quick win

Move new UI/action strings to constants.

This change introduces new hardcoded strings in .tsx ("Invite link", "Copy", "Download QR", "classroom-invite-qr.png"). Please centralize them as constants.

💡 Suggested patch
 const CLASSROOM_ANALYTICS_UNAVAILABLE_MESSAGE =
   "Classroom analytics are unavailable right now.";
+const INVITE_LINK_LABEL = "Invite link";
+const COPY_INVITE_LINK_LABEL = "Copy";
+const DOWNLOAD_QR_LABEL = "Download QR";
+const INVITE_QR_FILENAME = "classroom-invite-qr.png";
- link.download = "classroom-invite-qr.png";
+ link.download = INVITE_QR_FILENAME;
- Invite link
+ {INVITE_LINK_LABEL}
...
- Copy
+ {COPY_INVITE_LINK_LABEL}
...
- Download QR
+ {DOWNLOAD_QR_LABEL}

As per coding guidelines: **/*.tsx: Review for No hardcoded strings (use constants).

Also applies to: 1040-1042, 1056-1057, 1082-1083

🤖 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 `@src/app/rooms/`[id]/page.tsx around lines 299 - 304, Several UI/action
strings are hardcoded in this module (e.g., "Invite link", "Copy", "Download
QR", and the filename "classroom-invite-qr.png")—define constants (e.g.,
INVITE_LABEL, COPY_LABEL, DOWNLOAD_QR_LABEL, INVITE_QR_FILENAME) at the top of
the page.tsx module and replace all literal occurrences (including the canvas
download block using link.download and the UI button/tooltip labels found around
lines referenced) with those constants so the strings are centralized and
reusable.

Source: Coding guidelines

🤖 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 `@package.json`:
- Around line 62-63: Remove the unused dependency "html-to-image" from
package.json and package-lock.json: delete the "html-to-image": "^1.11.13" entry
in package.json and run the package manager's install/lockfile update (e.g., npm
install or npm prune && npm install) to update package-lock.json and
node_modules so the dependency is fully removed from the project and supply
chain.

In `@src/app/rooms/`[id]/page.tsx:
- Around line 1040-1049: The invite URL input using value={inviteUrl} is missing
an accessible label and the QR block lacks an alternative description; add a
proper <label> tied via htmlFor to the input's id (or add
aria-label/aria-labelledby) for the input element and ensure the QR container
has an accessible name (e.g., aria-label or a <figcaption>/aria-describedby)
describing its purpose (invite link QR code) so screen readers can announce it;
update the input element and the QR block (the inviteUrl input and the QR
component/container) accordingly to include ids and matching labels/aria
attributes.
- Around line 292-305: The downloadQr function silently returns when the canvas
element ("invite-qr") is missing or canvas.toDataURL fails; update downloadQr to
surface an error toast to the user instead of exiting silently: when
document.getElementById("invite-qr") is null or canvas.toDataURL throws/returns
falsy, call the app's toast/error utility (e.g., toast.error or showToast) with
a clear message like "Unable to download QR code" and abort; keep the existing
download logic (creating the link, setting href/download, click) intact and wrap
canvas.toDataURL in a try/catch to log and show the toast on exceptions.

---

Nitpick comments:
In `@src/app/rooms/`[id]/page.tsx:
- Around line 299-304: Several UI/action strings are hardcoded in this module
(e.g., "Invite link", "Copy", "Download QR", and the filename
"classroom-invite-qr.png")—define constants (e.g., INVITE_LABEL, COPY_LABEL,
DOWNLOAD_QR_LABEL, INVITE_QR_FILENAME) at the top of the page.tsx module and
replace all literal occurrences (including the canvas download block using
link.download and the UI button/tooltip labels found around lines referenced)
with those constants so the strings are centralized and reusable.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71af30a4-18b5-45b5-8125-132b2c07107b

📥 Commits

Reviewing files that changed from the base of the PR and between 5760c05 and 1a52e15.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/app/rooms/[id]/page.tsx

Comment thread package.json
Comment thread src/app/rooms/[id]/page.tsx
Comment thread src/app/rooms/[id]/page.tsx
@knoxiboy

knoxiboy commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Automated Detailed Review

Please address the above items and request a review again.

@knoxiboy knoxiboy added gssoc'26 GSSoC program issue level:intermediate Intermediate level task labels Jun 8, 2026
@mayannkkk19

Copy link
Copy Markdown
Contributor Author

Sure @knoxiboy , I am looking into it...

@knoxiboy

Copy link
Copy Markdown
Owner

Hi! This PR currently has merge conflicts with the main branch. Please rebase/merge main and resolve conflicts so we can review and merge it. Thank you!

@mayannkkk19

Copy link
Copy Markdown
Contributor Author

Got it

@mayannkkk19
mayannkkk19 force-pushed the feat/implement-classroom-qr-generation branch from 1a52e15 to f61ef39 Compare June 11, 2026 17:36
@codeant-ai

codeant-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@knoxiboy
knoxiboy merged commit eb8f0cb into knoxiboy:main Jun 13, 2026
21 of 24 checks passed
@github-actions github-actions Bot added gssoc:approved Approved for GSSoC quality:clean Clean code quality and removed size/l labels Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GSSoC gssoc'26 GSSoC program issue level:intermediate Intermediate level task quality:clean Clean code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Implement classroom invite link sharing with QR code generation

2 participants