feat: dont show cancel button

This commit is contained in:
amhsirak
2025-08-25 19:40:53 +05:30
parent b134bd1c29
commit 53d8b81fc8

View File

@@ -19,10 +19,17 @@ import { useNavigate, useLocation } from "react-router-dom";
interface RobotMeta { interface RobotMeta {
name: string; name: string;
id: string; id: string;
prebuiltId?: string;
createdAt: string; createdAt: string;
pairs: number; pairs: number;
updatedAt: string; updatedAt: string;
params: any[]; params: any[];
type?: string;
description?: string;
usedByUsers?: number[];
subscriptionLevel?: number;
access?: string;
sample?: any[];
url?: string; url?: string;
} }
@@ -73,7 +80,7 @@ export const RobotDuplicatePage = ({ handleStart }: RobotSettingsProps) => {
const [targetUrl, setTargetUrl] = useState<string | undefined>(""); const [targetUrl, setTargetUrl] = useState<string | undefined>("");
const [robot, setRobot] = useState<RobotSettings | null>(null); const [robot, setRobot] = useState<RobotSettings | null>(null);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { recordingId, notify, setRerenderRobots } = const { recordingId, notify, setRerenderRobots} =
useGlobalInfoStore(); useGlobalInfoStore();
useEffect(() => { useEffect(() => {
@@ -132,7 +139,10 @@ export const RobotDuplicatePage = ({ handleStart }: RobotSettingsProps) => {
t("robot_duplication.notifications.duplicate_success") t("robot_duplication.notifications.duplicate_success")
); );
handleStart(robot); handleStart(robot);
navigate("/robots"); const basePath = location.pathname.includes("/prebuilt-robots")
? "/prebuilt-robots"
: "/robots";
navigate(basePath);
} else { } else {
notify("error", t("robot_duplication.notifications.duplicate_error")); notify("error", t("robot_duplication.notifications.duplicate_error"));
} }
@@ -145,7 +155,10 @@ export const RobotDuplicatePage = ({ handleStart }: RobotSettingsProps) => {
}; };
const handleCancel = () => { const handleCancel = () => {
navigate("/robots"); const basePath = location.pathname.includes("/prebuilt-robots")
? "/prebuilt-robots"
: "/robots";
navigate(basePath);
}; };
return ( return (
@@ -156,6 +169,7 @@ export const RobotDuplicatePage = ({ handleStart }: RobotSettingsProps) => {
saveButtonText={t("robot_duplication.buttons.duplicate")} saveButtonText={t("robot_duplication.buttons.duplicate")}
cancelButtonText={t("robot_duplication.buttons.cancel")} cancelButtonText={t("robot_duplication.buttons.cancel")}
isLoading={isLoading} isLoading={isLoading}
showCancelButton={false}
> >
<> <>
<Box style={{ display: "flex", flexDirection: "column" }}> <Box style={{ display: "flex", flexDirection: "column" }}>