Skip to content

chore: new root key dialog#3637

Merged
perkinsjr merged 2 commits intoroot-key-redisignfrom
eng-1935-ui-a-admin-can-click-create-new-root-key-and-see-a-modal
Jul 21, 2025
Merged

chore: new root key dialog#3637
perkinsjr merged 2 commits intoroot-key-redisignfrom
eng-1935-ui-a-admin-can-click-create-new-root-key-and-see-a-modal

Conversation

@MichaelUnkey
Copy link
Collaborator

@MichaelUnkey MichaelUnkey commented Jul 21, 2025

What does this PR do?

Fixes # (issue)

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Approve appearance.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • New Features
    • Introduced a new button for creating root keys, featuring a form with validation for entering a key name and (future) permissions selection.
    • Added a modal dialog interface for the root key creation process.
  • Refactor
    • Replaced the inline "Create New Root Key" button in the navigation with the new dedicated component for improved maintainability.

@MichaelUnkey MichaelUnkey requested a review from perkinsjr July 21, 2025 16:24
@linear
Copy link

linear bot commented Jul 21, 2025

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2025

⚠️ No Changeset found

Latest commit: 9eb24ea

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

📝 Walkthrough

Walkthrough

A new React component, CreateRootKeyButton, is introduced to encapsulate the UI and logic for creating a root key, including form state and validation. The navigation UI is updated to use this new component, replacing the previous inline JSX button logic. Some mutation and permission selection logic remains stubbed or commented out.

Changes

File(s) Change Summary
.../create-root-key/create-rootkey-button.tsx Added new exported React component CreateRootKeyButton with form handling, validation, and dialog management.
.../settings/root-keys/navigation.tsx Replaced inline "Create New Root Key" button with imported CreateRootKeyButton component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Navigation
    participant CreateRootKeyButton
    participant DialogContainer

    User->>Navigation: Navigates to Root Keys page
    Navigation->>CreateRootKeyButton: Renders button
    User->>CreateRootKeyButton: Clicks "Create New Root Key"
    CreateRootKeyButton->>DialogContainer: Opens modal dialog
    User->>DialogContainer: Fills form, submits (submission currently stubbed)
Loading

Estimated code review effort

2 (~15 minutes)

Possibly related PRs

Suggested reviewers

  • MichaelUnkey
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need 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)

  • @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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@vercel
Copy link

vercel bot commented Jul 21, 2025

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

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 6:15pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
engineering ⬜️ Ignored (Inspect) Visit Preview Jul 21, 2025 6:15pm

@MichaelUnkey MichaelUnkey marked this pull request as ready for review July 21, 2025 16:25
@perkinsjr perkinsjr self-assigned this Jul 21, 2025
@perkinsjr
Copy link
Member

Adding some design things to fix:

** If I click a tool tip it triggers the form input errors* which is annoying for a user.

The tooltips bleed are hidden if they overflow sorry for the bad photo... 😅

CleanShot 2025-07-21 at 12 45 06@2x

Change this to Root Key Name

CleanShot 2025-07-21 at 12 48 00@2x

Copy link
Collaborator Author

ok grabbing a lunch item and ill fix these

@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2025

Thank you for following the naming conventions for pull request titles! 🙏

@vercel vercel bot temporarily deployed to Preview – dashboard July 21, 2025 18:15 Inactive
@perkinsjr
Copy link
Member

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 7

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd4f010 and 9eb24ea.

📒 Files selected for processing (2)
  • apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/navigation.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ogzhanolguncu
PR: unkeyed/unkey#3156
File: apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/index.tsx:112-0
Timestamp: 2025-04-22T11:49:06.167Z
Learning: In the CreateKeyDialog component of Unkey, section navigation is designed to always allow progression even if validation fails, as visual indicators display the validation state of each section.
Learnt from: chronark
PR: unkeyed/unkey#2792
File: apps/dashboard/app/(app)/settings/user/update-user-email.tsx:76-78
Timestamp: 2025-01-07T19:55:33.055Z
Learning: In the Unkey codebase, the Empty component can be used as a container for loading states, as demonstrated in the UpdateUserEmail component where it wraps the Loading component.
Learnt from: ogzhanolguncu
PR: unkeyed/unkey#3242
File: apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/override-indicator.tsx:50-65
Timestamp: 2025-05-15T16:26:08.666Z
Learning: In the Unkey dashboard, Next.js router (router.push) should be used for client-side navigation instead of window.location.href to preserve client state and enable smoother transitions between pages.
Learnt from: ogzhanolguncu
PR: unkeyed/unkey#3315
File: apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/components/general-setup.tsx:40-50
Timestamp: 2025-06-19T13:01:55.338Z
Learning: In the create-key form's GeneralSetup component, the Controller is intentionally bound to "identityId" as the primary field while "externalId" is set explicitly via setValue. The ExternalIdField component has been designed to handle this pattern where it receives identityId as its value prop but manages both identityId and externalId through its onChange callback.
Learnt from: ogzhanolguncu
PR: unkeyed/unkey#2143
File: apps/dashboard/components/ui/group-button.tsx:21-31
Timestamp: 2024-12-03T14:07:45.173Z
Learning: In the `ButtonGroup` component (`apps/dashboard/components/ui/group-button.tsx`), avoid suggesting the use of `role="group"` in ARIA attributes.
Learnt from: chronark
PR: unkeyed/unkey#2146
File: apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx:74-75
Timestamp: 2024-10-04T17:27:09.821Z
Learning: In `apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx`, the hidden `<input>` elements for `workspaceId` and `keyAuthId` work correctly without being registered with React Hook Form.
Learnt from: p6l-richard
PR: unkeyed/unkey#2085
File: apps/www/components/glossary/terms-stepper-mobile.tsx:16-20
Timestamp: 2024-10-23T16:25:33.113Z
Learning: In the `apps/www/components/glossary/terms-stepper-mobile.tsx` file, avoid suggesting to extract the term navigation logic into a custom hook, as the user prefers to keep the component straightforward.
Learnt from: Srayash
PR: unkeyed/unkey#2568
File: apps/dashboard/app/auth/sign-up/oauth-signup.tsx:25-25
Timestamp: 2024-10-25T23:53:41.716Z
Learning: In the React component `OAuthSignUp` (`apps/dashboard/app/auth/sign-up/oauth-signup.tsx`), adding a `useEffect` cleanup function to reset the `isLoading` state causes a "something went wrong" popup to appear before redirecting when a user clicks on signup.
Learnt from: ogzhanolguncu
PR: unkeyed/unkey#2825
File: apps/dashboard/app/(app)/logs-v2/components/controls/components/logs-datetime/index.tsx:0-0
Timestamp: 2025-01-30T20:38:00.058Z
Learning: In the logs dashboard, keyboard shortcuts that toggle UI elements (like popovers) should be implemented in the component that owns the state being toggled, not in the presentational wrapper components. For example, the 'T' shortcut for toggling the datetime filter is implemented in DatetimePopover, not in LogsDateTime.
apps/dashboard/app/(app)/settings/root-keys/navigation.tsx (7)

Learnt from: ogzhanolguncu
PR: #2143
File: apps/dashboard/components/ui/group-button.tsx:21-31
Timestamp: 2024-12-03T14:07:45.173Z
Learning: In the ButtonGroup component (apps/dashboard/components/ui/group-button.tsx), avoid suggesting the use of role="group" in ARIA attributes.

Learnt from: ogzhanolguncu
PR: #3242
File: apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/override-indicator.tsx:50-65
Timestamp: 2025-05-15T16:26:08.666Z
Learning: In the Unkey dashboard, Next.js router (router.push) should be used for client-side navigation instead of window.location.href to preserve client state and enable smoother transitions between pages.

Learnt from: p6l-richard
PR: #2085
File: apps/www/components/glossary/terms-stepper-mobile.tsx:16-20
Timestamp: 2024-10-23T16:25:33.113Z
Learning: In the apps/www/components/glossary/terms-stepper-mobile.tsx file, avoid suggesting to extract the term navigation logic into a custom hook, as the user prefers to keep the component straightforward.

Learnt from: ogzhanolguncu
PR: #3156
File: apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/index.tsx:112-0
Timestamp: 2025-04-22T11:49:06.167Z
Learning: In the CreateKeyDialog component of Unkey, section navigation is designed to always allow progression even if validation fails, as visual indicators display the validation state of each section.

Learnt from: chronark
PR: #2146
File: apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx:74-75
Timestamp: 2024-10-04T17:27:09.821Z
Learning: In apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx, the hidden <input> elements for workspaceId and keyAuthId work correctly without being registered with React Hook Form.

Learnt from: chronark
PR: #3324
File: apps/dashboard/app/(app)/authorization/roles/components/upsert-role/components/warning-callout.tsx:22-27
Timestamp: 2025-07-03T11:57:15.263Z
Learning: The target prop on InlineLink components in the @unkey/ui package is a boolean prop, not a string. When target is truthy, it automatically sets target="_blank" and rel="noopener noreferrer" on the underlying anchor element. Using just target (equivalent to target={true}) is the correct way to make the link open in a new tab.

Learnt from: ogzhanolguncu
PR: #3528
File: apps/dashboard/app/(app)/settings/team/role-switcher.tsx:60-76
Timestamp: 2025-07-11T12:57:39.875Z
Learning: In the Select component from @unkey/ui, when fixing chevron overflow/positioning issues, applying w-fit directly to the SelectTrigger doesn't resolve the problem. A wrapper div with w-fit class around the entire Select component is required to properly contain the chevron within the trigger area.

apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx (4)

Learnt from: ogzhanolguncu
PR: #2143
File: apps/dashboard/components/ui/group-button.tsx:21-31
Timestamp: 2024-12-03T14:07:45.173Z
Learning: In the ButtonGroup component (apps/dashboard/components/ui/group-button.tsx), avoid suggesting the use of role="group" in ARIA attributes.

Learnt from: chronark
PR: #2146
File: apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx:74-75
Timestamp: 2024-10-04T17:27:09.821Z
Learning: In apps/dashboard/app/(app)/apis/[apiId]/settings/default-prefix.tsx, the hidden <input> elements for workspaceId and keyAuthId work correctly without being registered with React Hook Form.

Learnt from: Srayash
PR: #2568
File: apps/dashboard/app/auth/sign-up/oauth-signup.tsx:25-25
Timestamp: 2024-10-25T23:53:41.716Z
Learning: In the React component OAuthSignUp (apps/dashboard/app/auth/sign-up/oauth-signup.tsx), adding a useEffect cleanup function to reset the isLoading state causes a "something went wrong" popup to appear before redirecting when a user clicks on signup.

Learnt from: ogzhanolguncu
PR: #3156
File: apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/index.tsx:112-0
Timestamp: 2025-04-22T11:49:06.167Z
Learning: In the CreateKeyDialog component of Unkey, section navigation is designed to always allow progression even if validation fails, as visual indicators display the validation state of each section.

🪛 GitHub Actions: autofix.ci
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx

[error] 31-31: ESLint correctness/noUnusedVariables: This variable 'rest' is unused. Unused variables usually are result of incomplete refactoring, typos and other source of bugs.


[error] 33-33: ESLint correctness/noUnusedVariables: This variable 'trpcUtils' is unused. Unsafe fix suggested: prepend with underscore.


[error] 35-35: ESLint correctness/noUnusedVariables: This variable 'name' is unused. Unsafe fix suggested: prepend with underscore.


[error] 35-35: ESLint correctness/noUnusedVariables: This variable 'setName' is unused. Unsafe fix suggested: prepend with underscore.


[error] 36-36: ESLint correctness/noUnusedVariables: This variable 'showKeyInSnippet' is unused. Unsafe fix suggested: prepend with underscore.


[error] 36-36: ESLint correctness/noUnusedVariables: This variable 'setShowKeyInSnippet' is unused. Unsafe fix suggested: prepend with underscore.


[error] 37-37: ESLint correctness/noUnusedVariables: This variable 'isConfirmOpen' is unused. Unsafe fix suggested: prepend with underscore.


[error] 37-37: ESLint correctness/noUnusedVariables: This variable 'setIsConfirmOpen' is unused. Unsafe fix suggested: prepend with underscore.


[error] 38-38: ESLint correctness/noUnusedVariables: This variable 'pendingAction' is unused. Unsafe fix suggested: prepend with underscore.


[error] 38-38: ESLint correctness/noUnusedVariables: This variable 'setPendingAction' is unused. Unsafe fix suggested: prepend with underscore.


[error] 45-45: ESLint correctness/noUnusedVariables: This variable 'setValue' is unused.


[error] 46-46: ESLint correctness/noUnusedVariables: This variable 'watch' is unused.


[error] 47-47: ESLint correctness/noUnusedVariables: This variable 'isValid' is unused.


[error] 47-47: ESLint correctness/noUnusedVariables: This variable 'isSubmitting' is unused.


[error] 69-69: ESLint correctness/noUnusedVariables: Parameter 'values' in function 'onSubmit' is unused. Unsafe fix suggested: prepend with underscore.

🔇 Additional comments (3)
apps/dashboard/app/(app)/settings/root-keys/navigation.tsx (1)

7-7: Good refactoring to extract UI logic into a dedicated component.

The extraction of the root key creation functionality into a dedicated CreateRootKeyButton component improves separation of concerns and maintainability. The conditional rendering logic is preserved while abstracting the implementation details.

Also applies to: 79-79

apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx (2)

23-26: Form schema validation looks appropriate.

The Zod schema provides reasonable validation with a 3-50 character range for the name field and array structure for permissions, which aligns with typical root key requirements.


131-131: Submit button is hardcoded as disabled.

The submit button is currently hardcoded as disabled={true}, which prevents form submission. This appears intentional for work-in-progress code, but ensure this gets updated when the mutation logic is implemented.

Verify that the submit functionality will be enabled once the commented mutation code is implemented.

Comment on lines +8 to +9
import { useRouter } from "next/navigation";
import { parseAsArrayOf, useQueryState } from "nuqs";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Remove unused imports.

The useRouter from Next.js navigation and parseAsArrayOf, useQueryState from nuqs are imported but not used in the current implementation.

-import { useRouter } from "next/navigation";
-import { parseAsArrayOf, useQueryState } from "nuqs";
📝 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.

Suggested change
import { useRouter } from "next/navigation";
import { parseAsArrayOf, useQueryState } from "nuqs";
🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
at lines 8 to 9, remove the unused imports: useRouter from next/navigation and
parseAsArrayOf, useQueryState from nuqs, as they are not used anywhere in the
file.

Comment on lines +34 to +43
...rest
}: React.ButtonHTMLAttributes<HTMLButtonElement> & Props) => {
const trpcUtils = trpc.useUtils();
const [isOpen, setIsOpen] = useState(defaultOpen ?? false);
const [name, setName] = useState<string | undefined>(undefined);
const [showKeyInSnippet, setShowKeyInSnippet] = useState(false);
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
const [pendingAction, setPendingAction] = useState<
"close" | "create-another" | "go-to-details" | null
>(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unused state variables to fix linting errors.

Multiple state variables are declared but never used, causing ESLint errors. Since this appears to be work-in-progress code, consider removing unused variables or prefixing them with underscore if they're planned for future use.

-const [name, setName] = useState<string | undefined>(undefined);
-const [showKeyInSnippet, setShowKeyInSnippet] = useState(false);
-const [isConfirmOpen, setIsConfirmOpen] = useState(false);
-const [pendingAction, setPendingAction] = useState<
-    "close" | "create-another" | "go-to-details" | null
->(null);

Or if these are planned for future implementation, prefix with underscore:

+const [_name, _setName] = useState<string | undefined>(undefined);
+const [_showKeyInSnippet, _setShowKeyInSnippet] = useState(false);
+const [_isConfirmOpen, _setIsConfirmOpen] = useState(false);
+const [_pendingAction, _setPendingAction] = useState<
+    "close" | "create-another" | "go-to-details" | null
+>(null);
📝 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.

Suggested change
...rest
}: React.ButtonHTMLAttributes<HTMLButtonElement> & Props) => {
const trpcUtils = trpc.useUtils();
const [isOpen, setIsOpen] = useState(defaultOpen ?? false);
const [name, setName] = useState<string | undefined>(undefined);
const [showKeyInSnippet, setShowKeyInSnippet] = useState(false);
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
const [pendingAction, setPendingAction] = useState<
"close" | "create-another" | "go-to-details" | null
>(null);
...rest
}: React.ButtonHTMLAttributes<HTMLButtonElement> & Props) => {
const trpcUtils = trpc.useUtils();
const [isOpen, setIsOpen] = useState(defaultOpen ?? false);
🧰 Tools
🪛 GitHub Actions: autofix.ci

[error] 35-35: ESLint correctness/noUnusedVariables: This variable 'name' is unused. Unsafe fix suggested: prepend with underscore.


[error] 35-35: ESLint correctness/noUnusedVariables: This variable 'setName' is unused. Unsafe fix suggested: prepend with underscore.


[error] 36-36: ESLint correctness/noUnusedVariables: This variable 'showKeyInSnippet' is unused. Unsafe fix suggested: prepend with underscore.


[error] 36-36: ESLint correctness/noUnusedVariables: This variable 'setShowKeyInSnippet' is unused. Unsafe fix suggested: prepend with underscore.


[error] 37-37: ESLint correctness/noUnusedVariables: This variable 'isConfirmOpen' is unused. Unsafe fix suggested: prepend with underscore.


[error] 37-37: ESLint correctness/noUnusedVariables: This variable 'setIsConfirmOpen' is unused. Unsafe fix suggested: prepend with underscore.


[error] 38-38: ESLint correctness/noUnusedVariables: This variable 'pendingAction' is unused. Unsafe fix suggested: prepend with underscore.


[error] 38-38: ESLint correctness/noUnusedVariables: This variable 'setPendingAction' is unused. Unsafe fix suggested: prepend with underscore.

🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
around lines 34 to 43, several state variables like name, showKeyInSnippet,
isConfirmOpen, and pendingAction are declared but not used, causing ESLint
errors. To fix this, either remove these unused state declarations if they are
not needed yet, or prefix their names with an underscore to indicate they are
intentionally unused placeholders for future implementation.

Comment on lines +48 to +57
const {
register,
handleSubmit,
setValue,
watch,
formState: { errors, isValid, isSubmitting },
} = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
mode: "onChange",
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix unused form hook variables.

Several variables from the form hook are unused, causing linting errors. Clean up unused variables or prefix with underscore if planned for future use.

const {
    register,
    handleSubmit,
-    setValue,
-    watch,
-    formState: { errors, isValid, isSubmitting },
+    formState: { errors },
} = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
    mode: "onChange",
});
📝 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.

Suggested change
const {
register,
handleSubmit,
setValue,
watch,
formState: { errors, isValid, isSubmitting },
} = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
mode: "onChange",
});
const {
register,
handleSubmit,
formState: { errors },
} = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
mode: "onChange",
});
🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
between lines 48 and 57, several variables returned from the useForm hook are
unused, causing linting errors. Remove the unused variables from the
destructuring assignment or prefix them with an underscore if you intend to use
them later, to resolve the lint warnings.

Comment on lines +59 to +101
// const selectedPermissions = watch("permissions");

// const create = trpc.rootKey.create.useMutation({
// onSuccess: async (res) => {
// toast.success("Your Root Key has been created");
// await revalidate("/settings/root-keys");
// api.overview.query.invalidate();
// router.push(`/settings/root-keys/${res.keyId}`);
// setIsOpen(false);
// },
// onError: (error) => {
// console.error(error);
// toast.error(error.message);
// },
// });

async function onSubmit(values: z.infer<typeof formSchema>) {
// create.mutate({
// name: values.name,
// permissions: [],
// });
}

// function handlePermissionChange(permission: string, checked: boolean) {
// const current = new Set(selectedPermissions);
// if (checked) {
// current.add(permission);
// } else {
// current.delete(permission);
// }
// setValue("permissions", Array.from(current), { shouldValidate: true });
// }

// function handleSelectAll(group: string, checked: boolean) {
// const groupPerms = PERMISSIONS.find((g) => g.group === group)?.permissions || [];
// const current = new Set(selectedPermissions);
// if (checked) {
// groupPerms.forEach((p) => current.add(p));
// } else {
// groupPerms.forEach((p) => current.delete(p));
// }
// setValue("permissions", Array.from(current), { shouldValidate: true });
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider cleaning up extensive commented code.

There's a large amount of commented-out code for mutation handling and permission selection. For work-in-progress code, consider either:

  1. Removing commented code and tracking planned features in TODOs/issues
  2. Converting key commented sections to TODO comments with specific implementation plans

This will improve code readability and maintainability.

Example approach:

-// const selectedPermissions = watch("permissions");
-// const create = trpc.rootKey.create.useMutation({...});
+// TODO: Implement permission selection logic
+// TODO: Implement TRPC mutation for root key creation with proper error handling

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: autofix.ci

[error] 69-69: ESLint correctness/noUnusedVariables: Parameter 'values' in function 'onSubmit' is unused. Unsafe fix suggested: prepend with underscore.

🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
between lines 59 and 101, there is a large block of commented-out code related
to mutation handling and permission selection. To improve readability and
maintainability, remove this commented code entirely if it is not immediately
needed, or replace it with concise TODO comments that clearly describe the
intended future implementation. This keeps the code clean while preserving the
plan for these features.

Comment on lines +75 to +80
async function onSubmit(values: z.infer<typeof formSchema>) {
// create.mutate({
// name: values.name,
// permissions: [],
// });
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix unused parameter in submit handler.

The values parameter is unused, causing a linting error. Since this is a stub implementation, prefix with underscore to indicate intentional non-use.

-async function onSubmit(values: z.infer<typeof formSchema>) {
+async function onSubmit(_values: z.infer<typeof formSchema>) {
    // create.mutate({
    //     name: values.name,
    //     permissions: [],
    // });
}
📝 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.

Suggested change
async function onSubmit(values: z.infer<typeof formSchema>) {
// create.mutate({
// name: values.name,
// permissions: [],
// });
}
async function onSubmit(_values: z.infer<typeof formSchema>) {
// create.mutate({
// name: values.name,
// permissions: [],
// });
}
🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
around lines 75 to 80, the onSubmit function has an unused parameter 'values'
causing a linting error. Rename the parameter to '_values' to indicate
intentional non-use and resolve the lint warning while keeping the stub
implementation.

Comment on lines +145 to +151
<FormInput
label="Name"
description="Give your key a name, this is not customer facing."
error={errors.name?.message}
{...register("name")}
placeholder="key-name"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider label clarity based on PR feedback.

The current label is "Name" which is generic. Based on the PR comments, there was feedback to change "Root Key" to "Root Key Name" for clarity. Consider using a more descriptive label like "Root Key Name" to improve user understanding.

<FormInput
-    label="Name"
+    label="Root Key Name"
    description="Give your key a name, this is not customer facing."
    error={errors.name?.message}
    {...register("name")}
    placeholder="key-name"
/>
📝 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.

Suggested change
<FormInput
label="Name"
description="Give your key a name, this is not customer facing."
error={errors.name?.message}
{...register("name")}
placeholder="key-name"
/>
<FormInput
- label="Name"
+ label="Root Key Name"
description="Give your key a name, this is not customer facing."
error={errors.name?.message}
{...register("name")}
placeholder="key-name"
/>
🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
around lines 145 to 151, update the FormInput label from "Name" to "Root Key
Name" to improve clarity and align with PR feedback. This change will make the
label more descriptive and help users better understand the input purpose.

Comment on lines +158 to +160
<Button type="button" variant="outline" size="md" className="w-fit rounded-lg pl-3">
Select Permissions...
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Implement permissions selection functionality.

The permissions selection is currently just a placeholder button. This is likely the next step in the implementation to address the form's permissions validation requirement.

Would you like me to help implement the permissions selection UI or create an issue to track this functionality?

🤖 Prompt for AI Agents
In
apps/dashboard/app/(app)/settings/root-keys/components/create-root-key/create-rootkey-button.tsx
around lines 158 to 160, the "Select Permissions..." button is currently a
placeholder without functionality. Implement the permissions selection UI by
adding an interactive component such as a dropdown or modal that allows users to
choose permissions. Connect this UI to the form state to ensure permissions are
properly captured and validated. If this is a larger task, create a tracking
issue to implement this feature incrementally.

@perkinsjr perkinsjr merged commit ea21fd6 into root-key-redisign Jul 21, 2025
9 of 10 checks passed
@graphite-app
Copy link

graphite-app bot commented Jul 21, 2025

Ad gif. Sitting in front of an old computer, '90s child actor Brent Rambo gives a robust thumbs up to the camera, his mouth a confident upside-down crescent. His autograph is superimposed onto the scene, giving the impression that his stamp of approval truly matters.  (Added via Giphy)

@perkinsjr perkinsjr deleted the eng-1935-ui-a-admin-can-click-create-new-root-key-and-see-a-modal branch July 21, 2025 18:22
@graphite-app
Copy link

graphite-app bot commented Jul 21, 2025

Graphite Automations

"Post a GIF when PR approved" took an action on this PR • (07/21/25)

1 gif was posted to this PR based on Andreas Thomas's automation.

@coderabbitai coderabbitai bot mentioned this pull request Aug 14, 2025
18 tasks
perkinsjr added a commit that referenced this pull request Aug 20, 2025
* chore: new root key dialog (#3637)

* Dialog created

* small changes

* feat: ui show permission side bar when select permission button is (#3654)

* Dialog created

* small changes

* half functional

* small spacing changes and chevron

* Rabbit Changes

* remove useffect

* feat: UI when a permission is selected it should show in the modal (#3663)

* Dialog created

* small changes

* half functional

* small spacing changes and chevron

* Rabbit Changes

* remove useffect

* almost

* re ordered badge list collapse

* undo rabbit

* [autofix.ci] apply automated fixes

* fix scroll

* button size and margin

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: UI when a user searches for a permission it should show (#3695)

* Dialog created

* small changes

* half functional

* small spacing changes and chevron

* Rabbit Changes

* remove useffect

* almost

* re ordered badge list collapse

* undo rabbit

* [autofix.ci] apply automated fixes

* fix scroll

* changes before merge

* functioning again

* style change

* more tweaks

* Fix all the fucking things

* remove close button

* fmt

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: James Perkins <jamesperkins@hey.com>

* feat: rootkey create with success dialog and confirm close (#3714)

* Dialog created

* small changes

* half functional

* small spacing changes and chevron

* Rabbit Changes

* remove useffect

* almost

* re ordered badge list collapse

* undo rabbit

* [autofix.ci] apply automated fixes

* fix scroll

* changes before merge

* functioning again

* style change

* more tweaks

* Fix all the fucking things

* remove close button

* fmt

* dialog and confirm added

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: James Perkins <jamesperkins@hey.com>

* feat: a user selects edit root key and an edit root key modal (#3731)

* Dialog created

* small changes

* half functional

* small spacing changes and chevron

* Rabbit Changes

* remove useffect

* almost

* re ordered badge list collapse

* undo rabbit

* [autofix.ci] apply automated fixes

* fix scroll

* changes before merge

* chore: deprecate v1 endpoints (#3680)

* fix: openapi

* chore: deprecate v1 endpoints

* fix: vault credentials and chproxy config (#3681)

* fix: openapi

* fix: vault credentials and chproxy config

* fix: rename flag accessor too

* fix: linter issues

* fix: some more v2 api changes (#3677)

* remove namespaceID

* actually use limit and cursor

* filter out delted overrides

* fix error messages list endpoints

* fix more error messages

* ensure identity create handles like permission/role create

* fix regex for roles

* fix regex for roles

* fix list keys cursor

* fix: uppercase common files (#3683)

* name files uppercase

* name files uppercase

* [autofix.ci] apply automated fixes

* name files uppercase

* name files uppercase

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: conflicting casing (#3689)

* fix the openapi spec again (#3692)

* dont trace chproxy endpoints (#3691)

* fix: log verifications to the owning workspace (#3693)

* functioning again

* style change

* more tweaks

* fix: validate s3 config (#3694)

* Fix all the fucking things

* remove close button

* fmt

* fix: speakeasy ignore directive is ignored if it's a string (#3699)

* fix: upsert permissions with slug or name colission (#3696)

* fix: upsert permissions with slug or name colission

* chore: also remove index

* fix permission test and remove unnnecessary test

---------

Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>

* docs: migration (#3678)

* fix: openapi

* docs: migration from v1 to v2

* fix: remove binaries

* [autofix.ci] apply automated fixes

* docs: add james' feedback

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: api list keys zod errors (#3702)

* fix api zod errors

* [autofix.ci] apply automated fixes

* make array handling uniform

* make array handling uniform

* fix rabbi comment

* fix: permission array for roles

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* ci: don't build for windows and freebsd (#3700)

* docs: errors (#3703)

* chore: move sdks to unkeyed/sdks (#3701)

* fix: omitting array vs null (#3704)

* fix omitting array vs null

* [autofix.ci] apply automated fixes

* fix flakey test

* fix flakey test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: panics not being catched (#3706)

* fix panics not being catched

* feat: add counter to track panics

Signed-off-by: Ian Meyer <k@imeyer.io>

---------

Signed-off-by: Ian Meyer <k@imeyer.io>
Co-authored-by: Ian Meyer <k@imeyer.io>

* docs: use `CodeGroup` in hono/nextjs TS libraries (#3708)

* Update hono.mdx

* Update nextjs.mdx

* ci: remove outdated steps and flows (#3709)

* docs: update sdks (#3712)

* docs: update sdks

* Update nextjs.mdx

* [autofix.ci] apply automated fixes

* fix: rabbit feedback

* Update nextjs.mdx

* fix: root key is required

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* dialog and confirm added

* feat(deployment beta): projects UI for Unkey Deploy (#3662)

* projects and branches

* wip

* wip

* spec differ wip

* fix some docker, add some trpc, integrate diff viewer

* change version to deployments, add feature flag, update go schema

* update versions page

* fix null condition

* delete old router, fix null assertion

* fmt

* fmt

* fmt again

* apply auth and feature flagging access to projects, remove versions

* yolo

* stable yolo

* stable yolo

* style: fmt

* fix: hardcode time, so it doesn't fail on the first of a month

* [autofix.ci] apply automated fixes

---------

Co-authored-by: chronark <dev@chronark.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* chore: add missingd delete endpoint for v2 (#3711)

* only log key at the end (#3716)

* fix: allow wildcard and colon in permissions query (#3717)

* remove regex for permissions

* allow for asterix and colon in permissions

* fix: update identity by identity key instead of externalId and fix wrong body for permission and role (#3713)

* docs and remove externalId from keyResponse

* fix updateIdentity to take in an identity parameter instead of an externalId

* fix get role/permission

* Update go/apps/api/openapi/spec/common/Permission.yaml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update openapi-generated.yaml

* fix comment

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* chore: openapi references (#3723)

* feat: add paginated tRPC endpoint for projects (#3697)

* feat: add new endpoint for deploy projects

* chore: replace file path

* [autofix.ci] apply automated fixes

* feat: add missing endpoint

* fix: trpc path

* fix: add feature flag

* chore: remove optin

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: region not showing and wrong rl id (#3722)

* fix: region not showing and wrong rl id

* pass region down

* perf: bad get key performance (#3724)

* perf: make getKey 2 seperate queries so mysql chooses correct idx

* fix query

* fix query name

* docs: verify identities endpoints (#3727)

* chore: docs (#3728)

* chore: fixup migration guide

* adjust more

* adjust more

* adjust more

* rabbit comments

* Update index.mdx

* working updates

* re factor for clarity

* only update if diff than existing

* [autofix.ci] apply automated fixes

* re name create-root-key to root-key folder

---------

Signed-off-by: Ian Meyer <k@imeyer.io>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>
Co-authored-by: Oğuzhan Olguncu <21091016+ogzhanolguncu@users.noreply.github.com>
Co-authored-by: James Perkins <jamesperkins@hey.com>
Co-authored-by: Ian Meyer <k@imeyer.io>
Co-authored-by: JA Castro <51177379+ubinatus@users.noreply.github.com>
Co-authored-by: Meg Stepp <mcstepp@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fresh

* start rabbit changes

* rabbits

* missing processing

* Update apps/dashboard/lib/trpc/routers/index.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/dashboard/app/(app)/settings/root-keys/components/root-key/components/permission-badge-list.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* more rabbit

* function name

* [autofix.ci] apply automated fixes

* minor changes

* rabbit checked locally

* comment changes

* light mode fix

* removed old page files

* updated success

* slack comment changes

* cleanup

* rabbit

* more rabbits

* most consts

* change clear and details

* cleanup

* pr suggested changes

* few nits

---------

Signed-off-by: Ian Meyer <k@imeyer.io>
Co-authored-by: CodeReaper <148160799+MichaelUnkey@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>
Co-authored-by: Oğuzhan Olguncu <21091016+ogzhanolguncu@users.noreply.github.com>
Co-authored-by: Ian Meyer <k@imeyer.io>
Co-authored-by: JA Castro <51177379+ubinatus@users.noreply.github.com>
Co-authored-by: Meg Stepp <mcstepp@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: MichaelUnkey <michael@unkey.com>
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.

2 participants