Files
supabase/apps/studio/components/interfaces/Settings/Logs/MultiSelectActionBar.tsx
Danny White ec53175b8a refactor(ui): rename text-brand to text-primary (#50564)
## What kind of change does this PR introduce?

Refactor. Follow-up to #49871.

## What is the current behavior?

Branded (green) text still uses the `text-brand` classname while the
colour comes from `--primary`.

## What is the new behavior?

**Rename-only:** `text-brand` → `text-primary` across callsites and
docs. Leftover `bg-brand` / `border-brand` alias to `brand-default`. No
intentional colour changes in this PR.

This better matches how we treat our green in other components and
props, like `variant="primary"` for green buttons.

## To test

On light mode: smoke-test that branded text still looks like #49871
(readable green, not the bright fill).

-
[Homepage](https://zone-www-dot-com-git-dnywh-depr-316-text-brand-de2380-supabase.vercel.app/):
“Scale to millions” uses `text-primary`
- [Docs
homepage](https://docs-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/docs):
branded links like “More on self-hosting” are still readable
- [Typography
docs](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/typography):
documents `text-primary`
- [Colour
usage](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/color-usage):
`text-primary` is visibly darker than `bg-brand-default` _on light mode_
- [Studio auth
providers](https://studio-staging-git-dnywh-depr-316-text-brand-to-60fa6c-supabase.vercel.app/dashboard/project/_/auth/providers):
enabled provider badge text readable; status dot stays bright green

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Style**
* Updated branded text, link hover states, icons, badges, indicators,
and highlighted content across the Design System, Docs, Studio, Learn,
UI Library, and marketing experiences to use the primary theme color.
* Updated syntax highlighting and table-of-contents styling for
consistent primary-color presentation.
  * Refined brand color fallback behavior for bright fills and borders.

* **Documentation**
* Updated color-usage and typography guidance to recommend the primary
text utility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 16:19:03 +10:00

111 lines
3.7 KiB
TypeScript

import { Check, ChevronDown, Copy, X as XIcon } from 'lucide-react'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from 'ui'
import type { LogData, QueryType } from './Logs.types'
import { buildLogsPrompt } from './Logs.utils'
import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
import { AiAssistantDropdown } from '@/components/ui/AiAssistantDropdown'
import { ShortcutBadge } from '@/components/ui/ShortcutBadge'
import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
export type LogCopyFormat = 'json' | 'markdown' | 'csv'
interface MultiSelectActionBarProps {
selectedRows: Set<string>
selectedRowsData: LogData[]
copiedFormat: LogCopyFormat | null
onCopy: (format: LogCopyFormat) => void
onClear: () => void
queryType?: QueryType
sqlQuery?: string
}
export function MultiSelectActionBar({
selectedRows,
selectedRowsData,
copiedFormat,
onCopy,
onClear,
queryType,
sqlQuery,
}: MultiSelectActionBarProps) {
const { openSidebar } = useSidebarManagerSnapshot()
const aiSnap = useAiAssistantStateSnapshot()
function handleOpenAiAssistant() {
const prompt = buildLogsPrompt(selectedRowsData, queryType, sqlQuery)
openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
aiSnap.newChat({ initialMessage: prompt })
}
const count = selectedRows.size
if (count === 0) return null
return (
<div
className="flex items-center gap-2 px-3 py-1.5 border-b bg-surface-200 text-sm sticky top-0 z-10"
style={{ height: 40 }}
>
<span className="text-foreground-light font-mono text-xs">
{count} row{count !== 1 ? 's' : ''} selected
</span>
<div className="flex items-center gap-1 ml-auto">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
size="tiny"
icon={
copiedFormat ? <Check size={12} className="text-primary" /> : <Copy size={12} />
}
iconRight={<ChevronDown size={11} />}
>
{copiedFormat ? 'Copied!' : 'Copy'}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-60">
<DropdownMenuItem onClick={() => onCopy('json')} className="gap-x-2">
<Copy size={13} />
<p>Copy as JSON</p>
<ShortcutBadge shortcutId={SHORTCUT_IDS.RESULTS_COPY_JSON} className="ml-auto" />
</DropdownMenuItem>
<DropdownMenuItem onClick={() => onCopy('markdown')} className="gap-x-2">
<Copy size={13} />
<p>Copy as Markdown</p>
<ShortcutBadge shortcutId={SHORTCUT_IDS.RESULTS_COPY_MARKDOWN} className="ml-auto" />
</DropdownMenuItem>
<DropdownMenuItem onClick={() => onCopy('csv')} className="gap-x-2">
<Copy size={13} />
<p>Copy as CSV</p>
<ShortcutBadge shortcutId={SHORTCUT_IDS.RESULTS_COPY_CSV} className="ml-auto" />
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<AiAssistantDropdown
label="Explain with AI"
buildPrompt={() => buildLogsPrompt(selectedRowsData, queryType, sqlQuery)}
onOpenAssistant={handleOpenAiAssistant}
telemetrySource="log_explorer"
/>
<Button
variant="text"
size="tiny"
icon={<XIcon size={12} />}
onClick={onClear}
title="Clear selection"
className="text-foreground-lighter px-1.5 hover:text-foreground"
/>
</div>
</div>
)
}