-
Notifications
You must be signed in to change notification settings - Fork 0
feat: migrate to pnpm, enhance Docker and deployment workflows, and improve clipboard OTP UX #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Updated package manager from Yarn to pnpm in package.json and Dockerfile. - Adjusted dependency specifications to use workspace:* for local packages. - Removed yarn.lock and added pnpm-lock.yaml for dependency management. - Updated Dockerfile to install pnpm globally and configure it for better network settings. - Refactored middleware and cookie imports to align with new structure. - Cleaned up unused code and comments in various components.
- Renamed core service to core-client for clarity. - Added environment variables for base URL configurations. - Removed commented-out network definitions to clean up the file.
- Introduced a new docker-compose file for the core-client service. - Configured build context and Dockerfile path. - Set environment variables for base URL configurations.
…ions - Introduced environment variables NEXT_PUBLIC_BASE_URL and NEXT_PUBLIC_BASE_URL_ATTACHMENT in the Dockerfile. - Enhanced configuration for better integration with the core-client service.
- Changed the base URL in coreApi and guestApi from the environment variable to a hardcoded URL for immediate testing. - Added TODO comments to remind future updates to revert to using the environment variable.
- Added a reusable `useClipboardOtp` hook for extracting OTP from the clipboard. - Introduced `PasteOtpButton` component to facilitate pasting OTP directly into forms. - Updated `SetPasswordPage`, `SignupOtpForm`, and other components to utilize the new clipboard functionality. - Enhanced user experience by allowing OTP pasting and auto-submission. - Refactored `PasswordInput` component for better integration with the new features.
…tp hook - Introduced a new `requestPermission` method to explicitly request clipboard access. - Added `isRequestingPermission` state to track the permission request status. - Updated `checkClipboard` method to utilize the new permission request logic. - Enhanced the overall clipboard OTP functionality for better user experience.
- Added a useEffect to listen for changes in clipboard permission status. - Automatically checks the clipboard when permission is granted.
WalkthroughThis update introduces a pnpm-based monorepo workspace configuration, replacing Yarn, and updates all relevant package and Docker files accordingly. It adds a CI/CD pipeline using GitHub Actions, enhances OTP input UX with clipboard support, and makes various dependency, environment, and authentication-related adjustments across the codebase. Several new utility components and hooks are introduced. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (React)
participant useClipboardOtp Hook
participant PasteOtpButton
participant Server/API
User->>UI (React): Navigates to OTP input page
UI (React)->>useClipboardOtp Hook: Mounts, checks clipboard (auto)
useClipboardOtp Hook->>UI (React): Sets extractedOtp state
User->>PasteOtpButton: Clicks "Paste OTP"
PasteOtpButton->>useClipboardOtp Hook: Reads extractedOtp
PasteOtpButton->>UI (React): Calls onPaste with OTP
UI (React)->>Server/API: Submits OTP for verification
Server/API-->>UI (React): Returns verification result
Possibly related PRs
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Pnpm
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
…vice - Introduced a new docker-compose.prod.yml file for deploying the core-client service. - Configured service settings including build context, Dockerfile path, and environment variables for base URL configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (9)
docker-compose.prod.yml (1)
1-13: Consider adding production-specific configurations.The Docker Compose configuration is functional but may benefit from additional production-specific settings:
- Resource limits: Consider adding memory and CPU limits to prevent resource exhaustion
- Health checks: Add health check configuration for better monitoring
- Security: Consider adding security_opt or user configurations
Here's an enhanced version with production best practices:
version: "3.8" services: core-client: container_name: core-client build: context: . dockerfile: ./apps/core/Dockerfile restart: always + deploy: + resources: + limits: + memory: 512M + cpus: '0.5' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"] + interval: 30s + timeout: 10s + retries: 3 environment: NEXT_PUBLIC_BASE_URL: ${NEXT_PUBLIC_BASE_URL} NEXT_PUBLIC_BASE_URL_ATTACHMENT: ${NEXT_PUBLIC_BASE_URL_ATTACHMENT}apps/core/Dockerfile (1)
26-27: Remove outdated comment and verify build efficiency.The comment mentions "Configure pnpm with better network settings and use Taobao registry" but the command uses the standard
pnpm install --frozen-lockfilewithout any registry configuration.-# Configure pnpm with better network settings and use Taobao registry -RUN pnpm install --frozen-lockfile +RUN pnpm install --frozen-lockfile.github/workflows/deploy.yml (3)
46-46: Fix trailing spaces.Remove trailing spaces as flagged by yamllint.
- docker compose -f docker-compose.prod.yml up -d + docker compose -f docker-compose.prod.yml up -d
16-20: Eliminate duplicate .env file creation.The .env file creation is duplicated in both jobs. Consider using a reusable workflow or moving it to a shared step.
+ create-env: + runs-on: ubuntu-latest + steps: + - name: Create .env file + run: | + echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }}" >> .env + echo "NEXT_PUBLIC_BASE_URL_ATTACHMENT=${{ secrets.NEXT_PUBLIC_BASE_URL_ATTACHMENT }}" >> .env + - name: Upload .env as artifact + uses: actions/upload-artifact@v4 + with: + name: env-file + path: .env + build: runs-on: [self-hosted, core] + needs: create-env steps: - name: Checkout Repository uses: actions/checkout@v4 - - - name: Create .env file - run: | - echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }}" >> .env - echo "NEXT_PUBLIC_BASE_URL_ATTACHMENT=${{ secrets.NEXT_PUBLIC_BASE_URL_ATTACHMENT }}" >> .env + - name: Download .env file + uses: actions/download-artifact@v4 + with: + name: env-fileAlso applies to: 37-41
48-48: Implement rollback logic for failed deployments.The comment indicates missing rollback logic. Consider implementing health checks and rollback mechanisms for production deployments.
Would you like me to generate a robust deployment script with health checks and rollback capabilities?
apps/core/app/auth/signup/otp/_components/signup-otp-form.tsx (1)
70-75: Consider adding user confirmation for auto-submit on paste.The auto-submit functionality on paste is convenient but might be too aggressive. Consider adding a brief delay or user confirmation to prevent accidental submissions.
const handlePasteOtp = (otp: string) => { setValue("otp", otp); - // Auto submit after pasting valid OTP - const data = getValues(); - handleSubmitForm(data); + // Auto submit after pasting valid OTP with a brief delay + setTimeout(() => { + const data = getValues(); + handleSubmitForm(data); + }, 500); };packages/ui/src/components/molecules/paste-otp-button.tsx (1)
57-62: Consider using CSS variables for variant-based styling.The current approach with conditional classes works but could be improved with CSS variables for better maintainability and consistency with the design system.
Consider refactoring to use CSS variables:
- variant === "primary" && "bg-primary", - variant === "secondary" && "bg-secondary", - variant === "tertiary" && "bg-tertiary", + "bg-[var(--button-bg)]",This would require the Button component to set appropriate CSS variables based on the variant.
packages/ui/src/hooks/use-clipboard-otp.ts (2)
91-91: Remove debug console.log statement.The console.log statement appears to be debug code that should be removed before production.
- console.log("permission", permission);
168-168: Remove debug console.log statement.Another debug console.log that should be removed.
- console.log("permission changed", permissionStatus);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (36)
.github/workflows/deploy.yml(1 hunks)apps/core/Dockerfile(4 hunks)apps/core/app/(landing)/_components/mobile-menu/BrowseSheet.tsx(3 hunks)apps/core/app/(landing)/become-auther/_components/auther-form.tsx(0 hunks)apps/core/app/auth/_components/auth-card.tsx(1 hunks)apps/core/app/auth/forget-password/_components/form/forgetPasswordForm.tsx(1 hunks)apps/core/app/auth/login/_components/form/loginForm.tsx(5 hunks)apps/core/app/auth/login/page.tsx(1 hunks)apps/core/app/auth/set-password/page.tsx(7 hunks)apps/core/app/auth/signup/otp/_components/signup-otp-form.tsx(5 hunks)apps/core/middleware.ts(1 hunks)apps/core/package.json(2 hunks)apps/storybook/package.json(2 hunks)docker-compose.prod.yml(1 hunks)docker-compose.yml(1 hunks)package.json(1 hunks)packages/apis/package.json(2 hunks)packages/apis/src/constant/cookie.ts(1 hunks)packages/apis/src/instance/core-api.ts(2 hunks)packages/apis/src/instance/guest-api.ts(1 hunks)packages/apis/src/utils/cookies.ts(1 hunks)packages/design-system/package.json(1 hunks)packages/icons/package.json(1 hunks)packages/icons/src/types/types.ts(1 hunks)packages/ui/package.json(2 hunks)packages/ui/src/components/index.ts(1 hunks)packages/ui/src/components/molecules/passwordInput.tsx(1 hunks)packages/ui/src/components/molecules/paste-otp-button.tsx(1 hunks)packages/ui/src/constant/cookie.ts(0 hunks)packages/ui/src/hooks/index.ts(1 hunks)packages/ui/src/hooks/use-clipboard-otp.ts(1 hunks)packages/ui/src/hooks/use-dimensions.ts(1 hunks)packages/ui/tsconfig.json(1 hunks)packages/utils/package.json(1 hunks)pnpm-workspace.yaml(1 hunks)scripts/prepare.js(1 hunks)
💤 Files with no reviewable changes (2)
- apps/core/app/(landing)/become-auther/_components/auther-form.tsx
- packages/ui/src/constant/cookie.ts
🧰 Additional context used
🧠 Learnings (3)
apps/storybook/package.json (1)
Learnt from: mrbadri
PR: pixel-genius/pixel-client#133
File: apps/core/app/dashboard/_compnents/app-sidebar.tsx:17-20
Timestamp: 2024-12-22T16:57:42.240Z
Learning: We always use '@repo/icons' path alias instead of relative paths for icons across the codebase for maintainability.
apps/core/package.json (1)
Learnt from: mrbadri
PR: pixel-genius/pixel-client#133
File: apps/core/app/dashboard/_compnents/app-sidebar.tsx:17-20
Timestamp: 2024-12-22T16:57:42.240Z
Learning: We always use '@repo/icons' path alias instead of relative paths for icons across the codebase for maintainability.
packages/ui/package.json (1)
Learnt from: mrbadri
PR: pixel-genius/pixel-client#133
File: apps/core/app/dashboard/_compnents/app-sidebar.tsx:17-20
Timestamp: 2024-12-22T16:57:42.240Z
Learning: We always use '@repo/icons' path alias instead of relative paths for icons across the codebase for maintainability.
🧬 Code Graph Analysis (4)
apps/core/app/auth/forget-password/_components/form/forgetPasswordForm.tsx (3)
packages/apis/src/services/core/accounts/users/forgot-password/post/post-forget-password.types.ts (1)
PostForgetPasswordRequest(5-5)packages/apis/src/services/core/accounts/users/forgot-password/post/post-forget-password.schema.ts (1)
postForgetPasswordSchema(15-18)packages/apis/src/services/core/accounts/users/forgot-password/post/use-post-forget-password.ts (1)
UsePostForgetPassword(22-34)
apps/core/app/auth/signup/otp/_components/signup-otp-form.tsx (1)
packages/ui/src/components/molecules/paste-otp-button.tsx (1)
PasteOtpButton(26-72)
packages/ui/src/components/molecules/paste-otp-button.tsx (2)
packages/ui/src/components/atoms/button.tsx (1)
Button(151-151)packages/ui/src/lib/utils.ts (1)
cn(4-6)
apps/core/app/auth/set-password/page.tsx (2)
packages/ui/src/hooks/use-clipboard-otp.ts (1)
useClipboardOtp(30-222)packages/ui/src/components/molecules/paste-otp-button.tsx (1)
PasteOtpButton(26-72)
🪛 YAMLlint (1.37.1)
pnpm-workspace.yaml
[error] 3-3: no new line character at the end of file
(new-line-at-end-of-file)
[error] 3-3: trailing spaces
(trailing-spaces)
.github/workflows/deploy.yml
[error] 46-46: trailing spaces
(trailing-spaces)
🪛 actionlint (1.7.7)
.github/workflows/deploy.yml
11-11: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🪛 Biome (1.9.4)
packages/ui/src/hooks/use-clipboard-otp.ts
[error] 85-85: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 160-160: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (60)
packages/icons/src/types/types.ts (1)
3-3: Good type narrowing improvement!Changing from
SVGElementtoSVGSVGElementmakes the type more specific and semantically correct for icon components that render as<svg>elements. This provides better type safety and IntelliSense support without introducing breaking changes.apps/core/app/(landing)/_components/mobile-menu/BrowseSheet.tsx (1)
1-12: LGTM - Clean formatting improvements!The formatting changes improve code readability and consistency across import statements, JSX elements, and exports without affecting functionality.
Also applies to: 30-32, 35-38, 49-49
packages/apis/src/utils/cookies.ts (1)
1-1: Cookies constant import and location verified
- Confirmed
packages/apis/src/constant/cookie.tsexists.- The switch from absolute to relative import is appropriate and keeps constants close to their usage.
All set!
packages/ui/src/hooks/use-dimensions.ts (1)
1-1: Correct addition of client directive!Adding
"use client";is appropriate here since this hook uses browser-specific APIs (ResizeObserver, getBoundingClientRect, window properties) that only work on the client side. This directive is necessary for Next.js 13+ app router environments.scripts/prepare.js (1)
7-7: Package manager migration approvedConfirmed that
[email protected]is a valid stable release (Dec 6, 2024). While the latest pnpm version is 10.13.1, pinning to 9.15.0 is acceptable for now, and the comment update remains consistent.packages/ui/tsconfig.json (1)
12-12: LGTM: Proper inclusion of shared constants from apis package.This change correctly includes the constants from the apis package, aligning with the refactoring to centralize shared constants. The relative path is appropriate for the monorepo structure.
packages/ui/src/hooks/index.ts (1)
3-3: LGTM: Proper export of the new clipboard OTP hook.The export is correctly placed in alphabetical order and follows the established pattern for hook exports in this package.
packages/icons/package.json (1)
82-83: LGTM: Proper workspace protocol usage for internal dependencies.The migration from
"*"to"workspace:*"aligns with pnpm workspace best practices, ensuring internal packages are resolved from within the workspace for better dependency management.apps/storybook/package.json (2)
13-14: LGTM: Consistent workspace protocol usage for UI and icons packages.The migration to
"workspace:*"for internal dependencies is consistent with the pnpm workspace setup and ensures proper resolution of internal packages.
23-24: LGTM: Proper workspace protocol for development dependencies.The development dependencies are correctly updated to use the workspace protocol, maintaining consistency with the monorepo migration approach.
packages/design-system/package.json (1)
12-13: LGTM: Workspace protocol migration and Node.js types addition.The changes properly implement the workspace protocol for the TypeScript config and add the necessary Node.js types dependency, consistent with the monorepo migration and development requirements.
packages/utils/package.json (1)
13-14: LGTM! Proper workspace protocol usage.The migration from wildcard dependencies to workspace protocol is correct for pnpm monorepos. This ensures proper dependency resolution within the workspace.
packages/apis/src/constant/cookie.ts (1)
1-4: LGTM! Good architectural decision.Moving cookie constants from the UI package to the APIs package improves separation of concerns and makes the dependency relationship clearer.
apps/core/app/auth/login/page.tsx (1)
20-25: LGTM! Clean UI and improved UX.The removal of commented-out social login components and the
prefetch={false}attribute improves code cleanliness and user experience through default prefetching.package.json (2)
22-24: LGTM! Consistent workspace protocol usage.The migration to workspace protocol for internal dependencies is consistent with the pnpm migration.
29-29: Confirm [email protected] compatibility[email protected] is a stable release, widely adopted in early 2025 with no known critical bugs. To avoid any minor version-management or CI/CD mismatches, please:
- Use Corepack to pin the exact pnpm version specified in your
packageManagerfield.- Verify the active binary in your environment with
which pnpm(macOS/Linux) orwhere.exe pnpm.*(Windows).- If you run into friction or want the latest features and performance improvements, consider upgrading to the current stable 10.x series (latest: 10.12.1).
No further changes are required here.
packages/ui/src/components/index.ts (1)
56-56: LGTM: Export addition follows proper pattern.The export for
PasteOtpButtonis correctly placed in the molecules section and follows the established export pattern in the index file.apps/core/app/auth/forget-password/_components/form/forgetPasswordForm.tsx (3)
31-33: Good error handling implementation.The onError callback properly handles API errors with user-friendly feedback, using the server message when available and falling back to a generic message.
40-42: Effective performance optimization.Route prefetching for the next step in the authentication flow improves user experience by preloading the set-password page.
49-50: Good UX improvements.The placeholder text change to "Enter your username" is more accurate than the previous email placeholder, and adding autoFocus improves accessibility and user experience.
apps/core/package.json (3)
13-16: Correct workspace protocol implementation.The migration from wildcard
"*"to"workspace:*"for internal dependencies is the proper approach for pnpm monorepos, ensuring consistent dependency resolution.
36-37: Consistent devDependency updates.The devDependencies also correctly use the workspace protocol, maintaining consistency across the monorepo configuration.
29-32: All new dependencies are actively used across the codebase
A ripgrep search over*.ts/*.tsxfiles confirms that:
@tabler/icons-reactis imported in dozens of UI componentslucide-reactappears throughout atoms and moleculesinput-otpis used in OTP-related formsrechartspowers charts in the dashboardPlease confirm that the version ranges (
^3.12.0,^0.483.0,^1.2.4,^2.12.7) match the latest stable releases (e.g. vianpm outdatedor the respective package changelogs).apps/core/middleware.ts (1)
2-19: Critical: Authentication Middleware Disabled Without ReplacementAll authentication checks in apps/core/middleware.ts have been commented out, leaving protected routes unguarded and calling NextResponse.next() unconditionally. No alternative authentication logic was found elsewhere in the codebase.
Please confirm this change is intentional and that authentication is now handled in another layer. If it’s temporary, restore or relocate the auth logic and update the cookie import path:
-// import { COOKIES } from "@repo/ui/constant/cookie"; +// import { COOKIES } from "@repo/apis/constant/cookie";• apps/core/middleware.ts: lines 2–19 need review for reinstating protection or verifying replacement
• Ensure protected routes like/dashboardare still securedapps/core/app/auth/_components/auth-card.tsx (3)
1-1: Good: Client component conversion is appropriateConverting to a client component is correct since the component now uses the
useRouterhook for navigation.
19-29: Good: Well-implemented back button with accessibilityThe back button implementation is excellent:
- Proper accessibility with
aria-label- Consistent styling with existing design system
- Appropriate positioning and hover states
32-32: Minor: Padding adjustment looks goodThe padding change from
py-7topy-8provides better visual spacing around the content.packages/apis/package.json (2)
15-16: Good: Correct workspace protocol usageThe change from
"*"to"workspace:*"is correct for pnpm workspace configuration and ensures proper internal dependency resolution.
40-44: Good: Enhanced exports configurationThe exports array format allows multiple file extensions and provides more flexibility for module resolution.
packages/apis/src/instance/core-api.ts (1)
1-1: Good: Correct import path updateThe import path change to use relative imports is correct and reflects the relocation of the COOKIES constant to the APIs package.
apps/core/app/auth/login/_components/form/loginForm.tsx (4)
33-35: Good: Personalized success message improves UXThe personalized toast message with username and emoji creates a more engaging user experience.
49-53: Good: Route prefetching optimizes navigation performancePrefetching key authentication routes will improve perceived performance when users navigate between auth pages.
63-63: Good: Auto-focus improves accessibility and UXAdding
autoFocusto the first input field provides better user experience and accessibility.
74-74: Good: Simplified CSS classes are cleanerReplacing multiple CSS classes with a single "underline" class is more maintainable and readable.
apps/core/Dockerfile (1)
49-51: LGTM - Environment variables properly configured.The addition of Next.js public environment variables is correctly implemented and aligns with the docker-compose configuration.
packages/ui/package.json (1)
15-16: LGTM - Workspace protocol correctly implemented.The migration from wildcard
"*"to"workspace:*"for internal dependencies follows pnpm workspace best practices. This ensures proper dependency resolution and prevents version conflicts in the monorepo.Also applies to: 52-54
docker-compose.yml (1)
1-1: LGTM - Docker Compose configuration properly updated.The changes correctly:
- Add explicit version specification
- Rename service for consistency with deployment configuration
- Add required environment variables that align with the Dockerfile and CI/CD pipeline
Also applies to: 4-5, 12-14
apps/core/app/auth/signup/otp/_components/signup-otp-form.tsx (3)
31-34: LGTM - Clipboard OTP integration properly implemented.The integration of the
useClipboardOtphook with digit-only pattern is correctly implemented and enhances user experience.
113-121: LGTM - PasteOtpButton integration enhances UX.The replacement of manual verification with the new
PasteOtpButtoncomponent provides a better user experience with visual OTP preview and proper loading states.
87-89: Verify OTP pattern change across flowsThe new
REGEXP_ONLY_DIGITSpattern is now used in:• apps/core/app/auth/signup/otp/_components/signup-otp-form.tsx
• apps/core/app/auth/set-password/page.tsxMeanwhile, elsewhere (e.g.
apps/core/app/dashboard/products/create/_components/version-modal.tsx) the alphanumeric patternREGEXP_ONLY_DIGITS_AND_CHARSis still in use.Before merging, please confirm that your backend OTP endpoints (signup, reset-password, verify-otp) accept digits-only codes. If any service or email/SMS provider sends alphanumeric tokens, you’ll need to revert or extend this pattern.
apps/core/app/auth/set-password/page.tsx (7)
3-6: LGTM! Clean integration of new clipboard OTP functionality.The imports are well-organized and the new components (
PasteOtpButton,useClipboardOtp) will enhance the OTP input user experience significantly.
26-30: Good configuration of the clipboard OTP hook.The hook is properly configured with appropriate OTP length and pattern restrictions. The
REGEXP_ONLY_DIGITSpattern ensures only numeric OTPs are accepted, which is standard for most OTP systems.
40-44: Excellent use of React Hook Form's watch method.Using
watchto monitor the OTP field enables real-time synchronization with the InputOTP component, providing a smooth user experience.
66-68: Clean OTP paste handler implementation.The handler properly uses
setValueto update the form state when an OTP is pasted, maintaining consistency with React Hook Form patterns.
93-98: Proper OTP input configuration with form synchronization.The
REGEXP_ONLY_DIGITSpattern restriction andwatchvalue integration ensure the OTP input behaves correctly with both manual input and clipboard paste functionality.
112-118: Excellent integration of the paste OTP button.The button is properly configured with the extracted OTP, paste handler, loading state, and appropriate styling. The secondary variant and full-width styling fit well with the form design.
121-135: Good replacement with specialized PasswordInput components.The transition from generic inputs to
PasswordInputcomponents provides better UX with built-in password visibility toggle functionality while maintaining proper form integration.packages/ui/src/components/molecules/paste-otp-button.tsx (4)
8-24: Well-defined TypeScript interface with comprehensive prop types.The interface covers all necessary props with proper types, optional flags, and helpful JSDoc comments. The eslint disable comment for the onPaste callback is appropriate since it's a standard React callback pattern.
35-41: Excellent error handling in the paste click handler.The handler properly checks for OTP availability and provides user feedback through toast notifications when no OTP is found. This prevents silent failures and improves user experience.
44-52: Proper button configuration with accessibility features.The button is correctly configured with appropriate props, disabled state when no OTP is available, and includes an accessible clipboard icon. The
type="button"prevents form submission issues.
53-69: Thoughtful OTP preview implementation with good UX.The conditional rendering shows either the OTP preview with proper formatting (spaced digits) or a fallback text. The
showOtpPreviewflag provides flexibility for different use cases.packages/ui/src/components/molecules/passwordInput.tsx (3)
4-4: Good refactoring to use the Input component.The switch to using the
Inputcomponent withiconRightprop simplifies the component structure and improves maintainability.
12-29: Excellent extraction of toggle button to a constant.Moving the toggle button JSX to a constant improves code readability and makes the render method cleaner. The button maintains proper accessibility with screen reader support and appropriate ARIA attributes.
32-42: Clean implementation using Input component's iconRight prop.The refactored approach is much cleaner than the previous manual positioning logic. The
hide-password-toggleclass and proper prop forwarding maintain the expected behavior.packages/ui/src/hooks/use-clipboard-otp.ts (6)
4-28: Well-designed TypeScript interfaces with comprehensive documentation.The interfaces are properly typed with helpful JSDoc comments, providing clear guidance for hook usage and return values.
30-38: Good configuration with sensible defaults.The hook options provide flexibility while maintaining reasonable defaults. The alphanumeric pattern and auto-check behavior are appropriate for most OTP use cases.
48-79: Robust OTP extraction logic with fallback handling.The extraction logic handles various scenarios well - prioritizing numeric sequences, falling back to alphanumeric patterns, and validating against the configured pattern.
130-149: Excellent permission-aware clipboard checking.The clipboard checking logic properly handles permission states and provides appropriate fallbacks when access is denied.
152-195: Comprehensive permission listener setup with proper cleanup.The effect properly sets up permission change listeners and includes appropriate cleanup to prevent memory leaks.
197-212: Well-implemented auto-check functionality.The auto-check logic respects configuration options and properly handles both mount and focus scenarios for optimal user experience.
| // TODO: change to process.env.NEXT_PUBLIC_BASE_URL | ||
| // baseURL: process.env.NEXT_PUBLIC_BASE_URL, | ||
| baseURL: "https://api.pixelgenius.ir", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid hardcoding the base URL
Hardcoding the API base URL removes environment flexibility and makes the code less maintainable. Consider keeping the environment variable approach.
- // TODO: change to process.env.NEXT_PUBLIC_BASE_URL
- // baseURL: process.env.NEXT_PUBLIC_BASE_URL,
- baseURL: "https://api.pixelgenius.ir",
+ baseURL: process.env.NEXT_PUBLIC_BASE_URL || "https://api.pixelgenius.ir",This provides a fallback while maintaining environment flexibility.
📝 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.
| // TODO: change to process.env.NEXT_PUBLIC_BASE_URL | |
| // baseURL: process.env.NEXT_PUBLIC_BASE_URL, | |
| baseURL: "https://api.pixelgenius.ir", | |
| // before: | |
| // // TODO: change to process.env.NEXT_PUBLIC_BASE_URL | |
| // // baseURL: process.env.NEXT_PUBLIC_BASE_URL, | |
| // baseURL: "https://api.pixelgenius.ir", | |
| // after: | |
| baseURL: process.env.NEXT_PUBLIC_BASE_URL || "https://api.pixelgenius.ir", |
🤖 Prompt for AI Agents
In packages/apis/src/instance/core-api.ts around lines 10 to 12, the baseURL is
hardcoded which reduces flexibility. Replace the hardcoded URL with
process.env.NEXT_PUBLIC_BASE_URL and provide a fallback to the current URL
string to maintain environment flexibility and ensure the code works in
different environments.
- Renamed core-client service to client for clarity. - Updated image reference to use the latest version of the pixel-client. - Adjusted service settings in docker-compose.prod.yml for improved deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
docker-compose.prod.yml (3)
1-2: Drop the obsoleteversionkeyCompose V2 ignores the
versionfield and the linter already warns about it. Keeping it around is just noise and may confuse newcomers who think it still matters.-version: "3.8"
6-6: Avoid hard-codingcontainer_nameunless strictly necessaryPinned names break Compose’s default naming (which namespaces by project) and can clash on hosts running multiple stacks or replicas. Unless other services depend on the literal name
client, consider deleting this key.- container_name: client
11-13: Considerenv_fileor Docker secrets for deploy-time values
NEXT_PUBLIC_BASE_URL*appear public, but if any sensitive variables are later added it’s safer to mount an.env/env_file:or usesecrets:. Either way keeps the compose file generic and avoids accidental commits of secrets.No change required now, just flagging for future hardening.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docker-compose.prod.yml(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI/CD Pipeline
docker-compose.prod.yml
[warning] 1-1: The attribute version is obsolete in docker-compose.prod.yml and will be ignored. Please remove it to avoid potential confusion.
🔇 Additional comments (1)
docker-compose.prod.yml (1)
5-9: Re-evaluate simultaneous use ofimageandbuildDefining both keys is valid, but the resulting behaviour is subtle: Compose will build a new image and then tag it as
mrbadri/pixel-client:latest, potentially overwriting a registry image with local artefacts.
If the CI builds and pushes the image separately, keep onlyimage:; if you need local builds, keep onlybuild:or move the tag insidebuild: → tags:.- image: mrbadri/pixel-client:latest - build: - context: . - dockerfile: ./apps/core/Dockerfile + # Option A – pull the pre-built image + image: mrbadri/pixel-client:latest + + # Option B – build locally and tag +# build: +# context: . +# dockerfile: ./apps/core/Dockerfile
- Added a step to log in to Docker Hub before building and pushing the Docker image. - Cleaned up the push command by removing redundant login steps from the push action. - Improved overall clarity and efficiency of the deployment workflow.
- Removed unnecessary blank lines in the deploy.yml file for improved readability. - Ensured consistency in the Docker push command formatting.
- Changed the deployment command to pull the client service instead of the web service in the Docker Compose workflow. - Ensured the deployment process aligns with the recent renaming of the core-client service.
…nt workflow - Eliminated unnecessary commented-out lines in the deploy.yml file to enhance clarity and maintainability of the workflow. - Streamlined the deployment process by focusing on active commands.
- Introduced a concurrency group in the deploy.yml file to manage simultaneous workflow runs. - Set the concurrency group to use the branch name, enhancing control over deployment processes.
- Changed the runner configuration in deploy.yml to use self-hosted runners instead of the default group. - Aimed to optimize deployment performance and resource management.
- Added port mapping for the core service to expose port 3000 in docker-compose.prod.yml. - This change allows external access to the service, facilitating communication with other services or clients.
- Changed the base URL for both coreApi and guestApi from "https://api.pixelgenius.ir" to "http://api.pixelgenius.ir". - This adjustment ensures consistency in API endpoint usage across the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
.github/workflows/deploy.yml (2)
15-16: Define custom runner label “core” inactionlint.yaml.
actionlintstill flagscoreas an unknown self-hosted label. Add the configuration file suggested in the earlier review or rename the label to one of the well-known defaults to silence the warning.Also applies to: 35-36
25-33: Stop hard-coding the Docker Hub username.
mrbadriis hard-wired in both the login and push steps. Reuse the${{ secrets.DOCKER_USERNAME }}secret so the workflow works for forks / other environments and avoids leaking internal details.- run: docker login -u mrbadri -p ${{ secrets.DOCKER_TOKEN }} + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }} - run: docker push mrbadri/pixel-client:latest + run: docker push ${{ secrets.DOCKER_USERNAME }}/pixel-client:latest
🧹 Nitpick comments (2)
.github/workflows/deploy.yml (2)
48-50: Clean trailing whitespace & avoid shell foot-gun.Line 50 has trailing spaces flagged by
yamllint, and an unquoted newline after-dcan accidentally concatenate the next line if someone removes the comment.- docker compose -f docker-compose.prod.yml up -d + docker compose -f docker-compose.prod.yml up -d
52-53: Implement—or remove—the rollback TODO, and fix the typo.The comment states “rullback” but there is no logic to handle a failed start. Either implement the rollback (e.g., check container health and redeploy the previous tag) or delete the comment to keep the workflow honest.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/deploy.yml(1 hunks)docker-compose.prod.yml(1 hunks)packages/apis/src/instance/core-api.ts(2 hunks)packages/apis/src/instance/guest-api.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- docker-compose.prod.yml
- packages/apis/src/instance/guest-api.ts
- packages/apis/src/instance/core-api.ts
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/deploy.yml
15-15: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
35-35: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🪛 YAMLlint (1.37.1)
.github/workflows/deploy.yml
[error] 50-50: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
…-compose configuration - Modified the post-login schema transformation to return the original data without modifications. - Updated the docker-compose.yml to rename the core-client service to client and changed the image reference to the latest version, enhancing clarity and consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (4)
packages/apis/src/services/core/accounts/users/login/post/post-login.schema.ts (2)
11-11: Fix typo in variable name.There's a typo in the variable name: "Transofrmed" should be "Transformed".
-export const postLoginResponseSchemaTransofrmed = apiResponseSchema +export const postLoginResponseSchemaTransformed = apiResponseSchemaAlso update the reference on line 28:
- response: postLoginResponseSchemaTransofrmed, + response: postLoginResponseSchemaTransformed,
25-25: Consider removing redundant identity transform.The transform function simply returns the data unchanged. If no transformation is needed, consider removing the
.transform((data) => data)entirely to simplify the code.- .transform((data) => data); +;docker-compose.yml (2)
6-6: Staticcontainer_nameblocks scaling and paralleldocker compose upruns
Hard-codingcontainer_name: clientprevents multiple replicas and forces users to remove the container before re-running the stack. Unless another service depends on this exact name, drop the key and let Compose generate one.- container_name: client
13-15: Confirm the twoNEXT_PUBLIC_*vars are defined for all environments
If these come from the developer’s shell, local builds may fail silently when they’re missing. Consider a.envfile checked into the repo (or.env.example) so newcomers get sensible defaults and CI is explicit.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docker-compose.yml(1 hunks)packages/apis/src/services/core/accounts/users/login/post/post-login.schema.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
packages/apis/src/services/core/accounts/users/login/post/post-login.schema.ts
Show resolved
Hide resolved
| client: | ||
| image: mrbadri/pixel-client:latest | ||
| container_name: client | ||
| build: | ||
| context: . | ||
| dockerfile: ./apps/core/Dockerfile | ||
| restart: always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Avoid mixing image: with build: unless you need a custom tag – right now the intent is ambiguous
Having both keys is allowed, but Compose will always build first; image: is then just the tag of that locally-built image. In CI you also docker pull mrbadri/pixel-client:latest, so developers may unknowingly run different images than prod. Either:
- Drop
build:here and rely exclusively on the registry image, or - Keep
build:and replacelatestwith a deterministic tag (commit SHA / semver) that the pipeline also pushes, so local ≈ prod.
- image: mrbadri/pixel-client:latest
+ # Option A – tag the locally-built image deterministically
+ image: mrbadri/pixel-client:${PIXEL_CLIENT_TAG:-dev}🏁 Script executed:
#!/bin/bash
# Search for references to pixel-client in the repository
rg 'pixel-client' -n
# Search for any definition or usage of PIXEL_CLIENT_TAG environment variable
rg 'PIXEL_CLIENT_TAG' -n
# Search for docker pull commands referencing the image
rg 'docker pull.*mrbadri/pixel-client' -n
# Show the image: line in docker-compose.yml for context
sed -n '1,50p' docker-compose.yml | rg 'image:' -nLength of output: 352
🏁 Script executed:
#!/bin/bash
# Check for CI configuration files
if [ -d .github ]; then
echo "Found GitHub workflows:"
find .github -maxdepth 2 -type f
else
echo ".github directory not found"
fi
if [ -f Jenkinsfile ]; then
echo "Jenkinsfile present"
else
echo "Jenkinsfile not found"
fi
if [ -f .gitlab-ci.yml ]; then
echo ".gitlab-ci.yml present"
else
echo ".gitlab-ci.yml not found"
fi
# Display deploy.sh to see how the image is pulled or built in prod
echo "---- deploy.sh ----"
sed -n '1,200p' deploy.sh || echo "deploy.sh not found"
# Display docker-compose.prod.yml to inspect service definitions
echo "---- docker-compose.prod.yml ----"
sed -n '1,200p' docker-compose.prod.yml || echo "docker-compose.prod.yml not found"
# Search for build: and pull usage in docker-compose.prod.yml
rg 'build:' -n docker-compose.prod.yml || echo "no build: in prod compose"
rg 'pull' -n docker-compose.prod.yml || echo "no pull in prod compose"Length of output: 1767
🏁 Script executed:
#!/bin/bash
# Inspect CI workflows for usage of pixel-client image
echo "---- References to pixel-client in CI workflows ----"
rg 'pixel-client' -n .github/workflows || echo "No references found"
# Show build-and-merge workflow
echo "---- .github/workflows/build-and-merge.yml ----"
sed -n '1,200p' .github/workflows/build-and-merge.yml || echo "build-and-merge.yml not found"
# Show deploy workflow
echo "---- .github/workflows/deploy.yml ----"
sed -n '1,200p' .github/workflows/deploy.yml || echo "deploy.yml not found"Length of output: 5420
Clarify build vs. image in Docker Compose
Compose always rebuilds a service when build: is present, tagging it as whatever you’ve set in image:. In our CI/CD:
- Build job (
.github/workflows/build-and-merge.yml):
docker compose -f docker-compose.prod.yml build→docker push mrbadri/pixel-client:latest - Deploy job (
.github/workflows/deploy.yml):
docker compose -f docker-compose.prod.yml pull clientthenup -d
→ Butupseesbuild:and rebuilds from source, so the pulledlatestis never used.
This mismatch means prod never runs exactly what CI pushed—and using the floating latest tag makes drift more likely.
Recommendations (choose one):
- Drop
build:in production and rely solely on the registry image. - Keep
build:but:- Switch to a deterministic tag (
${PIXEL_CLIENT_TAG}instead oflatest), - Have CI push that same tag,
- Change deploy to use
docker compose up --no-build.
- Switch to a deterministic tag (
Example diff for docker-compose.prod.yml:
services:
client:
- image: mrbadri/pixel-client:latest
- build:
- context: .
- dockerfile: ./apps/core/Dockerfile
+ # Pull only from registry in prod
+ image: mrbadri/pixel-client:${PIXEL_CLIENT_TAG:-latest}Files requiring updates:
- docker-compose.prod.yml
- .github/workflows/deploy.yml (e.g. add
--no-buildor remove build) - Optionally deploy.sh if it also uses
docker compose up
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In docker-compose.yml lines 4 to 10, the presence of both build and image causes
Docker Compose to rebuild the image on deploy, ignoring the pulled image from
the registry. To fix this, remove the build section from the production compose
file to rely solely on the prebuilt image, or alternatively, keep build but
switch to a fixed tag instead of latest, ensure CI pushes that tag, and modify
deploy commands to use 'docker compose up --no-build' to prevent rebuilding
during deployment.
- Introduced docker-compose.dev.yml for development environment with client-dev service. - Added docker-compose.preview.yml for PR previews, allowing dynamic port assignment and image tagging. - Updated deploy.yml to handle deployments for development and PR previews, enhancing CI/CD workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.github/workflows/deploy.yml (2)
18-19:corerunner label still unrecognised by actionlintactionlint flags every usage of
[self-hosted, core]. Ensure.github/actionlint.yamldeclarescore, or rename the label to one of the well-known values to silence the lint job.
52-54: Use secrets for Docker Hub username as wellHard-coding
mrbadricouples the workflow to a single account and leaks information if the repo is ever forked. Leverage the secret already suggested in past reviews:- - name: Login to Docker Hub - run: docker login -u mrbadri -p ${{ secrets.DOCKER_TOKEN }} + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
🧹 Nitpick comments (2)
scripts/haproxy-config-helper.md (2)
8-37: Add syntax identifier to fenced HAProxy snippet
markdownlint(MD040) complains because the code block has no language hint. Addinghaproxyafter the opening back-ticks fixes the lint error and gives readers syntax highlighting.-``` +```haproxy frontend pixel_frontend bind *:80 bind *:443 ssl crt /etc/ssl/certs/pixel.pem @@ # Port calculation: 3100 + PR_NUMBER -``` +```
64-67: Avoid hard-coding the public IP in documentation
82.115.24.87will become stale the moment the server is reprovisioned or fronted by a load balancer/CDN. Replace static IPs with a placeholder such as<SERVER_IP>or a DNS record (e.g.pixel.yourdomain.com) to keep the doc future-proof and prevent accidental disclosure of infrastructure details.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/deploy.yml(1 hunks)docker-compose.dev.yml(1 hunks)docker-compose.preview.yml(1 hunks)scripts/haproxy-config-helper.md(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- docker-compose.preview.yml
- docker-compose.dev.yml
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/deploy.yml
18-18: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
75-75: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
95-95: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
115-115: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
173-173: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🪛 markdownlint-cli2 (0.17.2)
scripts/haproxy-config-helper.md
7-7: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (1)
.github/workflows/deploy.yml (1)
11-14:concurrency.groupexpression may mis-serialize on non-PR pushes
github.event.numberis undefined forpushevents, which can result in an empty string (CI-main-) instead of a unique key. Consider an explicit fallback:group: CI-${{ github.ref_name }}-${{ github.event.number || github.run_id }}
- Replaced the GitHub script action with a sticky pull request comment action for posting deployment and cleanup messages. - Enhanced the preview deployment comment to include a structured message with the preview URL and container details. - Improved the cleanup confirmation comment to provide a clear summary of the resources removed after the PR is closed.
- Added permissions for reading contents and writing to pull requests and issues in deploy.yml. - This change enhances the workflow's ability to interact with GitHub resources during deployment processes.
🚀 Preview Deployed Successfully!Your pull request preview is now available:
This preview will be automatically cleaned up when the PR is closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
.github/workflows/deploy.yml (3)
23-24: Missing actionlint runner-label config for “core”
runs-on: [self-hosted, core]is still flagged by actionlint as an unknown label. Either add an explicit.github/actionlint.yamldeclaring the custom label or rename the label to one of the built-in values.
57-58: Hard-coded Docker Hub username & plaintext passwordThe username
mrbadriis hard-coded in both thedocker loginanddocker pushcommands, and the password is supplied via-p.
Use GitHub secrets for the username and pass the token via--password-stdinto avoid leaking credentials in process lists:- run: docker login -u mrbadri -p ${{ secrets.DOCKER_TOKEN }} + run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin- docker push mrbadri/pixel-client:$TAG + docker push ${{ secrets.DOCKER_USERNAME }}/pixel-client:$TAGAlso applies to: 70-76
64-67: No-op retagging on the dev branch
$TAGis already set todev, so re-tagging the image adds no value and costs CI time:- docker compose -f docker-compose.dev.yml build - docker tag mrbadri/pixel-client:dev mrbadri/pixel-client:$TAG + docker compose -f docker-compose.dev.yml build
🧹 Nitpick comments (1)
.github/workflows/deploy.yml (1)
52-56: Duplicate “create .env” logic across four jobsThe same shell fragment is copy-pasted. Extract it into a reusable composite action or a single reusable step (e.g.
uses: ./.github/actions/setup-env) to keep the workflow DRY and easier to maintain.Also applies to: 87-91, 107-111, 127-131
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/deploy.yml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/deploy.yml
23-23: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
80-80: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
100-100: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
120-120: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
169-169: label "core" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2025", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-24.04-arm", "ubuntu-22.04", "ubuntu-22.04-arm", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
(runner-label)
🧹 Preview Cleanup CompleteAll preview deployment resources for this pull request have been successfully removed:
The cleanup process has finished for PR #362. |
…mprove clipboard OTP UX (#362) * chore: migrate project to pnpm and update dependencies - Updated package manager from Yarn to pnpm in package.json and Dockerfile. - Adjusted dependency specifications to use workspace:* for local packages. - Removed yarn.lock and added pnpm-lock.yaml for dependency management. - Updated Dockerfile to install pnpm globally and configure it for better network settings. - Refactored middleware and cookie imports to align with new structure. - Cleaned up unused code and comments in various components. * refactor: update docker-compose configuration for core-client service - Renamed core service to core-client for clarity. - Added environment variables for base URL configurations. - Removed commented-out network definitions to clean up the file. * feat: add docker-compose configuration for core-client service - Introduced a new docker-compose file for the core-client service. - Configured build context and Dockerfile path. - Set environment variables for base URL configurations. * feat: add environment variables to Dockerfile for base URL configurations - Introduced environment variables NEXT_PUBLIC_BASE_URL and NEXT_PUBLIC_BASE_URL_ATTACHMENT in the Dockerfile. - Enhanced configuration for better integration with the core-client service. * fix: update base URL in coreApi and guestApi to a hardcoded value - Changed the base URL in coreApi and guestApi from the environment variable to a hardcoded URL for immediate testing. - Added TODO comments to remind future updates to revert to using the environment variable. * feat: enhance authentication components with clipboard OTP functionality - Added a reusable `useClipboardOtp` hook for extracting OTP from the clipboard. - Introduced `PasteOtpButton` component to facilitate pasting OTP directly into forms. - Updated `SetPasswordPage`, `SignupOtpForm`, and other components to utilize the new clipboard functionality. - Enhanced user experience by allowing OTP pasting and auto-submission. - Refactored `PasswordInput` component for better integration with the new features. * feat: add clipboard permission request functionality to useClipboardOtp hook - Introduced a new `requestPermission` method to explicitly request clipboard access. - Added `isRequestingPermission` state to track the permission request status. - Updated `checkClipboard` method to utilize the new permission request logic. - Enhanced the overall clipboard OTP functionality for better user experience. * feat: implement clipboard permission listener in useClipboardOtp hook - Added a useEffect to listen for changes in clipboard permission status. - Automatically checks the clipboard when permission is granted. * feat: add deploy action * feat: add production docker-compose configuration for core-client service - Introduced a new docker-compose.prod.yml file for deploying the core-client service. - Configured service settings including build context, Dockerfile path, and environment variables for base URL configurations. * refactor: update docker-compose configuration for client service - Renamed core-client service to client for clarity. - Updated image reference to use the latest version of the pixel-client. - Adjusted service settings in docker-compose.prod.yml for improved deployment. * chore: enhance Docker Hub deployment process in workflow - Added a step to log in to Docker Hub before building and pushing the Docker image. - Cleaned up the push command by removing redundant login steps from the push action. - Improved overall clarity and efficiency of the deployment workflow. * chore: clean up Docker deployment workflow - Removed unnecessary blank lines in the deploy.yml file for improved readability. - Ensured consistency in the Docker push command formatting. * fix: update Docker deployment workflow to pull client service - Changed the deployment command to pull the client service instead of the web service in the Docker Compose workflow. - Ensured the deployment process aligns with the recent renaming of the core-client service. * chore: remove commented-out Docker build and push steps from deployment workflow - Eliminated unnecessary commented-out lines in the deploy.yml file to enhance clarity and maintainability of the workflow. - Streamlined the deployment process by focusing on active commands. * chore: add concurrency configuration to deployment workflow - Introduced a concurrency group in the deploy.yml file to manage simultaneous workflow runs. - Set the concurrency group to use the branch name, enhancing control over deployment processes. * chore: update deployment workflow to use self-hosted runners - Changed the runner configuration in deploy.yml to use self-hosted runners instead of the default group. - Aimed to optimize deployment performance and resource management. * chore: expose port for core service in production Docker Compose - Added port mapping for the core service to expose port 3000 in docker-compose.prod.yml. - This change allows external access to the service, facilitating communication with other services or clients. * fix: update API base URLs from HTTPS to HTTP - Changed the base URL for both coreApi and guestApi from "https://api.pixelgenius.ir" to "http://api.pixelgenius.ir". - This adjustment ensures consistency in API endpoint usage across the application. * refactor: simplify post-login schema transformation and update docker-compose configuration - Modified the post-login schema transformation to return the original data without modifications. - Updated the docker-compose.yml to rename the core-client service to client and changed the image reference to the latest version, enhancing clarity and consistency. * feat: add development and preview Docker Compose configurations - Introduced docker-compose.dev.yml for development environment with client-dev service. - Added docker-compose.preview.yml for PR previews, allowing dynamic port assignment and image tagging. - Updated deploy.yml to handle deployments for development and PR previews, enhancing CI/CD workflow. * refactor: update PR comment actions in deployment workflow - Replaced the GitHub script action with a sticky pull request comment action for posting deployment and cleanup messages. - Enhanced the preview deployment comment to include a structured message with the preview URL and container details. - Improved the cleanup confirmation comment to provide a clear summary of the resources removed after the PR is closed. * chore: update permissions in deployment workflow - Added permissions for reading contents and writing to pull requests and issues in deploy.yml. - This change enhances the workflow's ability to interact with GitHub resources during deployment processes.
…duct listing and convert bun to pnpm (#363) * feat: restructure landing page with new layout, tabs, and dynamic product listing (#361) * feat: implement api for product list and replace json * feat: add landing page components and layout structure - Introduced new layout components for the landing page, including BackgroundLanding and LandingPage. - Created a new home layout with text generation effect and integrated it into the main structure. - Updated Navbar and LandingTabs --------- Co-authored-by: p.damavandi <[email protected]> * feat: handle search product UI * feat: migrate to pnpm, enhance Docker and deployment workflows, and improve clipboard OTP UX (#362) * chore: migrate project to pnpm and update dependencies - Updated package manager from Yarn to pnpm in package.json and Dockerfile. - Adjusted dependency specifications to use workspace:* for local packages. - Removed yarn.lock and added pnpm-lock.yaml for dependency management. - Updated Dockerfile to install pnpm globally and configure it for better network settings. - Refactored middleware and cookie imports to align with new structure. - Cleaned up unused code and comments in various components. * refactor: update docker-compose configuration for core-client service - Renamed core service to core-client for clarity. - Added environment variables for base URL configurations. - Removed commented-out network definitions to clean up the file. * feat: add docker-compose configuration for core-client service - Introduced a new docker-compose file for the core-client service. - Configured build context and Dockerfile path. - Set environment variables for base URL configurations. * feat: add environment variables to Dockerfile for base URL configurations - Introduced environment variables NEXT_PUBLIC_BASE_URL and NEXT_PUBLIC_BASE_URL_ATTACHMENT in the Dockerfile. - Enhanced configuration for better integration with the core-client service. * fix: update base URL in coreApi and guestApi to a hardcoded value - Changed the base URL in coreApi and guestApi from the environment variable to a hardcoded URL for immediate testing. - Added TODO comments to remind future updates to revert to using the environment variable. * feat: enhance authentication components with clipboard OTP functionality - Added a reusable `useClipboardOtp` hook for extracting OTP from the clipboard. - Introduced `PasteOtpButton` component to facilitate pasting OTP directly into forms. - Updated `SetPasswordPage`, `SignupOtpForm`, and other components to utilize the new clipboard functionality. - Enhanced user experience by allowing OTP pasting and auto-submission. - Refactored `PasswordInput` component for better integration with the new features. * feat: add clipboard permission request functionality to useClipboardOtp hook - Introduced a new `requestPermission` method to explicitly request clipboard access. - Added `isRequestingPermission` state to track the permission request status. - Updated `checkClipboard` method to utilize the new permission request logic. - Enhanced the overall clipboard OTP functionality for better user experience. * feat: implement clipboard permission listener in useClipboardOtp hook - Added a useEffect to listen for changes in clipboard permission status. - Automatically checks the clipboard when permission is granted. * feat: add deploy action * feat: add production docker-compose configuration for core-client service - Introduced a new docker-compose.prod.yml file for deploying the core-client service. - Configured service settings including build context, Dockerfile path, and environment variables for base URL configurations. * refactor: update docker-compose configuration for client service - Renamed core-client service to client for clarity. - Updated image reference to use the latest version of the pixel-client. - Adjusted service settings in docker-compose.prod.yml for improved deployment. * chore: enhance Docker Hub deployment process in workflow - Added a step to log in to Docker Hub before building and pushing the Docker image. - Cleaned up the push command by removing redundant login steps from the push action. - Improved overall clarity and efficiency of the deployment workflow. * chore: clean up Docker deployment workflow - Removed unnecessary blank lines in the deploy.yml file for improved readability. - Ensured consistency in the Docker push command formatting. * fix: update Docker deployment workflow to pull client service - Changed the deployment command to pull the client service instead of the web service in the Docker Compose workflow. - Ensured the deployment process aligns with the recent renaming of the core-client service. * chore: remove commented-out Docker build and push steps from deployment workflow - Eliminated unnecessary commented-out lines in the deploy.yml file to enhance clarity and maintainability of the workflow. - Streamlined the deployment process by focusing on active commands. * chore: add concurrency configuration to deployment workflow - Introduced a concurrency group in the deploy.yml file to manage simultaneous workflow runs. - Set the concurrency group to use the branch name, enhancing control over deployment processes. * chore: update deployment workflow to use self-hosted runners - Changed the runner configuration in deploy.yml to use self-hosted runners instead of the default group. - Aimed to optimize deployment performance and resource management. * chore: expose port for core service in production Docker Compose - Added port mapping for the core service to expose port 3000 in docker-compose.prod.yml. - This change allows external access to the service, facilitating communication with other services or clients. * fix: update API base URLs from HTTPS to HTTP - Changed the base URL for both coreApi and guestApi from "https://api.pixelgenius.ir" to "http://api.pixelgenius.ir". - This adjustment ensures consistency in API endpoint usage across the application. * refactor: simplify post-login schema transformation and update docker-compose configuration - Modified the post-login schema transformation to return the original data without modifications. - Updated the docker-compose.yml to rename the core-client service to client and changed the image reference to the latest version, enhancing clarity and consistency. * feat: add development and preview Docker Compose configurations - Introduced docker-compose.dev.yml for development environment with client-dev service. - Added docker-compose.preview.yml for PR previews, allowing dynamic port assignment and image tagging. - Updated deploy.yml to handle deployments for development and PR previews, enhancing CI/CD workflow. * refactor: update PR comment actions in deployment workflow - Replaced the GitHub script action with a sticky pull request comment action for posting deployment and cleanup messages. - Enhanced the preview deployment comment to include a structured message with the preview URL and container details. - Improved the cleanup confirmation comment to provide a clear summary of the resources removed after the PR is closed. * chore: update permissions in deployment workflow - Added permissions for reading contents and writing to pull requests and issues in deploy.yml. - This change enhances the workflow's ability to interact with GitHub resources during deployment processes. * fix: change base url --------- Co-authored-by: p.damavandi <[email protected]>
Description
Changes
Checks
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Chores
Style
Refactor
Documentation