diff --git a/apps/code/snapshots.yml b/apps/code/snapshots.yml index 367b3371a3..843bb26229 100644 --- a/apps/code/snapshots.yml +++ b/apps/code/snapshots.yml @@ -692,10 +692,6 @@ snapshots: hash: v1.k4693efd2.e747a3b5d0983a7a125335f1d95cc7735dafda73abdb3f63ccfadde0482c5ce9.tjc4lMKeaOJjLLxd9tivmgKLshzHZwuSAa_MbqwN_20 skill-buttons-skillbuttonactionmessage--run-experiment--light: hash: v1.k4693efd2.c18264887c67224ea1196646ff27f31ef9d79add87b5e9dfead377fcaf0dc941.MwzR7Yyd4le31Qm7RB2yk-qLk5ujgLkN-cMAB2WQ9_k - skill-buttons-skillbuttonsmenu--default--dark: - hash: v1.k4693efd2.cfff4c6bbb0acef1c9941b21d2f69c24b234c2c206282acf6fcada0cb2bd2386.xILjVPp8ecQmGbPjGDdhbRyi9KFPpA_1nfYF3bfjwuc - skill-buttons-skillbuttonsmenu--default--light: - hash: v1.k4693efd2.eb9bd49b9700641f6f3c90653447c9767c52e997afec9843e8649b90752faad3.VdxEtBwtkU3ioy2evcNbrEKxPjQ1GDUpZAQzFe-Uho4 spaces-taskfeedrow--agent-origin--dark: hash: v1.k4693efd2.82f8c70a399c9ea768201933e202fcc2fde74332c5153aeabf6835ace79beee6.yEZq_qnKxItv5u0Ydcqa1B4VCwv8lwXUvcaFScE2XO0 spaces-taskfeedrow--agent-origin--light: diff --git a/packages/shared/src/analytics-events.ts b/packages/shared/src/analytics-events.ts index 2952a5e012..eea1430b6f 100644 --- a/packages/shared/src/analytics-events.ts +++ b/packages/shared/src/analytics-events.ts @@ -42,7 +42,6 @@ export type SkillButtonId = | "add-error-tracking" | "instrument-llm-calls" | "add-logging"; -type SkillButtonSource = "primary" | "dropdown"; export type CommandMenuAction = | "home" | "new-task" @@ -289,12 +288,6 @@ export interface BrainrotActivatedProperties { filled_cells: number; } -export interface SkillButtonTriggeredProperties { - task_id: string; - button_id: SkillButtonId; - source: SkillButtonSource; -} - // Settings events export interface SettingChangedProperties { setting_name: string; @@ -1319,7 +1312,6 @@ export const ANALYTICS_EVENTS = { COMMAND_MENU_ACTION: "Command menu action", COMMAND_CENTER_VIEWED: "Command center viewed", BRAINROT_ACTIVATED: "Brainrot activated", - SKILL_BUTTON_TRIGGERED: "Skill button triggered", POSTHOG_WEB_OPENED: "PostHog web opened", SIDEBAR_NAV_ITEM_CLICKED: "Sidebar nav item clicked", SIDEBAR_CUSTOMIZED: "Sidebar customized", @@ -1498,7 +1490,6 @@ export type EventPropertyMap = { [ANALYTICS_EVENTS.COMMAND_MENU_ACTION]: CommandMenuActionProperties; [ANALYTICS_EVENTS.COMMAND_CENTER_VIEWED]: never; [ANALYTICS_EVENTS.BRAINROT_ACTIVATED]: BrainrotActivatedProperties; - [ANALYTICS_EVENTS.SKILL_BUTTON_TRIGGERED]: SkillButtonTriggeredProperties; [ANALYTICS_EVENTS.POSTHOG_WEB_OPENED]: never; [ANALYTICS_EVENTS.SIDEBAR_NAV_ITEM_CLICKED]: SidebarNavItemClickedProperties; [ANALYTICS_EVENTS.SIDEBAR_CUSTOMIZED]: SidebarCustomizedProperties; diff --git a/packages/ui/src/features/command/keyboard-shortcuts.ts b/packages/ui/src/features/command/keyboard-shortcuts.ts index 55ad5d9458..6f1da71385 100644 --- a/packages/ui/src/features/command/keyboard-shortcuts.ts +++ b/packages/ui/src/features/command/keyboard-shortcuts.ts @@ -24,8 +24,6 @@ export const SHORTCUTS = { // takes slot 1 instead. SWITCH_STARRED_CHANNEL: "mod+1,mod+2,mod+3,mod+4,mod+5,mod+6,mod+7,mod+8,mod+9", - OPEN_IN_EDITOR: "mod+o", - COPY_PATH: "mod+shift+c", TOGGLE_FOCUS: "mod+r", PASTE_AS_FILE: "mod+shift+v", INBOX: "mod+i", @@ -211,20 +209,6 @@ export const KEYBOARD_SHORTCUTS: KeyboardShortcut[] = [ category: "panels", context: "Task detail", }, - { - id: "open-in-editor", - keys: SHORTCUTS.OPEN_IN_EDITOR, - description: "Open in external editor", - category: "panels", - context: "Task detail", - }, - { - id: "copy-path", - keys: SHORTCUTS.COPY_PATH, - description: "Copy file path", - category: "panels", - context: "Task detail", - }, { id: "find-in-conversation", keys: SHORTCUTS.FIND_IN_CONVERSATION, diff --git a/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.stories.tsx b/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.stories.tsx deleted file mode 100644 index eb76ddd98f..0000000000 --- a/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.stories.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { SkillButtonsMenu } from "@posthog/ui/features/skill-buttons/components/SkillButtonsMenu"; -import type { Meta, StoryObj } from "@storybook/react-vite"; - -const meta: Meta = { - title: "Skill Buttons/SkillButtonsMenu", - component: SkillButtonsMenu, - parameters: { - layout: "centered", - }, - args: { - taskId: "storybook-task", - }, -}; - -export default meta; -type Story = StoryObj; - -export const Default: Story = {}; diff --git a/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.tsx b/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.tsx deleted file mode 100644 index da5d2d3952..0000000000 --- a/packages/ui/src/features/skill-buttons/components/SkillButtonsMenu.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { CaretDown } from "@phosphor-icons/react"; -import { - Button, - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@posthog/quill"; -import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events"; -import { track } from "../../../shell/analytics"; -import { sendPromptToAgent } from "../../sessions/sendPromptToAgent"; -import { - buildSkillButtonPromptBlocks, - SKILL_BUTTON_ORDER, - SKILL_BUTTONS, - type SkillButton, - type SkillButtonId, -} from "../prompts"; -import { useSkillButtonsStore } from "../skillButtonsStore"; - -interface SkillButtonsMenuProps { - taskId: string; -} - -function SkillButtonIcon({ button }: { button: SkillButton }) { - const { Icon, color } = button; - return ; -} - -export function SkillButtonsMenu({ taskId }: SkillButtonsMenuProps) { - const lastSelectedId = useSkillButtonsStore((s) => s.lastSelectedId); - const setLastSelectedId = useSkillButtonsStore((s) => s.setLastSelectedId); - - const primaryButton = SKILL_BUTTONS[lastSelectedId]; - const dropdownButtons = SKILL_BUTTON_ORDER.filter( - (id) => id !== lastSelectedId, - ).map((id) => SKILL_BUTTONS[id]); - - const handleTrigger = ( - buttonId: SkillButtonId, - source: "primary" | "dropdown", - ) => { - track(ANALYTICS_EVENTS.SKILL_BUTTON_TRIGGERED, { - task_id: taskId, - button_id: buttonId, - source, - }); - setLastSelectedId(buttonId); - sendPromptToAgent(taskId, buildSkillButtonPromptBlocks(buttonId)); - }; - - return ( - -
- - handleTrigger(primaryButton.id, "primary")} - > - - {primaryButton.label} - - } - /> - {primaryButton.tooltip} - - - - - - } - /> - - {dropdownButtons.map((button) => ( - - handleTrigger(button.id, "dropdown")} - > - - {button.label} - - } - /> - {button.tooltip} - - ))} - - -
-
- ); -} diff --git a/packages/ui/src/features/skill-buttons/skillButtonsStore.ts b/packages/ui/src/features/skill-buttons/skillButtonsStore.ts deleted file mode 100644 index 932c1f8b77..0000000000 --- a/packages/ui/src/features/skill-buttons/skillButtonsStore.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - isSkillButtonId, - SKILL_BUTTON_ORDER, - type SkillButtonId, -} from "@posthog/core/skill-buttons/catalog"; -import { create } from "zustand"; -import { persist } from "zustand/middleware"; - -interface SkillButtonsStoreState { - lastSelectedId: SkillButtonId; -} - -interface SkillButtonsStoreActions { - setLastSelectedId: (id: SkillButtonId) => void; -} - -type SkillButtonsStore = SkillButtonsStoreState & SkillButtonsStoreActions; - -const DEFAULT_PRIMARY: SkillButtonId = SKILL_BUTTON_ORDER[0]; - -export const useSkillButtonsStore = create()( - persist( - (set) => ({ - lastSelectedId: DEFAULT_PRIMARY, - setLastSelectedId: (lastSelectedId) => set({ lastSelectedId }), - }), - { - name: "skill-buttons-storage", - merge: (persisted, current) => { - const persistedState = persisted as { - lastSelectedId?: string; - }; - const restored = isSkillButtonId(persistedState.lastSelectedId) - ? persistedState.lastSelectedId - : DEFAULT_PRIMARY; - return { - ...current, - lastSelectedId: restored, - }; - }, - }, - ), -); diff --git a/packages/ui/src/features/skills/SkillDetailPanel.tsx b/packages/ui/src/features/skills/SkillDetailPanel.tsx index 6be4fd58e3..0feb3da4d3 100644 --- a/packages/ui/src/features/skills/SkillDetailPanel.tsx +++ b/packages/ui/src/features/skills/SkillDetailPanel.tsx @@ -14,7 +14,6 @@ import type { SkillInfo } from "@posthog/shared"; import { stripFrontmatter } from "@posthog/shared"; import { CodeMirrorEditor } from "@posthog/ui/features/code-editor/components/CodeMirrorEditor"; import { MarkdownRenderer } from "@posthog/ui/features/editor/components/MarkdownRenderer"; -import { ExternalAppsOpener } from "@posthog/ui/features/task-detail/components/ExternalAppsOpener"; import { toast } from "@posthog/ui/primitives/toast"; import { AlertDialog, @@ -298,9 +297,6 @@ export function SkillDetailPanel({ Import )} - {skill.source !== "bundled" && ( - - )} {issues.length > 0 && ( diff --git a/packages/ui/src/features/task-detail/components/ExternalAppsOpener.tsx b/packages/ui/src/features/task-detail/components/ExternalAppsOpener.tsx deleted file mode 100644 index 2d4727280b..0000000000 --- a/packages/ui/src/features/task-detail/components/ExternalAppsOpener.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import { CodeIcon, CopyIcon } from "@phosphor-icons/react"; -import { - Button, - ButtonGroup, - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuTrigger, -} from "@posthog/quill"; -import { ChevronDown } from "lucide-react"; -import { useCallback } from "react"; -import { useHotkeys } from "react-hotkeys-hook"; -import { SHORTCUTS } from "../../command/keyboard-shortcuts"; -import { useExternalAppAction } from "../../external-apps/useExternalAppAction"; -import { useExternalApps } from "../../external-apps/useExternalApps"; - -const THUMBNAIL_ICON_SIZE = 20; -const DROPDOWN_ICON_SIZE = 20; - -interface ExternalAppsOpenerProps { - targetPath: string | null; -} - -export function ExternalAppsOpener({ targetPath }: ExternalAppsOpenerProps) { - const openExternalApp = useExternalAppAction(); - const { detectedApps, defaultApp, isLoading, setLastUsedApp } = - useExternalApps(); - - const handleOpenDefault = useCallback(async () => { - if (!defaultApp || !targetPath) return; - const displayName = targetPath.split("/").pop() || targetPath; - await openExternalApp( - { type: "open-in-app", appId: defaultApp.id }, - targetPath, - displayName, - ); - }, [openExternalApp, defaultApp, targetPath]); - - const handleOpenWith = useCallback( - async (appId: string) => { - if (!targetPath) return; - const displayName = targetPath.split("/").pop() || targetPath; - await openExternalApp( - { type: "open-in-app", appId }, - targetPath, - displayName, - ); - await setLastUsedApp(appId); - }, - [openExternalApp, targetPath, setLastUsedApp], - ); - - const handleCopyPath = useCallback(async () => { - if (!targetPath) return; - const displayName = targetPath.split("/").pop() || targetPath; - await openExternalApp({ type: "copy-path" }, targetPath, displayName); - }, [openExternalApp, targetPath]); - - useHotkeys( - SHORTCUTS.OPEN_IN_EDITOR, - (event) => { - event.preventDefault(); - handleOpenDefault(); - }, - { enableOnFormTags: ["INPUT", "TEXTAREA", "SELECT"] }, - [handleOpenDefault], - ); - - useHotkeys( - SHORTCUTS.COPY_PATH, - (event) => { - event.preventDefault(); - handleCopyPath(); - }, - { enableOnFormTags: ["INPUT", "TEXTAREA", "SELECT"] }, - [handleCopyPath], - ); - - if (!targetPath) { - return null; - } - - const isReady = !isLoading && detectedApps.length > 0; - - return ( - - - - - } - > - - - - {detectedApps.map((app) => ( - handleOpenWith(app.id)} - > - {app.icon ? ( - - ) : ( - - )} - {app.name} - {app.id === defaultApp?.id && ( - ⌘O - )} - - ))} - - - - Copy Path - ⌘⇧C - - - - - ); -} diff --git a/packages/ui/src/features/task-detail/components/TaskDetail.tsx b/packages/ui/src/features/task-detail/components/TaskDetail.tsx index 458b6d954a..661a39f6d4 100644 --- a/packages/ui/src/features/task-detail/components/TaskDetail.tsx +++ b/packages/ui/src/features/task-detail/components/TaskDetail.tsx @@ -16,8 +16,6 @@ import { useFileSearchStore } from "../../command/fileSearchStore"; import { useRepoFileWatcher } from "../../file-watcher/useRepoFileWatcher"; import { clearGitReviewQueries } from "../../git-interaction/gitCacheKeys"; import { PanelLayout } from "../../panels/components/PanelLayout"; -import { usePanelLayoutStore } from "../../panels/panelLayoutStore"; -import { getLeafPanel, parseTabId } from "../../panels/panelStoreHelpers"; import { PiSessionView } from "../../pi-sessions/PiSessionView"; import { MIN_CHAT_WIDTH } from "../../sessions/constants"; import { useCwd } from "../../sidebar/useCwd"; @@ -27,7 +25,6 @@ import { useWorkspaceEvents } from "../../workspace/useWorkspaceEvents"; import { HeaderTitleEditor } from "../HeaderTitleEditor"; import { useTaskData } from "../hooks/useTaskData"; import { CustomImageBadge } from "./CustomImageBadge"; -import { ExternalAppsOpener } from "./ExternalAppsOpener"; import { WorkspaceModeBadge } from "./WorkspaceModeBadge"; const MIN_REVIEW_WIDTH = 300; @@ -57,28 +54,6 @@ export function TaskDetail({ const effectiveRepoPath = useCwd(taskId); - const activeRelativePath = usePanelLayoutStore((state) => { - const layout = state.getLayout(taskId); - if (!layout) return null; - - const panelId = layout.focusedPanelId; - if (!panelId) return null; - - const panel = getLeafPanel(layout.panelTree, panelId); - if (!panel) return null; - - const parsed = parseTabId(panel.content.activeTabId); - if (parsed.type === "file") { - return parsed.value; - } - return null; - }); - - const openTargetPath = - activeRelativePath && effectiveRepoPath - ? [effectiveRepoPath, activeRelativePath].join("/").replace(/\/+/g, "/") - : effectiveRepoPath; - const openFilePicker = useFileSearchStore((state) => state.openPicker); const { enableScope, disableScope } = useHotkeysContext(); @@ -129,15 +104,10 @@ export function TaskDetail({ // Memoized so the headerContent memo below isn't busted by unrelated renders. const trailing = useMemo( () => - channelId || openTargetPath ? ( - - {channelId && ( - - )} - {openTargetPath && } - + channelId ? ( + ) : null, - [channelId, taskId, openTargetPath], + [channelId, taskId], ); const workspace = useWorkspace(taskId); const workspaceMode = workspace?.mode; diff --git a/packages/ui/src/features/task-detail/components/TaskHeaderActions.test.tsx b/packages/ui/src/features/task-detail/components/TaskHeaderActions.test.tsx index f80d03734d..9e438ed755 100644 --- a/packages/ui/src/features/task-detail/components/TaskHeaderActions.test.tsx +++ b/packages/ui/src/features/task-detail/components/TaskHeaderActions.test.tsx @@ -45,12 +45,6 @@ vi.mock("@posthog/ui/features/code-review/hooks/useDiffStatsToggle", () => ({ toggle: vi.fn(), }), })); -vi.mock( - "@posthog/ui/features/skill-buttons/components/SkillButtonsMenu", - () => ({ - SkillButtonsMenu: () => null, - }), -); vi.mock("@posthog/ui/features/autoresearch/AutoresearchHeaderButton", () => ({ AutoresearchHeaderButton: () => null, })); diff --git a/packages/ui/src/features/task-detail/components/TaskHeaderActions.tsx b/packages/ui/src/features/task-detail/components/TaskHeaderActions.tsx index 6f061ace2b..b3e931afd6 100644 --- a/packages/ui/src/features/task-detail/components/TaskHeaderActions.tsx +++ b/packages/ui/src/features/task-detail/components/TaskHeaderActions.tsx @@ -18,7 +18,6 @@ import { StopCloudRunButton } from "@posthog/ui/features/sessions/components/Sto import { useHandoffDialogStore } from "@posthog/ui/features/sessions/handoffDialogStore"; import { useSessionCallbacks } from "@posthog/ui/features/sessions/hooks/useSessionCallbacks"; import { useSessionForTask } from "@posthog/ui/features/sessions/useSession"; -import { SkillButtonsMenu } from "@posthog/ui/features/skill-buttons/components/SkillButtonsMenu"; import { useWorkspace, useWorkspaceLoaded, @@ -142,9 +141,6 @@ export function TaskHeaderActions({ task }: { task: Task }) { pl="1" className="h-full max-w-[50%] shrink-0 overflow-hidden" > -
- -