Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ import {
} from "@features/inbox/utils/filterReports";
import { INBOX_REFETCH_INTERVAL_MS } from "@features/inbox/utils/inboxConstants";
import { setPendingInboxOpenMethod } from "@features/inbox/utils/pendingInboxOpenMethod";
import { DiscoveredTaskDetailPane } from "@features/setup/components/DiscoveredTaskDetailPane";
import { RecommendedSetupTasks } from "@features/setup/components/RecommendedSetupTasks";
import { useSetupStore } from "@features/setup/stores/setupStore";
import {
useIntegrations,
useRepositoryIntegration,
Expand Down Expand Up @@ -350,9 +347,6 @@ export function InboxSignalsTab() {
// ── Click handler: plain / cmd / shift ──────────────────────────────────
const handleReportClick = useCallback(
(reportId: string, event: { metaKey: boolean; shiftKey: boolean }) => {
// Selecting a real report clears any discovered-task selection so the
// detail pane can swap to the report.
useSetupStore.getState().selectDiscoveredTask(null);
if (event.shiftKey) {
setPendingInboxOpenMethod("click_shift");
selectRange(
Expand Down Expand Up @@ -433,39 +427,14 @@ export function InboxSignalsTab() {
};
}, [sidebarIsResizing, setSidebarWidth, setSidebarIsResizing]);

// ── Discovered-task suggestions (rendered inline at top of list) ───────
const discoveredTasks = useSetupStore((s) => s.discoveredTasks);
const hasDiscoveredTasks = discoveredTasks.length > 0;
const selectedDiscoveredTaskId = useSetupStore(
(s) => s.selectedDiscoveredTaskId,
);
const selectDiscoveredTask = useSetupStore((s) => s.selectDiscoveredTask);
const selectedDiscoveredTask =
discoveredTasks.find((t) => t.id === selectedDiscoveredTaskId) ?? null;

const handleSelectDiscoveredTask = useCallback(
(taskId: string) => {
selectDiscoveredTask(taskId);
clearSelection();
},
[selectDiscoveredTask, clearSelection],
);

const handleCloseDiscoveredTaskPane = useCallback(() => {
selectDiscoveredTask(null);
}, [selectDiscoveredTask]);

// ── Layout mode (computed early — needed by focus effect below) ────────
const hasReports = allReports.length > 0;
const hasActiveFilters =
sourceProductFilter.length > 0 ||
suggestedReviewerFilter.length > 0 ||
statusFilter.length < 5;
const shouldShowTwoPane =
hasReports ||
!!searchQuery.trim() ||
hasActiveFilters ||
hasDiscoveredTasks;
hasReports || !!searchQuery.trim() || hasActiveFilters;

// Sticky: once we enter two-pane mode, stay there even if a refetch
// momentarily empties the list (e.g. when sort order changes).
Expand Down Expand Up @@ -704,9 +673,6 @@ export function InboxSignalsTab() {
onReportAction={tracker.signalAction}
/>
</Box>
<RecommendedSetupTasks
onSelectTask={handleSelectDiscoveredTask}
/>
<ReportListPane
reports={reports}
allReports={allReports}
Expand Down Expand Up @@ -762,11 +728,6 @@ export function InboxSignalsTab() {
onReportAction={tracker.signalAction}
onScroll={tracker.signalScroll}
/>
) : selectedDiscoveredTask ? (
<DiscoveredTaskDetailPane
task={selectedDiscoveredTask}
onClose={handleCloseDiscoveredTaskPane}
/>
) : (
<SelectReportPane />
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Badge } from "@components/ui/Badge";
import { Button } from "@components/ui/Button";
import { MarkdownRenderer } from "@features/editor/components/MarkdownRenderer";
import { useFolders } from "@features/folders/hooks/useFolders";
import { useSetupStore } from "@features/setup/stores/setupStore";
Expand All @@ -9,22 +10,53 @@ import {
FALLBACK_CATEGORY_CONFIG,
} from "@features/setup/utils/categoryConfig";
import { useDetectedCloudRepository } from "@hooks/useDetectedCloudRepository";
import { PlusIcon, SparkleIcon, X as XIcon } from "@phosphor-icons/react";
import { Box, Button, Flex, ScrollArea, Text } from "@radix-ui/themes";
import { PlusIcon, SparkleIcon } from "@phosphor-icons/react";
import {
Box,
Dialog,
Flex,
ScrollArea,
Text,
VisuallyHidden,
} from "@radix-ui/themes";
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
import { useActiveRepoStore } from "@stores/activeRepoStore";
import { useNavigationStore } from "@stores/navigationStore";
import { track } from "@utils/analytics";

interface DiscoveredTaskDetailPaneProps {
task: DiscoveredTask;
interface DiscoveredTaskDetailDialogProps {
task: DiscoveredTask | null;
onClose: () => void;
}

export function DiscoveredTaskDetailPane({
export function DiscoveredTaskDetailDialog({
task,
onClose,
}: DiscoveredTaskDetailDialogProps) {
return (
<Dialog.Root
open={task !== null}
onOpenChange={(open) => {
if (!open) onClose();
}}
>
<Dialog.Content maxWidth="640px">
<VisuallyHidden>
<Dialog.Title>{task?.title ?? "Suggestion"}</Dialog.Title>
</VisuallyHidden>
{task && <DialogBody task={task} onClose={onClose} />}
</Dialog.Content>
</Dialog.Root>
);
}

function DialogBody({
task,
onClose,
}: DiscoveredTaskDetailPaneProps) {
}: {
task: DiscoveredTask;
onClose: () => void;
}) {
const config = CATEGORY_CONFIG[task.category] ?? FALLBACK_CATEGORY_CONFIG;
const CategoryIcon = config.icon;

Expand All @@ -48,6 +80,7 @@ export function DiscoveredTaskDetailPane({
useSetupStore
.getState()
.removeDiscoveredTask(task.id, task.repoPath ?? null);
onClose();
navigateToTaskInput({
initialPrompt,
folderId,
Expand All @@ -66,47 +99,30 @@ export function DiscoveredTaskDetailPane({
useSetupStore
.getState()
.removeDiscoveredTask(task.id, task.repoPath ?? null);
onClose();
};

return (
<>
<Flex
align="center"
justify="between"
gap="2"
py="2"
className="shrink-0 border-b border-b-(--gray-5) @2xl:px-6 @3xl:px-8 @4xl:px-10 @5xl:px-12 @lg:px-4 @md:px-3 @xl:px-5 px-2"
>
<Flex align="center" gap="2" className="min-w-0">
<Badge
color="violet"
className="!leading-none inline-flex shrink-0 items-center gap-1"
>
<SparkleIcon size={10} weight="fill" />
Suggested
</Badge>
<Text className="block min-w-0 text-balance break-words font-bold text-base">
{task.title}
</Text>
</Flex>
<Flex align="center" gap="1" className="shrink-0">
<button
type="button"
onClick={onClose}
aria-label="Close suggestion"
className="rounded p-0.5 text-gray-11 hover:bg-gray-3 hover:text-gray-12"
>
<XIcon size={14} />
</button>
</Flex>
<Flex direction="column" gap="4">
<Flex align="center" gap="2" wrap="wrap">
<Badge
color="violet"
className="!leading-none inline-flex shrink-0 items-center gap-1"
>
<SparkleIcon size={10} weight="fill" />
Suggested
</Badge>
<Text className="block min-w-0 text-balance break-words font-bold text-base">
{task.title}
</Text>
</Flex>

<ScrollArea type="auto" scrollbars="vertical" className="min-h-0 flex-1">
<Flex
direction="column"
gap="4"
className="@2xl:px-6 @3xl:px-8 @4xl:px-10 @5xl:px-12 @lg:px-4 @md:px-3 @xl:px-5 px-2 py-4"
>
<ScrollArea
type="auto"
scrollbars="vertical"
className="max-h-[60vh] min-h-0"
>
<Flex direction="column" gap="4" pr="3">
<Flex align="center" gap="2" className="text-(--gray-11)">
<span style={{ color: `var(--${config.color}-9)` }}>
<CategoryIcon size={14} weight="duotone" />
Expand Down Expand Up @@ -162,32 +178,16 @@ export function DiscoveredTaskDetailPane({
</Flex>
</ScrollArea>

<Flex
align="center"
justify="end"
gap="2"
className="h-[38px] shrink-0 border-t border-t-(--gray-5) bg-(--gray-1) @2xl:px-6 @3xl:px-8 @4xl:px-10 @5xl:px-12 @lg:px-4 @md:px-3 @xl:px-5 px-2"
>
<Button
size="1"
variant="ghost"
color="gray"
className="gap-1 font-medium text-[11px]"
onClick={handleDismiss}
>
<Flex gap="3" justify="end">
<Button variant="soft" color="gray" onClick={handleDismiss}>
Dismiss
</Button>
<Button
size="1"
variant="solid"
className="gap-1 font-medium text-[11px]"
onClick={handleCreateTask}
>
<PlusIcon size={12} />
<Button variant="solid" onClick={handleCreateTask}>
<PlusIcon size={14} weight="bold" />
Implement as new task
</Button>
</Flex>
</>
</Flex>
);
}

Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions apps/code/src/renderer/features/setup/stores/setupStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ interface SetupStoreState {
discoveredTasks: DiscoveredTask[];
discoveryByRepo: Record<string, RepoDiscoveryState>;
enricherByRepo: Record<string, RepoEnricherState>;
selectedDiscoveredTaskId: string | null;
}

interface SetupStoreActions {
Expand All @@ -66,7 +65,6 @@ interface SetupStoreActions {
completeEnrichment: (repoPath: string) => void;
failEnrichment: (repoPath: string) => void;
removeDiscoveredTask: (taskId: string, repoPath: string | null) => void;
selectDiscoveredTask: (taskId: string | null) => void;
addEnricherSuggestionIfMissing: (task: DiscoveredTask) => void;
pushDiscoveryActivity: (repoPath: string, entry: ActivityEntry) => void;
resetSetup: () => void;
Expand All @@ -83,7 +81,6 @@ const initialState: SetupStoreState = {
discoveredTasks: [],
discoveryByRepo: {},
enricherByRepo: {},
selectedDiscoveredTaskId: null,
};

export function selectRepoDiscovery(
Expand Down Expand Up @@ -265,17 +262,9 @@ export const useSetupStore = create<SetupStore>()(
discoveredTasks: state.discoveredTasks.filter(
(t) => !(t.id === taskId && isTaskForRepo(t, repoPath)),
),
selectedDiscoveredTaskId:
state.selectedDiscoveredTaskId === taskId
? null
: state.selectedDiscoveredTaskId,
}));
},

selectDiscoveredTask: (taskId) => {
set({ selectedDiscoveredTaskId: taskId });
},

// Adds an enricher-source suggestion if there isn't already one with
// the same id+repoPath. Idempotent — safe to call repeatedly on every
// detection run. Dismissed suggestions stay dismissed until `resetSetup`.
Expand Down
Loading
Loading