Skip to content

Add id prop to BoardEntityBadge and update usage in useBoardEntityBad…#4340

Open
vedantbhavsar26 wants to merge 2 commits into
umami-software:masterfrom
vedantbhavsar26:master
Open

Add id prop to BoardEntityBadge and update usage in useBoardEntityBad…#4340
vedantbhavsar26 wants to merge 2 commits into
umami-software:masterfrom
vedantbhavsar26:master

Conversation

@vedantbhavsar26

@vedantbhavsar26 vedantbhavsar26 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

…geProps


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

@vedantbhavsar26 is attempting to deploy a commit to the Umami Software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes BoardEntityBadge clickable by wrapping it in a Next.js <Link> that navigates to /{type}s/{id}, and threads the required id through both the component props and the useBoardEntityBadgeProps hook for all three entity types (website, pixel, link).

  • BoardEntityBadge.tsx — adds id: string prop and wraps the inner <Row> in <Link href={\/${type}s/${id}`}>`, aliasing the icon import to avoid the name collision with next/link.
  • useBoardEntityBadgeProps.ts — returns id for all three entity shapes; the pixel branch also sets domain: pixel.id which is semantically incorrect (domain expects a hostname, not a UUID), though it has no visible effect today because the pixel icon path never reads domain.

Confidence Score: 4/5

Safe to merge — the navigation links point to confirmed existing routes and the component renders correctly for all entity types.

The core feature (clickable badge with correct routing) is solid. The only concern is domain: pixel.id in the pixel branch of useBoardEntityBadgeProps, where a UUID is placed into a field that semantically holds a website hostname. The value is never read today, but it is a latent inconsistency that could mislead a future contributor.

useBoardEntityBadgeProps.ts — the pixel branch sets domain to the pixel's ID, which is a UUID rather than a domain name.

Important Files Changed

Filename Overview
src/app/(main)/boards/BoardEntityBadge.tsx Adds id prop and wraps the badge in a next/link <Link> pointing to /{type}s/{id}; all three entity-type routes (/websites, /pixels, /links) are confirmed to exist in the app.
src/app/(main)/boards/useBoardEntityBadgeProps.ts Adds id to all three return shapes; pixel branch incorrectly sets domain: pixel.id (a UUID, not a hostname), which is semantically wrong even though it has no current visual effect.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Board as Board View
    participant Hook as useBoardEntityBadgeProps
    participant Badge as BoardEntityBadge
    participant Router as Next.js Router

    Board->>Hook: useBoardEntityBadgeProps(entityType, entityId)
    Hook-->>Board: "{ id, type, name, domain? } | null"

    Board->>Badge: "<BoardEntityBadge id={id} type={type} name={name} domain={domain} />"
    Badge->>Router: "<Link href={`/{type}s/{id}`}>"
    Note over Badge,Router: /websites/{id}<br>/pixels/{id}<br>/links/{id}
    Router-->>Badge: Navigates on click
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Board as Board View
    participant Hook as useBoardEntityBadgeProps
    participant Badge as BoardEntityBadge
    participant Router as Next.js Router

    Board->>Hook: useBoardEntityBadgeProps(entityType, entityId)
    Hook-->>Board: "{ id, type, name, domain? } | null"

    Board->>Badge: "<BoardEntityBadge id={id} type={type} name={name} domain={domain} />"
    Badge->>Router: "<Link href={`/{type}s/{id}`}>"
    Note over Badge,Router: /websites/{id}<br>/pixels/{id}<br>/links/{id}
    Router-->>Badge: Navigates on click
Loading

Reviews (1): Last reviewed commit: "Add id prop to BoardEntityBadge and upda..." | Re-trigger Greptile


if (entityType === 'pixel' && pixel?.name) {
return { type: entityType, name: pixel.name };
return { type: entityType, name: pixel.name, domain: pixel.id, id: pixel.id };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 The domain field is being set to pixel.id, but the domain prop on BoardEntityBadge is passed to <Favicon domain={domain} /> and is semantically a website hostname. For a pixel entity, this value is never consumed by the component (pixel type renders <Grid2x2 /> instead of <Favicon>), so there is no visual regression right now — but if the component ever references domain for pixels in the future, it will receive a UUID instead of a hostname. The field should be omitted or set to undefined.

Suggested change
return { type: entityType, name: pixel.name, domain: pixel.id, id: pixel.id };
return { type: entityType, name: pixel.name, id: pixel.id };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant