Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import { DEFAULT_TAG_COLOR } from '@property/tags/tagColors';
import { cn, TagDot } from '@ui';
import { For, Show } from 'solid-js';
import type { GithubPullRequestLabel } from '../types/entity';
import { rowPillClasses } from './row-pill';
const GITHUB_HEX_COLOR = /^#?([0-9a-f]{6})$/i;
/** A GitHub label's color as CSS, or the default tag color when it has none. */
export function githubLabelColor(color: string | null | undefined): string {
const hex = color && GITHUB_HEX_COLOR.exec(color)?.[1];
return hex ? `#${hex}` : DEFAULT_TAG_COLOR;
}
/**
* A GitHub label drawn like Macro's tag pills: a neutral outline pill with
* the label's color as a dot, so labels read the same as email and task tags.
*/
export function GithubLabelPill(props: {
name: string;
/** GitHub's six-digit hex color, with or without `#`. */
color?: string | null;
class?: string;
}) {
return (
<span
title={props.name}
class={rowPillClasses(cn('max-w-full', props.class))}
>
<TagDot fill={githubLabelColor(props.color)} size="sm" />
<span data-pill-text class="min-w-0 truncate">
{props.name}
</span>
</span>
);
}
/** A pull request's labels as pills, in GitHub's order. */
export function GithubLabelPills(props: {
labels: readonly GithubPullRequestLabel[];
class?: string;
pillClass?: string;
}) {
return (
<Show when={props.labels.length > 0}>
<span class={cn('flex min-w-0 items-center gap-1', props.class)}>
<For each={props.labels}>
{(label) => (
<GithubLabelPill
name={label.name}
color={label.color}
class={props.pillClass}
/>
)}
</For>
</span>
</Show>
);
}