Skip to content

Commit d0ce642

Browse files
committed
Visual tweaks to make the settings cog work in the slashcommands popover, plus some bonuses
1 parent 620cf3d commit d0ce642

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

webview-ui/src/components/chat/ContextMenu.tsx

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
} from "@src/utils/context-mentions"
1414
import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanumeric"
1515
import { vscode } from "@src/utils/vscode"
16+
import { buildDocLink } from "@/utils/docLinks"
17+
import { Trans } from "react-i18next"
1618

1719
interface ContextMenuProps {
1820
onSelect: (type: ContextMenuOptionType, value?: string) => void
@@ -79,8 +81,6 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
7981
fontWeight: "bold",
8082
fontSize: "0.85em",
8183
opacity: 0.8,
82-
textTransform: "uppercase",
83-
letterSpacing: "0.5px",
8484
}}>
8585
{option.label}
8686
</span>
@@ -290,35 +290,36 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
290290
}}>
291291
{/* Settings button for slash commands */}
292292
{searchQuery.startsWith("/") && (
293-
<div
294-
style={{
295-
padding: "8px 12px",
296-
borderBottom: "1px solid var(--vscode-editorGroup-border)",
297-
display: "flex",
298-
alignItems: "center",
299-
justifyContent: "space-between",
300-
backgroundColor: "var(--vscode-dropdown-background)",
301-
}}>
302-
<span style={{ fontSize: "0.85em", opacity: 0.8 }}>Slash Commands</span>
293+
<div className="p-2 flex items-start gap-4 justify-between">
294+
<div className="text-sm">
295+
<p className="font-bold text-base text-vscode-foreground mt-1 mb-0.5">Slash Commands</p>
296+
<p className="text-xs mt-0.5 -mb-1">
297+
<Trans
298+
i18nKey="settings:slashCommands.description"
299+
components={{
300+
DocsLink: (
301+
<a
302+
href={buildDocLink(
303+
"features/slash-commands",
304+
"slash_commands_settings",
305+
)}
306+
target="_blank"
307+
rel="noopener noreferrer"
308+
className="text-vscode-textLink-foreground hover:underline">
309+
Docs
310+
</a>
311+
),
312+
}}
313+
/>
314+
</p>
315+
</div>
303316
<button
317+
className="mt-1 cursor-pointer"
304318
onClick={handleSettingsClick}
305319
onMouseDown={(e) => {
306320
e.stopPropagation()
307321
e.preventDefault()
308322
}}
309-
style={{
310-
background: "transparent",
311-
border: "none",
312-
cursor: "pointer",
313-
padding: "4px",
314-
display: "flex",
315-
alignItems: "center",
316-
justifyContent: "center",
317-
borderRadius: "3px",
318-
color: "var(--vscode-foreground)",
319-
opacity: 0.7,
320-
transition: "opacity 0.2s, background-color 0.2s",
321-
}}
322323
onMouseEnter={(e) => {
323324
e.currentTarget.style.opacity = "1"
324325
e.currentTarget.style.backgroundColor = "var(--vscode-list-hoverBackground)"
@@ -339,7 +340,9 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
339340
onClick={() => isOptionSelectable(option) && onSelect(option.type, option.value)}
340341
style={{
341342
padding:
342-
option.type === ContextMenuOptionType.SectionHeader ? "8px 6px 4px 6px" : "4px 6px",
343+
option.type === ContextMenuOptionType.SectionHeader
344+
? "16px 8px 4px 8px"
345+
: "4px 8px",
343346
cursor: isOptionSelectable(option) ? "pointer" : "default",
344347
color: "var(--vscode-dropdown-foreground)",
345348
display: "flex",

0 commit comments

Comments
 (0)