Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tags-settings-badges-click-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperdx/app': patch
---

feat: use the click-ui `Badge` for dashboard and alert tags, and for the
"Experimental", "Beta", "Disabled", "Dev only", team member, and pending
invite badges in settings.
21 changes: 8 additions & 13 deletions packages/app/src/UserPreferencesModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Badge } from '@clickhouse/click-ui';
import {
Autocomplete,
Badge,
Divider,
Group,
Modal,
Expand All @@ -11,7 +11,6 @@ import {
Text,
Tooltip,
} from '@mantine/core';
import { IconFlask } from '@tabler/icons-react';

import {
isContentFontSize,
Expand Down Expand Up @@ -149,9 +148,7 @@ export const UserPreferencesModal = ({
label={
<Group align="center" gap="xs">
Appearance
<Badge variant="light" fw="normal" size="xs">
Experimental
</Badge>
<Badge size="sm" text="Experimental" state="info" />
</Group>
}
labelPosition="left"
Expand Down Expand Up @@ -211,14 +208,12 @@ export const UserPreferencesModal = ({
w={220}
>
<Badge

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.

🔵 minor — Mantine Tooltip now wraps a click-ui Badge, and the Tooltip may not be able to attach a ref to it

Mantine Tooltip clones its child and attaches a ref so floating-ui can position the tooltip. Unless click-ui's Badge forwards refs, the 'Only available in local/dev mode…' tooltip will be mispositioned or won't show. I couldn't check the click-ui source (node_modules isn't in this checkout), so confirm whether Badge forwards refs. If it doesn't, wrap it in an element that takes a ref, e.g. <Tooltip …><span><Badge … /></span></Tooltip>, and check the tooltip still appears on hover.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

variant="light"
color="violet"
fw="normal"
size="xs"
leftSection={<IconFlask size={10} />}
>
Dev Only
</Badge>
size="sm"
text="Dev only"
state="neutral"
icon="flask"
iconDir="start"
/>
</Tooltip>
</Group>
}
Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/components/Iac/TerraformHelperPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { Badge } from '@clickhouse/click-ui';
import {
Anchor,
Badge,
Collapse,
Group,
ScrollArea,
Expand Down Expand Up @@ -67,9 +67,7 @@ export function TerraformHelperPanel({
<Text size="sm" fw={500}>
Terraform
</Text>
<Badge variant="light" fw="normal" size="xs">
Experimental
</Badge>
<Badge size="sm" text="Experimental" state="info" />
</Group>
<Text size="xs" style={{ color: 'var(--color-text-muted)' }}>
ClickStack resources in the ClickHouse Terraform provider are in alpha —
Expand Down
15 changes: 3 additions & 12 deletions packages/app/src/components/ListingCard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import Link from 'next/link';
import { formatDistanceToNow } from 'date-fns';
import {
ActionIcon,
Badge,
Card,
Group,
Menu,
Text,
Tooltip,
} from '@mantine/core';
import { Badge } from '@clickhouse/click-ui';
import { ActionIcon, Card, Group, Menu, Text, Tooltip } from '@mantine/core';
import { IconDots, IconTrash } from '@tabler/icons-react';

import { FavoriteButton } from '@/components/FavoriteButton';
Expand Down Expand Up @@ -118,9 +111,7 @@ export function ListingCard({
{tags && tags.length > 0 && (
<Group gap="xs" mt="xs">
{tags.map(tag => (
<Badge key={tag} variant="light" size="xs">
{tag}
</Badge>
<Badge key={tag} size="sm" text={tag} state="neutral" />
))}
</Group>
)}
Expand Down
15 changes: 3 additions & 12 deletions packages/app/src/components/ListingListRow.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import Router from 'next/router';
import { formatDistanceToNow } from 'date-fns';
import {
ActionIcon,
Badge,
Group,
Menu,
Table,
Text,
Tooltip,
} from '@mantine/core';
import { Badge } from '@clickhouse/click-ui';
import { ActionIcon, Group, Menu, Table, Text, Tooltip } from '@mantine/core';
import { IconDots, IconTrash } from '@tabler/icons-react';

import { FormatTime } from '@/useFormatTime';
Expand Down Expand Up @@ -61,9 +54,7 @@ export function ListingRow({
<Table.Td>
<Group gap={4}>
{tags?.map(tag => (
<Badge key={tag} variant="light" size="xs">
{tag}
</Badge>
<Badge key={tag} size="sm" text={tag} state="neutral" />
))}
</Group>
</Table.Td>
Expand Down
12 changes: 8 additions & 4 deletions packages/app/src/components/ServiceMap/ServiceMapSidePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Badge } from '@clickhouse/click-ui';
import { SourceKind } from '@hyperdx/common-utils/dist/types';
import { Badge, Group, Stack, Text } from '@mantine/core';
import { Group, Stack, Text } from '@mantine/core';

import { useSource } from '@/source';

Expand All @@ -24,9 +25,12 @@ export default function ServiceMapSidePanel({
<Text size="sm" ps="sm">
Service Map
</Text>
<Badge size="xs" ms="xs" color="gray" autoContrast radius="sm">
Beta
</Badge>
<Badge
size="sm"
text="Beta"
state="info"
style={{ marginInlineStart: 'var(--mantine-spacing-xs)' }}

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.

🔵 minor — Raw inline margin style where the parent Group's gap would do the same job

The repo conventions say to prefer Mantine style props over raw style objects. Remove style={{ marginInlineStart: 'var(--mantine-spacing-xs)' }} from the Badge, change the parent <Group gap={0}> to <Group gap="xs">, and the spacing stays the same. TeamMembersSection.tsx:264 has the same pattern: put the 'You' badge and the name in a <Group gap="xs"> instead of setting an inline marginRight.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

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.

🔵 minor — The Beta badge's spacing is set with a raw style using a Mantine CSS variable, when the parent Group could provide the gap

Change the parent to <Group gap="xs"> (it is currently gap={0}) and remove the style={{ marginInlineStart: 'var(--mantine-spacing-xs)' }} from the Badge. This follows the convention to prefer Mantine style props over raw styles. Other click-ui badges get their spacing from a Group gap, for example in IacMigrationSection.tsx and LLMDashboardPage.tsx.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

/>
</Group>
{traceTableSource && traceTableSource.kind === SourceKind.Trace ? (
<ServiceMap
Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/components/Sources/SourcesList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useRef, useState } from 'react';
import { useRouter } from 'next/router';
import { Badge } from '@clickhouse/click-ui';
import { SourceKind } from '@hyperdx/common-utils/dist/types';
import {
ActionIcon,
Alert,
Badge,
Box,
Button,
Card,
Expand Down Expand Up @@ -206,9 +206,7 @@ export function SourcesList({
{s.name}
</Text>
{s.disabled && (
<Badge size="xs" variant="light" color="gray">
Disabled
</Badge>
<Badge size="sm" text="Disabled" state="neutral" />
)}
</Group>
<Text size={subtextSize} c="dimmed" mt={4}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useMemo, useState } from 'react';
import { Badge } from '@clickhouse/click-ui';
import {
buildImportFile,
collectImportableResources,
Expand All @@ -9,7 +10,6 @@ import {
} from '@hyperdx/common-utils/dist/iac';
import {
Alert,
Badge,
Box,
Button,
Card,
Expand Down Expand Up @@ -231,9 +231,7 @@ export default function IacMigrationSection({
<Box id="iac_migration" data-testid="iac-migration-section">
<Group gap="xs">
<Text size="md">Export to Terraform</Text>
<Badge variant="light" fw="normal" size="xs">
Experimental
</Badge>
<Badge size="sm" text="Experimental" state="info" />
</Group>
<Divider my="md" />
<Card>
Expand Down
34 changes: 20 additions & 14 deletions packages/app/src/components/TeamSettings/TeamMembersSection.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { HTTPError } from 'ky';
import CopyToClipboard from 'react-copy-to-clipboard';
import { Badge } from '@clickhouse/click-ui';
import {
Badge,
Box,
Button,
Card,
Expand Down Expand Up @@ -243,9 +243,14 @@ export default function TeamMembersSection() {
<Table.Td>
<div>
{member.isCurrentUser && (
<Badge variant="light" mr="xs" tt="none">
You
</Badge>
<Badge
size="sm"
text="You"
state="info"
style={{

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.

🔵 minor — The 'You' badge's spacing is set with a hand-written marginRight: var(--mantine-spacing-xs) style

Replace the wrapping <div> with <Group gap="xs"> (or a Box with style props) and remove the inline style on the Badge. This follows the convention to prefer Mantine style props over raw styles, and it stops the badge from depending on Mantine's internal spacing variable.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

marginRight: 'var(--mantine-spacing-xs)',
}}
/>
)}
<span className="text-white fw-bold fs-7">
{member.name}
Expand All @@ -263,13 +268,10 @@ export default function TeamMembersSection() {
<Table.Td>
{member.groupName && (
<Badge
variant="light"
color="green"
fw="normal"
tt="none"
>
{member.groupName}
</Badge>
size="sm"
text={member.groupName}
state="success"
/>
)}
</Table.Td>
<Table.Td style={{ textAlign: 'right' }}>
Expand Down Expand Up @@ -303,9 +305,13 @@ export default function TeamMembersSection() {
</span>
</Table.Td>
<Table.Td>
<Badge variant="dot" color="gray" fw="normal" tt="none">
Pending Invite
</Badge>
<Badge
size="sm"
text="Pending invite"
state="neutral"
icon="dot"
iconDir="start"
/>
<CopyToClipboard text={invitation.url}>
<Button size="compact-xs" variant="secondary" ml="xs">
📋 Copy URL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Badge, Group, Text } from '@mantine/core';
import { Badge } from '@clickhouse/click-ui';
import { Group, Text } from '@mantine/core';

import { AlertPropertiesSummary } from '@/components/alerts/AlertPropertiesSummary';
import type { AlertsPageItem } from '@/types';
Expand Down Expand Up @@ -94,9 +95,7 @@ export function AlertDetailProperties({ alert }: { alert: AlertsPageItem }) {
<PropertyRow label="Tags" testId="alert-property-tags">
<Group gap={4}>
{tags.map(tag => (
<Badge key={tag} variant="light" color="gray" size="xs">
{tag}
</Badge>
<Badge key={tag} size="sm" text={tag} state="neutral" />
))}
</Group>
</PropertyRow>
Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/components/alerts/AlertDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import Link from 'next/link';
import ReactMarkdown from 'react-markdown';
import { Badge } from '@clickhouse/click-ui';
import { AlertSource } from '@hyperdx/common-utils/dist/types';
import {
Badge,
Collapse,
Flex,
Group,
Expand Down Expand Up @@ -190,9 +190,7 @@ export const AlertDetails = React.memo(function AlertDetails({
{alert.tags?.length > 0 && (
<Group gap={4}>
{alert.tags.map(tag => (
<Badge key={tag} variant="light" color="gray" size="xs">
{tag}
</Badge>
<Badge key={tag} size="sm" text={tag} state="neutral" />
))}
</Group>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/app/tests/e2e/features/team.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ test.describe('Team Settings Page', { tag: ['@team', '@full-stack'] }, () => {
const row = teamPage.getInvitationRow(email);
await expect(row).toBeVisible({ timeout: 10000 });
await expect(row.getByText(email)).toBeVisible();
await expect(row.getByText('Pending Invite')).toBeVisible();
await expect(row.getByText('Pending invite')).toBeVisible();
});

await test.step('Delete the invitation', async () => {
Expand Down
Loading