Skip to content

chore: select added to ui and eng docs#3214

Merged
MichaelUnkey merged 3 commits intomainfrom
move-select-to-ui-and-eng-docs
May 5, 2025
Merged

chore: select added to ui and eng docs#3214
MichaelUnkey merged 3 commits intomainfrom
move-select-to-ui-and-eng-docs

Conversation

@MichaelUnkey
Copy link
Collaborator

@MichaelUnkey MichaelUnkey commented May 1, 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?

  • All Dashboard Select components still work as they should

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 new Select component examples and documentation, showcasing multiple visual variants and usage patterns.
    • Added Select and Settings Card components to the UI library.
  • Documentation

    • Added comprehensive documentation for the Select component, including accessibility, usage guidelines, and best practices.
  • Chores

    • Updated dependencies to include the Select component package.
    • Standardized import sources for Select components across the application to use the external UI library.

@vercel
Copy link

vercel bot commented May 1, 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 May 5, 2025 2:46pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
engineering ⬜️ Ignored (Inspect) Visit Preview May 5, 2025 2:46pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 1, 2025

📝 Walkthrough

Walkthrough

This set of changes primarily migrates the import source of Select UI components (Select, SelectContent, SelectItem, SelectTrigger, SelectValue) from a local implementation to the external @unkey/ui package across multiple files in the dashboard and engineering applications. Additionally, new documentation and example files for the Select component are introduced, and the internal UI package is updated to export and support the Select component. The dependency @radix-ui/react-select is added to the UI package, and minor import path adjustments and export order changes are made within the UI library.

Changes

File(s) Change Summary
apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/components/credits-setup.tsx
apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx
apps/dashboard/app/(app)/apis/[apiId]/select.tsx
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_components/identifier-dialog.tsx
apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/add-permission-for-api.tsx
apps/dashboard/app/(app)/settings/team/client.tsx
apps/dashboard/app/(app)/settings/team/invite.tsx
apps/dashboard/app/(app)/settings/team/role-switcher.tsx
apps/dashboard/app/(app)/settings/vercel/client.tsx
apps/dashboard/app/integrations/vercel/callback/client.tsx
Changed import source of Select UI components from local implementation to external @unkey/ui package. No functional changes.
apps/dashboard/components/dashboard/feedback-component.tsx Updated Select component import to use @unkey/ui/src/components/select instead of a relative path.
apps/engineering/content/design/components/select.example.tsx Added new example file demonstrating usage of Select component and its variants.
apps/engineering/content/design/components/select.mdx Added new documentation file for the Select component, describing features, usage, and best practices.
internal/ui/package.json Added @radix-ui/react-select as a new dependency.
internal/ui/src/components/select.tsx Changed import path for utility function cn to a relative path; updated color tokens and added dark mode background colors in styling variants.
internal/ui/src/index.ts Added exports for select and settings-card components; reordered some exports.

Sequence Diagram(s)

sequenceDiagram
  participant AppComponent as Dashboard/App Component
  participant UnkeyUI as @unkey/ui (Select)
  AppComponent->>UnkeyUI: Import Select, SelectContent, etc.
  AppComponent->>UnkeyUI: Render Select component in UI
  Note right of AppComponent: All select dropdowns now use external UI package
Loading

Suggested reviewers

  • perkinsjr
  • mcstepp
  • ogzhanolguncu
  • chronark

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 245b3df and 65ce3b0.

📒 Files selected for processing (1)
  • internal/ui/src/components/select.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/ui/src/components/select.tsx
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Build / Build
  • GitHub Check: Test API / API Test Local
✨ 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.
    • 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.

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.

@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2025

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

@vercel vercel bot temporarily deployed to Preview – dashboard May 1, 2025 20:23 Inactive
@MichaelUnkey MichaelUnkey marked this pull request as ready for review May 1, 2025 20:24
@MichaelUnkey MichaelUnkey enabled auto-merge May 1, 2025 20:25
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 (4)
apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/components/credits-setup.tsx (1)

3-3: Import migration to @unkey/ui is correct.
Switching to the external Select exports from @unkey/ui aligns with the new UI library structure and should replace the local component. Ensure that the local @/components/ui/select implementation is removed if it’s no longer used.

apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/add-permission-for-api.tsx (1)

5-5: Inconsistent UI import sources—consider unifying.
You’ve migrated Select* to @unkey/ui but still import Dialog from the local UI path (@/components/ui/dialog). For consistency and ease of maintenance, consider migrating all shared primitives (Dialog, FormInput, etc.) to @unkey/ui.

apps/dashboard/components/dashboard/feedback-component.tsx (1)

16-22: Import path is inconsistent with other files

While other files in this PR use @unkey/ui for importing Select components, this file uses a deeper path @unkey/ui/src/components/select. Consider standardizing to use the same import path across all files.

-import {
-  Select,
-  SelectContent,
-  SelectItem,
-  SelectTrigger,
-  SelectValue,
-} from "@unkey/ui/src/components/select";
+import {
+  Select,
+  SelectContent,
+  SelectItem,
+  SelectTrigger,
+  SelectValue,
+} from "@unkey/ui";
apps/engineering/content/design/components/select.mdx (1)

1-78: Well-structured Select component documentation

The documentation is comprehensive, covering features, variants, usage examples, props, accessibility, and best practices for the Select component. The content is well-organized with clear sections and includes all necessary information for developers to effectively implement and use the component.

One minor formatting suggestion in the Variants section (lines 21-27): Consider adding a blank line after the colon in line 23 before starting the list items for consistent formatting with other sections of the document.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~23-~23: Loose punctuation mark.
Context: ...ent supports four variants: - default: Standard select with gray styling - `su...

(UNLIKELY_OPENING_PUNCTUATION)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f5d8fe8 and 245b3df.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • apps/dashboard/app/(app)/apis/[apiId]/_components/create-key/components/credits-setup.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/select.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/_components/identifier-dialog.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/add-permission-for-api.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/team/client.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/team/invite.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/team/role-switcher.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/vercel/client.tsx (1 hunks)
  • apps/dashboard/app/integrations/vercel/callback/client.tsx (1 hunks)
  • apps/dashboard/components/dashboard/feedback-component.tsx (1 hunks)
  • apps/engineering/content/design/components/select.example.tsx (1 hunks)
  • apps/engineering/content/design/components/select.mdx (1 hunks)
  • internal/ui/package.json (1 hunks)
  • internal/ui/src/components/select.tsx (1 hunks)
  • internal/ui/src/index.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
apps/engineering/content/design/components/select.mdx

[uncategorized] ~23-~23: Loose punctuation mark.
Context: ...ent supports four variants: - default: Standard select with gray styling - `su...

(UNLIKELY_OPENING_PUNCTUATION)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Build / Build
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test ./internal/clickhouse
🔇 Additional comments (15)
internal/ui/package.json (1)

19-19: Verify new dependency version and peerDependency strategy.
Adding @radix-ui/react-select@^2.0.0 is necessary for the new Select component, but please confirm that this version aligns with the rest of your Radix UI dependencies and consider whether @radix-ui/react-select should live in peerDependencies instead of dependencies to avoid duplicate installations in consuming apps.

internal/ui/src/components/select.tsx (1)

7-7: Confirm relative import path for cn.
The change from an absolute to a relative import ("../lib/utils") looks intentional, but please verify that cn is correctly exported from src/lib/utils.ts and that there are no stale references to the old path.

apps/dashboard/app/(app)/apis/[apiId]/select.tsx (2)

3-3: Import update for Select components looks good.
Aligning all Select imports with @unkey/ui ensures consistency across the codebase.


38-39: Verify usage of defaultValue on <SelectValue>.
Radix’s <Select.Value> typically accepts a placeholder prop rather than defaultValue. Please confirm that defaultValue={selected} renders as expected; otherwise, consider changing to:

- <SelectValue defaultValue={selected} />
+ <SelectValue placeholder={interval[selected]} />
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_components/identifier-dialog.tsx (1)

9-9: LGTM: Clean import from the UI package

This import correctly uses the standardized path from @unkey/ui, which helps maintain consistency across the codebase.

apps/dashboard/app/(app)/settings/vercel/client.tsx (1)

25-25: LGTM: Clean import from the UI package

This import correctly uses the standardized path from @unkey/ui, which helps maintain consistency across the codebase.

apps/dashboard/app/(app)/settings/team/invite.tsx (1)

17-17: LGTM: Clean import from the UI package

This import correctly uses the standardized path from @unkey/ui, which helps maintain consistency across the codebase.

apps/dashboard/app/integrations/vercel/callback/client.tsx (1)

14-14: Import changed from local to package component.

The import source for Select components has been successfully migrated from a local path to the @unkey/ui package, aligning with the standardization efforts across the codebase.

apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx (1)

28-28: Import migrated to use shared UI package.

The Select component imports have been successfully updated to use the @unkey/ui package instead of local components, maintaining consistency with other files in the codebase.

apps/dashboard/app/(app)/settings/team/client.tsx (1)

5-13: Import reordering and source migration.

The import changes look good:

  1. The trpc import was moved earlier in the import list
  2. The Select component imports now use the @unkey/ui package

This maintains the functionality while improving standardization across the codebase.

apps/dashboard/app/(app)/settings/team/role-switcher.tsx (1)

4-7: Import reorganization and standardization.

Good reorganization of imports:

  1. Individual imports for toast, types, and trpc are now properly separated
  2. Select component imports now use the standardized @unkey/ui package

These changes improve code organization while maintaining the same functionality.

Also applies to: 14-14

internal/ui/src/index.ts (1)

5-9: Export order reorganized with new components added

The export order has been updated and new components (select and settings-card) have been added to the UI package exports. This aligns with the PR objectives of adding the Select component to UI and engineering docs.

Also applies to: 12-12

apps/engineering/content/design/components/select.example.tsx (3)

1-16: Proper imports and setup for Select examples

The client directive and imports are correctly set up, importing the Select component and related subcomponents from the @unkey/ui package as intended in this PR. The appropriate utility components and icons are also imported.


17-92: Comprehensive SelectExample component with various configurations

The SelectExample component effectively demonstrates four key usage patterns:

  1. Basic Select with controlled state
  2. Select with left icon
  3. Select with grouped options
  4. Disabled Select

This covers most of the functionality described in the documentation and provides clear usage examples.


94-134: Well-implemented variant examples with corresponding icons

The SelectExampleVariants component properly demonstrates the three variant states (success, warning, error) with appropriate icons that reinforce the semantic meaning of each state. The layout provides a good side-by-side comparison of the different variants.

@ogzhanolguncu ogzhanolguncu self-assigned this May 1, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 2, 2025

⚠️ No Changeset found

Latest commit: ee26a14

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

@vercel vercel bot temporarily deployed to Preview – engineering May 2, 2025 16:14 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard May 2, 2025 16:15 Inactive
@MichaelUnkey MichaelUnkey marked this pull request as draft May 4, 2025 17:19
auto-merge was automatically disabled May 4, 2025 17:19

Pull request was converted to draft

@MichaelUnkey MichaelUnkey marked this pull request as ready for review May 5, 2025 14:43
@MichaelUnkey MichaelUnkey enabled auto-merge May 5, 2025 14:43
Copy link
Contributor

@ogzhanolguncu ogzhanolguncu left a comment

Choose a reason for hiding this comment

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

Looking good.

@vercel vercel bot temporarily deployed to Preview – dashboard May 5, 2025 14:46 Inactive
@MichaelUnkey MichaelUnkey added this pull request to the merge queue May 5, 2025
Merged via the queue into main with commit 894c5f0 May 5, 2025
32 of 37 checks passed
@MichaelUnkey MichaelUnkey deleted the move-select-to-ui-and-eng-docs branch May 5, 2025 14:48
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