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
Restyle the Slack archive importer and Slack/Pipedream connections to match settings (#7587)
Will Hutchinsonb0a36077bdc4
diff --git a/apps/web/src/features/settings/Team.tsx b/apps/web/src/features/settings/Team.tsxindex 9c713ef0f6..2b7532775d 100644--- a/apps/web/src/features/settings/Team.tsx+++ b/apps/web/src/features/settings/Team.tsx@@ -1495,8 +1495,8 @@ function TeamManagement(props: {</SettingsSection><SettingsSection title="Connections">- <SlackImport teamId={props.teamId} isAdmin={isAdminOrOwner()} /><SettingsCard>+ <SlackImport teamId={props.teamId} isAdmin={isAdminOrOwner()} /><IntegrationRowicon={<GithubIcon />}title="GitHub App"diff --git a/apps/web/src/features/settings/connections/ConnectedView.tsx b/apps/web/src/features/settings/connections/ConnectedView.tsxindex 7b7eda849e..023ec44029 100644--- a/apps/web/src/features/settings/connections/ConnectedView.tsx+++ b/apps/web/src/features/settings/connections/ConnectedView.tsx@@ -2,10 +2,10 @@ import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';import CaretRightIcon from '@phosphor/caret-right.svg';import { Button } from '@ui';import { For, Show } from 'solid-js';+import { IntegrationRow, SettingsCard, SettingsSection } from '../primitives';import { LeftoverRow } from './leftover-row';import type { ConnectionsModel } from './model';import { isConnectionsEmpty } from './model';-import { IntegrationRow, SettingsCard, SettingsSection } from './primitives';import { availableStarters, providerIcon } from './provider-meta';import { useConnectionsView } from './view-state';diff --git a/apps/web/src/features/settings/connections/ConnectionsPage.tsx b/apps/web/src/features/settings/connections/ConnectionsPage.tsxindex d81cfe205f..b46c95a9c8 100644--- a/apps/web/src/features/settings/connections/ConnectionsPage.tsx+++ b/apps/web/src/features/settings/connections/ConnectionsPage.tsx@@ -7,10 +7,10 @@ import {import { connectPipedreamApp } from '@queries/pipedream-connectors';import { Button } from '@ui';import { createEffect, on, Show } from 'solid-js';+import { SettingsPage } from '../primitives';import { ConnectedView } from './ConnectedView';import { DiscoverView } from './DiscoverView';import { PipedreamAiProvider } from './PipedreamAiProvider';-import { SettingsPage } from './primitives';import { useConnectionsModel } from './use-connections-model';import { ConnectionsViewProvider, useConnectionsView } from './view-state';@@ -64,6 +64,7 @@ function ConnectionsContent(props: { onOpenMacroMcp: () => void }) {title="Agent connections"description={description}onBack={view.provider() ? view.closeProvider : undefined}+ backLabel="Connections"><div class="flex items-center gap-3 text-sm text-ink-muted">Couldn't load Connections.diff --git a/apps/web/src/features/settings/connections/DiscoverView.tsx b/apps/web/src/features/settings/connections/DiscoverView.tsxindex 54d756a319..e812dd8ebe 100644--- a/apps/web/src/features/settings/connections/DiscoverView.tsx+++ b/apps/web/src/features/settings/connections/DiscoverView.tsx@@ -12,10 +12,10 @@ import XIcon from '@phosphor/x.svg';import type { PipedreamCatalogEntryResponse } from '@service-cognition/client';import { Button } from '@ui';import { createMemo, createSignal, For, Show } from 'solid-js';+import { ConnectAction } from '../integration-ui';+import { IntegrationRow, SettingsCard, SettingsSection } from '../primitives';import { AddCustomMcpDialog } from './add-custom-mcp-dialog';-import { ConnectAction } from './integration-ui';import type { ConnectionsModel } from './model';-import { IntegrationRow, SettingsCard, SettingsSection } from './primitives';import {availableStarters,PIPEDREAM_BROWSE_HIDDEN_SLUGS,@@ -86,7 +86,7 @@ export function DiscoverView(props: { model: ConnectionsModel }) {<div class="grid grid-cols-1 gap-3 @[460px]:grid-cols-2"><For each={featured()}>{(item) => (- <SettingsCard>+ <SettingsCard class="@container"><buttontype="button"class="flex h-full w-full flex-col items-stretch text-left outline-none hover:bg-ink/4 focus-visible:bg-ink/6"diff --git a/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsxindex 1165c1f89e..3faefb9786 100644--- a/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx+++ b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx@@ -6,6 +6,14 @@ import {useUpdatePipedreamConnectionMutation,} from '@queries/pipedream-connectors';import { createSignal, type JSX, Show, Suspense } from 'solid-js';+import { match } from 'ts-pattern';+import { type ConnectionState, StatusDot } from '../integration-ui';+import {+ IntegrationRow,+ SettingsCard,+ SettingsPage,+ SettingsSection,+} from '../primitives';import { AiGrantActions } from './ai-grant-actions';import { capabilityFacts } from './capability-row';import {@@ -13,18 +21,13 @@ import {DisconnectConfirmDialog,} from './disconnect-confirm';import {+ type CapabilityStatus,type ConnectionsModel,CURATED_AI,type CuratedAiProvider,capabilitiesFor,} from './model';import { useNativeMcpActions } from './native-actions';-import {- IntegrationRow,- SettingsCard,- SettingsPage,- SettingsSection,-} from './primitives';import { providerIcon } from './provider-meta';import { SlackChannelImportCard } from './slack-channel-import/SlackChannelImportCard';import { useConnectionsView } from './view-state';@@ -55,6 +58,27 @@ const COPY: Record<},};+function statusIndicator(status: CapabilityStatus): {+ state: ConnectionState;+ label: string;+} {+ return match(status)+ .with('connected', () => ({+ state: 'connected' as const,+ label: 'Connected',+ }))+ .with('off', () => ({ state: 'disconnected' as const, label: 'Disabled' }))+ .with('action-required', () => ({+ state: 'attention' as const,+ label: 'Needs reconnecting',+ }))+ .with('not-connected', () => ({+ state: 'disconnected' as const,+ label: 'Not connected',+ }))+ .exhaustive();+}+export function PipedreamAiProvider(props: {model: ConnectionsModel;provider: CuratedAiProvider;@@ -65,6 +89,8 @@ export function PipedreamAiProvider(props: {capabilitiesFor(props.model, props.provider).find((item) => item.kind === 'ai');+ const status = () => row()?.status ?? 'not-connected';+ const indicator = () => statusIndicator(status());const aiFacts = () => {const cap = row();return cap ? capabilityFacts(cap) : 'Powered by Pipedream';@@ -152,7 +178,7 @@ export function PipedreamAiProvider(props: {const actions = (): JSX.Element => (<AiGrantActions- status={row()?.status ?? 'not-connected'}+ status={status()}onConnect={() => void connect()}onReconnect={reconnect}onEnable={() => setEnabled(true)}@@ -169,15 +195,21 @@ export function PipedreamAiProvider(props: {<SettingsPagetitle={copy.title}icon={providerIcon(props.provider)}+ description={copy.outcome}onBack={view.closeProvider}+ backLabel="Connections">- <SettingsSection title="Your Connections">+ <SettingsSection title="Macro AI"><SettingsCard><IntegrationRow+ icon={providerIcon(props.provider)}title={copy.title}- description={copy.outcome}+ status={+ <StatusDot state={indicator().state} label={indicator().label} />+ }+ description={indicator().label}facts={aiFacts()}- muted={row()?.status === 'off'}+ muted={status() === 'off'}>{actions()}</IntegrationRow>diff --git a/apps/web/src/features/settings/connections/ai-grant-actions.tsx b/apps/web/src/features/settings/connections/ai-grant-actions.tsxindex ed727c2942..ac103be23d 100644--- a/apps/web/src/features/settings/connections/ai-grant-actions.tsx+++ b/apps/web/src/features/settings/connections/ai-grant-actions.tsx@@ -1,10 +1,10 @@import type { JSX } from 'solid-js';import { match } from 'ts-pattern';+import { ConnectAction } from '../integration-ui';import {type ConnectionMenuItem,ConnectionRowActions,} from './connection-more';-import { ConnectAction } from './integration-ui';import type { CapabilityStatus } from './model';export function AiGrantActions(props: {diff --git a/apps/web/src/features/settings/connections/connection-more.tsx b/apps/web/src/features/settings/connections/connection-more.tsxindex fdb0b88390..cbb51363bd 100644--- a/apps/web/src/features/settings/connections/connection-more.tsx+++ b/apps/web/src/features/settings/connections/connection-more.tsx@@ -38,7 +38,10 @@ export function ConnectionMore(props: {<Dropdown><Dropdown.Triggeraria-label="More"- class="relative inline-flex size-6 items-center justify-center border-1 border-edge bg-transparent text-ink-muted outline-none hover:bg-hover hover:text-ink"+ variant="ghost"+ size="icon-sm"+ depth={3}+ class="text-ink-muted hover:text-ink"><DotsThreeIcon class="size-4" /></Dropdown.Trigger>diff --git a/apps/web/src/features/settings/connections/integration-ui.tsx b/apps/web/src/features/settings/connections/integration-ui.tsxdeleted file mode 100644index cc61abd2b8..0000000000--- a/apps/web/src/features/settings/connections/integration-ui.tsx+++ /dev/null@@ -1,86 +0,0 @@-import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';-import SpinnerIcon from '@phosphor/spinner-gap.svg';-import { cn } from '@ui';-import { type JSX, Show } from 'solid-js';--/*- * Trailing actions for Connections cards, including a non-interactive label- * when the entire row is already a button.- */--/**- * The trailing action on an integration row. Defaults to a quiet text+arrow- * "Connect" affordance (mirrors Linear's link-style connect button); pass- * `variant` to render a neutral or destructive action.- */-export function ConnectAction(props: {- label: JSX.Element;- onClick?: () => void;- href?: string;- disabled?: boolean;- loading?: boolean;- ariaLabel?: string;- /** 'connect' shows the external-link arrow; the others are plain buttons. */- variant?: 'connect' | 'neutral' | 'danger';-}) {- const variant = () => props.variant ?? 'connect';- const className = () =>- cn(- 'inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-sm font-medium',- 'cursor-default transition-colors',- 'outline-none focus-visible:bg-ink/6',- props.disabled || props.loading- ? 'opacity-50 pointer-events-none'- : undefined,- variant() === 'danger'- ? 'text-ink-muted hover:bg-ink/4 hover:text-failure'- : 'text-ink-muted hover:bg-ink/4 hover:text-ink'- );- const body = (- <>- <Show when={props.loading}>- <SpinnerIcon class="size-4 animate-spin" />- </Show>- {props.label}- <Show when={variant() === 'connect' && !props.loading}>- <ArrowUpRightIcon class="size-3.5 opacity-70" />- </Show>- </>- );- if (props.href) {- const inert = () => Boolean(props.disabled || props.loading);- return (- <a- href={props.href}- target="_blank"- rel="noopener noreferrer"- aria-label={props.ariaLabel}- aria-disabled={inert() || undefined}- onClick={(event) => {- if (inert()) event.preventDefault();- }}- class={className()}- >- {body}- </a>- );- }- if (!props.onClick) {- return (- <span aria-hidden="true" class={cn(className(), 'pointer-events-none')}>- {body}- </span>- );- }- return (- <button- type="button"- disabled={props.disabled || props.loading}- aria-label={props.ariaLabel}- onClick={() => props.onClick?.()}- class={className()}- >- {body}- </button>- );-}diff --git a/apps/web/src/features/settings/connections/leftover-row.tsx b/apps/web/src/features/settings/connections/leftover-row.tsxindex 8ca3903f9d..adbce4a74a 100644--- a/apps/web/src/features/settings/connections/leftover-row.tsx+++ b/apps/web/src/features/settings/connections/leftover-row.tsx@@ -8,10 +8,12 @@ import {import { Button, Dialog, Panel } from '@ui';import { createEffect, createSignal, type JSX, on, Show } from 'solid-js';import { match } from 'ts-pattern';+import { ConnectAction } from '../integration-ui';import {readMcpAuthAttempted,writeMcpAuthAttempted,} from '../mcp-auth-attempt';+import { IntegrationRow, SettingsRow } from '../primitives';import {type ConnectionMenuItem,ConnectionRowActions,@@ -20,10 +22,8 @@ import {type DisconnectConfirm,DisconnectConfirmDialog,} from './disconnect-confirm';-import { ConnectAction } from './integration-ui';import type { Leftover } from './model';import { useNativeMcpActions } from './native-actions';-import { IntegrationRow, SettingsRow } from './primitives';function leftoverDisabled(leftover: Leftover): boolean {return match(leftover)diff --git a/apps/web/src/features/settings/connections/primitives.tsx b/apps/web/src/features/settings/connections/primitives.tsxdeleted file mode 100644index 2165728d16..0000000000--- a/apps/web/src/features/settings/connections/primitives.tsx+++ /dev/null@@ -1,259 +0,0 @@-import CaretLeftIcon from '@phosphor/caret-left.svg';-import { cn } from '@ui';-import { type JSX, Show, useContext } from 'solid-js';-import {- SettingsSheetContext,- SettingsCard as SharedSettingsCard,-} from '../primitives';--/*- * Connections presentation adapted from #6151. Kept local to the Connections- * page so its card spacing and provider headers do not alter Harness or the- * other settings pages.- *- * <SettingsPage title="Account" description="…">- * <SettingsSection title="Profile">- * <SettingsCard>- * <SettingsRow label="Email">…</SettingsRow>- * <SettingsRow label="Full name">…</SettingsRow>- * </SettingsCard>- * </SettingsSection>- * </SettingsPage>- */--/**- * Scrolling page shell: a centered, max-width column with a large title and an- * optional one-line description, followed by the page's sections.- */-export function SettingsPage(props: {- title: string;- /** Optional one-line subtitle; accepts text or inline markup (e.g. a link). */- description?: JSX.Element;- /** Quiet line under the description (e.g. a cross-tab signpost). */- signpost?: JSX.Element;- /** Brand mark left of the title. Same slot as IntegrationRow. */- icon?: JSX.Element;- /** Right-aligned controls beside the title (e.g. a global toggle). */- actions?: JSX.Element;- onBack?: () => void;- backLabel?: string;- children: JSX.Element;-}) {- const inSheet = useContext(SettingsSheetContext);- return (- <div- data-settings-page- data-drawer-scroll-body={inSheet ? true : undefined}- class="h-full min-h-0 overflow-y-auto [overflow-anchor:none] bg-[color-mix(in_srgb,var(--color-panel)_99%,var(--color-ink))] [&_[data-variant=cta]]:bg-ink [&_[data-variant=cta]]:text-panel [&_[data-variant=cta]]:focus-visible:ring-panel/70 [&_:has(>input[type=checkbox])]:[--color-accent:var(--color-ink)] [&_input[type=checkbox]]:accent-ink"- >- {/* On mobile/tablet the page is full-frame: the chrome insets live inside the- scroll content (plus the usual breathing room) so pages scroll under- the floating header and bottom rows like every other block. */}- <div- class={cn(- 'mx-auto w-full max-w-[960px]',- inSheet- ? 'px-3 pt-2 pb-[max(24px,var(--mobile-sheet-safe-padding))]'- : 'px-12 pt-8 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]'- )}- >- <Show when={props.onBack}>- <button- type="button"- class="mb-5 -ml-1.5 inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 text-sm text-ink-muted outline-none hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"- onClick={props.onBack}- >- <CaretLeftIcon class="size-4" />- {props.backLabel ?? 'Connections'}- </button>- </Show>- <header class="flex flex-col gap-1.5">- <Show when={!inSheet || props.onBack || props.icon}>- <div class="flex items-start justify-between gap-4">- <div class="flex min-w-0 items-center gap-3.5">- <Show when={props.icon}>- <div class="flex size-9 shrink-0 items-center justify-center [&_svg]:size-8 [&_img]:size-8">- {props.icon}- </div>- </Show>- <h1 class="min-w-0 text-[26px]/tight font-medium tracking-[-0.025em] text-ink">- {props.title}- </h1>- </div>- <Show when={props.actions}>- <div class="shrink-0 pt-1">{props.actions}</div>- </Show>- </div>- </Show>- <Show when={props.description}>- <p class="text-sm text-ink-muted text-balance">- {props.description}- </p>- </Show>- <Show when={props.signpost}>{props.signpost}</Show>- </header>- <div- class={cn('flex flex-col', inSheet ? 'mt-3 gap-6' : 'mt-12 gap-12')}- >- {props.children}- </div>- </div>- </div>- );-}--export { SettingsSection } from '../primitives';--/**- * A quiet outlined card. Direct children are treated as rows and get a divider- * between them (via `settings-row-dividers`); a single-child card draws- * no divider, so it doubles as a plain container.- * `border-1` is 1px. The default `border` utility is a 0.5px hairline.- */-export function SettingsCard(props: { class?: string; children: JSX.Element }) {- return (- <SharedSettingsCard class={cn('@container', props.class)}>- {props.children}- </SharedSettingsCard>- );-}--/**- * A label (with optional sub-text) on the left and its control on the right.- * `align="start"` top-aligns the two columns for taller controls.- */-export function SettingsRow(props: {- label: JSX.Element;- description?: JSX.Element;- children?: JSX.Element;- align?: 'center' | 'start';- /** Hide the description on mobile, where the row is too cramped for it. */- hideDescriptionOnMobile?: boolean;- /**- * Below a 460px container width, stack the control on its own row beneath- * the label/description instead of keeping it in a right-hand column.- * Requires an ancestor carrying `@container`.- */- stackOnNarrow?: boolean;- /** Soften the label when the row is paused / disabled. */- muted?: boolean;- class?: string;-}) {- return (- <div- class={cn(- 'flex gap-4 px-4 py-3.5 min-h-[60px]',- props.stackOnNarrow- ? 'flex-col gap-3 @[460px]:flex-row @[460px]:justify-between @[460px]:gap-4'- : 'justify-between',- // Cross-axis alignment only makes sense once the row is horizontal, so- // gate it behind the container width when stacking.- props.align === 'start'- ? props.stackOnNarrow- ? '@[460px]:items-start'- : 'items-start'- : props.stackOnNarrow- ? '@[460px]:items-center'- : 'items-center',- props.class- )}- >- <div class="flex flex-col gap-0.5 min-w-0">- <div- class={cn(- 'text-sm font-medium truncate',- props.muted ? 'text-ink-muted' : 'text-ink'- )}- >- {props.label}- </div>- <Show when={props.description}>- <div- class={cn(- 'text-sm text-ink-muted text-balance',- props.hideDescriptionOnMobile && 'mobile:hidden'- )}- >- {props.description}- </div>- </Show>- </div>- <Show when={props.children}>- <div- class={cn(- 'flex items-center gap-2',- props.stackOnNarrow- ? 'w-full @[460px]:w-auto @[460px]:shrink-0 @[460px]:justify-end @[460px]:text-right'- : 'shrink-0 justify-end text-right'- )}- >- {props.children}- </div>- </Show>- </div>- );-}--/**- * A row for an integration / service: a brand icon, a title + one-line- * description, and a trailing action slot. Used by the Connected accounts and- * MCP cards so every integration reads the same. The action stays on the- * title row. Description and facts use the width under the title.- */-export function IntegrationRow(props: {- /** The brand icon, rendered at its native size inside a fixed slot. */- icon?: JSX.Element;- title: JSX.Element;- description?: JSX.Element;- /** Proven facts under the outcome. Not truncated. */- facts?: JSX.Element;- /** Optional indicator shown right after the title (e.g. a connection dot). */- status?: JSX.Element;- /** Soften title and icon when the row is paused / disabled. */- muted?: boolean;- children?: JSX.Element;- class?: string;-}) {- return (- <div class={cn('flex items-start gap-4 px-4 py-5', props.class)}>- <Show when={props.icon}>- <div- class={cn(- 'flex size-9 shrink-0 items-center justify-center [&_svg]:size-8 [&_img]:size-8',- props.muted && 'opacity-50'- )}- >- {props.icon}- </div>- </Show>- <div class="min-w-0 flex-1 flex flex-col gap-1">- <div class="flex min-w-0 items-center gap-3">- <div class="flex min-w-0 flex-1 items-center gap-2">- <div- class={cn(- 'text-sm font-medium truncate',- props.muted ? 'text-ink-muted' : 'text-ink'- )}- >- {props.title}- </div>- <Show when={props.status}>{props.status}</Show>- </div>- <Show when={props.children}>- <div class="flex shrink-0 items-center gap-2">{props.children}</div>- </Show>- </div>- <Show when={props.description}>- <div class="text-sm text-ink-muted text-balance">- {props.description}- </div>- </Show>- <Show when={props.facts}>- <div class="ph-no-capture text-xs text-ink-extra-muted text-balance">- {props.facts}- </div>- </Show>- </div>- </div>- );-}diff --git a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsxindex a523b27dd4..80a02ca029 100644--- a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx+++ b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx@@ -38,7 +38,7 @@ vi.mock('@ui', () => ({<button {...props} />),}));-vi.mock('../primitives', () => ({+vi.mock('../../primitives', () => ({SettingsSection: (props: { title: string; children: JSX.Element }) => (<section aria-label={props.title}>{props.children}</section>),diff --git a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsxindex 99be928880..7ce364ddd6 100644--- a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx+++ b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx@@ -17,7 +17,7 @@ import {type JSX,Show,} from 'solid-js';-import { SettingsCard, SettingsSection } from '../primitives';+import { SettingsCard, SettingsSection } from '../../primitives';import {buildRows,filterRows,diff --git a/apps/web/src/features/settings/integration-ui.tsx b/apps/web/src/features/settings/integration-ui.tsxindex 7c580a9bec..6b85a6492b 100644--- a/apps/web/src/features/settings/integration-ui.tsx+++ b/apps/web/src/features/settings/integration-ui.tsx@@ -26,30 +26,35 @@ export type ConnectionState = 'connected' | 'attention' | 'disconnected';* The trailing action on an integration row. Defaults to a quiet text+arrow* "Connect" affordance (mirrors Linear's link-style connect button); pass* `variant` to render a neutral or destructive action (e.g. Disconnect).+ *+ * Renders an external link when given `href`, and a non-interactive label+ * when given neither `href` nor `onClick` (for rows that are themselves the+ * button, so the row keeps a single tab stop).*/export function ConnectAction(props: {- label: string;- onClick: () => void;+ label: JSX.Element;+ onClick?: () => void;+ href?: string;disabled?: boolean;loading?: boolean;+ ariaLabel?: string;/** 'connect' shows the external-link arrow; the others are plain buttons. */variant?: 'connect' | 'neutral' | 'danger';}) {const variant = () => props.variant ?? 'connect';- return (- <button- type="button"- disabled={props.disabled || props.loading}- onClick={() => props.onClick()}- class={cn(- 'inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-sm font-medium',- 'cursor-default transition-colors disabled:opacity-50',- 'outline-none focus-visible:bg-ink/6',- variant() === 'danger'- ? 'text-ink-muted hover:bg-ink/4 hover:text-failure'- : 'text-ink-muted hover:bg-ink/4 hover:text-ink'- )}- >+ const inert = () => Boolean(props.disabled || props.loading);+ const className = () =>+ cn(+ 'inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-sm font-medium',+ 'cursor-default transition-colors',+ 'outline-none focus-visible:bg-ink/6',+ inert() && 'opacity-50 pointer-events-none',+ variant() === 'danger'+ ? 'text-ink-muted hover:bg-ink/4 hover:text-failure'+ : 'text-ink-muted hover:bg-ink/4 hover:text-ink'+ );+ const body = (+ <><Show when={props.loading}><SpinnerIcon class="size-4 animate-spin" /></Show>@@ -57,6 +62,41 @@ export function ConnectAction(props: {<Show when={variant() === 'connect' && !props.loading}><ArrowUpRightIcon class="size-3.5 opacity-70" /></Show>+ </>+ );+ if (props.href) {+ return (+ <a+ href={props.href}+ target="_blank"+ rel="noopener noreferrer"+ aria-label={props.ariaLabel}+ aria-disabled={inert() || undefined}+ onClick={(event) => {+ if (inert()) event.preventDefault();+ }}+ class={className()}+ >+ {body}+ </a>+ );+ }+ if (!props.onClick) {+ return (+ <span aria-hidden="true" class={cn(className(), 'pointer-events-none')}>+ {body}+ </span>+ );+ }+ return (+ <button+ type="button"+ disabled={inert()}+ aria-label={props.ariaLabel}+ onClick={() => props.onClick?.()}+ class={className()}+ >+ {body}</button>);}diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsxindex b3328d3a73..1dd645878a 100644--- a/apps/web/src/features/settings/primitives.tsx+++ b/apps/web/src/features/settings/primitives.tsx@@ -1,3 +1,4 @@+import CaretLeftIcon from '@phosphor/caret-left.svg';import { Button, type ButtonProps, ComposerSurface, cn } from '@ui';import { children, createContext, type JSX, Show, useContext } from 'solid-js';import { settingsTarget } from './core/settings-target';@@ -31,8 +32,15 @@ export function SettingsPage(props: {showTitleInSheet?: boolean;/** Optional one-line subtitle; accepts text or inline markup (e.g. a link). */description?: JSX.Element;+ /** Quiet line under the description (e.g. a cross-tab signpost). */+ signpost?: JSX.Element;+ /** Brand mark left of the title, for provider detail pages. */+ icon?: JSX.Element;/** Right-aligned controls beside the title (e.g. a global toggle). */actions?: JSX.Element;+ /** Renders a back affordance above the title for drill-in subpages. */+ onBack?: () => void;+ backLabel?: string;children: JSX.Element;}) {const inSheet = useContext(SettingsSheetContext);@@ -53,18 +61,36 @@ export function SettingsPage(props: {: '@container px-12 pt-8 pb-24 @max-[480px]/settings-page:px-4 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]')}>+ <Show when={props.onBack}>+ <button+ type="button"+ class="mb-5 -ml-1.5 inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 text-sm text-ink-muted outline-none hover:bg-ink/4 hover:text-ink focus-visible:bg-ink/6"+ onClick={props.onBack}+ >+ <CaretLeftIcon class="size-4" />+ {props.backLabel ?? 'Back'}+ </button>+ </Show><header class="flex items-start justify-between gap-4 @max-[480px]/settings-page:flex-col @max-[480px]/settings-page:gap-3"><div class="flex flex-col gap-1.5 min-w-0">- <Show when={!inSheet || props.showTitleInSheet}>- <h1 class="text-[26px]/tight font-medium tracking-[-0.025em] text-ink">- {props.title}- </h1>+ <Show when={!inSheet || props.showTitleInSheet || props.onBack}>+ <div class="flex min-w-0 items-center gap-3">+ <Show when={props.icon}>+ <div class="flex size-9 shrink-0 items-center justify-center [&_svg]:size-7 [&_img]:size-7">+ {props.icon}+ </div>+ </Show>+ <h1 class="min-w-0 text-[26px]/tight font-medium tracking-[-0.025em] text-ink">+ {props.title}+ </h1>+ </div></Show><Show when={props.description}><p class="text-sm leading-relaxed text-ink/60">{props.description}</p></Show>+ <Show when={props.signpost}>{props.signpost}</Show></div><Show when={props.actions}><div class="shrink-0 pt-1">{props.actions}</div>@@ -188,6 +214,8 @@ export function SettingsRow(props: {* Requires an ancestor carrying `@container`.*/stackOnNarrow?: boolean;+ /** Soften the label when the row is paused / disabled. */+ muted?: boolean;class?: string;}) {const inSheet = useContext(SettingsSheetContext);@@ -218,7 +246,11 @@ export function SettingsRow(props: {)}><div class="flex flex-col gap-0.5 min-w-0">- <div class="text-base text-ink">{props.label}</div>+ <div+ class={cn('text-base', props.muted ? 'text-ink-muted' : 'text-ink')}+ >+ {props.label}+ </div><Show when={props.description}><divclass={cn(@@ -295,22 +327,40 @@ export function ChoiceRow(props: {*/export function IntegrationRow(props: {/** The brand icon, rendered at its native size inside a fixed slot. */- icon: JSX.Element;+ icon?: JSX.Element;title: JSX.Element;description?: JSX.Element;+ /** Proven facts under the description (e.g. connected accounts). Wraps. */+ facts?: JSX.Element;/** Optional indicator shown right after the title (e.g. a connection dot). */status?: JSX.Element;+ /** Soften title and icon when the row is paused / disabled. */+ muted?: boolean;children?: JSX.Element;class?: string;}) {return (<div class={cn('flex flex-wrap items-center gap-4 px-4 py-4', props.class)}>- <div class="flex size-9 shrink-0 items-center justify-center [&_svg]:size-6">- {props.icon}- </div>+ <Show when={props.icon}>+ <div+ class={cn(+ 'flex size-9 shrink-0 items-center justify-center [&_svg]:size-6 [&_img]:size-6',+ props.muted && 'opacity-50'+ )}+ >+ {props.icon}+ </div>+ </Show><div class="flex-1 min-w-0 flex flex-col gap-0.5"><div class="flex items-center gap-2 min-w-0">- <div class="text-sm font-medium text-ink truncate">{props.title}</div>+ <div+ class={cn(+ 'text-sm font-medium truncate',+ props.muted ? 'text-ink-muted' : 'text-ink'+ )}+ >+ {props.title}+ </div><Show when={props.status}>{props.status}</Show></div><Show when={props.description}>@@ -318,6 +368,11 @@ export function IntegrationRow(props: {{props.description}</div></Show>+ <Show when={props.facts}>+ <div class="ph-no-capture text-xs text-ink-extra-muted">+ {props.facts}+ </div>+ </Show></div><Show when={props.children}><div class="shrink-0 flex items-center gap-2">{props.children}</div>diff --git a/apps/web/src/features/slack-import/components/conversation-picker.tsx b/apps/web/src/features/slack-import/components/conversation-picker.tsxindex 32944bcca6..9e234846f4 100644--- a/apps/web/src/features/slack-import/components/conversation-picker.tsx+++ b/apps/web/src/features/slack-import/components/conversation-picker.tsx@@ -1,5 +1,17 @@-import { For, type JSX, onMount, Show } from 'solid-js';-import type { ArchiveDiscovery, ConversationKind } from '../core/export';+import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';+import { InputGroup } from '@ui';+import { createUniqueId, For, type JSX, onMount, Show } from 'solid-js';+import type {+ ArchiveDiscovery,+ ConversationKind,+ ConversationMetadata,+ ExportUser,+} from '../core/export';+import {+ ConversationKindIcon,+ DialogSectionTitle,+ NativeCheckbox,+} from './import-ui';type Props = {discovery: ArchiveDiscovery;@@ -12,19 +24,59 @@ type Props = {onSelect(ids: string[], selected: boolean): void;};-const groups: { kind: ConversationKind; label: string }[] = [- { kind: 'public_channel', label: 'Public Slack channels → Team channels' },- { kind: 'private_channel', label: 'Private channels' },- { kind: 'direct_message', label: 'Direct messages' },- { kind: 'group_direct_message', label: 'Group DMs → Private channels' },+const GROUPS: { kind: ConversationKind; label: string; target: string }[] = [+ { kind: 'public_channel', label: 'Public channels', target: 'Team channels' },+ {+ kind: 'private_channel',+ label: 'Private channels',+ target: 'Private channels',+ },+ {+ kind: 'direct_message',+ label: 'Direct messages',+ target: 'Direct messages',+ },+ {+ kind: 'group_direct_message',+ label: 'Group DMs',+ target: 'Private channels',+ },];+/** Slack exports name DMs by id and group DMs `mpdm-a--b-1`; members read better. */+function displayName(+ conversation: ConversationMetadata,+ users: ReadonlyMap<string, ExportUser>+): string {+ const isDm =+ conversation.kind === 'direct_message' ||+ conversation.kind === 'group_direct_message';+ const generated =+ conversation.name === conversation.slackChannelId ||+ (isDm && conversation.name.startsWith('mpdm-'));+ if (conversation.name && !generated) return conversation.name;+ const members = conversation.memberIds+ .map((id) => {+ const user = users.get(id);+ return user?.real_name || user?.profile?.display_name || user?.name || id;+ })+ .join(', ');+ return members || conversation.slackChannelId;+}+export function ConversationPicker(props: Props): JSX.Element {let search: HTMLInputElement | undefined;// Discovery replaces the disabled file input inside an already-open dialog.onMount(() => search?.focus());+ const users = () =>+ new Map(props.discovery.users.map((user) => [user.id, user]));+ const named = () =>+ props.discovery.conversations.map((conversation) => ({+ ...conversation,+ name: displayName(conversation, users()),+ }));const visible = () =>- props.discovery.conversations.filter(+ named().filter((conversation) =>(props.showArchived || !conversation.archived) &&`${conversation.name} ${conversation.slackChannelId}`@@ -40,133 +92,162 @@ export function ConversationPicker(props: Props): JSX.Element {selectable().every((conversation) =>props.selected.has(conversation.slackChannelId));+ const anyVisibleSelected = () =>+ selectable().some((conversation) =>+ props.selected.has(conversation.slackChannelId)+ );+ const selectableIds = () =>+ selectable().map((conversation) => conversation.slackChannelId);return (<section class="flex flex-col gap-3" aria-label="Conversations">- <label class="flex flex-col gap-1 text-sm">- Filter conversations- <input+ <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">+ <DialogSectionTitle>Conversations</DialogSectionTitle>+ <label class="flex items-center gap-2 text-xs text-ink-muted">+ <NativeCheckbox+ checked={props.showArchived}+ onChange={(event) =>+ props.onShowArchived(event.currentTarget.checked)+ }+ />+ Show archived conversations+ </label>+ </div>++ <InputGroup size="lg">+ <InputGroup.Addon>+ <MagnifyingGlassIcon class="size-4" />+ </InputGroup.Addon>+ <InputGroup.Inputref={search}type="search"- class="rounded border border-edge-muted bg-input p-2 text-ink"+ aria-label="Filter conversations"+ placeholder="Filter conversations"+ class="text-sm"value={props.filter}onInput={(event) => props.onFilter(event.currentTarget.value)}/>- </label>- <label class="flex items-center gap-2 text-sm">- <input- type="checkbox"- checked={props.showArchived}- onChange={(event) =>- props.onShowArchived(event.currentTarget.checked)- }- />- Show archived conversations- </label>- <label class="flex items-center gap-2 text-sm">- <input- type="checkbox"- checked={allSelected()}- disabled={!selectable().length}- onChange={(event) =>- props.onSelect(- selectable().map((conversation) => conversation.slackChannelId),- event.currentTarget.checked- )- }- />- Select all visible conversations- </label>- <button- type="button"- class="self-start text-sm underline disabled:opacity-50"- disabled={- !selectable().some((conversation) =>- props.selected.has(conversation.slackChannelId)- )- }- onClick={() =>- props.onSelect(- selectable().map((conversation) => conversation.slackChannelId),- false- )- }- >- Clear visible selection- </button>- <p class="text-sm text-ink-muted">- {props.selected.size} selected. Filtering does not clear selections.- Message counts are not yet counted.+ <InputGroup.Addon align="inline-end">+ <InputGroup.ClearButton />+ </InputGroup.Addon>+ </InputGroup>++ <div class="overflow-hidden rounded-lg border border-edge-muted">+ <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-edge-divider bg-ink/3 px-4 py-2 text-sm">+ <label class="flex items-center gap-3 text-ink">+ <NativeCheckbox+ checked={allSelected()}+ disabled={!selectable().length}+ onChange={(event) =>+ props.onSelect(selectableIds(), event.currentTarget.checked)+ }+ />+ Select all visible conversations+ </label>+ <div class="flex items-center gap-3 text-xs">+ <span class="text-ink-muted">{props.selected.size} selected</span>+ <button+ type="button"+ class="font-medium text-link outline-none hover:text-link-hover hover:underline focus-visible:underline disabled:pointer-events-none disabled:opacity-50"+ disabled={!anyVisibleSelected()}+ onClick={() => props.onSelect(selectableIds(), false)}+ >+ Clear visible selection+ </button>+ </div>+ </div>+ <div class="max-h-64 overflow-y-auto">+ <Show+ when={visible().length}+ fallback={+ <p class="px-4 py-6 text-center text-sm text-ink-muted">+ No matching conversations.+ </p>+ }+ >+ <For each={GROUPS}>+ {(group) => (+ <ConversationGroup+ {...group}+ conversations={visible().filter(+ (conversation) => conversation.kind === group.kind+ )}+ selected={props.selected}+ unsupported={props.unsupported}+ onSelect={props.onSelect}+ />+ )}+ </For>+ </Show>+ </div>+ </div>+ <p class="text-xs text-ink-extra-muted">+ Filtering never clears your selection. Message counts are available+ after import.</p>- <div class="max-h-72 overflow-y-auto rounded border border-edge-muted p-3">- <Show- when={visible().length}- fallback={- <p class="text-sm text-ink-muted">No matching conversations.</p>- }+ </section>+ );+}++function ConversationGroup(+ props: (typeof GROUPS)[number] &+ Pick<Props, 'selected' | 'unsupported' | 'onSelect'> & {+ conversations: ArchiveDiscovery['conversations'];+ }+): JSX.Element {+ const headingId = createUniqueId();+ return (+ <Show when={props.conversations.length}>+ <div role="group" aria-labelledby={headingId} class="min-w-0">+ <div+ id={headingId}+ class="sticky top-0 z-10 flex items-center gap-1.5 bg-surface px-4 pt-3 pb-1 text-xs font-medium text-ink-muted">- <For each={groups}>- {(group) => (- <Show- when={visible().some(- (conversation) => conversation.kind === group.kind- )}- >- <fieldset class="mb-3 min-w-0">- <legend class="text-sm font-medium">{group.label}</legend>- <For- each={visible().filter(- (conversation) => conversation.kind === group.kind- )}- >- {(conversation) => (- <label class="flex items-start gap-2 py-2 text-sm">- <input- type="checkbox"- class="mt-1 shrink-0"- checked={props.selected.has(- conversation.slackChannelId- )}- disabled={props.unsupported.has(- conversation.slackChannelId- )}- onChange={(event) =>- props.onSelect(- [conversation.slackChannelId],- event.currentTarget.checked- )- }- />- <span class="min-w-0 break-words">- {conversation.name || conversation.slackChannelId}- <span class="block text-xs text-ink-muted">- {conversation.slackChannelId} ·{' '}- {conversation.memberIds.length} source members ·{' '}- {conversation.messageCount == null- ? 'Messages not yet counted'- : `${conversation.messageCount} messages`}- {conversation.archived ? ' · Archived' : ''}- </span>- <Show- when={props.unsupported.has(- conversation.slackChannelId- )}- >- <span class="block text-xs text-ink-muted">- Unavailable: a DM requires exactly two distinct- members with email addresses.- </span>- </Show>- </span>- </label>- )}- </For>- </fieldset>- </Show>- )}- </For>- </Show>+ {props.label}+ <Show when={props.target !== props.label}>+ <span class="font-normal text-ink-extra-muted">+ → {props.target}+ </span>+ </Show>+ </div>+ <For each={props.conversations}>+ {(conversation) => {+ const unsupported = () =>+ props.unsupported.has(conversation.slackChannelId);+ return (+ <label class="flex items-center gap-3 px-4 py-2 text-sm hover:bg-ink/4 has-disabled:opacity-60 has-disabled:hover:bg-transparent">+ <NativeCheckbox+ checked={props.selected.has(conversation.slackChannelId)}+ disabled={unsupported()}+ onChange={(event) =>+ props.onSelect(+ [conversation.slackChannelId],+ event.currentTarget.checked+ )+ }+ />+ <ConversationKindIcon kind={conversation.kind} />+ <span class="min-w-0 flex-1">+ <span class="block truncate text-ink">+ {conversation.name || conversation.slackChannelId}+ </span>+ <span class="block truncate text-xs text-ink-muted">+ {conversation.slackChannelId} ·{' '}+ {conversation.memberIds.length} source members+ {conversation.archived ? ' · Archived' : ''}+ </span>+ <Show when={unsupported()}>+ <span class="block text-xs text-warning-ink">+ Unavailable: a DM needs exactly two distinct members with+ email addresses.+ </span>+ </Show>+ </span>+ </label>+ );+ }}+ </For></div>- </section>+ </Show>);}diff --git a/apps/web/src/features/slack-import/components/import-progress.tsx b/apps/web/src/features/slack-import/components/import-progress.tsxindex d3f3333c62..f407626dcb 100644--- a/apps/web/src/features/slack-import/components/import-progress.tsx+++ b/apps/web/src/features/slack-import/components/import-progress.tsx@@ -1,21 +1,38 @@+import { formatDate } from '@core/util/date';+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';import { For, Index, type JSX, Show } from 'solid-js';import type {ImportConversation,ImportJob,ImportUploadProgress,} from '../context/contracts';+import {+ ConversationKindIcon,+ conversationTone,+ DialogSectionTitle,+ formatBytes,+ humanize,+ jobTone,+ StatusBadge,+ type StatusDisplay,+} from './import-ui';type Props = {job?: ImportJob;- phase?: string;+ /** The local session's status, shown until the server receipt exists. */+ phase?: StatusDisplay;+ /** Only while a local session has started preparing or uploading parts. */upload?: ImportUploadProgress;/** Undefined unless the host can confirm current access. */channelHref(id: string): string | undefined;};-function label(value: string): string {- return value.replaceAll('_', ' ');-}+const TERMINAL_JOB = new Set<ImportJob['status']>([+ 'completed',+ 'completed_with_errors',+ 'failed',+ 'cancelled',+]);function ConversationProgress(props: Pick<Props, 'channelHref'> & {@@ -28,118 +45,175 @@ function ConversationProgress(if (status === 'skipped' || !channelId) return undefined;return props.channelHref(channelId);};+ const counters = () => conversation().counters;+ const skippedWithoutReason = () =>+ conversation().status === 'skipped' &&+ !conversation().warnings.length &&+ !conversation().error;return (- <article class="min-w-0 rounded border border-edge-muted p-3">- <h4 class="break-words font-medium">- {conversation().name || conversation().slackChannelId}- </h4>+ <li class="flex min-w-0 flex-col gap-1 px-4 py-3">+ <div class="flex items-center justify-between gap-3">+ <div class="flex min-w-0 items-center gap-2">+ <ConversationKindIcon kind={conversation().kind} />+ <h4 class="truncate text-sm font-medium text-ink">+ {conversation().name || conversation().slackChannelId}+ </h4>+ <Show when={conversation().archived}>+ <span class="shrink-0 text-xs text-ink-extra-muted">Archived</span>+ </Show>+ </div>+ <div class="flex shrink-0 items-center gap-2">+ <Show when={href()}>+ {(href) => (+ <a+ href={href()}+ class="inline-flex items-center gap-1 text-xs font-medium text-link outline-none hover:text-link-hover hover:underline focus-visible:underline"+ >+ Open channel+ <ArrowUpRightIcon aria-hidden="true" class="size-3" />+ </a>+ )}+ </Show>+ <StatusBadge+ tone={conversationTone(conversation().status)}+ label={humanize(conversation().status)}+ />+ </div>+ </div><p class="text-xs text-ink-muted">- {conversation().slackChannelId} · {label(conversation().kind)}- {conversation().archived ? ' · Archived' : ''}- </p>- <p>- {label(conversation().status)} · {conversation().verifiedParts} /{' '}- {conversation().partCount ?? '?'} parts verified- </p>- <p class="text-ink-muted">- {conversation().counters.processed} processed ·{' '}- {conversation().counters.imported} imported ·{' '}- {conversation().counters.duplicates} duplicates ·{' '}- {conversation().counters.skipped} skipped ·{' '}- {conversation().counters.reactions} reactions- </p>- <p class="text-xs text-ink-muted">- Search: {label(conversation().searchStatus)}+ {conversation().verifiedParts} / {conversation().partCount ?? '?'} parts+ verified · {counters().processed} processed · {counters().imported}{' '}+ imported · {counters().duplicates} duplicates · {counters().skipped}{' '}+ skipped · {counters().reactions} reactions</p>+ <Show when={conversation().searchStatus !== 'not_needed'}>+ <p class="text-xs text-ink-extra-muted">+ Search indexing: {humanize(conversation().searchStatus)}+ </p>+ </Show><Show when={conversation().error}>- {(error) => <p role="alert">Error: {label(error())}</p>}+ {(error) => (+ <p role="alert" class="text-xs text-failure-ink">+ {humanize(error())}+ </p>+ )}</Show><For each={conversation().warnings}>- {(warning) => <p class="text-xs text-ink-muted">{label(warning)}</p>}+ {(warning) => (+ <p class="text-xs text-warning-ink">{humanize(warning)}</p>+ )}</For>- <Show- when={- conversation().status === 'skipped' &&- !conversation().warnings.length &&- !conversation().error- }- >+ <Show when={skippedWithoutReason()}><p class="text-xs text-ink-muted">- Skipped by the server; no additional reason provided.+ Skipped by the server without a reason.</p></Show>- <Show when={href()}>- {(href) => (- <a class="inline-block mt-2 underline" href={href()}>- Open channel- </a>- )}- </Show>- </article>+ </li>+ );+}++function UploadProgress(props: { upload: ImportUploadProgress }): JSX.Element {+ const percent = () =>+ props.upload.total > 0+ ? Math.min(+ 100,+ Math.round((props.upload.loaded / props.upload.total) * 100)+ )+ : 0;+ return (+ <div class="flex flex-col gap-1.5">+ <div class="flex items-center justify-between gap-3 text-xs text-ink-muted">+ <label for="slack-upload-progress">+ Upload: {formatBytes(props.upload.loaded)} of{' '}+ {formatBytes(props.upload.total)} prepared+ </label>+ <Show when={!props.upload.indeterminate}>+ <span class="tabular-nums">{percent()}%</span>+ </Show>+ </div>+ <progress+ id="slack-upload-progress"+ class="h-1.5 w-full appearance-none overflow-hidden rounded-full bg-edge-muted text-accent [&::-moz-progress-bar]:rounded-full [&::-moz-progress-bar]:bg-accent [&::-webkit-progress-bar]:bg-transparent [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-accent [&::-webkit-progress-value]:transition-[width]"+ max={Math.max(1, props.upload.total)}+ value={props.upload.indeterminate ? undefined : props.upload.loaded}+ />+ <p class="text-xs text-ink-extra-muted">+ The total grows as history is read. Files and attachments are never+ uploaded.+ </p>+ </div>);}export function ImportProgress(props: Props): JSX.Element {+ const status = () => props.job?.status;+ const badge = (): StatusDisplay => {+ const current = status();+ if (current) return { tone: jobTone(current), label: humanize(current) };+ return props.phase ?? { tone: 'neutral', label: 'Idle' };+ };+ const source = () =>+ props.job?.source.kind === 'known'+ ? props.job.source.sourceId+ : 'Confirmed unknown workspace';+ const cancelled = () => status() === 'cancelling' || status() === 'cancelled';+ const active = () => {+ const current = status();+ return current !== undefined && !TERMINAL_JOB.has(current);+ };return (- <section class="flex flex-col gap-3 text-sm" aria-label="Import progress">- <p role="status">{label(props.job?.status ?? props.phase ?? 'idle')}</p>+ <section class="flex flex-col gap-3" aria-label="Import progress">+ <div class="flex items-center justify-between gap-3">+ <DialogSectionTitle>Progress</DialogSectionTitle>+ <StatusBadge role="status" tone={badge().tone} label={badge().label} />+ </div><Show when={props.upload}>- {(upload) => (- <div class="flex flex-col gap-1">- <label for="slack-upload-progress">- Upload: {upload().loaded.toLocaleString()} /{' '}- {upload().total.toLocaleString()} bytes prepared so far- </label>- <progress- id="slack-upload-progress"- class="w-full"- max={Math.max(1, upload().total)}- value={upload().indeterminate ? undefined : upload().loaded}- />- <p class="text-xs text-ink-muted">- The total grows as history is read. File and attachment bytes are- never uploaded.- </p>- </div>- )}+ {(upload) => <UploadProgress upload={upload()} />}</Show><Show when={props.job}>{(job) => (<>- <p class="break-all text-xs text-ink-muted">- Job {job().jobId} · {job().createdAt}- </p>- <p>+ <p class="text-xs text-ink-muted">{job().conversations.length} selected ·{' '}{job().includeMessageHistory? 'With message history'- : 'Without message history'}- </p>- <p class="text-xs text-ink-muted">- Source:{' '}- {props.job?.source.kind === 'known'- ? props.job.source.sourceId- : 'Confirmed unknown workspace'}+ : 'Without message history'}{' '}+ · {source()}+ <Show when={job().createdAt}>+ {(createdAt) => (+ <>+ {' '}+ · Started{' '}+ <time dateTime={createdAt()}>+ {formatDate(createdAt(), { showTime: true })}+ </time>+ </>+ )}+ </Show></p>- <Show- when={- job().status === 'cancelling' || job().status === 'cancelled'- }- >- <p>+ <Show when={cancelled()}>+ <p class="text-xs text-warning-ink">Cancellation is not rollback. Committed messages and channelsremain; running conversations may finish before cancellationsettles.</p></Show>- <Index each={job().conversations}>- {(conversation) => (- <ConversationProgress- conversation={conversation()}- channelHref={props.channelHref}- />- )}- </Index>+ <ul class="divide-y divide-edge-divider overflow-hidden rounded-lg border border-edge-muted">+ <Index each={job().conversations}>+ {(conversation) => (+ <ConversationProgress+ conversation={conversation()}+ channelHref={props.channelHref}+ />+ )}+ </Index>+ </ul>+ <Show when={active()}>+ <p class="text-xs text-ink-extra-muted">+ Cancelling stops future work only. Running conversations may+ finish, and imported channels and messages are kept.+ </p>+ </Show></>)}</Show>diff --git a/apps/web/src/features/slack-import/components/import-ui.tsx b/apps/web/src/features/slack-import/components/import-ui.tsxnew file mode 100644index 0000000000..4ed5934713--- /dev/null+++ b/apps/web/src/features/slack-import/components/import-ui.tsx@@ -0,0 +1,195 @@+import ChatCircleIcon from '@phosphor/chat-circle.svg';+import HashIcon from '@phosphor/hash.svg';+import InfoIcon from '@phosphor/info.svg';+import LockIcon from '@phosphor/lock.svg';+import UsersIcon from '@phosphor/users.svg';+import WarningCircleIcon from '@phosphor/warning-circle.svg';+import { cn } from '@ui';+import { type JSX, splitProps } from 'solid-js';+import { match } from 'ts-pattern';+import type { ImportConversation, ImportJobStatus } from '../context/contracts';+import type { ConversationKind } from '../core/export';++/** `completed_with_errors` → `Completed with errors`. */+export function humanize(value: string): string {+ const text = value.replaceAll('_', ' ');+ return text.charAt(0).toUpperCase() + text.slice(1);+}++export function formatBytes(bytes: number): string {+ if (bytes < 1024) return `${bytes} B`;+ const units = ['KB', 'MB', 'GB'];+ let value = bytes / 1024;+ let unit = 0;+ while (value >= 1024 && unit < units.length - 1) {+ value /= 1024;+ unit += 1;+ }+ return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`;+}++export type StatusTone =+ | 'neutral'+ | 'active'+ | 'success'+ | 'warning'+ | 'failure';++/** A status resolved for display: the view maps domain state to this. */+export type StatusDisplay = { tone: StatusTone; label: string };++export function jobTone(status: ImportJobStatus): StatusTone {+ return match(status)+ .with('uploading', 'processing', () => 'active' as const)+ .with('completed', () => 'success' as const)+ .with('completed_with_errors', 'cancelling', () => 'warning' as const)+ .with('failed', 'cancelled', () => 'failure' as const)+ .exhaustive();+}++export function conversationTone(+ status: ImportConversation['status']+): StatusTone {+ return match(status)+ .with('awaiting_uploads', 'queued', () => 'neutral' as const)+ .with('importing', () => 'active' as const)+ .with('completed', () => 'success' as const)+ .with('skipped', () => 'warning' as const)+ .with('failed', () => 'failure' as const)+ .exhaustive();+}++const TONE_CLASS: Record<StatusTone, string> = {+ neutral: 'bg-ink/5 text-ink-muted',+ active: 'bg-accent-bg text-accent-ink',+ success: 'bg-success-bg text-success-ink',+ warning: 'bg-warning-bg text-warning-ink',+ failure: 'bg-failure-bg text-failure-ink',+};++/** A compact status pill; the label is the element's only text for exact lookups. */+export function StatusBadge(props: {+ tone: StatusTone;+ label: string;+ role?: JSX.HTMLAttributes<HTMLSpanElement>['role'];+ class?: string;+}): JSX.Element {+ return (+ <span+ role={props.role}+ class={cn(+ 'inline-flex h-5 shrink-0 items-center rounded-full px-2 text-xs font-medium whitespace-nowrap',+ TONE_CLASS[props.tone],+ props.class+ )}+ >+ {props.label}+ </span>+ );+}++const DOT_CLASS: Record<StatusTone, string> = {+ neutral: 'bg-ink-muted',+ active: 'bg-accent',+ success: 'bg-success',+ warning: 'bg-warning',+ failure: 'bg-failure',+};++/** A bare tone dot for dense rows where a text badge would repeat the label. */+export function StatusDot(props: { tone: StatusTone }): JSX.Element {+ return (+ <span+ aria-hidden="true"+ class={cn(+ 'inline-block size-2 shrink-0 rounded-full',+ DOT_CLASS[props.tone]+ )}+ />+ );+}++const NOTICE_CLASS = {+ error: 'border-failure/30 bg-failure-bg text-failure-ink',+ warning: 'border-warning/30 bg-warning-bg text-warning-ink',+ info: 'border-edge-muted bg-ink/3 text-ink-muted',+} as const;++/** Inline message for errors, warnings and loading states inside the dialog. */+export function Notice(props: {+ tone: keyof typeof NOTICE_CLASS;+ children: JSX.Element;+ class?: string;+}): JSX.Element {+ return (+ <div+ role={props.tone === 'error' ? 'alert' : 'status'}+ class={cn(+ 'flex items-start gap-2 rounded-lg border px-3 py-2 text-xs leading-5',+ NOTICE_CLASS[props.tone],+ props.class+ )}+ >+ {props.tone === 'info' ? (+ <InfoIcon aria-hidden="true" class="mt-0.5 size-4 shrink-0" />+ ) : (+ <WarningCircleIcon aria-hidden="true" class="mt-0.5 size-4 shrink-0" />+ )}+ <div class="min-w-0 flex-1">{props.children}</div>+ </div>+ );+}++export const CONVERSATION_KIND_LABEL: Record<ConversationKind, string> = {+ public_channel: 'Public channel',+ private_channel: 'Private channel',+ direct_message: 'Direct message',+ group_direct_message: 'Group DM',+};++export function ConversationKindIcon(props: {+ kind: ConversationKind;+ class?: string;+}): JSX.Element {+ const className = () => cn('size-4 shrink-0 text-ink-muted', props.class);+ return match(props.kind)+ .with('public_channel', () => (+ <HashIcon aria-hidden="true" class={className()} />+ ))+ .with('private_channel', () => (+ <LockIcon aria-hidden="true" class={className()} />+ ))+ .with('direct_message', () => (+ <ChatCircleIcon aria-hidden="true" class={className()} />+ ))+ .with('group_direct_message', () => (+ <UsersIcon aria-hidden="true" class={className()} />+ ))+ .exhaustive();+}++/** The native checkbox in the accent color, as the settings `ChoiceRow` uses. */+export function NativeCheckbox(+ props: Omit<JSX.InputHTMLAttributes<HTMLInputElement>, 'type'>+): JSX.Element {+ const [local, rest] = splitProps(props, ['class']);+ return (+ <input+ type="checkbox"+ class={cn('size-4 shrink-0 accent-accent', local.class)}+ {...rest}+ />+ );+}++/** Section heading inside the dialog body; mirrors the settings section label. */+export function DialogSectionTitle(props: {+ children: JSX.Element;+ class?: string;+}): JSX.Element {+ return (+ <h3 class={cn('text-sm font-semibold text-ink', props.class)}>+ {props.children}+ </h3>+ );+}diff --git a/apps/web/src/features/slack-import/components/slack-import-card.tsx b/apps/web/src/features/slack-import/components/slack-import-card.tsxindex d1abfe167a..24d0af82ea 100644--- a/apps/web/src/features/slack-import/components/slack-import-card.tsx+++ b/apps/web/src/features/slack-import/components/slack-import-card.tsx@@ -1,22 +1,26 @@import SlackIcon from '@icon/mcp-slack.svg';import { Button } from '@ui';import type { JSX } from 'solid-js';-import { IntegrationRow, SettingsCard } from '../../settings/primitives';+import { IntegrationRow } from '../../settings/primitives';type Props = { onOpen(trigger: HTMLButtonElement): void };+/** The Connections row that opens the importer; the host supplies the card. */export function SlackImportCard(props: Props): JSX.Element {return (- <SettingsCard>- <IntegrationRow- icon={<SlackIcon />}- title="Import from Slack"- description="Import conversations from a Slack export, with optional message history."+ <IntegrationRow+ icon={<SlackIcon />}+ title="Slack"+ description="Import channels and message history from a Slack export."+ >+ <Button+ variant="outline"+ size="sm"+ depth={3}+ onClick={(event) => props.onOpen(event.currentTarget)}>- <Button onClick={(event) => props.onOpen(event.currentTarget)}>- Import from Slack- </Button>- </IntegrationRow>- </SettingsCard>+ Import from Slack+ </Button>+ </IntegrationRow>);}diff --git a/apps/web/src/features/slack-import/slack-import.tsx b/apps/web/src/features/slack-import/slack-import.tsxindex 9e80f1ae20..400392235e 100644--- a/apps/web/src/features/slack-import/slack-import.tsx+++ b/apps/web/src/features/slack-import/slack-import.tsx@@ -1,6 +1,8 @@+import { IntegrationRow } from '@app/features/settings/primitives';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { enableSlackArchiveImport } from '@core/constant/featureFlags';import { holdAutomaticReload } from '@core/util/reloadForNewerBuild';+import SlackIcon from '@icon/mcp-slack.svg';import {invalidateListChannels,useListChannelsQuery,@@ -32,7 +34,12 @@ export function SlackImport(props: Props): JSX.Element {{(teamId) => (<Suspensefallback={- <p class="text-sm text-ink-muted">Loading Slack import…</p>+ <IntegrationRow+ icon={<SlackIcon />}+ title="Slack"+ description="Loading Slack import…"+ muted+ />}><SlackImportSettings teamId={teamId} />diff --git a/apps/web/src/features/slack-import/views/import-dialog.test.tsx b/apps/web/src/features/slack-import/views/import-dialog.test.tsxindex f74ec1669d..2228088ee2 100644--- a/apps/web/src/features/slack-import/views/import-dialog.test.tsx+++ b/apps/web/src/features/slack-import/views/import-dialog.test.tsx@@ -295,11 +295,7 @@ describe('Slack import dialog', () => {it('cancels an unconfirmed review without creating or cancelling a server job', async () => {const view = setup();await view.choose();- fireEvent.click(- screen.getByRole('button', {- name: 'Cancel import (keep partial results)',- })- );+ fireEvent.click(screen.getByRole('button', { name: 'Cancel import' }));await waitFor(() =>expect(view.fake.archive.dispose).toHaveBeenCalledOnce());@@ -313,7 +309,7 @@ describe('Slack import dialog', () => {const dialog = screen.getByRole('dialog');const processing = importReceipt({ status: 'processing' });view.setPage({ ...view.page(), jobs: [processing] });- fireEvent.click(screen.getByRole('button', { name: 'job · processing' }));+ fireEvent.click(screen.getByRole('button', { name: /job · Processing/ }));const result = importReceipt({status: 'cancelled',revision: 8,@@ -355,7 +351,7 @@ describe('Slack import dialog', () => {expect(screen.queryByText('Settings suspended')).toBeNull();expect(view.completed).toHaveBeenCalledOnce();expect(screen.getByText(/9 imported/)).toBeTruthy();- expect(screen.getByText('target unavailable')).toBeTruthy();+ expect(screen.getByText('Target unavailable')).toBeTruthy();expect(screen.getAllByRole('link')).toHaveLength(1);expect(screen.getByRole('link').getAttribute('href')).toBe('/app/channel/accessible'@@ -383,11 +379,7 @@ describe('Slack import dialog', () => {);await waitFor(() => expect(view.fake.put).toHaveBeenCalled());expect(screen.getByLabelText(/Upload:/).getAttribute('value')).toBe('2');- fireEvent.click(- screen.getByRole('button', {- name: 'Cancel import (keep partial results)',- })- );+ fireEvent.click(screen.getByRole('button', { name: 'Cancel import' }));await waitFor(() =>expect(view.fake.commands.cancel).toHaveBeenCalledOnce());@@ -397,7 +389,7 @@ describe('Slack import dialog', () => {it('finalizes a historical upload with skips without creating an archive worker', async () => {const view = setup();view.setPage({ ...view.page(), jobs: [importReceipt()] });- fireEvent.click(screen.getByRole('button', { name: 'job · uploading' }));+ fireEvent.click(screen.getByRole('button', { name: /job · Uploading/ }));fireEvent.click(screen.getByRole('button', { name: 'Finalize with skips' }));@@ -419,13 +411,9 @@ describe('Slack import dialog', () => {jobs: [importReceipt()],nextCursor: 'cursor',});- fireEvent.click(screen.getByRole('button', { name: 'job · uploading' }));+ fireEvent.click(screen.getByRole('button', { name: /job · Uploading/ }));view.fake.commands.cancel.mockRejectedValue(new Error('request failed'));- fireEvent.click(- screen.getByRole('button', {- name: 'Cancel import (keep partial results)',- })- );+ fireEvent.click(screen.getByRole('button', { name: 'Cancel import' }));await screen.findByText(/Cancellation was not confirmed/);fireEvent.click(screen.getByRole('button', { name: 'Older imports' }));expect(view.inputs().before?.()).toBe('cursor');diff --git a/apps/web/src/features/slack-import/views/import-dialog.tsx b/apps/web/src/features/slack-import/views/import-dialog.tsxindex 1fec103989..24cfd1652f 100644--- a/apps/web/src/features/slack-import/views/import-dialog.tsx+++ b/apps/web/src/features/slack-import/views/import-dialog.tsx@@ -1,4 +1,8 @@-import { Button, Dialog } from '@ui';+import { formatDate } from '@core/util/date';+import ArrowsClockwiseIcon from '@phosphor/arrows-clockwise.svg';+import CaretRightIcon from '@phosphor/caret-right.svg';+import FileZipIcon from '@phosphor/file-zip.svg';+import { ActionDialogShell, Button, cn, Dialog } from '@ui';import {createEffect,createRoot,@@ -10,14 +14,26 @@ import {onCleanup,Show,} from 'solid-js';+import { match } from 'ts-pattern';import { ConversationPicker } from '../components/conversation-picker';import { ImportProgress } from '../components/import-progress';+import {+ DialogSectionTitle,+ formatBytes,+ humanize,+ jobTone,+ NativeCheckbox,+ Notice,+ type StatusDisplay,+ StatusDot,+} from '../components/import-ui';import { SlackImportCard } from '../components/slack-import-card';-import type { ImportJob } from '../context/contracts';+import type { ImportJob, ImportPage } from '../context/contracts';import { useImportContext } from '../context/import-context';import {createImportController,type ImportController,+ type ImportPhase,} from '../primitives/import-controller';type Props = {@@ -32,6 +48,44 @@ function terminal(job: ImportJob): boolean {);}+/** Phases before any server write; closing the dialog here discards the archive. */+const REVIEW_PHASES = new Set<ImportPhase>([+ 'idle',+ 'discovering',+ 'selecting',+]);+/** Phases during which the upload summary is meaningful. */+const UPLOAD_PHASES = new Set<ImportPhase>([+ 'preparing',+ 'uploading',+ 'interrupted',+ 'finalizing',+ 'cancelling',+ 'monitoring',+ 'terminal',+]);++const SOURCE_CONFIRMATION =+ "I confirm this archive belongs to this team's Slack workspace, including when its identity is unknown.";++function phaseDisplay(phase: ImportPhase): StatusDisplay {+ const tone = match(phase)+ .with('idle', 'disposed', () => 'neutral' as const)+ .with(+ 'discovering',+ 'selecting',+ 'preparing',+ 'uploading',+ 'finalizing',+ 'monitoring',+ () => 'active' as const+ )+ .with('interrupted', 'cancelling', () => 'warning' as const)+ .with('terminal', () => 'success' as const)+ .exhaustive();+ return { tone, label: humanize(phase) };+}+/** Confirmed jobs outlive dialog content; closing an unconfirmed review discards its file. */export function ImportDialog(props: Props): JSX.Element {const context = useImportContext();@@ -47,6 +101,7 @@ export function ImportDialog(props: Props): JSX.Element {before,});const [controller, setController] = createSignal<ImportController>();+ const [archive, setArchive] = createSignal<{ name: string; size: number }>();const [selected, setSelected] = createSignal<ReadonlySet<string>>(new Set());const [filter, setFilter] = createSignal('');const [showArchived, setShowArchived] = createSignal(false);@@ -73,9 +128,12 @@ export function ImportDialog(props: Props): JSX.Element {return saved;return observed ?? source.page()?.jobs.find((job) => job.jobId === jobId());};+ const phase = () => controller()?.phase();const localActive = () => {- const phase = controller()?.phase();- return phase !== undefined && !['monitoring', 'terminal'].includes(phase);+ const current = phase();+ return (+ current !== undefined && !['monitoring', 'terminal'].includes(current)+ );};const observedCompletions = new Set<string>();async function refreshCompleted(job: ImportJob): Promise<void> {@@ -106,6 +164,7 @@ export function ImportDialog(props: Props): JSX.Element {disposeSession?.();disposeSession = undefined;setController(undefined);+ setArchive(undefined);setActionError(undefined);setSelected(new Set<string>());setConfirmed(false);@@ -116,9 +175,8 @@ export function ImportDialog(props: Props): JSX.Element {function changeOpen(next: boolean): void {if (!next) {- const phase = controller()?.phase();- if (phase === 'idle' || phase === 'discovering' || phase === 'selecting')- resetSession();+ const current = phase();+ if (current === undefined || REVIEW_PHASES.has(current)) resetSession();}setOpen(next);}@@ -129,6 +187,7 @@ export function ImportDialog(props: Props): JSX.Element {resetSession();setJobId(undefined);setHistoryReceipt(undefined);+ setArchive({ name: file.name, size: file.size });const session = createRoot((dispose) => {disposeSession = dispose;return createImportController({@@ -196,7 +255,7 @@ export function ImportDialog(props: Props): JSX.Element {}function select(ids: string[], checked: boolean): void {- if (controller()?.phase() !== 'selecting') return;+ if (phase() !== 'selecting') return;setSelected((previous) => {const next = new Set(previous);for (const id of ids) {@@ -207,19 +266,22 @@ export function ImportDialog(props: Props): JSX.Element {});}+ function openHistory(receipt: ImportJob): void {+ resetSession();+ setHistoryReceipt(undefined);+ setJobId(receipt.jobId);+ }+const discovery = () => controller()?.discovery();const canCancel = () =>- (controller() && controller()?.phase() !== 'terminal') ||- (job() && !terminal(job()!));+ (controller() && phase() !== 'terminal') || (job() && !terminal(job()!));const cancelPending = () =>- cancelling() ||- controller()?.phase() === 'cancelling' ||- job()?.status === 'cancelling';+ cancelling() || phase() === 'cancelling' || job()?.status === 'cancelling';const canChooseAnother = () =>controller() &&(!localActive() ||- controller()?.phase() === 'selecting' ||- (controller()?.phase() === 'interrupted' && !discovery()));+ phase() === 'selecting' ||+ (phase() === 'interrupted' && !discovery()));const fileDisabled = () => !source.page() || localActive() || busy();const error = () => actionError() ?? controller()?.error();const warning = () => refreshWarning() ?? controller()?.warning();@@ -245,6 +307,82 @@ export function ImportDialog(props: Props): JSX.Element {? binding.sourceId: 'Previously confirmed unknown workspace';};+ const upload = () => {+ const current = phase();+ return current && UPLOAD_PHASES.has(current)+ ? controller()?.uploadProgress()+ : undefined;+ };+ const recoveredUpload = () => !controller() && job()?.status === 'uploading';+ const showProgress = () => {+ const current = phase();+ return Boolean(job() || (current && !REVIEW_PHASES.has(current)));+ };++ const primaryAction = (): JSX.Element => {+ const current = phase();+ if (current === 'selecting') {+ return (+ <Button+ variant="strong"+ depth={2}+ disabled={!selected().size || !confirmed() || busy()}+ onClick={() =>+ void runAction(() =>+ controller()!.start({+ selectedIds: [...selected()],+ includeMessageHistory: includeHistory(),+ sourceConfirmed: confirmed(),+ })+ )+ }+ >+ Import selected channels ({selected().size})+ </Button>+ );+ }+ if (current === 'interrupted' && discovery()) {+ return (+ <Show+ when={controller()?.job()}+ fallback={+ <Button+ variant="strong"+ depth={2}+ disabled={busy()}+ onClick={() => void runAction(() => controller()!.recoverJob())}+ >+ Recover job receipt+ </Button>+ }+ >+ <Button+ variant="strong"+ depth={2}+ disabled={busy()}+ onClick={() =>+ void runAction(() => controller()!.finalizeWithSkips())+ }+ >+ Finalize with skips+ </Button>+ </Show>+ );+ }+ if (recoveredUpload()) {+ return (+ <Button+ variant="strong"+ depth={2}+ disabled={busy() || cancelling()}+ onClick={() => void runAction(finalizeHistory)}+ >+ Finalize with skips+ </Button>+ );+ }+ return null;+ };return (<>@@ -258,231 +396,412 @@ export function ImportDialog(props: Props): JSX.Element {open={open()}onOpenChange={changeOpen}position="center"+ class="w-180"+ visibleScrimonCloseAutoFocus={(event) => {// The card is outside Dialog's trigger context; retain its focus owner.event.preventDefault();if (!open()) opener?.focus();}}>- <div class="max-h-[85dvh] overflow-y-auto p-4 sm:p-6 flex flex-col gap-4 text-ink">- <Dialog.Title class="text-lg font-semibold">- Import from Slack- </Dialog.Title>- <Dialog.Description class="text-sm text-ink-muted">- Select a Slack export ZIP. Parsing stays in your browser; only- selected conversation data is uploaded. Keep this Settings page open- until uploads finish.- </Dialog.Description>- <label class="flex flex-col gap-1 text-sm">- Slack export ZIP- {/* The mobile focus trap requires tabindex=-1 even on disabled inputs. */}- <input- type="file"- accept=".zip,application/zip"+ <ActionDialogShell class="max-h-[85dvh]">+ <ActionDialogShell.Body class="space-y-6">+ <ActionDialogShell.Header>+ <ActionDialogShell.Title>+ Import from Slack+ </ActionDialogShell.Title>+ <ActionDialogShell.Description>+ Bring conversations from a Slack export into this team. The+ archive is read in your browser and only the conversations you+ select are uploaded. Keep this page open until uploads finish.+ </ActionDialogShell.Description>+ </ActionDialogShell.Header>++ <ArchivePicker+ archive={archive()}disabled={fileDisabled()}- tabIndex={fileDisabled() ? -1 : undefined}- onChange={(event) => {- const file = event.currentTarget.files?.[0];- event.currentTarget.value = '';- void runAction(() => chooseFile(file));- }}+ reading={phase() === 'discovering'}+ onChoose={(file) => void runAction(() => chooseFile(file))}/>- </label>- <p class="text-xs text-ink-muted">- Files, attachments and attachment-only messages are not imported.- Encrypted, multi-volume and ZIP64 archives are unsupported. This is- not a live Slack connection.- </p>- <Show when={!source.page() && !source.error()}>- <p role="status">Loading import settings…</p>- </Show>- <Show when={source.error()}>- <p role="alert">- Progress could not be refreshed. Existing server imports may still- be running.- </p>- </Show>- <Show when={error()}>{(error) => <p role="alert">{error()}</p>}</Show>- <Show when={warning()}>- {(warning) => <p role="status">{warning()}</p>}- </Show>- <Show when={controller()?.phase() === 'selecting' && discovery()}>- {(found) => (- <>- <ConversationPicker- discovery={found()}- selected={selected()}- unsupported={unsupported()}- filter={filter()}- showArchived={showArchived()}- onFilter={setFilter}- onShowArchived={setShowArchived}- onSelect={select}- />- <label class="flex items-center gap-2 text-sm">- <input- type="checkbox"- checked={includeHistory()}- onChange={(event) =>- setIncludeHistory(event.currentTarget.checked)- }- />- Include message history- </label>- <p class="text-sm text-ink-muted">- {found().users.length - namedAuthors()} source users have- email attribution; {namedAuthors()} use Slack-name attribution- via the system bot. Emails are lowercased as exported, without- alias matching or a team roster lookup. External email- addresses can become channel members. DMs require two distinct- email-bearing members; importing never adds you as a third- member.- </p>- <p class="text-sm text-ink-muted">- Public Slack channels become Team channels with explicit- members, never globally Public. Existing channel names, roles- and membership history are preserved.- </p>- <p class="text-sm">- Team source: {boundSource()}. Archive source:{' '}- {archiveSource()}.- </p>- <label class="flex items-start gap-2 text-sm">- <input- type="checkbox"- class="mt-1"- checked={confirmed()}- onChange={(event) =>- setConfirmed(event.currentTarget.checked)- }++ <Show when={!source.page() && !source.error()}>+ <Notice tone="info">Loading import settings…</Notice>+ </Show>+ <Show when={source.error()}>+ <Notice tone="warning">+ Progress could not be refreshed. Imports already running on the+ server continue.+ </Notice>+ </Show>+ <Show when={error()}>+ {(error) => <Notice tone="error">{error()}</Notice>}+ </Show>+ <Show when={warning()}>+ {(warning) => <Notice tone="warning">{warning()}</Notice>}+ </Show>++ <Show when={phase() === 'selecting' && discovery()}>+ {(found) => (+ <>+ <ConversationPicker+ discovery={found()}+ selected={selected()}+ unsupported={unsupported()}+ filter={filter()}+ showArchived={showArchived()}+ onFilter={setFilter}+ onShowArchived={setShowArchived}+ onSelect={select}/>- I confirm this archive belongs to this team's Slack workspace,- including when its identity is unknown. The source binding is- immutable; this team cannot import another Slack workspace.- </label>- <Button- variant="strong"- disabled={!selected().size || !confirmed() || busy()}- onClick={() =>- void runAction(() =>- controller()!.start({- selectedIds: [...selected()],- includeMessageHistory: includeHistory(),- sourceConfirmed: confirmed(),- })- )- }- >- Import selected channels ({selected().size})- </Button>- </>- )}- </Show>- <Show when={controller() || job()}>- <ImportProgress- job={job()}- phase={controller()?.phase()}- upload={controller()?.uploadProgress()}- channelHref={props.channelHref}+ <section class="flex flex-col gap-3" aria-label="Options">+ <DialogSectionTitle>Options</DialogSectionTitle>+ <div class="divide-y divide-edge-divider overflow-hidden rounded-lg border border-edge-muted">+ <label class="flex items-start gap-3 px-4 py-3">+ <NativeCheckbox+ class="mt-0.5"+ checked={includeHistory()}+ aria-label="Include message history"+ aria-describedby="slack-import-history-hint"+ onChange={(event) =>+ setIncludeHistory(event.currentTarget.checked)+ }+ />+ <span class="min-w-0 flex-1">+ <span class="block text-sm text-ink">+ Include message history+ </span>+ <span+ id="slack-import-history-hint"+ class="block text-xs text-ink-muted"+ >+ Messages, threads and reactions are imported with+ each conversation. Files, attachments and+ attachment-only messages are skipped.+ </span>+ </span>+ </label>+ <dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 px-4 py-3 text-xs">+ <dt class="text-ink-muted">Team source</dt>+ <dd class="min-w-0 truncate text-ink">+ {boundSource()}+ </dd>+ <dt class="text-ink-muted">Archive source</dt>+ <dd class="min-w-0 truncate text-ink">+ {archiveSource()}+ </dd>+ <dt class="text-ink-muted">Members</dt>+ <dd class="text-ink">+ {found().users.length - namedAuthors()} matched by+ email · {namedAuthors()} attributed by Slack name+ </dd>+ </dl>+ <label class="flex items-start gap-3 px-4 py-3">+ <NativeCheckbox+ class="mt-0.5"+ checked={confirmed()}+ aria-label={SOURCE_CONFIRMATION}+ aria-describedby="slack-import-source-hint"+ onChange={(event) =>+ setConfirmed(event.currentTarget.checked)+ }+ />+ <span class="min-w-0 flex-1">+ <span class="block text-sm text-ink">+ {SOURCE_CONFIRMATION}+ </span>+ <span+ id="slack-import-source-hint"+ class="block text-xs text-ink-muted"+ >+ The source binding is permanent: this team cannot+ import another Slack workspace later.+ </span>+ </span>+ </label>+ </div>+ <p class="text-xs text-ink-extra-muted">+ Public Slack channels become Team channels with explicit+ members, never globally public. Existing channel names,+ roles and membership history are preserved. External email+ addresses can become channel members; a DM needs two+ distinct email-bearing members and never adds you as a+ third.+ </p>+ </section>+ </>+ )}+ </Show>++ <Show when={showProgress()}>+ <ImportProgress+ job={job()}+ phase={phase() ? phaseDisplay(phase()!) : undefined}+ upload={upload()}+ channelHref={props.channelHref}+ />+ </Show>+ <Show when={recoveredUpload()}>+ <Notice tone="warning">+ Progress was recovered without the archive, and uploads do not+ resume after a reload. Finalize with skips to process the+ verified conversations, or cancel and start a new import.+ </Notice>+ </Show>++ <JobHistory+ page={source.page()}+ activeJobId={jobId()}+ disabled={localActive() || busy()}+ paged={Boolean(before())}+ onOpen={openHistory}+ onNewest={() => setBefore(undefined)}+ onOlder={() => setBefore(source.page()?.nextCursor)}/>- </Show>- <p class="text-xs text-ink-muted">- Cancellation stops future work, not work already committed. Running- conversations may finish. Imported channels and messages are not- rolled back.- </p>- <Show when={!controller() && job()?.status === 'uploading'}>- <p class="text-sm text-ink-muted">- Server progress has been recovered without the ZIP. Local uploads- do not resume after reload. Finalize with skips to process- verified conversations, or cancel and confirm a new import.- </p>- <Button- disabled={busy() || cancelling()}- onClick={() => void runAction(finalizeHistory)}- >- Finalize with skips- </Button>- </Show>- <div class="flex flex-wrap gap-2">- <Show when={controller()?.phase() === 'interrupted' && discovery()}>- <Show- when={controller()?.job()}- fallback={- <Button- disabled={busy()}- onClick={() =>- void runAction(() => controller()!.recoverJob())- }- >- Recover job receipt- </Button>- }+ </ActionDialogShell.Body>+ <ActionDialogShell.Footer class="justify-between">+ <div class="flex items-center gap-2">+ <Button+ variant="ghost"+ size="icon-md"+ depth={2}+ label="Refresh progress"+ disabled={busy()}+ onClick={() => void runAction(() => source.refresh())}>+ <ArrowsClockwiseIcon />+ </Button>+ <Show when={canCancel()}><Button- disabled={busy()}- onClick={() =>- void runAction(() => controller()!.finalizeWithSkips())- }+ variant="ghost"+ depth={2}+ disabled={cancelPending()}+ onClick={() => void cancel()}>- Finalize with skips+ Cancel import</Button></Show>- </Show>- <Show when={canCancel()}>- <Button disabled={cancelPending()} onClick={() => void cancel()}>- Cancel import (keep partial results)- </Button>- </Show>- <Show when={canChooseAnother()}>- <Button disabled={busy() || cancelling()} onClick={resetSession}>- Choose another archive- </Button>- </Show>- <Button- disabled={busy()}- onClick={() => void runAction(() => source.refresh())}- >- Refresh progress- </Button>- <Button onClick={() => changeOpen(false)}>Close</Button>- </div>- <section class="flex flex-col gap-2" aria-label="Job history">- <h3 class="font-medium">Job history</h3>- <Index each={source.page()?.jobs}>- {(receipt) => (+ </div>+ <div class="flex items-center gap-2">+ <Show when={canChooseAnother()}><Button- class="h-auto break-all text-left justify-start"- disabled={localActive() || busy()}- onClick={() => {- resetSession();- setHistoryReceipt(undefined);- setJobId(receipt().jobId);- }}+ variant="ghost"+ depth={2}+ disabled={busy() || cancelling()}+ onClick={resetSession}>- {receipt().createdAt || receipt().jobId} ·{' '}- {receipt().status.replaceAll('_', ' ')}- </Button>- )}- </Index>- <Show when={source.page()?.jobs.length === 0}>- <p class="text-sm text-ink-muted">No imports on this page.</p>- </Show>- <div class="flex flex-wrap gap-2">- <Show when={before()}>- <Button onClick={() => setBefore(undefined)}>- Newest imports- </Button>- </Show>- <Show when={source.page()?.nextCursor}>- <Button onClick={() => setBefore(source.page()?.nextCursor)}>- Older imports+ Choose another archive</Button></Show>+ <Button+ variant="ghost"+ depth={2}+ onClick={() => changeOpen(false)}+ >+ Close+ </Button>+ {primaryAction()}</div>- </section>- </div>+ </ActionDialogShell.Footer>+ </ActionDialogShell></Dialog></>);}++/**+ * The archive drop zone. The native input stays in the DOM (visually hidden)+ * so the accessible name, focus order and file dialog remain native.+ */+function ArchivePicker(props: {+ archive: { name: string; size: number } | undefined;+ disabled: boolean;+ reading: boolean;+ onChoose(file: File | undefined): void;+}): JSX.Element {+ const [dragging, setDragging] = createSignal(false);+ const accept = (file: File | undefined) => {+ setDragging(false);+ if (props.disabled) return;+ props.onChoose(file);+ };+ return (+ <section class="flex flex-col gap-3" aria-label="Archive">+ <DialogSectionTitle>Archive</DialogSectionTitle>+ <div+ class={cn(+ 'relative flex items-center gap-3 rounded-lg border border-dashed px-4 py-3 transition-colors',+ dragging()+ ? 'border-accent bg-accent-bg'+ : 'border-edge-frame bg-control',+ props.disabled ? 'opacity-60' : 'hover:border-edge hover:bg-ink/4'+ )}+ onDragOver={(event) => {+ if (props.disabled) return;+ event.preventDefault();+ setDragging(true);+ }}+ onDragLeave={() => setDragging(false)}+ onDrop={(event) => {+ event.preventDefault();+ accept(event.dataTransfer?.files?.[0]);+ }}+ >+ {/* The mobile focus trap requires tabindex=-1 even on disabled inputs. */}+ <input+ id="slack-import-file"+ type="file"+ accept=".zip,application/zip"+ class="peer sr-only"+ aria-labelledby="slack-import-file-label"+ aria-describedby="slack-import-file-hint"+ disabled={props.disabled}+ tabIndex={props.disabled ? -1 : undefined}+ onChange={(event) => {+ const file = event.currentTarget.files?.[0];+ event.currentTarget.value = '';+ accept(file);+ }}+ />+ <label+ for="slack-import-file"+ aria-hidden="true"+ class="absolute inset-0 rounded-lg peer-focus-visible:ring-2 peer-focus-visible:ring-accent"+ />+ <div class="flex size-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink-muted">+ <FileZipIcon aria-hidden="true" class="size-5" />+ </div>+ <div class="min-w-0 flex-1">+ <div+ id="slack-import-file-label"+ class="text-sm font-medium text-ink"+ >+ Slack export ZIP+ </div>+ <div+ id="slack-import-file-hint"+ class="truncate text-xs text-ink-muted"+ >+ <Show+ when={props.archive}+ fallback="Drop the .zip exported from Slack here, or browse for it."+ >+ {(archive) => (+ <>+ {archive().name} · {formatBytes(archive().size)}+ {props.reading ? ' · Reading archive…' : ''}+ </>+ )}+ </Show>+ </div>+ </div>+ <Show when={!props.disabled}>+ <span class="shrink-0 text-sm font-medium text-ink-muted">+ Browse+ </span>+ </Show>+ </div>+ <p class="text-xs text-ink-extra-muted">+ Encrypted, multi-volume and ZIP64 archives are not supported. This is a+ one-time import, not a live Slack connection.+ </p>+ </section>+ );+}++function JobHistory(props: {+ page: ImportPage | undefined;+ activeJobId: string | undefined;+ disabled: boolean;+ paged: boolean;+ onOpen(job: ImportJob): void;+ onNewest(): void;+ onOlder(): void;+}): JSX.Element {+ const when = (receipt: ImportJob): JSX.Element =>+ receipt.createdAt ? (+ <time dateTime={receipt.createdAt}>+ {formatDate(receipt.createdAt, { showTime: true })}+ </time>+ ) : (+ receipt.jobId+ );+ return (+ <section class="flex flex-col gap-3" aria-label="Job history">+ <DialogSectionTitle>Previous imports</DialogSectionTitle>+ <Show+ when={props.page?.jobs.length}+ fallback={+ <p class="text-xs text-ink-muted">+ {props.paged+ ? 'No older imports.'+ : 'No imports yet for this team.'}+ </p>+ }+ >+ <ul class="divide-y divide-edge-divider overflow-hidden rounded-lg border border-edge-muted">+ <Index each={props.page?.jobs}>+ {(receipt) => (+ <li>+ <button+ type="button"+ class={cn(+ 'flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm outline-none transition-colors hover:bg-ink/4 focus-visible:bg-ink/6 disabled:pointer-events-none disabled:opacity-50',+ receipt().jobId === props.activeJobId && 'bg-ink/4'+ )}+ aria-current={+ receipt().jobId === props.activeJobId ? 'true' : undefined+ }+ disabled={props.disabled}+ onClick={() => props.onOpen(receipt())}+ >+ <StatusDot tone={jobTone(receipt().status)} />+ <span class="min-w-0 flex-1 truncate text-ink">+ {when(receipt())} · {humanize(receipt().status)}+ </span>+ <span class="shrink-0 text-xs text-ink-muted">+ {receipt().conversations.length}{' '}+ {receipt().conversations.length === 1+ ? 'conversation'+ : 'conversations'}{' '}+ ·{' '}+ {receipt().includeMessageHistory+ ? 'With history'+ : 'Without history'}+ </span>+ <CaretRightIcon+ aria-hidden="true"+ class="size-4 shrink-0 text-ink-extra-muted"+ />+ </button>+ </li>+ )}+ </Index>+ </ul>+ </Show>+ <Show when={props.paged || props.page?.nextCursor}>+ <div class="flex items-center gap-2">+ <Show when={props.paged}>+ <Button+ variant="outline"+ size="sm"+ depth={2}+ onClick={props.onNewest}+ >+ Newest imports+ </Button>+ </Show>+ <Show when={props.page?.nextCursor}>+ <Button+ variant="outline"+ size="sm"+ depth={2}+ onClick={props.onOlder}+ >+ Older imports+ </Button>+ </Show>+ </div>+ </Show>+ </section>+ );+}diff --git a/apps/web/tests/e2e/slack-import.spec.ts b/apps/web/tests/e2e/slack-import.spec.tsindex a193f87b22..c65c5783d9 100644--- a/apps/web/tests/e2e/slack-import.spec.ts+++ b/apps/web/tests/e2e/slack-import.spec.ts@@ -104,13 +104,13 @@ for (const history of [false, true]) {).toBeDisabled();await page.getByLabel('Select all visible conversations').check();await page.getByRole('button', { name: 'Clear visible selection' }).click();- await expect(page.getByText('2 selected.', { exact: false })).toBeVisible();+ await expect(page.getByText('2 selected', { exact: true })).toBeVisible();if (!history) await page.getByLabel('Include message history').uncheck();await page.getByRole('button', { name: 'Import selected channels (2)' }).click();await expect(- page.getByText('completed with errors', { exact: true })+ page.getByText('Completed with errors', { exact: true })).toBeVisible();const writes = await page.evaluate(() =>JSON.parse(localStorage.getItem('slack-test-writes') ?? '[]')@@ -148,7 +148,9 @@ for (const history of [false, true]) {await page.reload();await opener.click();await page- .getByRole('button', { name: /2026-09-30.*completed with errors/ })+ .getByRole('region', { name: 'Job history' })+ .getByRole('button', { name: /Completed with errors/ })+ .filter({ has: page.locator('time[datetime="2026-09-30T00:00:00Z"]') }).click();await expect(page.getByText(@@ -158,7 +160,9 @@ for (const history of [false, true]) {await expect(page.getByRole('heading', { name: 'same name', exact: true })).toHaveCount(2);- await expect(page.getByText('Error: invalid input')).toBeVisible();+ await expect(+ page.getByText('Invalid input', { exact: true })+ ).toBeVisible();await expect(page.getByText('unselected', { exact: true })).toHaveCount(0);await expect(page.getByLabel('Filter conversations')).toHaveCount(0);expect(@@ -310,7 +314,9 @@ test.describe('local backend selection contract', () => {await page.getByRole('region', { name: 'Job history' }).getByRole('button')- .filter({ hasText: receipt.createdAt })+ .filter({+ has: page.locator(`time[datetime="${receipt.createdAt}"]`),+ }).click();await expect(page.getByText(