Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(web): remove 'Edit with AI' document button (#7711)

Jacob Beckermanffc62c11cde7
diff --git a/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx b/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx
deleted file mode 100644
index f524f885a5..0000000000
--- a/apps/web/src/features/block-md/component/DocumentAiEditBar.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-import { buildChatEditor } from '@core/component/AI/component/input/buildChatEditor';
-import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
-import clickOutside from '@core/directive/clickOutside';
-import { TOKENS } from '@core/hotkey/tokens';
-import SparkleIcon from '@phosphor/sparkle.svg';
-import { Button, ComposerSurface, SendButton } from '@ui';
-import { createSignal, Show } from 'solid-js';
-import { useMarkdownDocument } from '../context/markdown-document-context';
-import { cancelAiEdit, requestAiEditWithToast } from '../queries/ai-edit';
-
-false && clickOutside;
-
-/**
- * Right-aligned "Edit with AI" pill above the document discussion that expands
- * into a prompt card matching the Discussion composer.
- */
-export function DocumentAiEditBar(props: { documentId: string }) {
- const { state } = useMarkdownDocument();
-
- const [expanded, setExpanded] = createSignal(false);
- const [editing, setEditing] = createSignal(false);
- const [hovering, setHovering] = createSignal(false);
- const [prompt, setPrompt] = createSignal('');
-
- let editor = buildChatEditor();
-
- const collapse = () => {
- setExpanded(false);
- setPrompt('');
- state.editor.md.editor?.focus();
- };
-
- const submit = () => {
- const value = prompt().trim();
- if (!value || editing()) return;
- editor.controls.clear();
- setPrompt('');
- collapse();
- setEditing(true);
-
- void requestAiEditWithToast(
- { documentId: props.documentId, prompt: value },
- () => setEditing(false)
- );
- };
-
- const configureEditor = () =>
- buildChatEditor()
- .onEnter(() => {
- submit();
- return true;
- })
- .onEscape(() => {
- collapse();
- return true;
- })
- .onChange((markdown) => setPrompt(markdown));
-
- editor = configureEditor();
-
- const expand = () => {
- editor = configureEditor();
- setExpanded(true);
- requestAnimationFrame(() => editor.controls.focus());
- };
-
- return (
- <div class="flex justify-end">
- {/* breathe keyframe for the star while an edit runs */}
- <style>{`
- @keyframes ai-edit-breathe {
- 0%, 100% { transform: scale(1); }
- 50% { transform: scale(1.18); }
- }
- .ai-edit-star-breathing {
- animation: ai-edit-breathe 1.8s ease-in-out infinite;
- transform-origin: center;
- }
- `}</style>
- <Show
- when={expanded()}
- fallback={
- <Button
- onClick={(event) => {
- event.stopPropagation();
- if (editing()) cancelAiEdit(props.documentId);
- else expand();
- }}
- onMouseEnter={() => setHovering(true)}
- onMouseLeave={() => setHovering(false)}
- tooltip={editing() ? 'Stop AI edit' : 'Ask AI to edit'}
- hotkey={editing() ? undefined : TOKENS.chat.input.focus}
- variant="outline"
- glass={false}
- size="sm"
- class="gap-1.5 px-2.5"
- >
- <span
- class="flex size-4 shrink-0 items-center justify-center"
- classList={{
- 'ai-edit-star-breathing text-accent': editing(),
- }}
- >
- <SparkleIcon />
- </span>
- <span
- class="text-xs font-medium"
- classList={{ 'text-ink-muted': editing() && !hovering() }}
- >
- {editing() ? (hovering() ? 'Stop' : 'Editing…') : 'Edit with AI'}
- </span>
- </Button>
- }
- >
- <ComposerSurface class="h-auto w-96 max-w-full">
- <div class="flex flex-col gap-2 p-2" use:clickOutside={collapse}>
- <div class="flex items-start gap-2">
- <span class="flex h-8 w-4 shrink-0 items-center justify-center text-accent">
- <SparkleIcon />
- </span>
- <div class="min-w-0 grow text-base text-ink">
- <MarkdownShell
- config={editor}
- placeholder="Describe the edit…"
- autofocus
- />
- </div>
- </div>
- <div class="flex items-center justify-end">
- <SendButton
- tooltip="Send edit"
- shortcut="enter"
- disabled={prompt().trim().length === 0}
- onClick={submit}
- />
- </div>
- </div>
- </ComposerSurface>
- </Show>
- </div>
- );
-}
diff --git a/apps/web/src/features/block-md/component/Notebook.tsx b/apps/web/src/features/block-md/component/Notebook.tsx
index 714f7d787e..732686e467 100644
--- a/apps/web/src/features/block-md/component/Notebook.tsx
+++ b/apps/web/src/features/block-md/component/Notebook.tsx
@@ -1,4 +1,3 @@
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { createSizeBreakpoints } from '@app/util/create-size-breakpoints';
import { CommentMargin } from '@block-md/comments/CommentMargin';
import { useMacroMentionLinkResolver } from '@components/app/split-layout/split-router/mention-links';
@@ -7,7 +6,6 @@ import { ParamsProvider } from '@core/component/ParamsProvider';
import {
DEV_MODE_ENV,
ENABLE_MARKDOWN_COMMENTS,
- enableInlineAiEditing,
LOCAL_ONLY,
} from '@core/constant/featureFlags';
import { useIsMacroTeam } from '@core/context/team';
@@ -34,7 +32,6 @@ import {
untrack,
} from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
-import { DocumentAiEditBar } from './DocumentAiEditBar';
import { DocumentDiscussion } from './DocumentDiscussion';
import { InlineTaskGithubPullRequests } from './InlineTaskGithubPullRequests';
import { InlineTaskProperties } from './InlineTaskProperties';
@@ -101,13 +98,11 @@ export function Notebook(props: {
hotkeyScope: string | undefined;
autoFocus: boolean;
}) {
- const { element: blockElement, permissions, state } = useMarkdownDocument();
- const canEdit = permissions.canEdit;
+ const { element: blockElement, state } = useMarkdownDocument();
const { comments: commentState, params } = state;
const { md, setMd } = state.editor;
const { displayName: documentName } = useMarkdownName();
const scopeId = () => props.hotkeyScope;
- const inlineAiEditing = useFeatureFlag(enableInlineAiEditing);
const resolveAppLink = useMacroMentionLinkResolver();
let notebookRef!: HTMLDivElement;
@@ -371,11 +366,6 @@ export function Notebook(props: {
setShowLexicalStateDebugger(false)
}
/>
- <Show when={inlineAiEditing().enabled && canEdit() && !isMobile()}>
- <div class="mb-2">
- <DocumentAiEditBar documentId={props.documentId} />
- </div>
- </Show>
<DocumentDiscussion editorHasFocus={editorHasFocus()} />
</ParamsProvider>
</div>