feat: enhance TransferTicketModal with link/QR code support and impro… - #73
Merged
Conversation
…ve user lookup functionality
✅ Deploy Preview for qiew-code-dev2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for qc-dev2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Enhances the ticket transfer flow by expanding TransferTicketModal to support selecting recipients via contacts or via pasted profile links / QR codes (camera scan or image upload), and adds supporting API helpers for recipient lookup.
Changes:
- Add a “My contacts” vs “Link or QR” mode toggle in
TransferTicketModal, including QR camera scanning and QR image decoding. - Implement recipient resolution/preview via
/users/:idand/organizations/:idlookups, with organization-specific error messaging. - Simplify
transferActionPurchaseAPI payload to only includerecipientId, and addgetUserById/getOrganizationByIdhelper functions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| helpers/api.ts | Simplifies ticket-transfer payload and adds user/org lookup helper APIs used by the modal. |
| components/ActionPage/TransferTicketModal.tsx | Adds link/QR recipient resolution (camera + upload) and mode toggle UI for transferring tickets beyond contacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+32
to
+45
| const UUID_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i; | ||
|
|
||
| const fullName = (u: RecipientUser) => `${u.firstName || ''} ${u.lastName || ''}`.trim() || u.email; | ||
| const initials = (u: RecipientUser) => | ||
| `${(u.firstName || u.email || '?')[0] || ''}${(u.lastName || '')[0] || ''}`.toUpperCase(); | ||
|
|
||
| /** Pull a user id out of a profile link, full URL, or raw id — QR codes encode the same link. */ | ||
| const extractUserId = (input: string): string | null => { | ||
| const trimmed = input.trim(); | ||
| const welcomeMatch = trimmed.match(/\/welcome\/([^/?#]+)/i); | ||
| if (welcomeMatch) return welcomeMatch[1]; | ||
| const uuid = trimmed.match(UUID_RE); | ||
| return uuid ? uuid[0] : null; | ||
| }; |
Comment on lines
+216
to
+229
| const handleQrFile = async (file: File) => { | ||
| try { | ||
| setResolveError(null); | ||
| setResolving(true); | ||
| const QrScanner = (await import('qr-scanner')).default; | ||
| const result = await QrScanner.scanImage(file, { returnDetailedScanResult: true }); | ||
| const text = typeof result === 'string' ? result : result.data; | ||
| setLinkInput(text); | ||
| await resolveRecipient(text); | ||
| } catch { | ||
| setResolveError('Could not read a QR code from that image.'); | ||
| setResolving(false); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ve user lookup functionality