fix(vscode): hide Save-as-plan and Add-to-notes actions in VS Code runtime
Both flows write into ~/.config/openchamber which isn't reachable from the VS Code webview, so the buttons were dead weight there.
This commit is contained in:
@@ -1498,6 +1498,7 @@ const AssistantMessageBody: React.FC<Omit<MessageBodyProps, 'isUser'>> = ({
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent sideOffset={6}>{isSharing ? 'Saving image...' : 'Save as image'}</TooltipContent>
|
<TooltipContent sideOffset={6}>{isSharing ? 'Saving image...' : 'Save as image'}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
{!isVSCodeRuntime() ? (
|
||||||
<Tooltip delayDuration={1000}>
|
<Tooltip delayDuration={1000}>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
@@ -1517,6 +1518,7 @@ const AssistantMessageBody: React.FC<Omit<MessageBodyProps, 'isUser'>> = ({
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent sideOffset={6}>Save as plan</TooltipContent>
|
<TooltipContent sideOffset={6}>Save as plan</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
) : null}
|
||||||
<Tooltip delayDuration={1000}>
|
<Tooltip delayDuration={1000}>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { copyTextToClipboard } from '@/lib/clipboard';
|
|||||||
import { toast } from '@/components/ui';
|
import { toast } from '@/components/ui';
|
||||||
import { getProjectNotesAndTodos, saveProjectNotesAndTodos } from '@/lib/openchamberConfig';
|
import { getProjectNotesAndTodos, saveProjectNotesAndTodos } from '@/lib/openchamberConfig';
|
||||||
import { summarizeText } from '@/lib/voice/summarize';
|
import { summarizeText } from '@/lib/voice/summarize';
|
||||||
|
import { isVSCodeRuntime } from '@/lib/desktop';
|
||||||
|
|
||||||
interface TextSelectionMenuProps {
|
interface TextSelectionMenuProps {
|
||||||
containerRef: React.RefObject<HTMLElement | null>;
|
containerRef: React.RefObject<HTMLElement | null>;
|
||||||
@@ -628,6 +629,7 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
|||||||
<span>Copy</span>
|
<span>Copy</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{!isVSCodeRuntime() ? (
|
||||||
<button
|
<button
|
||||||
onClick={handleAddToNotes}
|
onClick={handleAddToNotes}
|
||||||
disabled={isAddingToNotes}
|
disabled={isAddingToNotes}
|
||||||
@@ -643,6 +645,7 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
|||||||
{isAddingToNotes ? <RiLoader4Line className="h-5 w-5 animate-spin" /> : <RiBookletLine className="h-5 w-5" />}
|
{isAddingToNotes ? <RiLoader4Line className="h-5 w-5 animate-spin" /> : <RiBookletLine className="h-5 w-5" />}
|
||||||
<span>Add to notes</span>
|
<span>Add to notes</span>
|
||||||
</button>
|
</button>
|
||||||
|
) : null}
|
||||||
</div>,
|
</div>,
|
||||||
document.body
|
document.body
|
||||||
);
|
);
|
||||||
@@ -703,6 +706,8 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
|||||||
<span className="whitespace-nowrap">New session</span>
|
<span className="whitespace-nowrap">New session</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{!isVSCodeRuntime() ? (
|
||||||
|
<>
|
||||||
<div className="w-px h-4 bg-[var(--interactive-border)]" />
|
<div className="w-px h-4 bg-[var(--interactive-border)]" />
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -721,6 +726,8 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
|||||||
{isAddingToNotes ? <RiLoader4Line className="h-4 w-4 animate-spin" /> : <RiBookletLine className="h-4 w-4" />}
|
{isAddingToNotes ? <RiLoader4Line className="h-4 w-4 animate-spin" /> : <RiBookletLine className="h-4 w-4" />}
|
||||||
<span className="whitespace-nowrap">Add to notes</span>
|
<span className="whitespace-nowrap">Add to notes</span>
|
||||||
</button>
|
</button>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
document.body
|
document.body
|
||||||
|
|||||||
Reference in New Issue
Block a user