-
Notifications
You must be signed in to change notification settings - Fork 31
chat banner entry point #2128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chat banner entry point #2128
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { Box, Flex } from "@radix-ui/themes"; | ||
| import { type AppMode, useNavigationStore } from "@stores/navigationStore"; | ||
|
|
||
| const MODES: { value: AppMode; label: string }[] = [ | ||
| { value: "code", label: "Code" }, | ||
| { value: "work", label: "Work" }, | ||
| ]; | ||
|
|
||
| export function ModeSwitcher() { | ||
| const mode = useNavigationStore((s) => s.mode); | ||
| const setMode = useNavigationStore((s) => s.setMode); | ||
|
|
||
| return ( | ||
| <Box p="2" className="shrink-0 border-(--gray-6) border-b"> | ||
| <Flex | ||
| align="center" | ||
| gap="1" | ||
| className="rounded-(--radius-2) bg-(--gray-3) p-1" | ||
| > | ||
| {MODES.map((m) => { | ||
| const isActive = mode === m.value; | ||
| return ( | ||
| <button | ||
| key={m.value} | ||
| type="button" | ||
| onClick={() => setMode(m.value)} | ||
| className={`flex-1 cursor-pointer rounded-(--radius-1) py-1 text-center font-medium text-[13px] transition-colors ${ | ||
| isActive | ||
| ? "bg-(--color-panel-solid) text-(--gray-12) shadow-sm" | ||
| : "text-(--gray-11) hover:text-(--gray-12)" | ||
| }`} | ||
| > | ||
| {m.label} | ||
| </button> | ||
| ); | ||
| })} | ||
| </Flex> | ||
| </Box> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ import { ModelSelector } from "./ModelSelector"; | |
| import { PlanStatusBar } from "./PlanStatusBar"; | ||
| import { ReasoningLevelSelector } from "./ReasoningLevelSelector"; | ||
| import { RawLogsView } from "./raw-logs/RawLogsView"; | ||
| import { TryInPostHogWorkBanner } from "./TryInPostHogWorkBanner"; | ||
|
|
||
| interface SessionViewProps { | ||
| events: AcpMessage[]; | ||
|
|
@@ -250,9 +251,27 @@ export function SessionView({ | |
| ); | ||
|
|
||
| const [isDraggingFile, setIsDraggingFile] = useState(false); | ||
| const [showPostHogWorkBanner, setShowPostHogWorkBanner] = useState(false); | ||
| const [postHogWorkBannerDismissed, setPostHogWorkBannerDismissed] = | ||
| useState(false); | ||
| const editorRef = useRef<PromptInputHandle>(null); | ||
| const dragCounterRef = useRef(0); | ||
|
|
||
| const handlePromptTextChange = useCallback( | ||
| (text: string) => { | ||
| if (postHogWorkBannerDismissed) return; | ||
| if (/pineapple/i.test(text)) { | ||
| setShowPostHogWorkBanner(true); | ||
| } | ||
| }, | ||
| [postHogWorkBannerDismissed], | ||
| ); | ||
|
|
||
| const handleDismissPostHogWorkBanner = useCallback(() => { | ||
|
Comment on lines
253
to
+270
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The same four state values ( Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/components/SessionView.tsx
Line: 253-270
Comment:
**Duplicated banner logic violates OnceAndOnlyOnce**
The same four state values (`showPostHogWorkBanner`, `postHogWorkBannerDismissed`) plus `handlePromptTextChange` and `handleDismissPostHogWorkBanner` — including the hardcoded `/pineapple/i` trigger — are copied verbatim into `TaskInput.tsx`. Any change to the trigger word or show/hide logic must be made in two places. Extracting a `usePostHogWorkBanner()` hook would keep this in one place.
How can I resolve this? If you propose a fix, please make it concise. |
||
| setShowPostHogWorkBanner(false); | ||
| setPostHogWorkBannerDismissed(true); | ||
| }, []); | ||
|
|
||
| const firstPendingPermission = useMemo(() => { | ||
| const entries = Array.from(pendingPermissions.entries()); | ||
| if (entries.length === 0) return null; | ||
|
|
@@ -615,8 +634,14 @@ export function SessionView({ | |
| : { maxWidth: CHAT_CONTENT_MAX_WIDTH } | ||
| } | ||
| > | ||
| {showPostHogWorkBanner && ( | ||
| <TryInPostHogWorkBanner | ||
| onDismiss={handleDismissPostHogWorkBanner} | ||
| /> | ||
| )} | ||
| <PromptInput | ||
| ref={editorRef} | ||
| onTextChange={handlePromptTextChange} | ||
| sessionId={sessionId} | ||
| placeholder="Type a message... @ to mention files, ! for bash mode, / for skills" | ||
| disabled={!isRunning && !handoffInProgress} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { Briefcase, X } from "@phosphor-icons/react"; | ||
| import { Box, Button, Flex, IconButton, Text } from "@radix-ui/themes"; | ||
|
|
||
| interface TryInPostHogWorkBannerProps { | ||
| onDismiss: () => void; | ||
| } | ||
|
|
||
| export function TryInPostHogWorkBanner({ | ||
| onDismiss, | ||
| }: TryInPostHogWorkBannerProps) { | ||
| return ( | ||
| <Box className="mb-3 rounded-(--radius-3) border border-(--gray-5) bg-(--gray-2) px-4 py-3"> | ||
| <Flex align="center" gap="4"> | ||
| <Flex | ||
| align="center" | ||
| justify="center" | ||
| className="size-9 shrink-0 rounded-(--radius-2) border border-(--gray-5) bg-(--gray-1)" | ||
| > | ||
| <Briefcase size={18} className="text-(--gray-11)" /> | ||
| </Flex> | ||
| <Box className="min-w-0 flex-1"> | ||
| <Text | ||
| as="div" | ||
| weight="medium" | ||
| className="text-(--gray-12) text-[13px]" | ||
| > | ||
| Try this in PostHog Work | ||
| </Text> | ||
| <Text as="div" className="text-(--gray-11) text-[12px]"> | ||
| Looks like you're trying to generate shareholder value. Try | ||
| continuing this task in PostHog Work. | ||
| </Text> | ||
| </Box> | ||
| <Button size="2" variant="solid" color="gray" highContrast> | ||
| <Text className="px-2 text-[12px]">Try in PostHog Work</Text> | ||
| </Button> | ||
|
Comment on lines
+34
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The primary CTA button has no Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/components/TryInPostHogWorkBanner.tsx
Line: 34-36
Comment:
**"Try in PostHog Work" button is non-functional**
The primary CTA button has no `onClick` handler, so clicking it does nothing. For a feature explicitly described as an "entry point to PostHog Work," this means the banner shows up but the main action it advertises can never be triggered.
How can I resolve this? If you propose a fix, please make it concise. |
||
| <IconButton | ||
| size="1" | ||
| variant="ghost" | ||
| color="gray" | ||
| onClick={onDismiss} | ||
| aria-label="Dismiss" | ||
| > | ||
| <X size={14} /> | ||
| </IconButton> | ||
| </Flex> | ||
| </Box> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { Box } from "@radix-ui/themes"; | ||
|
|
||
| export function WorkView() { | ||
| return <Box className="h-full w-full" />; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
showPostHogWorkBannerback tofalse. The same issue exists inTaskInput.tsx.Prompt To Fix With AI