diff --git a/apps/code/src/renderer/components/HeaderRow.tsx b/apps/code/src/renderer/components/HeaderRow.tsx index 713003eb8..2e36918e6 100644 --- a/apps/code/src/renderer/components/HeaderRow.tsx +++ b/apps/code/src/renderer/components/HeaderRow.tsx @@ -84,7 +84,7 @@ export function HeaderRow() { - + ); } diff --git a/apps/code/src/renderer/features/git-interaction/components/GitInteractionMenu.tsx b/apps/code/src/renderer/features/git-interaction/components/GitInteractionMenu.tsx index 91af37ec5..056b1a2e0 100644 --- a/apps/code/src/renderer/features/git-interaction/components/GitInteractionMenu.tsx +++ b/apps/code/src/renderer/features/git-interaction/components/GitInteractionMenu.tsx @@ -12,8 +12,16 @@ import { GitFork, GitPullRequest, } from "@phosphor-icons/react"; -import { ChevronDownIcon } from "@radix-ui/react-icons"; -import { Button, DropdownMenu, Flex, Spinner, Text } from "@radix-ui/themes"; +import { + Button, + ButtonGroup, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@posthog/quill"; +import { Spinner } from "@radix-ui/themes"; +import { ChevronDown } from "lucide-react"; interface GitInteractionMenuProps { primaryAction: GitMenuAction; @@ -23,51 +31,6 @@ interface GitInteractionMenuProps { onSelect: (actionId: GitMenuActionId) => void; } -function ActionButton({ - action, - isPrimary, - isBusy, - allDisabled, - onClick, -}: { - action: GitMenuAction; - isPrimary: boolean; - isBusy?: boolean; - allDisabled?: boolean; - onClick: () => void; -}) { - const icon = getActionIcon(action.id); - const isDisabled = !action.enabled || isBusy; - const button = ( - - ); - - if (!action.enabled && action.disabledReason) { - return ( - - {button} - - ); - } - - return button; -} - function getActionIcon(actionId: GitMenuActionId) { switch (actionId) { case "commit": @@ -98,69 +61,81 @@ export function GitInteractionMenu({ }: GitInteractionMenuProps) { const allDisabled = actions.every((a) => !a.enabled); const showDropdown = actions.length > 1; + const variant = allDisabled ? "default" : "primary"; + const isPrimaryDisabled = !primaryAction.enabled || isBusy; + + const primaryButton = ( + + ); + + const wrappedPrimaryButton = + !primaryAction.enabled && primaryAction.disabledReason ? ( + + {primaryButton} + + ) : ( + primaryButton + ); + + if (!showDropdown || allDisabled) { + return wrappedPrimaryButton; + } return ( - - onPrimary(primaryAction.id)} - /> - {showDropdown && ( - - + + {wrappedPrimaryButton} + + - - - - - {actions.map((action) => { - const icon = getActionIcon(action.id); - const itemContent = ( - - {icon} - {action.label} - - ); - - if (!action.enabled && action.disabledReason) { - return ( - - - {itemContent} - - - ); - } + /> + } + > + + + + {actions.map((action) => { + const icon = getActionIcon(action.id); + const itemContent = ( + <> + {icon} {action.label} + + ); + if (!action.enabled && action.disabledReason) { return ( - onSelect(action.id)} + content={action.disabledReason} + side="left" > - {itemContent} - + {itemContent} + ); - })} - - - )} - + } + + return ( + onSelect(action.id)} + > + {itemContent} + + ); + })} + + + ); } diff --git a/apps/code/src/renderer/features/task-detail/components/ExternalAppsOpener.tsx b/apps/code/src/renderer/features/task-detail/components/ExternalAppsOpener.tsx index 3ab95e8aa..ea54b45d4 100644 --- a/apps/code/src/renderer/features/task-detail/components/ExternalAppsOpener.tsx +++ b/apps/code/src/renderer/features/task-detail/components/ExternalAppsOpener.tsx @@ -1,22 +1,32 @@ import { useExternalApps } from "@features/external-apps/hooks/useExternalApps"; import { CodeIcon, CopyIcon } from "@phosphor-icons/react"; -import { ChevronDownIcon } from "@radix-ui/react-icons"; -import { DropdownMenu, Flex, Text } from "@radix-ui/themes"; +import { + Button, + ButtonGroup, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuTrigger, + Kbd, +} from "@posthog/quill"; import { SHORTCUTS } from "@renderer/constants/keyboard-shortcuts"; import { handleExternalAppAction } from "@utils/handleExternalAppAction"; -import { useCallback, useState } from "react"; +import { ChevronDown } from "lucide-react"; +import { useCallback } from "react"; import { useHotkeys } from "react-hotkeys-hook"; const THUMBNAIL_ICON_SIZE = 20; -const DROPDOWN_ICON_SIZE = 16; +const DROPDOWN_ICON_SIZE = 20; interface ExternalAppsOpenerProps { targetPath: string | null; } export function ExternalAppsOpener({ targetPath }: ExternalAppsOpenerProps) { - const { detectedApps, defaultApp, isLoading } = useExternalApps(); - const [dropdownOpen, setDropdownOpen] = useState(false); + const { detectedApps, defaultApp, isLoading, setLastUsedApp } = + useExternalApps(); const handleOpenDefault = useCallback(async () => { if (!defaultApp || !targetPath) return; @@ -37,8 +47,9 @@ export function ExternalAppsOpener({ targetPath }: ExternalAppsOpenerProps) { targetPath, displayName, ); + await setLastUsedApp(appId); }, - [targetPath], + [targetPath, setLastUsedApp], ); const handleCopyPath = useCallback(async () => { @@ -78,72 +89,44 @@ export function ExternalAppsOpener({ targetPath }: ExternalAppsOpenerProps) { const isReady = !isLoading && detectedApps.length > 0; return ( - - - + + - ) : ( - - )} - - - - - - - - {detectedApps.map((app) => ( - handleOpenWith(app.id)} - shortcut={app.id === defaultApp?.id ? "⌘ O" : undefined} - className="px-1" - > - + } + > + + + + {detectedApps.map((app) => ( + handleOpenWith(app.id)} + > {app.icon ? ( )} - {app.name} - - - ))} - - + {app.name} + {app.id === defaultApp?.id && ( + + ⌘O + + )} + + ))} + + - Copy Path - - - - + Copy Path + + ⌘⇧C + + + + + ); } diff --git a/apps/code/src/renderer/features/task-detail/components/TaskDetail.tsx b/apps/code/src/renderer/features/task-detail/components/TaskDetail.tsx index 22a900d08..f7d038522 100644 --- a/apps/code/src/renderer/features/task-detail/components/TaskDetail.tsx +++ b/apps/code/src/renderer/features/task-detail/components/TaskDetail.tsx @@ -151,11 +151,7 @@ export function TaskDetail({ task: initialTask }: TaskDetailProps) { )} - {openTargetPath && ( - - - - )} + {openTargetPath && } ), [