Update fork menu tooltip and icons
- Change tooltip label from "Fork message" to "Fork chat" - Use Split icon for both "Fork in a new tab" and "Fork in a new workspace" menu items
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { memo, useCallback, useMemo, useState } from "react";
|
import { memo, useCallback, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Text, View } from "react-native";
|
import { Text, View } from "react-native";
|
||||||
import { FolderPlus, Split } from "lucide-react-native";
|
import { Split } from "lucide-react-native";
|
||||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -19,21 +19,11 @@ interface AssistantForkMenuProps {
|
|||||||
testID?: string;
|
testID?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThemedFolderPlus = withUnistyles(FolderPlus);
|
|
||||||
const ThemedSplit = withUnistyles(Split);
|
const ThemedSplit = withUnistyles(Split);
|
||||||
|
|
||||||
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||||
const foregroundMutedColorMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
const foregroundMutedColorMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||||
|
|
||||||
function getIcon(target: AssistantForkTarget) {
|
|
||||||
switch (target) {
|
|
||||||
case "tab":
|
|
||||||
return <ThemedSplit size={16} uniProps={foregroundColorMapping} />;
|
|
||||||
case "workspace":
|
|
||||||
return <ThemedFolderPlus size={16} uniProps={foregroundColorMapping} />;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const AssistantForkMenu = memo(function AssistantForkMenu({
|
export const AssistantForkMenu = memo(function AssistantForkMenu({
|
||||||
onFork,
|
onFork,
|
||||||
testID = "assistant-fork-menu",
|
testID = "assistant-fork-menu",
|
||||||
@@ -79,6 +69,8 @@ export const AssistantForkMenu = memo(function AssistantForkMenu({
|
|||||||
[t],
|
[t],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const forkIcon = useMemo(() => <ThemedSplit size={16} uniProps={foregroundColorMapping} />, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu open={isOpen} onOpenChange={handleOpenChange}>
|
<DropdownMenu open={isOpen} onOpenChange={handleOpenChange}>
|
||||||
<Tooltip delayDuration={250} enabledOnDesktop enabledOnMobile={false}>
|
<Tooltip delayDuration={250} enabledOnDesktop enabledOnMobile={false}>
|
||||||
@@ -106,7 +98,7 @@ export const AssistantForkMenu = memo(function AssistantForkMenu({
|
|||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
closeOnSelect={false}
|
closeOnSelect={false}
|
||||||
disabled={isLocked && pendingTarget !== "tab"}
|
disabled={isLocked && pendingTarget !== "tab"}
|
||||||
leading={getIcon("tab")}
|
leading={forkIcon}
|
||||||
onSelect={handleSelect("tab")}
|
onSelect={handleSelect("tab")}
|
||||||
status={pendingTarget === "tab" ? "pending" : undefined}
|
status={pendingTarget === "tab" ? "pending" : undefined}
|
||||||
testID={`${testID}-new-tab`}
|
testID={`${testID}-new-tab`}
|
||||||
@@ -116,7 +108,7 @@ export const AssistantForkMenu = memo(function AssistantForkMenu({
|
|||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
closeOnSelect={false}
|
closeOnSelect={false}
|
||||||
disabled={isLocked && pendingTarget !== "workspace"}
|
disabled={isLocked && pendingTarget !== "workspace"}
|
||||||
leading={getIcon("workspace")}
|
leading={forkIcon}
|
||||||
onSelect={handleSelect("workspace")}
|
onSelect={handleSelect("workspace")}
|
||||||
status={pendingTarget === "workspace" ? "pending" : undefined}
|
status={pendingTarget === "workspace" ? "pending" : undefined}
|
||||||
testID={`${testID}-new-workspace`}
|
testID={`${testID}-new-workspace`}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ export const en = {
|
|||||||
copyCode: "Copy code",
|
copyCode: "Copy code",
|
||||||
copyTurn: "Copy turn",
|
copyTurn: "Copy turn",
|
||||||
copyMessage: "Copy message",
|
copyMessage: "Copy message",
|
||||||
forkMenu: "Fork message",
|
forkMenu: "Fork chat",
|
||||||
forkInNewTab: "Fork in a new tab",
|
forkInNewTab: "Fork in a new tab",
|
||||||
forkInNewWorkspace: "Fork in a new workspace",
|
forkInNewWorkspace: "Fork in a new workspace",
|
||||||
forkUnavailable: "Update the host to use this.",
|
forkUnavailable: "Update the host to use this.",
|
||||||
|
|||||||
Reference in New Issue
Block a user