feat: dont show cancel button

This commit is contained in:
amhsirak
2025-08-25 19:44:30 +05:30
parent 53d8b81fc8
commit 0bd666e372

View File

@@ -18,10 +18,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;
} }
@@ -33,13 +40,13 @@ interface ScheduleConfig {
runEvery: number; runEvery: number;
runEveryUnit: "MINUTES" | "HOURS" | "DAYS" | "WEEKS" | "MONTHS"; runEveryUnit: "MINUTES" | "HOURS" | "DAYS" | "WEEKS" | "MONTHS";
startFrom: startFrom:
| "SUNDAY" | "SUNDAY"
| "MONDAY" | "MONDAY"
| "TUESDAY" | "TUESDAY"
| "WEDNESDAY" | "WEDNESDAY"
| "THURSDAY" | "THURSDAY"
| "FRIDAY" | "FRIDAY"
| "SATURDAY"; | "SATURDAY";
atTimeStart?: string; atTimeStart?: string;
atTimeEnd?: string; atTimeEnd?: string;
timezone: string; timezone: string;
@@ -173,6 +180,7 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
action.args && action.args &&
action.args.length > 0 action.args.length > 0
) { ) {
// Check if first argument has a limit property
const arg = action.args[0]; const arg = action.args[0];
if (arg && typeof arg === "object" && "limit" in arg) { if (arg && typeof arg === "object" && "limit" in arg) {
limits.push({ limits.push({
@@ -214,6 +222,7 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
const selector = action.args[0]; const selector = action.args[0];
// Handle full word type actions first
if ( if (
action.action === "type" && action.action === "type" &&
action.args?.length >= 2 && action.args?.length >= 2 &&
@@ -230,6 +239,7 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
continue; continue;
} }
// Handle character-by-character sequences (both type and press)
if ( if (
(action.action === "type" || action.action === "press") && (action.action === "type" || action.action === "press") &&
action.args?.length >= 2 && action.args?.length >= 2 &&
@@ -582,7 +592,8 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
setRerenderRobots(true); setRerenderRobots(true);
notify("success", t("robot_edit.notifications.update_success")); notify("success", t("robot_edit.notifications.update_success"));
handleStart(robot); handleStart(robot);
navigate("/robots"); const basePath = "/robots";
navigate(basePath);
} else { } else {
notify("error", t("robot_edit.notifications.update_failed")); notify("error", t("robot_edit.notifications.update_failed"));
} }
@@ -595,7 +606,8 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
}; };
const handleCancel = () => { const handleCancel = () => {
navigate("/robots"); const basePath = "/robots";
navigate(basePath);
}; };
const lastPair = const lastPair =
@@ -610,6 +622,7 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
onCancel={handleCancel} onCancel={handleCancel}
saveButtonText={t("robot_edit.save")} saveButtonText={t("robot_edit.save")}
cancelButtonText={t("robot_edit.cancel")} cancelButtonText={t("robot_edit.cancel")}
showCancelButton={false}
isLoading={isLoading} isLoading={isLoading}
> >
<> <>
@@ -640,4 +653,4 @@ export const RobotEditPage = ({ handleStart }: RobotSettingsProps) => {
</> </>
</RobotConfigPage> </RobotConfigPage>
); );
}; };