Feat: Add QR code ID display customization feature#2053
Conversation
Implement workspace-level setting to allow admins to choose between displaying QR code ID or SAM ID on QR code labels. This addresses issue #2051 by providing organizations flexibility in how they identify assets on QR codes. Key changes: - Add qrIdDisplayPreference enum to Organization schema with QR_ID and SAM_ID options - Create QrIdDisplayPreferenceSelector component using popover pattern for consistent UI - Update QR code preview logic to use useCurrentOrganization hook instead of prop drilling - Add preference setting to workspace general settings page - Update bulk QR download to respect organization preference - Modify API endpoints to include sequentialId for SAM ID display - Add database migration for new preference field The feature is fully backward compatible with QR_ID as the default preference.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements a new workspace-level setting that allows admins to customize how asset identifiers appear on QR code labels. Organizations can now choose between displaying the traditional QR code ID or the sequential/SAM ID on their QR codes.
Key changes:
- Added qrIdDisplayPreference enum field to Organization model with QR_ID and SAM_ID options
- Created QrIdDisplayPreferenceSelector component with search and keyboard navigation capabilities
- Updated QR code rendering to conditionally display preferred identifier type
- Modified API endpoints to return sequentialId data needed for SAM ID display
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/database/schema.prisma | Adds QrIdDisplayPreference enum and qrIdDisplayPreference field to Organization model |
| app/database/migrations/...migration.sql | Creates database migration for new enum and organization field |
| app/modules/organization/service.server.ts | Updates organization service to handle new preference field in updates and selections |
| app/components/workspace/qr-id-display-preference-selector.tsx | New component providing dropdown selector with search functionality for QR ID display preferences |
| app/components/workspace/edit-form.tsx | Integrates preference selector into workspace settings forms |
| app/components/workspace/currency-selector.tsx | Minor styling update to maintain consistent height with new selector |
| app/components/code-preview/code-preview.tsx | Updates QR label rendering to use organization preference and sequential ID |
| app/components/code-preview/code-preview-dialog.tsx | Passes sequentialId data to code preview component |
| app/components/assets/bulk-download-qr-dialog.tsx | Updates bulk QR download to respect organization preference |
| app/routes/_layout+/settings.general.tsx | Adds preference handling to general settings page |
| app/routes/_layout+/account-details.workspace.$workspaceId.edit.tsx | Adds preference handling to workspace edit page |
| app/routes/_layout+/assets.$assetId.overview.tsx | Passes sequentialId to asset overview QR display |
| app/routes/api+/assets.get-assets-for-bulk-qr-download.ts | Returns sequentialId and preference data for bulk operations |
| app/routes/api+/assets.$assetId.generate-code-obj.ts | Returns sequentialId data for individual asset QR generation |
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
…name support - Replace direct fetch calls with useApiQuery for consistency - Add callback support (onSuccess/onError) to useApiQuery hook - Implement SAM ID prefixing in bulk download filenames when preference is SAM_ID - Fix infinite API calls issue by using useEffect pattern instead of unstable callbacks - Add comprehensive test coverage for useApiQuery callback functionality - Fix act() warnings in tests by wrapping refetch calls properly - Update API route type definitions for better type safety This improves code consistency, adds better filename organization for bulk downloads, and ensures robust error handling throughout the QR download workflow.
Implement workspace-level setting to allow admins to choose between displaying QR code ID or SAM ID on QR code labels. This addresses issue #2051 by providing organizations flexibility in how they identify assets on QR codes.
Key changes:
The feature is fully backward compatible with QR_ID as the default preference.
Pending: