Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thenamankumar committed Oct 24, 2024
1 parent 7019025 commit 6b04299
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions vscode/webviews/chat/cells/contextCell/ContextCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,35 @@ export const ContextCell: FunctionComponent<{
})
}, [excludedContext.length, usedContext.length])

const triggerAccordion = useCallback(() => {
const onEditContext = useCallback(() => {
setAccordionValue(prev => {
if (!prev) {
recordContextCellOpening()
}
return prev ? '' : 'item-1'
})
}, [recordContextCellOpening])

const onEditContext = useCallback(() => {
triggerAccordion()
onManuallyEditContext()
}, [triggerAccordion, onManuallyEditContext])
}, [onManuallyEditContext, recordContextCellOpening])

const {
config: { internalDebugContext },
} = useConfig()

const telemetryRecorder = useTelemetryRecorder()
const oneboxEnabled = useExperimentalOneBox()
const logValueChange = useCallback(
const handleValueChange = useCallback(
(value: string | undefined) => {
setAccordionValue(value)
if (value) {
recordContextCellOpening()
}
if (oneboxEnabled) {
telemetryRecorder.recordEvent('onebox.contextDrawer', 'clicked', {
[value ? 'expanded' : 'collapsed']: 1,
})
}
},
[telemetryRecorder, oneboxEnabled]
[telemetryRecorder, oneboxEnabled, recordContextCellOpening]
)

const [showAllResults, setShowAllResults] = useState(false)
Expand All @@ -148,19 +148,14 @@ export const ContextCell: FunctionComponent<{
<Accordion
type="single"
collapsible={!showSnippets}
defaultValue={
((__storybook__initialOpen || defaultOpen) && 'item-1') || undefined
}
onValueChange={logValueChange}
onValueChange={handleValueChange}
asChild={true}
value={accordionValue}
>
<AccordionItem value="item-1" asChild>
<Cell
header={
<AccordionTrigger
onClick={triggerAccordion}
onKeyUp={triggerAccordion}
title={itemCountLabel}
className="tw-flex tw-items-center tw-gap-4"
disabled={isContextLoading}
Expand Down

0 comments on commit 6b04299

Please sign in to comment.