11import {
22 ArrowCounterClockwise ,
33 ArrowsClockwise ,
4- CaretDown ,
5- ChatCircle ,
64 Columns ,
75 Rows ,
86 X ,
97} from "@phosphor-icons/react" ;
108import type { ResolvedDiffSource } from "@posthog/core/code-review/resolveDiffSource" ;
11- import {
12- Button ,
13- DropdownMenu ,
14- DropdownMenuContent ,
15- DropdownMenuItem ,
16- DropdownMenuRadioGroup ,
17- DropdownMenuRadioItem ,
18- DropdownMenuSeparator ,
19- DropdownMenuTrigger ,
20- MenuLabel ,
21- } from "@posthog/quill" ;
9+ import { Button } from "@posthog/quill" ;
2210import { useDiffViewerStore } from "@posthog/ui/features/code-editor/diffViewerStore" ;
2311import {
2412 type ReviewMode ,
@@ -28,7 +16,7 @@ import { Tooltip } from "@posthog/ui/primitives/Tooltip";
2816import { Flex , Separator , Text } from "@radix-ui/themes" ;
2917import { FoldVertical , Maximize , Minimize , UnfoldVertical } from "lucide-react" ;
3018import { memo } from "react" ;
31- import { DiffSettingsMenu } from "./DiffSettingsMenu" ;
19+ import { type CommentFileFilter , DiffSettingsMenu } from "./DiffSettingsMenu" ;
3220import { DiffSourceSelector } from "./DiffSourceSelector" ;
3321
3422interface ReviewToolbarProps {
@@ -52,8 +40,6 @@ interface ReviewToolbarProps {
5240 defaultBranch ?: string | null ;
5341}
5442
55- export type CommentFileFilter = "none" | "commented" | "unresolved" ;
56-
5743function formatFileCount ( count : number , suffix : string ) : string {
5844 const noun = count === 1 ? "file" : "files" ;
5945 return `${ count } ${ noun } ${ suffix } ` ;
@@ -139,58 +125,6 @@ export const ReviewToolbar = memo(function ReviewToolbar({
139125 </ Flex >
140126
141127 < Flex align = "center" gap = "1" ml = "auto" >
142- { onCommentFilterChange && (
143- < DropdownMenu >
144- < DropdownMenuTrigger
145- render = {
146- < Button
147- size = "sm"
148- variant = { commentFilter === "none" ? "default" : "primary" }
149- aria-label = "Filter files by review comments"
150- className = "rounded-xs"
151- >
152- < ChatCircle
153- size = { 14 }
154- weight = { commentFilter === "none" ? "regular" : "fill" }
155- />
156- < CaretDown size = { 10 } weight = "bold" />
157- </ Button >
158- }
159- />
160- < DropdownMenuContent
161- align = "end"
162- side = "bottom"
163- sideOffset = { 6 }
164- className = "min-w-[220px]"
165- >
166- < MenuLabel > Comment filter</ MenuLabel >
167- < DropdownMenuRadioGroup
168- value = { commentFilter === "none" ? "" : commentFilter }
169- onValueChange = { ( value ) =>
170- onCommentFilterChange ( value as CommentFileFilter )
171- }
172- >
173- < DropdownMenuRadioItem value = "commented" >
174- All comments ({ commentedFileCount } )
175- </ DropdownMenuRadioItem >
176- < DropdownMenuRadioItem value = "unresolved" >
177- Unresolved comments ({ unresolvedCommentedFileCount } )
178- </ DropdownMenuRadioItem >
179- </ DropdownMenuRadioGroup >
180- { commentFilter !== "none" && (
181- < >
182- < DropdownMenuSeparator />
183- < DropdownMenuItem
184- onClick = { ( ) => onCommentFilterChange ( "none" ) }
185- >
186- Clear comment filter
187- </ DropdownMenuItem >
188- </ >
189- ) }
190- </ DropdownMenuContent >
191- </ DropdownMenu >
192- ) }
193-
194128 { onRefresh && (
195129 < Tooltip content = "Refresh diff" >
196130 < Button size = "icon-sm" onClick = { onRefresh } className = "rounded-xs" >
@@ -256,7 +190,12 @@ export const ReviewToolbar = memo(function ReviewToolbar({
256190
257191 < Separator orientation = "vertical" size = "1" />
258192
259- < DiffSettingsMenu />
193+ < DiffSettingsMenu
194+ commentedFileCount = { commentedFileCount }
195+ unresolvedCommentedFileCount = { unresolvedCommentedFileCount }
196+ commentFilter = { commentFilter }
197+ onCommentFilterChange = { onCommentFilterChange }
198+ />
260199
261200 < Tooltip content = "Close review" >
262201 < Button size = "icon-sm" onClick = { handleClose } className = "rounded-xs" >
0 commit comments