Skip to content

chore: card component with docs moved to ui#3318

Merged
MichaelUnkey merged 5 commits intomainfrom
move-card-to-ui
Jun 13, 2025
Merged

chore: card component with docs moved to ui#3318
MichaelUnkey merged 5 commits intomainfrom
move-card-to-ui

Conversation

@MichaelUnkey
Copy link
Collaborator

@MichaelUnkey MichaelUnkey commented Jun 12, 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?

  • Pages with Card components look and function the same as prod.
  • Docs in Engineering are sufficient.

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 set of reusable Card UI components, including Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, and MetricCardTitle, for building consistent card layouts.
  • Documentation
    • Added comprehensive documentation and usage examples for the Card component system, including best practices and accessibility guidelines.
  • Refactor
    • Consolidated and standardized UI component imports across the dashboard for improved consistency and maintainability.

@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2025

⚠️ No Changeset found

Latest commit: a8b0150

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
Copy link

vercel bot commented Jun 12, 2025

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
dashboard ⬜️ Ignored (Inspect) Visit Preview Jun 13, 2025 3:41pm
engineering ⬜️ Ignored (Inspect) Visit Preview Jun 13, 2025 3:41pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

📝 Walkthrough
## Walkthrough

The changes introduce a new set of Card UI components in the internal UI library, document their usage, and refactor multiple dashboard files to import Card-related components from the new `@unkey/ui` package instead of local paths. No functional or behavioral changes were made to the affected components.

## Changes

| Files/Groups                                                                                              | Change Summary                                                                                                                        |
|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `internal/ui/src/components/card.tsx`, `internal/ui/src/index.ts`                                         | Added new Card UI components and exported them from the UI library.                                                                   |
| `apps/engineering/content/design/components/card.example.tsx`, `apps/engineering/content/design/components/card.mdx` | Added example usage and documentation for the Card components.                                                                        |
| `apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/...`,<br>`apps/dashboard/app/(app)/audit/components/table/log-details/components/log-section.tsx`,<br>`apps/dashboard/app/(app)/logs/components/table/log-details/components/...`,<br>`apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/...`,<br>`apps/dashboard/app/(app)/settings/root-keys/[keyId]/page-layout.tsx`,<br>`apps/dashboard/app/(app)/settings/root-keys/[keyId]/page.tsx`,<br>`apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/legacy.tsx`,<br>`apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission-manager-card.tsx`,<br>`apps/dashboard/app/(app)/settings/root-keys/[keyId]/update-root-key-name.tsx`,<br>`apps/dashboard/app/(app)/settings/root-keys/new/client.tsx`,<br>`apps/dashboard/app/new/keys.tsx`,<br>`apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/components/rbac/permissions.tsx` | Refactored imports to use Card and related components from `@unkey/ui` instead of local paths; consolidated and reordered imports.    |

## Sequence Diagram(s)

_Not included as the changes are limited to import refactoring, component introduction, and documentation without new control flow or feature logic._

## Possibly related PRs

- [unkeyed/unkey#2737](https://github.com/unkeyed/unkey/pull/2737): The main PR consolidates UI component imports by switching Card-related components to be imported from the `@unkey/ui` package, which aligns with the retrieved PR’s introduction of using `@unkey/ui` components (specifically Button) in the dashboard, indicating a shared effort to migrate UI components to the `@unkey/ui` library.

## Suggested labels

`🕹️ oss.gg`

## Suggested reviewers

- perkinsjr
- chronark
- mcstepp
- ogzhanolguncu

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 589e0a8 and 169a17d.

📒 Files selected for processing (1)
  • internal/ui/src/components/card.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • 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 8/8)
  • GitHub Check: Test Go API Local / Test (Shard 7/8)
  • GitHub Check: Test Go API Local / Test (Shard 6/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
  • GitHub Check: Test Packages / Test ./internal/clickhouse
  • GitHub Check: Test Packages / Test ./packages/cache
  • GitHub Check: autofix
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
internal/ui/src/components/card.tsx (2)

3-3: Verify relative import – potential broken alias

The absolute alias @/lib/utils was replaced with a relative path ../lib/utils.
Please double-check that every consumer of the internal UI package resolves this path correctly once it’s transpiled / published (e.g. dist/components/card.js ends up with require("../lib/utils")). If the package is flattened or moved during the build, this relative reference can break.

If your build still supports the alias, consider keeping the alias import instead.


44-44: 👍 Display name fixed

displayName now correctly reads "MetricCardTitle".
No further action required.

✨ 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 12, 2025

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

@MichaelUnkey MichaelUnkey enabled auto-merge June 12, 2025 13:42
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: 1

♻️ Duplicate comments (4)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/log-section.tsx (1)

2-2: Consolidated imports from @unkey/ui
Centralized the Button, Card, and CardContent imports—good for uniformity across the app.

apps/dashboard/app/(app)/audit/components/table/log-details/components/log-section.tsx (1)

2-2: Consolidated imports from @unkey/ui
Centralized the Button, Card, and CardContent imports—good for uniformity across the app.

apps/dashboard/app/(app)/logs/components/table/log-details/components/log-meta.tsx (1)

2-2: Consolidated imports from @unkey/ui
Centralized the Button, Card, and CardContent imports—good for uniformity across the app.

apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/log-meta.tsx (1)

2-2: Consolidated imports from @unkey/ui
Centralized the Button, Card, and CardContent imports—good for uniformity across the app.

🧹 Nitpick comments (4)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/log-outcome-distribution-section.tsx (1)

26-29: Minor copy typo: double space
toast.success("Outcomes copied to clipboard"); contains two consecutive spaces after “Outcomes”.

-        toast.success("Outcomes  copied to clipboard");
+        toast.success("Outcomes copied to clipboard");
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/roles-permissions.tsx (1)

61-70: Copy-to-clipboard helper is duplicated across components
The same logic appears in at least three files in this PR. Consider extracting a small copyToClipboard(text, successMsg, errorMsg) utility to avoid repetition and keep toast handling consistent.

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

1-3: Nit: keep exports alphabetically sorted

For long barrel files an alphabetical order eases scanning & merge-conflict resolution.
Consider moving the new card export accordingly.

 export * from "./components/button";
 export * from "./components/card";
 export * from "./components/checkbox";
apps/engineering/content/design/components/card.mdx (1)

128-136: Minor grammar polish

- Apply consistent spacing using the default padding is missing “to”.

- - Apply consistent spacing using the default padding
+ - Apply consistent spacing using the default padding

Also, the phrase “Card with header, content, and footer sections” is duplicated a few lines above—consider removing the repetition for brevity.

🧰 Tools
🪛 LanguageTool

[grammar] ~134-~134: Did you mean “to Apply”?
Context: ...omponents based on your content needs - Apply consistent spacing using the default pa...

(MISSING_TO_BEFORE_A_VERB)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d9eb0d2 and 589e0a8.

📒 Files selected for processing (20)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/log-outcome-distribution-section.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/log-section.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/roles-permissions.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/components/rbac/permissions.tsx (1 hunks)
  • apps/dashboard/app/(app)/audit/components/table/log-details/components/log-section.tsx (1 hunks)
  • apps/dashboard/app/(app)/logs/components/table/log-details/components/log-meta.tsx (1 hunks)
  • apps/dashboard/app/(app)/logs/components/table/log-details/components/log-section.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/log-meta.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/log-section.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/page-layout.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/page.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/legacy.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission-manager-card.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/[keyId]/update-root-key-name.tsx (1 hunks)
  • apps/dashboard/app/(app)/settings/root-keys/new/client.tsx (1 hunks)
  • apps/dashboard/app/new/keys.tsx (1 hunks)
  • apps/engineering/content/design/components/card.example.tsx (1 hunks)
  • apps/engineering/content/design/components/card.mdx (1 hunks)
  • internal/ui/src/components/card.tsx (1 hunks)
  • internal/ui/src/index.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
internal/ui/src/components/card.tsx (1)
apps/dashboard/lib/utils.ts (1)
  • cn (5-7)
🪛 LanguageTool
apps/engineering/content/design/components/card.mdx

[duplication] ~41-~41: Possible typo: you repeated a word.
Context: ...oter. ### Complete Card Card with header, content, and footer sectio...

(ENGLISH_WORD_REPEAT_RULE)


[grammar] ~134-~134: Did you mean “to Apply”?
Context: ...omponents based on your content needs - Apply consistent spacing using the default pa...

(MISSING_TO_BEFORE_A_VERB)

⏰ Context from checks skipped due to timeout of 90000ms (18)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 7/8)
  • GitHub Check: Test Go API Local / Test (Shard 8/8)
  • GitHub Check: Build / Build
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test Go API Local / Test (Shard 6/8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test ./packages/nextjs
  • GitHub Check: Test Packages / Test ./internal/clickhouse
  • GitHub Check: Test Packages / Test ./packages/rbac
  • GitHub Check: Test Packages / Test ./packages/hono
  • GitHub Check: Test Packages / Test ./packages/cache
  • GitHub Check: Test Packages / Test ./internal/resend
  • GitHub Check: autofix
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
apps/dashboard/app/(app)/settings/root-keys/[keyId]/page-layout.tsx (1)

4-4: Consolidate card component imports
Importing Card, CardContent, CardHeader, and CardTitle from @unkey/ui correctly centralizes UI components for consistency and maintainability. Ensure that the @unkey/ui package is declared in the project’s dependencies (e.g., in package.json) and that these exports match the library’s API.

apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/log-section.tsx (2)

4-4: Imports look good
Switching to the central @unkey/ui source keeps the component palette consistent across the app.


48-55: Confirm prop-compatibility for the new Button
shape="square" and variant="outline" must still be supported by the Button exported from @unkey/ui; otherwise the control may silently render with unexpected styling.

apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/log-outcome-distribution-section.tsx (1)

4-4: Imports consolidated correctly
Good to see the local card implementation replaced with the shared library.

apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/components/roles-permissions.tsx (1)

3-3: Centralising UI imports – looks good
The file now relies solely on @unkey/ui; ensures one canonical source for the Card & Button primitives.

apps/dashboard/app/(app)/settings/root-keys/[keyId]/page.tsx (1)

7-7: Shared UI component import acknowledged
Importing Button, Card* from @unkey/ui keeps the page consistent with the new design-system – no issues spotted here.

apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/components/rbac/permissions.tsx (1)

3-3: UI import update OK
All required primitives are now pulled from @unkey/ui; compilation should stay green.

apps/dashboard/app/(app)/logs/components/table/log-details/components/log-section.tsx (1)

2-2:

Details

✅ Verification successful

Ensure new Button still accepts the shape prop

The Button coming from @unkey/ui must expose the shape="square" prop that this component relies on.
If shape is no longer supported (or renamed), this will fail at compile-time.


🏁 Script executed:

#!/bin/bash
# Does the internal Button prop interface still include `shape`?
rg --glob '*button*.tsx' -A3 -n $'shape' internal/ui/src/components

Length of output: 299


Button shape prop is still supported
Verified that the Button component in @unkey/ui (see internal/ui/src/components/button.tsx around line 35) still exposes a shape prop with a square option. No further action required.

apps/dashboard/app/(app)/settings/root-keys/[keyId]/update-root-key-name.tsx (1)

6-6: Import consolidation looks good

All newly-imported symbols (Button, Card*, FormInput) are used below and replace the previous local-path imports.
No further action required.

apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/permission-manager-card.tsx (1)

11-11: LGTM – centralised UI import

The switch to @unkey/ui keeps the file self-contained and removes local coupling.
No issues observed.

apps/dashboard/app/(app)/settings/root-keys/[keyId]/permissions/legacy.tsx (1)

4-9: Import grouping/readability improved

Re-ordering + consolidation into @unkey/ui is clear and idiomatic.
Nothing further.

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

1-4: Verify the utils import path

cn is imported via "../lib/utils".
Inside internal/ui, that resolves to internal/ui/src/lib/utils.ts, yet the only known implementation lives under apps/dashboard/lib/utils.ts. Please confirm a duplicate util exists in internal/ui; otherwise builds will fail.

apps/dashboard/app/new/keys.tsx (1)

5-18: Import consolidation looks good

Moving all UI primitives to @unkey/ui simplifies tree-shaking and keeps local paths clean. No further action needed here.

apps/dashboard/app/(app)/settings/root-keys/new/client.tsx (1)

18-28: Unified UI import 👍

Consistently sourcing cards, inputs, and buttons from @unkey/ui improves discoverability and prevents multiple bundle instances. Good refactor.

apps/engineering/content/design/components/card.example.tsx (1)

1-12: Example import alignment

All examples correctly import card primitives from the new package. Ensure the docs site’s bundler includes @unkey/ui peer-deps so the live examples don’t break at runtime.

@vercel vercel bot temporarily deployed to Preview – dashboard June 12, 2025 13:51 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering June 12, 2025 19:54 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard June 12, 2025 19:55 Inactive
@ogzhanolguncu ogzhanolguncu self-assigned this Jun 13, 2025
@MichaelUnkey MichaelUnkey added this pull request to the merge queue Jun 13, 2025
Merged via the queue into main with commit 1d7026f Jun 13, 2025
31 of 38 checks passed
@MichaelUnkey MichaelUnkey deleted the move-card-to-ui branch June 13, 2025 16:20
@coderabbitai coderabbitai bot mentioned this pull request Jun 20, 2025
18 tasks
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