Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
return
}

if (type === ContextMenuOptionType.Export) {
// Handle export action for current mode
setInputValue("")
setShowContextMenu(false)
vscode.postMessage({ type: "exportMode", slug: mode })
return
}

if (type === ContextMenuOptionType.Mode && value) {
// Handle mode selection.
setMode(value)
Expand Down Expand Up @@ -325,7 +333,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[setInputValue, cursorPosition],
[setInputValue, cursorPosition, mode],
)

const handleKeyDown = useCallback(
Expand All @@ -348,6 +356,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
queryItems,
fileSearchResults,
allModes,
t("chat:exportCurrentMode"),
t("chat:exportModeDescription"),
)
const optionsLength = options.length

Expand Down Expand Up @@ -385,6 +395,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
queryItems,
fileSearchResults,
allModes,
t("chat:exportCurrentMode"),
t("chat:exportModeDescription"),
)[selectedMenuIndex]
if (
selectedOption &&
Expand Down Expand Up @@ -475,6 +487,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
fileSearchResults,
handleHistoryNavigation,
resetHistoryNavigation,
t,
],
)

Expand Down Expand Up @@ -1245,6 +1258,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
modes={allModes}
loading={searchLoading}
dynamicSearchResults={fileSearchResults}
exportLabel={t("chat:exportCurrentMode")}
exportDescription={t("chat:exportModeDescription")}
/>
</div>
)}
Expand Down
33 changes: 31 additions & 2 deletions webview-ui/src/components/chat/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface ContextMenuProps {
modes?: ModeConfig[]
loading?: boolean
dynamicSearchResults?: SearchResult[]
exportLabel?: string
exportDescription?: string
}

const ContextMenu: React.FC<ContextMenuProps> = ({
Expand All @@ -36,13 +38,24 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
queryItems,
modes,
dynamicSearchResults = [],
exportLabel = "Export current mode",
exportDescription = "Export the current mode configuration",
}) => {
const [materialIconsBaseUri, setMaterialIconsBaseUri] = useState("")
const menuRef = useRef<HTMLDivElement>(null)

const filteredOptions = useMemo(() => {
return getContextMenuOptions(searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes)
}, [searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes])
return getContextMenuOptions(
searchQuery,
inputValue,
selectedType,
queryItems,
dynamicSearchResults,
modes,
exportLabel,
exportDescription,
)
}, [searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes, exportLabel, exportDescription])

useEffect(() => {
if (menuRef.current) {
Expand All @@ -69,6 +82,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
const renderOptionContent = (option: ContextMenuQueryItem) => {
switch (option.type) {
case ContextMenuOptionType.Mode:
case ContextMenuOptionType.Export:
return (
<div style={{ display: "flex", flexDirection: "column", gap: "2px" }}>
<span style={{ lineHeight: "1.2" }}>{option.label}</span>
Expand Down Expand Up @@ -163,6 +177,8 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
switch (option.type) {
case ContextMenuOptionType.Mode:
return "symbol-misc"
case ContextMenuOptionType.Export:
return "export"
case ContextMenuOptionType.OpenedFile:
return "window"
case ContextMenuOptionType.File:
Expand Down Expand Up @@ -263,7 +279,20 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
}}
/>
)}
{(option.type === ContextMenuOptionType.Mode ||
option.type === ContextMenuOptionType.Export) && (
<i
className={`codicon codicon-${getIconForOption(option)}`}
style={{
marginRight: "6px",
flexShrink: 0,
fontSize: "14px",
marginTop: 0,
}}
/>
)}
{option.type !== ContextMenuOptionType.Mode &&
option.type !== ContextMenuOptionType.Export &&
option.type !== ContextMenuOptionType.File &&
option.type !== ContextMenuOptionType.Folder &&
option.type !== ContextMenuOptionType.OpenedFile &&
Expand Down
4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/ca/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/de/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,7 @@
"title": "Roo Code Cloud is coming soon!",
"description": "Run Roomote agents in the cloud, access your tasks from anywhere, collaborate with others, and more.",
"joinWaitlist": "Join the waitlist to get early access."
}
},
"exportCurrentMode": "Export current mode",
"exportModeDescription": "Export the current mode configuration"
}
4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/es/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/fr/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/hi/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/id/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/it/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/ja/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/ko/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/nl/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/pl/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/pt-BR/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/ru/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/tr/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/vi/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/zh-CN/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion webview-ui/src/i18n/locales/zh-TW/chat.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading