chat banner entry point#2128
Conversation
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/sessions/components/TryInPostHogWorkBanner.tsx:34-36
**"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.
### Issue 2 of 2
apps/code/src/renderer/features/sessions/components/SessionView.tsx:253-270
**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.
Reviews (1): Last reviewed commit: "chat banner entry point" | Re-trigger Greptile |
| <Button size="2" variant="solid" color="gray" highContrast> | ||
| <Text className="px-2 text-[12px]">Try in PostHog Work</Text> | ||
| </Button> |
There was a problem hiding this 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.
Prompt To Fix With AI
This 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.| 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(() => { |
There was a problem hiding this 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.
Prompt To Fix With AI
This 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.Introduces a top-level mode toggle above the nav list. Work mode is an empty shell — placeholder for an upcoming feature set built during the hackathon. Generated-By: PostHog Code Task-Id: bd0f6387-4ee8-42a4-b17d-80927d214463
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sessions/components/SessionView.tsx:260-268
The banner stays visible after the trigger word is deleted from the input. Once "pineapple" is typed the banner appears, but if the user then edits the text to remove it the banner remains — there is no branch that sets `showPostHogWorkBanner` back to `false`. The same issue exists in `TaskInput.tsx`.
```suggestion
const handlePromptTextChange = useCallback(
(text: string) => {
if (postHogWorkBannerDismissed) return;
setShowPostHogWorkBanner(/pineapple/i.test(text));
},
[postHogWorkBannerDismissed],
);
```
Reviews (2): Last reviewed commit: "feat(code): add Code/Work mode switcher ..." | Re-trigger Greptile |
| const handlePromptTextChange = useCallback( | ||
| (text: string) => { | ||
| if (postHogWorkBannerDismissed) return; | ||
| if (/pineapple/i.test(text)) { | ||
| setShowPostHogWorkBanner(true); | ||
| } | ||
| }, | ||
| [postHogWorkBannerDismissed], | ||
| ); |
There was a problem hiding this comment.
The banner stays visible after the trigger word is deleted from the input. Once "pineapple" is typed the banner appears, but if the user then edits the text to remove it the banner remains — there is no branch that sets
showPostHogWorkBanner back to false. The same issue exists in TaskInput.tsx.
| const handlePromptTextChange = useCallback( | |
| (text: string) => { | |
| if (postHogWorkBannerDismissed) return; | |
| if (/pineapple/i.test(text)) { | |
| setShowPostHogWorkBanner(true); | |
| } | |
| }, | |
| [postHogWorkBannerDismissed], | |
| ); | |
| const handlePromptTextChange = useCallback( | |
| (text: string) => { | |
| if (postHogWorkBannerDismissed) return; | |
| setShowPostHogWorkBanner(/pineapple/i.test(text)); | |
| }, | |
| [postHogWorkBannerDismissed], | |
| ); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/components/SessionView.tsx
Line: 260-268
Comment:
The banner stays visible after the trigger word is deleted from the input. Once "pineapple" is typed the banner appears, but if the user then edits the text to remove it the banner remains — there is no branch that sets `showPostHogWorkBanner` back to `false`. The same issue exists in `TaskInput.tsx`.
```suggestion
const handlePromptTextChange = useCallback(
(text: string) => {
if (postHogWorkBannerDismissed) return;
setShowPostHogWorkBanner(/pineapple/i.test(text));
},
[postHogWorkBannerDismissed],
);
```
How can I resolve this? If you propose a fix, please make it concise.
HACKATHON