Skip to content

chore: Add timestamp to unkey UI#3192

Merged
MichaelUnkey merged 6 commits intomainfrom
add-timestamp-to-unkey-ui
Apr 24, 2025
Merged

chore: Add timestamp to unkey UI#3192
MichaelUnkey merged 6 commits intomainfrom
add-timestamp-to-unkey-ui

Conversation

@MichaelUnkey
Copy link
Collaborator

@MichaelUnkey MichaelUnkey commented Apr 24, 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?

  1. Still functions as is should in Dashboard
  2. Docs show up and read well in Engineering

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

image

  • 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 interactive timestamp display component with multiple formats (local, UTC, relative) and copy-to-clipboard functionality.
    • Added a new button color variant, "info", for improved UI consistency.
  • Documentation
    • Added comprehensive documentation and usage examples for the new timestamp display component.
    • Expanded button documentation with examples for the new "info" color variant.
  • Refactor
    • Updated usage of the timestamp display component across the dashboard to use the new centralized version.

@changeset-bot
Copy link

changeset-bot bot commented Apr 24, 2025

⚠️ No Changeset found

Latest commit: 2b1fef0

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 Apr 24, 2025

📝 Walkthrough

Walkthrough

This update replaces all local imports of the TimestampInfo component within the dashboard and related applications with imports from the external @unkey/ui package. It introduces the TimestampInfo component and its documentation into the UI library, adds a new "info" color variant to the button component, and provides example usage and documentation for TimestampInfo. No application logic or control flow outside of import paths and styling is changed.

Changes

Files / Groups Change Summary
apps/dashboard/app/(app)/.../components/log-details/index.tsx
.../logs-table.tsx
.../last-used.tsx
apps/dashboard/app/(app)/audit/components/table/log-details/components/log-footer.tsx
.../logs-table.tsx
apps/dashboard/app/(app)/logs/components/table/log-details/components/log-footer.tsx
.../logs-table.tsx
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/table/logs-table.tsx
.../logs/components/table/log-details/components/log-footer.tsx
.../logs/components/table/logs-table.tsx
apps/dashboard/components/logs/control-cloud/control-pill.tsx
Changed the import source of the TimestampInfo component from a local path to the external package @unkey/ui. No other code or logic was modified in these files.
apps/engineering/content/design/components/timestamp-example.tsx Added new file with three React components demonstrating usage of TimestampInfo in local, UTC, and relative time formats. Each shows current and past timestamps in a styled layout.
apps/engineering/content/design/components/timestamp-info.mdx Added new documentation file for TimestampInfo, describing its features, usage, accessibility, and props. Includes usage examples and a detailed props table.
internal/ui/src/components/button.tsx Added a new "info" color variant to the button component, including styling for primary, outline, and ghost variants. No logic changes.
internal/ui/src/components/timestamp-info.tsx Introduced the new TimestampInfo React component. Supports local, UTC, and relative time display; interactive tooltip with copy-to-clipboard for multiple formats; responsive alignment; and accessibility features.
internal/ui/src/index.ts Added export statement for timestamp-info, making the component available from the UI package entry point.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AppComponent
  participant TimestampInfo (from @unkey/ui)
  participant Tooltip

  User->>AppComponent: Interacts with timestamp display
  AppComponent->>TimestampInfo: Renders with timestamp value and displayType
  TimestampInfo->>Tooltip: Displays formatted timestamp
  User->>Tooltip: Clicks on value to copy
  Tooltip->>User: Shows "Copied!" feedback
Loading

Possibly related PRs

  • fix: show timestamp on click #3118: Involves internal changes to the TimestampInfo component, including controlled tooltip state and external trigger refs, which relate to the current PR's switch to using the externalized version of this component.

Suggested labels

Improvement, Needs Approval

Suggested reviewers

  • perkinsjr
  • chronark
  • mcstepp

📜 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 8d50718 and 7ae9a60.

📒 Files selected for processing (2)
  • apps/engineering/content/design/components/button.mdx (2 hunks)
  • internal/ui/src/components/button.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/ui/src/components/button.tsx
🧰 Additional context used
🪛 LanguageTool
apps/engineering/content/design/components/button.mdx

[style] ~1057-~1057: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...Consider stacking buttons vertically on very small screens

(EN_WEAK_ADJECTIVE)

⏰ Context from checks skipped due to timeout of 90000ms (18)
  • 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 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: Build / Build
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test ./packages/rbac
  • GitHub Check: Test Packages / Test ./packages/nextjs
  • GitHub Check: Test Packages / Test ./packages/cache
  • GitHub Check: Test Packages / Test ./packages/api
  • GitHub Check: Test Packages / Test ./internal/clickhouse
  • GitHub Check: Test Packages / Test ./internal/keys
  • GitHub Check: Test Packages / Test ./internal/id
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
apps/engineering/content/design/components/button.mdx (3)

697-762: New “Info – Primary” documentation aligns with existing patterns
The primary variant examples correctly follow the established style for hover (!bg-info-9/90), focus (!ring-info-6 !border-info-11), loading, and disabled states.


763-819: “Info – Outline” examples look consistent
The outline variant snippets match the structure of other outline sections, including proper usage of color="info" and the hover/focus class overrides.


821-877: “Info – Ghost” documentation is correct
The ghost variant follows the same format as other ghost sections, with the right info classes for hover, focus, and disabled states.

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

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 Apr 24, 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 Apr 24, 2025 4:21pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
engineering ⬜️ Ignored (Inspect) Visit Preview Apr 24, 2025 4:21pm

@github-actions
Copy link
Contributor

github-actions bot commented Apr 24, 2025

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

@MichaelUnkey MichaelUnkey enabled auto-merge April 24, 2025 15:52
Copy link
Contributor

@MichaelUnkey can you update our engineering docs too?

Copy link
Contributor

if you haven't already 😄

Copy link
Contributor

I meant changes for Button 🙏

Copy link
Collaborator Author

Yup on the list. Seperate PR just wanted to finish the one I started first

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

🧹 Nitpick comments (9)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/logs-table.tsx (1)

10-10: Consolidate @unkey/ui imports
You have two separate imports from @unkey/ui. Combining them improves readability and reduces duplication:

-import { TimestampInfo } from "@unkey/ui";
-import { Button, Empty } from "@unkey/ui";
+import { TimestampInfo, Button, Empty } from "@unkey/ui";
internal/ui/src/components/button.tsx (1)

153-183: Fix comment label for info variant.

The comment on line 153 says "// Success" but it should say "// Info" since it's defining the info variant compounds.

-      // Success
+      // Info
      {
        variant: "primary",
        color: "info",

The styling implementation for the info variant looks good across all button types (primary, outline, ghost).

apps/engineering/content/design/components/timestamp-info.mdx (1)

60-60: Add missing article "the" before "clipboard".

Minor grammatical fix needed.

-Each value can be copied to clipboard by clicking on it.
+Each value can be copied to the clipboard by clicking on it.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~60-~60: Possible missing article found.
Context: ...tamp value Each value can be copied to clipboard by clicking on it. ## Accessibility -...

(AI_HYDRA_LEO_MISSING_THE)

apps/engineering/content/design/components/timestamp-example.tsx (2)

12-37: Consider consistent wrapper structure across examples

I notice that only this first example has an extra <div className="flex flex-col gap-4"> wrapper that's not present in the other two examples.

-  return (
-    <div className="flex flex-col gap-4">
-      <RenderComponentWithSnippet>
+  return (
+    <RenderComponentWithSnippet>

5-107: Consider refactoring to reduce code duplication

All three components have nearly identical structure and only differ in the displayType prop. Consider creating a single component that accepts the display type as a prop.

export const TimestampExample = ({ displayType }: { displayType: "local" | "utc" | "relative" }) => {
  const now = Date.now();
  const oneHourAgo = now - 3600 * 1000;
  const oneDayAgo = now - 86400 * 1000;
  const oneWeekAgo = now - 604800 * 1000;

  return (
    <RenderComponentWithSnippet>
      <Row>
        {/* Current Time */}
        <div className="flex flex-col gap-2 text-center">
          <h3 className="text-sm font-medium">Current Time</h3>
          <TimestampInfo value={now} displayType={displayType} />
        </div>
        {/* One Hour Ago */}
        <div className="flex flex-col gap-2 text-center">
          <h3 className="text-sm font-medium">One Hour Ago</h3>
          <TimestampInfo value={oneHourAgo} displayType={displayType} />
        </div>
        {/* One Day Ago */}
        <div className="flex flex-col gap-2 text-center">
          <h3 className="text-sm font-medium">One Day Ago</h3>
          <TimestampInfo value={oneDayAgo} displayType={displayType} />
        </div>
        {/* One Week Ago */}
        <div className="flex flex-col gap-2 text-center">
          <h3 className="text-sm font-medium">One Week Ago</h3>
          <TimestampInfo value={oneWeekAgo} displayType={displayType} />
        </div>
      </Row>
    </RenderComponentWithSnippet>
  );
};

export const TimestampExampleLocalTime = () => <TimestampExample displayType="local" />;
export const TimestampExampleUTC = () => <TimestampExample displayType="utc" />;
export const TimestampExampleRelative = () => <TimestampExample displayType="relative" />;
internal/ui/src/components/timestamp-info.tsx (4)

41-62: Remove duplicated type definition in props

The props type is defined twice - once in the component type definition and again in the parameter destructuring. This is redundant and could lead to inconsistencies if one is updated but not the other.

export const TimestampInfo: React.FC<{
  value: string | number;
  className?: string;
  displayType?: DisplayType;
  triggerRef?: React.RefObject<HTMLElement>;
  open?: boolean;
  onOpenChange?: (open: boolean) => void;
}> = ({
  value,
  className,
  displayType = "local",
  triggerRef: externalTriggerRef,
  open,
  onOpenChange,
-}: {
-  className?: string;
-  value: string | number;
-  displayType?: DisplayType;
-  triggerRef?: React.RefObject<HTMLElement>;
-  open?: boolean;
-  onOpenChange?: (open: boolean) => void;
-}) => {
+}) => {

106-125: Add keyboard accessibility to the TooltipRow component

The TooltipRow component is currently only clickable with a mouse. For better accessibility, consider adding keyboard support.

      //biome-ignore lint/a11y/useKeyWithClickEvents: no need
      <span
        onClick={(e) => {
          e.stopPropagation();
          navigator.clipboard.writeText(value);
          setCopied(true);
          setTimeout(() => setCopied(false), 1000);
        }}
+       onKeyDown={(e) => {
+         if (e.key === 'Enter' || e.key === ' ') {
+           e.preventDefault();
+           e.stopPropagation();
+           navigator.clipboard.writeText(value);
+           setCopied(true);
+           setTimeout(() => setCopied(false), 1000);
+         }
+       }}
+       tabIndex={0}
+       role="button"
        className="flex items-center hover:bg-gray-3 text-left cursor-pointer w-full px-5 py-2"
      >

13-17: Consider a more flexible way to detect microsecond timestamps

The function isUnixMicro checks for exactly 16 digits, which might not be flexible enough for all use cases. Consider a more robust approach.

const isUnixMicro = (unix: string | number): boolean => {
-  const digitLength = String(unix).length === 16;
+  // Check if length is in microsecond range (typically 16 digits for current dates)
+  const strUnix = String(unix);
+  const digitLength = strUnix.length >= 15 && strUnix.length <= 17;
  const isNum = !Number.isNaN(Number(unix));
  return isNum && digitLength;
};

106-125: Consider moving TooltipRow out of the parent component

The TooltipRow component is defined inside the TimestampInfo component, causing it to be recreated on each render. Consider moving it outside to optimize performance.

Extract the TooltipRow component outside of the TimestampInfo component to avoid unnecessary recreation on each render. This would be particularly beneficial if the component grows more complex in the future.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5b1ee90 and 8d50718.

📒 Files selected for processing (16)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/components/log-details/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/logs-table.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/_components/components/table/components/last-used.tsx (1 hunks)
  • apps/dashboard/app/(app)/audit/components/table/log-details/components/log-footer.tsx (1 hunks)
  • apps/dashboard/app/(app)/audit/components/table/logs-table.tsx (1 hunks)
  • apps/dashboard/app/(app)/logs/components/table/log-details/components/log-footer.tsx (1 hunks)
  • apps/dashboard/app/(app)/logs/components/table/logs-table.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/table/logs-table.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/log-details/components/log-footer.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/logs-table.tsx (1 hunks)
  • apps/dashboard/components/logs/control-cloud/control-pill.tsx (1 hunks)
  • apps/engineering/content/design/components/timestamp-example.tsx (1 hunks)
  • apps/engineering/content/design/components/timestamp-info.mdx (1 hunks)
  • internal/ui/src/components/button.tsx (2 hunks)
  • internal/ui/src/components/timestamp-info.tsx (1 hunks)
  • internal/ui/src/index.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/engineering/content/design/components/timestamp-example.tsx (2)
apps/engineering/app/components/render.tsx (1)
  • RenderComponentWithSnippet (12-67)
internal/ui/src/components/timestamp-info.tsx (1)
  • TimestampInfo (41-156)
internal/ui/src/components/timestamp-info.tsx (1)
internal/ui/src/components/tooltip.tsx (3)
  • Tooltip (30-30)
  • TooltipTrigger (30-30)
  • TooltipContent (30-30)
🪛 LanguageTool
apps/engineering/content/design/components/timestamp-info.mdx

[uncategorized] ~48-~48: Loose punctuation mark.
Context: ...e changes | ## Display Types - local: Shows time in the user's local timezone...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~60-~60: Possible missing article found.
Context: ...tamp value Each value can be copied to clipboard by clicking on it. ## Accessibility -...

(AI_HYDRA_LEO_MISSING_THE)

⏰ Context from checks skipped due to timeout of 90000ms (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: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Build / Build
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Packages / Test ./internal/clickhouse
🔇 Additional comments (21)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/table/logs-table.tsx (1)

8-8: Use centralized TimestampInfo component
Importing TimestampInfo from @unkey/ui ensures that the timestamp rendering is consistent across all dashboard tables instead of relying on a local copy.

apps/dashboard/app/(app)/audit/components/table/logs-table.tsx (1)

6-6: Switch to shared TimestampInfo import
The TimestampInfo component is now sourced from the central UI library (@unkey/ui), maintaining uniform behavior and look across audit logs.

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

9-9: Centralize TimestampInfo import
Updating the import to use the shared TimestampInfo from @unkey/ui improves reuse and ensures consistent timestamp behavior in the logs table.

apps/dashboard/components/logs/control-cloud/control-pill.tsx (1)

3-3: Import TimestampInfo from UI library
Switching to @unkey/ui for TimestampInfo aligns with the refactor to use the centralized component for time formatting in filter pills.

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

11-11: Adopt shared TimestampInfo component
The replacement of the local timestamp helper with the @unkey/ui TimestampInfo component standardizes the last-request column across rate-limit tables.

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

8-8: Centralized import of TimestampInfo
Switching the import to @unkey/ui standardizes the timestamp component usage across the app.

No additional logic changes are required; ensure the package is installed as noted in other reviews.

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

6-6: Centralized import of TimestampInfo
This import now points to the shared UI package, reducing duplication of the local component.

Ensure @unkey/ui is updated in your dependencies if not already present.

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

5-5: Centralized import of TimestampInfo
Replacing the local import with the shared UI package aligns this file with the rest of the codebase.

Double-check that the version of @unkey/ui you’ve added exports this component as expected.

apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/_components/components/table/components/last-used.tsx (1)

5-5: LGTM! Replaced local import with centralized UI component.

The import change from a local path to the shared @unkey/ui package properly centralizes the UI component and follows best practices for component reusability.

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

9-9: LGTM! Component export added to UI library.

The TimestampInfo component is now properly exported from the UI library, making it available for use across the application.

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

42-42: LGTM! Added info color variant to button options.

The "info" color variant is correctly added to the button's color options.

apps/engineering/content/design/components/timestamp-info.mdx (1)

1-67: LGTM! Well-documented component with comprehensive usage examples.

The documentation for the TimestampInfo component is thorough and covers all key aspects including usage examples, props, display types, and accessibility.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~48-~48: Loose punctuation mark.
Context: ...e changes | ## Display Types - local: Shows time in the user's local timezone...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~60-~60: Possible missing article found.
Context: ...tamp value Each value can be copied to clipboard by clicking on it. ## Accessibility -...

(AI_HYDRA_LEO_MISSING_THE)

apps/engineering/content/design/components/timestamp-example.tsx (4)

1-4: Import organization looks good

The component correctly imports TimestampInfo from the @unkey/ui package, which aligns with the PR objective of centralizing UI components.


5-39: TimestampExampleLocalTime component implementation is clean

The component demonstrates the local time format nicely with a clear hierarchy of timestamps, from current time to one week ago. The implementation correctly uses the displayType="local" prop.


41-73: TimestampExampleUTC component looks good

The UTC example follows the same pattern as the local time example and correctly uses displayType="utc".


75-107: TimestampExampleRelative component looks good

The relative time example matches the pattern of the previous examples and correctly uses displayType="relative".

internal/ui/src/components/timestamp-info.tsx (5)

1-8: Import organization is good

The component imports necessary dependencies and uses correct React imports.


9-17: Unix timestamp handling functions look good

The utility functions for converting and detecting microsecond Unix timestamps are well implemented.


19-37: Timestamp formatters implemented correctly

All three timestamp formatters (local, UTC, and relative) correctly handle both regular and microsecond Unix timestamps.


76-91: Good handling of tooltip positioning

The dynamic positioning of the tooltip based on viewport position is well implemented with proper event listeners and cleanup.


127-155: Clean, well-structured component rendering

The rendering logic nicely handles both external and internal trigger references, and the tooltip content is well organized.

@ogzhanolguncu ogzhanolguncu self-assigned this Apr 24, 2025
@MichaelUnkey MichaelUnkey added this pull request to the merge queue Apr 24, 2025
Merged via the queue into main with commit fa27104 Apr 24, 2025
32 of 37 checks passed
@MichaelUnkey MichaelUnkey deleted the add-timestamp-to-unkey-ui branch April 24, 2025 16:24
@coderabbitai coderabbitai bot mentioned this pull request Jun 2, 2025
18 tasks
@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