add active state to comment cards in prompt input
This commit is contained in:
@@ -184,6 +184,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
if (!item.commentID) return
|
if (!item.commentID) return
|
||||||
|
|
||||||
comments.setFocus({ file: item.path, id: item.commentID })
|
comments.setFocus({ file: item.path, id: item.commentID })
|
||||||
|
comments.setActive({ file: item.path, id: item.commentID })
|
||||||
view().reviewPanel.open()
|
view().reviewPanel.open()
|
||||||
|
|
||||||
if (item.commentOrigin === "review") {
|
if (item.commentOrigin === "review") {
|
||||||
@@ -1711,6 +1712,10 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
<div class="flex flex-nowrap items-start gap-2 p-2 overflow-x-auto no-scrollbar">
|
<div class="flex flex-nowrap items-start gap-2 p-2 overflow-x-auto no-scrollbar">
|
||||||
<For each={prompt.context.items()}>
|
<For each={prompt.context.items()}>
|
||||||
{(item) => {
|
{(item) => {
|
||||||
|
const active = () => {
|
||||||
|
const a = comments.active()
|
||||||
|
return !!item.commentID && item.commentID === a?.id && item.path === a?.file
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
value={
|
value={
|
||||||
@@ -1729,8 +1734,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
classList={{
|
classList={{
|
||||||
"group shrink-0 flex flex-col rounded-[6px] bg-background-stronger pl-2 pr-1 py-1 max-w-[200px] h-12 transition-all shadow-xs-border hover:shadow-xs-border-hover": true,
|
"group shrink-0 flex flex-col rounded-[6px] pl-2 pr-1 py-1 max-w-[200px] h-12 transition-all transition-transform shadow-xs-border hover:shadow-xs-border-hover": true,
|
||||||
"cursor-pointer hover:bg-surface-interactive-weak": !!item.commentID,
|
"cursor-pointer hover:bg-surface-interactive-weak": !!item.commentID && !active(),
|
||||||
|
"cursor-pointer bg-surface-interactive-hover hover:bg-surface-interactive-hover shadow-xs-border-hover":
|
||||||
|
active(),
|
||||||
|
"bg-background-stronger": !active(),
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
openComment(item)
|
openComment(item)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ function createCommentSession(dir: string, id: string | undefined) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const [focus, setFocus] = createSignal<CommentFocus | null>(null)
|
const [focus, setFocus] = createSignal<CommentFocus | null>(null)
|
||||||
|
const [active, setActive] = createSignal<CommentFocus | null>(null)
|
||||||
|
|
||||||
const list = (file: string) => store.comments[file] ?? []
|
const list = (file: string) => store.comments[file] ?? []
|
||||||
|
|
||||||
@@ -76,6 +77,9 @@ function createCommentSession(dir: string, id: string | undefined) {
|
|||||||
focus: createMemo(() => focus()),
|
focus: createMemo(() => focus()),
|
||||||
setFocus,
|
setFocus,
|
||||||
clearFocus: () => setFocus(null),
|
clearFocus: () => setFocus(null),
|
||||||
|
active: createMemo(() => active()),
|
||||||
|
setActive,
|
||||||
|
clearActive: () => setActive(null),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +139,9 @@ export const { use: useComments, provider: CommentsProvider } = createSimpleCont
|
|||||||
focus: () => session().focus(),
|
focus: () => session().focus(),
|
||||||
setFocus: (focus: CommentFocus | null) => session().setFocus(focus),
|
setFocus: (focus: CommentFocus | null) => session().setFocus(focus),
|
||||||
clearFocus: () => session().clearFocus(),
|
clearFocus: () => session().clearFocus(),
|
||||||
|
active: () => session().active(),
|
||||||
|
setActive: (active: CommentFocus | null) => session().setActive(active),
|
||||||
|
clearActive: () => session().clearActive(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -267,6 +267,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
--line-comment-z: 5;
|
--line-comment-z: 5;
|
||||||
--line-comment-popover-z: 6;
|
--line-comment-popover-z: 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
"surface-brand-base": "var(--yuzu-light-9)",
|
"surface-brand-base": "var(--yuzu-light-9)",
|
||||||
"surface-brand-hover": "var(--yuzu-light-10)",
|
"surface-brand-hover": "var(--yuzu-light-10)",
|
||||||
"surface-interactive-base": "var(--cobalt-light-3)",
|
"surface-interactive-base": "var(--cobalt-light-3)",
|
||||||
"surface-interactive-hover": "#0A1D4D",
|
"surface-interactive-hover": "#E5F0FF",
|
||||||
"surface-interactive-weak": "var(--cobalt-light-2)",
|
"surface-interactive-weak": "var(--cobalt-light-2)",
|
||||||
"surface-interactive-weak-hover": "var(--cobalt-light-3)",
|
"surface-interactive-weak-hover": "var(--cobalt-light-3)",
|
||||||
"surface-success-base": "var(--apple-light-3)",
|
"surface-success-base": "var(--apple-light-3)",
|
||||||
@@ -312,7 +312,7 @@
|
|||||||
"surface-brand-base": "var(--yuzu-light-9)",
|
"surface-brand-base": "var(--yuzu-light-9)",
|
||||||
"surface-brand-hover": "var(--yuzu-light-10)",
|
"surface-brand-hover": "var(--yuzu-light-10)",
|
||||||
"surface-interactive-base": "var(--cobalt-dark-3)",
|
"surface-interactive-base": "var(--cobalt-dark-3)",
|
||||||
"surface-interactive-hover": "#E5F0FF",
|
"surface-interactive-hover": "#0A1D4D",
|
||||||
"surface-interactive-weak": "var(--cobalt-dark-2)",
|
"surface-interactive-weak": "var(--cobalt-dark-2)",
|
||||||
"surface-interactive-weak-hover": "var(--cobalt-light-3)",
|
"surface-interactive-weak-hover": "var(--cobalt-light-3)",
|
||||||
"surface-success-base": "var(--apple-dark-3)",
|
"surface-success-base": "var(--apple-dark-3)",
|
||||||
|
|||||||
Reference in New Issue
Block a user