Zero icon indicating copy to clipboard operation
Zero copied to clipboard

Early access generate

Open nizzyabi opened this issue 8 months ago • 2 comments

NEVER MERGE

Summary by CodeRabbit

  • New Features

    • Introduced customizable and persistent keyboard shortcuts, including shortcut editing, recording, and per-user storage.
    • Added hotkey management UI and global/local scope support for keyboard shortcuts throughout the mail app.
    • Implemented early access user management, including bulk selection, confirmation, and automated welcome emails.
    • Added Farsi (Persian) language support and localization structure.
  • Improvements

    • Enhanced keyboard navigation and hotkey handling using a new provider and external library.
    • Refined navigation and quick action handling in mail lists.
    • Enabled editing and resetting of shortcuts with IndexedDB and server sync.
    • Improved code formatting and UI consistency in several components.
  • Bug Fixes

    • Fixed environment variable handling and service configuration in Docker and compose files.
  • Chores

    • Added new database tables and migrations for user hotkeys.
    • Updated dependencies and localization files.

nizzyabi avatar Apr 17 '25 16:04 nizzyabi

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
0 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2025 5:44pm

vercel[bot] avatar Apr 17 '25 16:04 vercel[bot]

[!IMPORTANT]

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a comprehensive user hotkeys system and Farsi language support. It adds a new database table and API endpoints for storing user-specific keyboard shortcuts, a frontend IndexedDB-based persistence layer, and a complete React integration for recording, editing, and using hotkeys via the react-hotkeys-hook library. The previous custom hotkey hook is removed, and the UI is refactored to support persistent, editable shortcuts with scope-based activation. Additionally, Farsi (Persian) localization is added, including configuration updates and a new, structured locale file. The deployment setup is enhanced with a Dockerfile and updated Docker Compose configuration.

Changes

Files / Group Change Summary
Dockerfile, docker-compose.yaml Add Dockerfile for Bun/Next.js app; update Compose to add app service, use env vars for tokens.
apps/mail/package.json Add react-hotkeys-hook dependency.
apps/mail/config/shortcuts.ts Redefine shortcut structure: add metadata, types, scope, preventDefault; update key bindings.
apps/mail/lib/hotkeys/hotkeys-db.ts, .../use-hotkey-utils.ts, .../compose-hotkeys.tsx, .../global-hotkeys.tsx, .../mail-list-hotkeys.tsx, .../thread-display-hotkeys.tsx Add IndexedDB hotkey persistence, new hotkey hooks/utilities, and React components for each hotkey scope.
apps/mail/app/(routes)/settings/shortcuts/page.tsx, .../hotkey-recorder.tsx Refactor shortcuts page to use stateful, persistent, and editable hotkeys; add hotkey recording dialog.
apps/mail/components/providers/hotkey-provider-wrapper.tsx, .../layout.tsx, .../mail/layout.tsx Add hotkey provider wrapper and integrate into layouts; replace old hotkey components.
apps/mail/components/mail/keyboard-shortcuts.tsx, apps/mail/hooks/use-hot-key.ts Remove old hotkey component and custom hook.
apps/mail/components/create/create-email.tsx, .../draft/drafts-list.tsx, .../draft/drafts.tsx, .../mail/mail-list.tsx, .../mail/mail.tsx, .../mail/reply-composer.tsx, .../ui/ai-sidebar.tsx Refactor components to use new hotkey context/hooks, remove old logic, improve formatting.
apps/mail/app/api/v1/hotkeys/route.ts, .../api/resend/add-to-audience/route.ts, .../api/resend/send-early-access/route.ts Add API endpoints for hotkey management and Resend audience/email features.
apps/mail/app/(full-width)/early-access/early-access.tsx, .../page.tsx, .../.env.example Add early access management UI and API integration; update env example.
apps/mail/config/navigation.ts Enable shortcuts settings menu item.
apps/mail/i18n/config.ts, .../locales/en.json, .../locales/fa.json, i18n.json Add Farsi language support, update locale config, add new strings.
packages/db/migrations/0022_round_violations.sql, .../meta/0022_snapshot.json, .../meta/_journal.json, .../src/schema.ts Add userHotkeys table and schema migration for user-specific shortcuts.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (Shortcuts Page)
    participant HotkeysDB (IndexedDB)
    participant API (/api/v1/hotkeys)
    participant DB

    User->>UI (Shortcuts Page): Open settings/shortcuts
    UI->>HotkeysDB: getAllHotkeys()
    HotkeysDB->>API: (if not initialized) GET /api/v1/hotkeys
    API->>DB: Query userHotkeys table
    DB-->>API: Return shortcuts
    API-->>HotkeysDB: Return shortcuts
    HotkeysDB-->>UI: Return merged shortcuts

    User->>UI: Edit/record a shortcut
    UI->>HotkeysDB: saveHotkey(shortcut)
    HotkeysDB->>API: PUT /api/v1/hotkeys (sync)
    API->>DB: Upsert shortcut
    DB-->>API: Ack
    API-->>HotkeysDB: Ack
    HotkeysDB-->>UI: Ack

    User->>UI: Use hotkey in app
    UI->>HotkeysDB: getHotkey(action)
    HotkeysDB-->>UI: Return shortcut
    UI->>UI: Activate handler for shortcut

Possibly related PRs

  • Mail-0/Zero#591: Introduces the same Dockerfile and Compose changes for deployment, directly related to containerization setup.
  • Mail-0/Zero#636: Adds Farsi language support, updating locale files and config, matching the i18n changes here.
  • Mail-0/Zero#649: Implements the new hotkeys system, including hooks, providers, and UI integration, directly related to the hotkey feature.

Suggested reviewers

  • MrgSub

Poem

In the garden of code, a new breeze blows,
Hotkeys now bloom where the old logic goes.
Farsi joins in, with scripts flowing right,
Shortcuts are captured—recorded in light!
Docker sets sail, the Compose ship departs,
Rabbits tap keys, and joy fills their hearts.

(🐇✨⌨️🌱)


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 17 '25 16:04 coderabbitai[bot]