fix(app): suggestion active state broken
This commit is contained in:
@@ -53,18 +53,15 @@ export const PromptPopover: Component<PromptPopoverProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<For each={props.atFlat.slice(0, 10)}>
|
<For each={props.atFlat.slice(0, 10)}>
|
||||||
{(item) => {
|
{(item) => {
|
||||||
const active = props.atActive === props.atKey(item)
|
const key = props.atKey(item)
|
||||||
const shared = {
|
|
||||||
"w-full flex items-center gap-x-2 rounded-md px-2 py-0.5": true,
|
|
||||||
"bg-surface-raised-base-hover": active,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.type === "agent") {
|
if (item.type === "agent") {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
classList={shared}
|
class="w-full flex items-center gap-x-2 rounded-md px-2 py-0.5"
|
||||||
|
classList={{ "bg-surface-raised-base-hover": props.atActive === key }}
|
||||||
onClick={() => props.onAtSelect(item)}
|
onClick={() => props.onAtSelect(item)}
|
||||||
onMouseEnter={() => props.setAtActive(props.atKey(item))}
|
onMouseEnter={() => props.setAtActive(key)}
|
||||||
>
|
>
|
||||||
<Icon name="brain" size="small" class="text-icon-info-active shrink-0" />
|
<Icon name="brain" size="small" class="text-icon-info-active shrink-0" />
|
||||||
<span class="text-14-regular text-text-strong whitespace-nowrap">@{item.name}</span>
|
<span class="text-14-regular text-text-strong whitespace-nowrap">@{item.name}</span>
|
||||||
@@ -78,9 +75,10 @@ export const PromptPopover: Component<PromptPopoverProps> = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
classList={shared}
|
class="w-full flex items-center gap-x-2 rounded-md px-2 py-0.5"
|
||||||
|
classList={{ "bg-surface-raised-base-hover": props.atActive === key }}
|
||||||
onClick={() => props.onAtSelect(item)}
|
onClick={() => props.onAtSelect(item)}
|
||||||
onMouseEnter={() => props.setAtActive(props.atKey(item))}
|
onMouseEnter={() => props.setAtActive(key)}
|
||||||
>
|
>
|
||||||
<FileIcon node={{ path: item.path, type: "file" }} class="shrink-0 size-4" />
|
<FileIcon node={{ path: item.path, type: "file" }} class="shrink-0 size-4" />
|
||||||
<div class="flex items-center text-14-regular min-w-0">
|
<div class="flex items-center text-14-regular min-w-0">
|
||||||
|
|||||||
Reference in New Issue
Block a user