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
chore(channels): fully remove deprecated components (#2776)
teo5a00e3738198
diff --git a/js/app/packages/block-channel/component/DeprecatedChannelInput/ActionButton.tsx b/js/app/packages/block-channel/component/DeprecatedChannelInput/ActionButton.tsxdeleted file mode 100644index beb0785b58..0000000000--- a/js/app/packages/block-channel/component/DeprecatedChannelInput/ActionButton.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';-import type { HotkeyToken } from '@core/hotkey/tokens';-import type { JSXElement } from 'solid-js';--export type ActionButtonProps = {- onClick?: (e: MouseEvent) => void;- tooltip: string;- hotkeyToken?: HotkeyToken;- shortcut?: string;- ref?: (el: HTMLDivElement) => void;- children: JSXElement;- clicked?: boolean;- darker?: boolean;-};--export function ActionButton(props: ActionButtonProps) {- const handleClick = (e: MouseEvent) => {- if (props.onClick) {- e.stopPropagation();- props.onClick(e);- }- };-- return (- <Tooltip- placement="top"- floatingOptions={{ offset: 12 }}- tooltip={- <LabelAndHotKey- label={props.tooltip}- hotkeyToken={props.hotkeyToken}- shortcut={props.shortcut}- />- }- ref={props.ref}- >- <button- class={`flex flex-col items-center justify-center h-[28px] w-[28px] hover:bg-hover hover-transition-bg ${props.clicked ? 'bg-active' : ''} rounded-md`}- onClick={handleClick}- >- {props.children}- </button>- </Tooltip>- );-}diff --git a/js/app/packages/block-channel/component/DeprecatedChannelInput/FormatRibbon.tsx b/js/app/packages/block-channel/component/DeprecatedChannelInput/FormatRibbon.tsxdeleted file mode 100644index 419ebf816f..0000000000--- a/js/app/packages/block-channel/component/DeprecatedChannelInput/FormatRibbon.tsx+++ /dev/null@@ -1,131 +0,0 @@-import type {- NodeTransformType,- SelectionData,-} from '@core/component/LexicalMarkdown/plugins';-import TextBold from '@icon/bold/text-b-bold.svg';-import TextCode from '@icon/regular/code.svg';-import ListBullets from '@icon/regular/list-bullets.svg';-import ListChecks from '@icon/regular/list-checks.svg';-import ListNumbers from '@icon/regular/list-numbers.svg';-import TextItalic from '@icon/regular/text-italic.svg';-import TextStriketrough from '@icon/regular/text-strikethrough.svg';-import TextQuote from '@icon/regular/quotes.svg';-import type { TextFormatType } from 'lexical';-import { ActionButton } from './ActionButton';--export type FormatRibbonProps = {- class?: string;- state: SelectionData;- inlineFormat: (format: TextFormatType) => void;- nodeFormat: (transform: NodeTransformType) => void;-};--export function FormatRibbon(props: FormatRibbonProps) {- const dispatchFormat = (transform: NodeTransformType) => {- const hasFormat = props.state.elementsInRange.has(transform);- props.nodeFormat(hasFormat ? 'paragraph' : transform);- };-- return (- <div- class="flex flex-row w-full gap-2 items-center p-2"- classList={{- [props.class!]: !!props.class,- }}- >- <ActionButton- tooltip="Bold"- shortcut="meta+b"- darker- clicked={props.state.bold}- onClick={(e) => {- e.preventDefault();- props.inlineFormat('bold');- }}- >- <TextBold width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Italic"- shortcut="meta+i"- darker- clicked={props.state.italic}- onClick={(e) => {- e.preventDefault();- props.inlineFormat('italic');- }}- >- <TextItalic width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Strikethrough"- shortcut="meta+shift+x"- darker- clicked={props.state.strikethrough}- onClick={(e) => {- e.preventDefault();- props.inlineFormat('strikethrough');- }}- >- <TextStriketrough width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Code"- shortcut="meta+e"- darker- clicked={props.state.strikethrough}- onClick={(e) => {- e.preventDefault();- props.inlineFormat('code');- }}- >- <TextCode width={20} height={20} />- </ActionButton>- <div class="w-[1px] h-[20px] bg-edge" />- <ActionButton- tooltip="Bullet List"- darker- clicked={props.state.elementsInRange.has('list-bullet')}- onClick={(e) => {- e.preventDefault();- dispatchFormat('list-bullet');- }}- >- <ListBullets width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Numbered List"- darker- clicked={props.state.elementsInRange.has('list-number')}- onClick={(e) => {- e.preventDefault();- dispatchFormat('list-number');- }}- >- <ListNumbers width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Checklist"- darker- clicked={props.state.elementsInRange.has('list-check')}- onClick={(e) => {- e.preventDefault();- dispatchFormat('list-check');- }}- >- <ListChecks width={20} height={20} />- </ActionButton>- <ActionButton- tooltip="Blockquote"- darker- clicked={props.state.elementsInRange.has('quote')}- onClick={(e) => {- e.preventDefault();- dispatchFormat('quote');- }}- >- <TextQuote width={20} height={20} />- </ActionButton>- </div>- );-}diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsxindex eb39274607..b3c77ee0c1 100644--- a/js/app/packages/block-email/component/BaseInput.tsx+++ b/js/app/packages/block-email/component/BaseInput.tsx@@ -1,5 +1,9 @@import { fileSelector } from '@core/directive/fileSelector';-import { FormatRibbon } from '@block-channel/component/DeprecatedChannelInput/FormatRibbon';+import { FormatButtons } from '@channel/Input/FormatButtons';+import {+ applyInlineFormat,+ applyNodeFormat,+} from '@channel/Input/utils/formatting';import { MacroSignatureButton } from '@block-email/component/MacroSignatureButton';import { convertContactInfoToEmailRecipient } from '@block-email/util/recipientConversion';import {@@ -60,19 +64,11 @@ import { Button } from '@ui/components/Button';import {defaultSelectionData,lazyRegister,+ type NodeTransformType,type SelectionData,} from 'core/component/LexicalMarkdown/plugins';-import {- NODE_TRANSFORM,- type NodeTransformType,-} from 'core/component/LexicalMarkdown/plugins/node-transform/nodeTransformPlugin';import { registerHotkey, useHotkeyDOMScope } from 'core/hotkey/hotkeys';-import {- $getRoot,- FORMAT_TEXT_COMMAND,- type LexicalEditor,- type TextFormatType,-} from 'lexical';+import { $getRoot, type LexicalEditor } from 'lexical';import {type Accessor,createEffect,@@ -1446,15 +1442,26 @@ export function BaseInput(props: {</div><div class="w-full h-full flex flex-col"><Show when={showFormatRibbon()}>- <FormatRibbon- state={formatState}- inlineFormat={(format: TextFormatType) => {- editor()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);- }}- nodeFormat={(transform: NodeTransformType) => {- editor()?.dispatchCommand(NODE_TRANSFORM, transform);- }}- />+ <div class="flex flex-row w-full gap-2 items-center p-2">+ <FormatButtons+ selectionState={() => formatState}+ includeQuote+ onInlineFormat={(format) => {+ const editor_ = editor();+ if (!editor_) return;+ applyInlineFormat(editor_, format);+ }}+ onNodeFormat={(transform) => {+ const editor_ = editor();+ if (!editor_) return;+ const isActive = formatState.elementsInRange.has(transform);+ const targetTransform: NodeTransformType = isActive+ ? 'paragraph'+ : transform;+ applyNodeFormat(editor_, targetTransform);+ }}+ />+ </div></Show><divclass="max-h-80 overflow-y-scroll w-full flex flex-col placeholder:text-ink-placeholder placeholder:opacity-50 px-3"diff --git a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx b/js/app/packages/block-email/component/compose/ComposeToolbar.tsxindex 07c87ab200..29b551648d 100644--- a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx+++ b/js/app/packages/block-email/component/compose/ComposeToolbar.tsx@@ -1,5 +1,5 @@import { SplitHeaderRight } from '@app/component/split-layout/components/SplitHeader';-import { FormatRibbon } from '@block-channel/component/DeprecatedChannelInput/FormatRibbon';+import { FormatButtons } from '@channel/Input/FormatButtons';import { EmailDateSelector } from '@block-email/component/email-date-selector';import { MAX_ATTACHMENTS_BYTES_SIZE } from '@block-email/constants';import { DropdownMenuContent, MenuItem } from '@core/component/Menu';@@ -24,11 +24,7 @@ import {NODE_TRANSFORM,type NodeTransformType,} from 'core/component/LexicalMarkdown/plugins/node-transform/nodeTransformPlugin';-import {- FORMAT_TEXT_COMMAND,- type LexicalEditor,- type TextFormatType,-} from 'lexical';+import { FORMAT_TEXT_COMMAND, type LexicalEditor } from 'lexical';import { createSignal, Show } from 'solid-js';import { useCompose } from './ComposeContext';@@ -76,16 +72,18 @@ export function EmailComposeToolbar(props: {return (<><Show when={showFormatRibbon()}>- <FormatRibbon- class="-ml-3"- state={structuredClone(defaultSelectionData)}- inlineFormat={(format: TextFormatType) => {- props.editor?.()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);- }}- nodeFormat={(transform: NodeTransformType) => {- props.editor?.()?.dispatchCommand(NODE_TRANSFORM, transform);- }}- />+ <div class="flex flex-row w-full gap-2 items-center p-2 -ml-3">+ <FormatButtons+ selectionState={() => defaultSelectionData}+ includeQuote+ onInlineFormat={(format) => {+ props.editor?.()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);+ }}+ onNodeFormat={(transform: NodeTransformType) => {+ props.editor?.()?.dispatchCommand(NODE_TRANSFORM, transform);+ }}+ />+ </div></Show><div class="flex flex-row w-full h-8 justify-between items-center space-x-2 allow-css-brackets mt-2"><Showdiff --git a/js/app/packages/channel/Input/FormatButtons.tsx b/js/app/packages/channel/Input/FormatButtons.tsxindex 440acc0ef0..20bbfcac37 100644--- a/js/app/packages/channel/Input/FormatButtons.tsx+++ b/js/app/packages/channel/Input/FormatButtons.tsx@@ -6,6 +6,7 @@ import ListChecksIcon from '@icon/regular/list-checks.svg';import ListNumbersIcon from '@icon/regular/list-numbers.svg';import TextItalicIcon from '@icon/regular/text-italic.svg';import TextStrikethroughIcon from '@icon/regular/text-strikethrough.svg';+import TextQuoteIcon from '@icon/regular/quotes.svg';import type {NodeTransformType,SelectionData,@@ -17,6 +18,7 @@ type FormatButtonsProps = {selectionState: Accessor<SelectionData | undefined>;onInlineFormat: (format: TextFormatType) => void;onNodeFormat: (format: NodeTransformType) => void;+ includeQuote?: boolean;};export function FormatButtons(props: FormatButtonsProps) {@@ -72,6 +74,15 @@ export function FormatButtons(props: FormatButtonsProps) {><ListChecksIcon class="size-5" /></RibbonButton>+ {props.includeQuote && (+ <RibbonButton+ label="Blockquote"+ active={props.selectionState()?.elementsInRange.has('quote')}+ onClick={() => props.onNodeFormat('quote')}+ >+ <TextQuoteIcon class="size-5" />+ </RibbonButton>+ )}</>);}