feat: Add commandMenuIcon function to ChatPanel

This commit adds the `commandMenuIcon` function to the `ChatPanel` component in `index.tsx`. This function returns an icon based on the given pattern. The function is used to display different icons for different patterns in the command menu.
This commit is contained in:
Rankin Zheng 2023-05-18 16:55:41 +08:00
parent b79e69e5af
commit 79cb2fd8d2

View File

@ -215,6 +215,24 @@ const chatPanel = () => {
});
}, [registed]);
const commandMenuIcon = (pattern: string) => {
if (pattern === 'code') {
return (<IconShellCommand size={16}
color='var(--vscode-menu-foreground)'
style={{
marginTop: 8,
marginLeft: 12,
}} />);
}
if (pattern === 'commit_message') {
return (<IconBook size={16}
color='var(--vscode-menu-foreground)'
style={{
marginTop: 8,
marginLeft: 12,
}} />);
}
};
useEffect(() => {
let filtered = commandMenus;
if (input) {
@ -244,13 +262,7 @@ const chatPanel = () => {
aria-checked={index === currentMenuIndex}
data-pattern={pattern}
>
<IconTerminal2
size={16}
color='var(--vscode-menu-foreground)'
style={{
marginTop: 8,
marginLeft: 8,
}} />
{commandMenuIcon(pattern)}
<Stack spacing={0}>
<Text sx={{
fontSize: 'sm',