Skip to content

Commit 41c05d3

Browse files
committed
fix: address PR review feedback for export option
- Add comprehensive tests for export functionality - Implement proper internationalization (i18n) with translation keys - Fix option ordering to place export after modes (consistent with other options) - Update all test cases to pass new translation parameters
1 parent cdb17e4 commit 41c05d3

File tree

5 files changed

+284
-24
lines changed

5 files changed

+284
-24
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
356356
queryItems,
357357
fileSearchResults,
358358
allModes,
359+
t("chat:exportCurrentMode"),
360+
t("chat:exportModeDescription"),
359361
)
360362
const optionsLength = options.length
361363

@@ -393,6 +395,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
393395
queryItems,
394396
fileSearchResults,
395397
allModes,
398+
t("chat:exportCurrentMode"),
399+
t("chat:exportModeDescription"),
396400
)[selectedMenuIndex]
397401
if (
398402
selectedOption &&
@@ -483,6 +487,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
483487
fileSearchResults,
484488
handleHistoryNavigation,
485489
resetHistoryNavigation,
490+
t,
486491
],
487492
)
488493

@@ -1253,6 +1258,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
12531258
modes={allModes}
12541259
loading={searchLoading}
12551260
dynamicSearchResults={fileSearchResults}
1261+
exportLabel={t("chat:exportCurrentMode")}
1262+
exportDescription={t("chat:exportModeDescription")}
12561263
/>
12571264
</div>
12581265
)}

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ interface ContextMenuProps {
2323
modes?: ModeConfig[]
2424
loading?: boolean
2525
dynamicSearchResults?: SearchResult[]
26+
exportLabel?: string
27+
exportDescription?: string
2628
}
2729

2830
const ContextMenu: React.FC<ContextMenuProps> = ({
@@ -36,13 +38,24 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
3638
queryItems,
3739
modes,
3840
dynamicSearchResults = [],
41+
exportLabel = "Export current mode",
42+
exportDescription = "Export the current mode configuration",
3943
}) => {
4044
const [materialIconsBaseUri, setMaterialIconsBaseUri] = useState("")
4145
const menuRef = useRef<HTMLDivElement>(null)
4246

4347
const filteredOptions = useMemo(() => {
44-
return getContextMenuOptions(searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes)
45-
}, [searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes])
48+
return getContextMenuOptions(
49+
searchQuery,
50+
inputValue,
51+
selectedType,
52+
queryItems,
53+
dynamicSearchResults,
54+
modes,
55+
exportLabel,
56+
exportDescription,
57+
)
58+
}, [searchQuery, inputValue, selectedType, queryItems, dynamicSearchResults, modes, exportLabel, exportDescription])
4659

4760
useEffect(() => {
4861
if (menuRef.current) {

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,5 +329,7 @@
329329
"title": "Roo Code Cloud is coming soon!",
330330
"description": "Run Roomote agents in the cloud, access your tasks from anywhere, collaborate with others, and more.",
331331
"joinWaitlist": "Join the waitlist to get early access."
332-
}
332+
},
333+
"exportCurrentMode": "Export current mode",
334+
"exportModeDescription": "Export the current mode configuration"
333335
}

0 commit comments

Comments
 (0)