Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export function ChatFileDownloadAll({ files }: ChatFileDownloadAllProps) {
variant='ghost-secondary'
onClick={handleDownloadAll}
disabled={isDownloading}
className='p-0'
size='icon'
>
{isDownloading ? (
<Loader className='size-3' animate />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const ClientChatMessage = memo(function ClientChatMessage({
<Button
aria-label={isCopied ? 'Copied!' : 'Copy to clipboard'}
variant='ghost-secondary'
className='p-0'
size='icon'
onClick={() => {
const contentToCopy =
typeof cleanTextContent === 'string'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import {
FieldError,
RequiredLabel,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/sidebar-fields'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import { useAddTableColumn, useUpdateColumn } from '@/hooks/queries/tables'
import { SelectOptionsEditor } from '../select-field'
import { columnTypeOptionsForTable } from './column-types'
Expand Down Expand Up @@ -263,19 +267,12 @@ function ColumnConfigBody({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Configure column</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 pt-3 pb-2 [overflow-anchor:none]'>
{/* `disabled` on the fieldset reaches every native control inside,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import type { ColumnDefinition, WorkflowGroup, WorkflowGroupOutput } from '@/lib
import { columnMatchesRef, getColumnId } from '@/lib/table/column-keys'
import { deriveOutputColumnName } from '@/lib/table/column-naming'
import { FieldError } from '@/app/workspace/[workspaceId]/tables/[tableId]/components/sidebar-fields'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import type { EnrichmentConfig as EnrichmentDef } from '@/enrichments/types'
import {
useAddWorkflowGroup,
Expand Down Expand Up @@ -232,31 +236,21 @@ export function EnrichmentConfig({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<div className='flex min-w-0 items-center gap-1.5'>
<Button
variant='ghost'
size='sm'
<TableSidebarHeaderAction
onClick={onBack}
iconPadding='sm'
className='size-7 flex-none'
className='flex-none'
aria-label='Back to enrichments'
>
<ArrowLeft className='size-[14px]' />
</Button>
</TableSidebarHeaderAction>
<OverflowText label={enrichment.name} className='text-[var(--text-primary)] text-small' />
</div>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 pt-3 pb-2 [overflow-anchor:none]'>
<div className='flex flex-col gap-[9.5px]'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use client'

import { useState } from 'react'
import { Button, ChipInput, cn } from '@sim/emcn'
import { ChipInput, cn } from '@sim/emcn'
import { Search, X } from '@sim/emcn/icons'
import type { ColumnDefinition, WorkflowGroup } from '@/lib/table'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import { ALL_ENRICHMENTS } from '@/enrichments'
import { getEnrichment } from '@/enrichments/registry'
import type { EnrichmentConfig as EnrichmentDef } from '@/enrichments/types'
Expand Down Expand Up @@ -71,19 +75,12 @@ function EnrichmentsSidebarBody({
if (editGroup && !editEnrichment) {
return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Enrichment</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>
<div className='flex flex-1 items-center justify-center px-6 text-center'>
<p className='text-[var(--text-tertiary)] text-small'>
This enrichment ("{editGroup.enrichmentId}") is no longer available. Delete the column
Expand Down Expand Up @@ -118,19 +115,12 @@ function EnrichmentsSidebarBody({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<h2 className='text-[var(--text-primary)] text-small'>Enrichments</h2>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='px-2 pt-3'>
<ChipInput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from 'react'
import { Button, cn } from '@sim/emcn'

interface TableSidebarHeaderProps {
children: ReactNode
}

export function TableSidebarHeader({ children }: TableSidebarHeaderProps) {
return (
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
{children}
</div>
)
}

interface TableSidebarHeaderActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
'aria-label': string
}

export const TableSidebarHeaderAction = forwardRef<
HTMLButtonElement,
TableSidebarHeaderActionProps
>(({ className, ...props }, ref) => (
<Button
{...props}
ref={ref}
variant='ghost'
size='sm'
iconPadding='sm'
className={cn(
'size-7 focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--text-muted)_30%,transparent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]',
className
)}
/>
))

TableSidebarHeaderAction.displayName = 'TableSidebarHeaderAction'
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ChipInput,
type ComboboxOptionGroup,
cn,
DashedDividerLine,
FieldDisclosure,
FieldDivider,
Label,
Loader,
Expand All @@ -16,7 +16,7 @@ import {
Tooltip,
toast,
} from '@sim/emcn'
import { ArrowLeft, ChevronDown, SquareArrowUpRight, X } from '@sim/emcn/icons'
import { ArrowLeft, SquareArrowUpRight, X } from '@sim/emcn/icons'
import { toError } from '@sim/utils/errors'
import { generateId } from '@sim/utils/id'
import { findValidationIssue, isValidationError } from '@/lib/api/client/errors'
Expand Down Expand Up @@ -46,6 +46,10 @@ import {
FieldError,
RequiredLabel,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/sidebar-fields'
import {
TableSidebarHeader,
TableSidebarHeaderAction,
} from '@/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-header/table-sidebar-header'
import { PreviewWorkflow } from '@/app/workspace/[workspaceId]/w/components/preview'
import { BlockTile } from '@/blocks/block-tile'
import { useDeployedWorkflowState } from '@/hooks/queries/deployments'
Expand Down Expand Up @@ -630,35 +634,25 @@ export function WorkflowSidebarBody({

return (
<div className='flex h-full flex-col'>
<div className='flex min-h-[48px] items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
<TableSidebarHeader>
<div className='flex min-w-0 items-center gap-1.5'>
{showBackButton && (
<Button
variant='ghost'
size='sm'
<TableSidebarHeaderAction
onClick={onBack}
iconPadding='sm'
className='size-7 flex-none'
className='flex-none'
aria-label='Back to enrichments'
>
<ArrowLeft className='size-[14px]' />
</Button>
</TableSidebarHeaderAction>
)}
<h2 className='flex min-w-0'>
<OverflowText label={title} className='text-[var(--text-primary)] text-small' />
</h2>
</div>
<Button
variant='ghost'
size='sm'
onClick={onClose}
iconPadding='sm'
className='size-7 flex-none'
aria-label='Close'
>
<TableSidebarHeaderAction onClick={onClose} className='flex-none' aria-label='Close'>
<X className='size-[14px]' />
</Button>
</div>
</TableSidebarHeaderAction>
</TableSidebarHeader>

<div className='flex-1 overflow-y-auto overflow-x-hidden px-2 pt-3 pb-2 [overflow-anchor:none]'>
{/* Single-output mode renames this column directly. */}
Expand Down Expand Up @@ -838,23 +832,9 @@ export function WorkflowSidebarBody({
)}
{selectedWorkflowId && (
<>
<div className='flex items-center gap-2.5 px-0.5 pt-3.5 pb-3'>
<DashedDividerLine className='flex-1' />
<button
type='button'
onClick={() => setShowAdvanced((v) => !v)}
className='flex items-center gap-1.5 whitespace-nowrap text-[var(--text-secondary)] text-small hover-hover:text-[var(--text-primary)]'
>
{showAdvanced ? 'Hide additional fields' : 'Show additional fields'}
<ChevronDown
className={cn(
'size-[14px] transition-transform duration-200',
showAdvanced && 'rotate-180'
)}
/>
</button>
<DashedDividerLine className='flex-1' />
</div>
<FieldDisclosure expanded={showAdvanced} onClick={() => setShowAdvanced((v) => !v)}>
{showAdvanced ? 'Hide additional fields' : 'Show additional fields'}
</FieldDisclosure>
{showAdvanced && (
<>
<InputMappingSection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
'use client'

import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Button, DashedDividerLine, FieldDivider, Loader, Tooltip } from '@sim/emcn'
import {
Button,
DashedDividerLine,
FieldDisclosure,
FieldDivider,
Loader,
Tooltip,
} from '@sim/emcn'
import {
BookOpen,
Check,
ChevronDown,
ChevronUp,
Lock,
Pencil,
Expand Down Expand Up @@ -470,11 +476,11 @@ export function Editor() {
{userPermissions.canAdmin && currentBlock.locked && !isAncestorLocked ? (
<Button
variant='ghost'
className='p-0'
size='icon'
onClick={() => collaborativeBatchToggleLocked([currentBlockId!])}
aria-label='Unlock block'
>
<Unlock className='size-[14px] text-[var(--text-secondary)]' />
<Unlock className='size-[14px]' />
</Button>
) : (
<div className='flex items-center justify-center'>
Expand All @@ -499,7 +505,7 @@ export function Editor() {
<Tooltip.Trigger asChild>
<Button
variant='ghost'
className='p-0'
size='icon'
onClick={isRenaming ? handleSaveRename : handleStartRename}
disabled={!canEditBlock}
aria-label={isRenaming ? 'Save name' : 'Rename block'}
Expand Down Expand Up @@ -538,7 +544,7 @@ export function Editor() {
<Tooltip.Trigger asChild>
<Button
variant='ghost'
className='p-0'
size='icon'
onClick={handleOpenDocs}
aria-label='Open documentation'
>
Expand Down Expand Up @@ -743,22 +749,14 @@ export function Editor() {
})}

{hasAdditionalFields && canEditBlock && (
<div className='flex items-center gap-2.5 px-0.5 pt-3.5 pb-3'>
<DashedDividerLine className='flex-1' />
<button
type='button'
onClick={handleToggleAdditionalFields}
className='flex items-center gap-1.5 whitespace-nowrap text-[var(--text-secondary)] text-small hover-hover:text-[var(--text-primary)]'
>
{displayAdvancedOptions
? 'Hide additional fields'
: 'Show additional fields'}
<ChevronDown
className={`size-[14px] transition-transform duration-200 ${displayAdvancedOptions ? 'rotate-180' : ''}`}
/>
</button>
<DashedDividerLine className='flex-1' />
</div>
<FieldDisclosure
expanded={displayAdvancedOptions}
onClick={handleToggleAdditionalFields}
>
{displayAdvancedOptions
? 'Hide additional fields'
: 'Show additional fields'}
</FieldDisclosure>
)}
{hasAdditionalFields && !canEditBlock && displayAdvancedOptions && (
<div className='flex items-center gap-2.5 px-0.5 pt-3.5 pb-3'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,12 +875,7 @@ export const Toolbar = memo(
<h2 className='text-[var(--text-primary)] text-sm'>Toolbar</h2>
<div className='flex shrink-0 items-center gap-2'>
{!isSearchActive ? (
<Button
variant='ghost'
className='p-0'
aria-label='Search toolbar'
onClick={focusSearch}
>
<Button variant='ghost' size='icon' aria-label='Search toolbar' onClick={focusSearch}>
<Search className='size-[14px]' />
</Button>
) : (
Expand Down
Loading
Loading