Skip to content

Conversation

samejr
Copy link
Member

@samejr samejr commented Sep 29, 2025

Adds a shortcut key to the admin area if only 1 filter result is shown for faster access

Copy link

changeset-bot bot commented Sep 29, 2025

⚠️ No Changeset found

Latest commit: bfe72f4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

  • apps/webapp/app/components/primitives/Buttons.tsx: Always invokes the shortcut hook for Button and LinkButton; computes disabled as existing disabled OR absence of props.shortcut; shortcut action triggers click and prevents default/propagation when present.
  • apps/webapp/app/routes/admin._index.tsx: Impersonate Button now conditionally receives a shortcut (mod+Enter, enabled on input elements) when exactly one user exists.
  • apps/webapp/app/routes/admin.orgs.tsx: Impersonate LinkButton now conditionally receives a shortcut (mod+Enter, enabled on input elements) when exactly one organization exists.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current description is a single-line summary and does not follow the repository’s required template sections, such as the issue closure line, checklist, testing steps, changelog, and screenshots. Please update the description to match the provided template by including “Closes #”, completing the checklist items for contribution and testing, detailing the testing steps taken, adding a brief changelog entry, and attaching any relevant screenshots.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "chore(webapp) adds shortcut key for admin area" is fully related to the main change in the changeset. The primary functional change is adding keyboard shortcuts (mod+Enter) to the Impersonate buttons in the admin routes when a single filtered result is displayed. While the PR also refactors the Button/LinkButton components to always invoke the shortcut hook (changing from conditional to unconditional invocation with a disabled flag), this is an implementation detail that supports the main feature. The title accurately captures the developer-facing intent: adding shortcut functionality to the admin area, which is clear and specific enough for teammates to understand the primary change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore(webapp)-add-shortcut-key-for-admin-area

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Tip

🧪 Early access (models): enabled

We are currently testing Sonnet 4.5 code review models, which should lead to better review quality. However, this model may result in higher noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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)
apps/webapp/app/components/primitives/Buttons.tsx (1)

347-355: Parity with Button: consider preventing default/propagation

For LinkButton’s shortcut action you don’t preventDefault/stopPropagation, unlike Button. It’s usually harmless, but aligning behaviors reduces surprises if global handlers exist. Optionally:

-  action: () => {
+  action: (e) => {
     if (innerRef.current) {
       innerRef.current.click();
+      e.preventDefault();
+      e.stopPropagation();
     }
   },
apps/webapp/app/routes/admin.orgs.tsx (1)

120-124: LGTM: Scoped shortcut only when a single result exists

Conditionally enabling mod+Enter for the single-org case reads well and avoids conflicts when multiple rows are present. Nice touch enabling on input elements so it works from the search field.

Minor: if you want screen readers to announce the shortcut, consider adding aria-keyshortcuts via Button/LinkButton when shortcut is set (e.g., Meta+Enter/Control+Enter). I can draft a utility if helpful.

apps/webapp/app/routes/admin._index.tsx (1)

147-151: LGTM: Shortcut for single-user impersonation

The conditional mod+Enter shortcut improves flow and matches the orgs page behavior. Works with the new Button wiring.

Optional: same a11y note about aria-keyshortcuts for discoverability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddebe4d and e0c8c09.

📒 Files selected for processing (3)
  • apps/webapp/app/components/primitives/Buttons.tsx (2 hunks)
  • apps/webapp/app/routes/admin._index.tsx (1 hunks)
  • apps/webapp/app/routes/admin.orgs.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/routes/admin.orgs.tsx
  • apps/webapp/app/components/primitives/Buttons.tsx
  • apps/webapp/app/routes/admin._index.tsx
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/routes/admin.orgs.tsx
  • apps/webapp/app/components/primitives/Buttons.tsx
  • apps/webapp/app/routes/admin._index.tsx
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

When importing from @trigger.dev/core in the webapp, never import the root package path; always use one of the documented subpath exports from @trigger.dev/core’s package.json

Files:

  • apps/webapp/app/routes/admin.orgs.tsx
  • apps/webapp/app/components/primitives/Buttons.tsx
  • apps/webapp/app/routes/admin._index.tsx
🧬 Code graph analysis (1)
apps/webapp/app/components/primitives/Buttons.tsx (1)
apps/webapp/app/hooks/useShortcutKeys.tsx (1)
  • useShortcutKeys (28-57)
⏰ 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). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/webapp/app/components/primitives/Buttons.tsx (1)

301-311: No change needed: createKeysFromShortcut already handles undefined
createKeysFromShortcut returns an empty array when passed undefined, so calling it unconditionally won’t crash. No update required.

@samejr samejr changed the title Chore(webapp) add shortcut key for admin area chore(webapp) adds shortcut key for admin area Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant