refactor: move handleBack()

This commit is contained in:
amhsirak
2025-08-25 19:53:47 +05:30
parent 8665847330
commit 8d938da958

View File

@@ -677,6 +677,13 @@ export const RobotIntegrationPage = ({
else return date.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
};
const handleBack = () => {
if (!recordingId) return;
setSelectedIntegrationType(null);
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
navigate(`${basePath}/${recordingId}/integrate`);
};
// --- MAIN RENDER ---
if (!selectedIntegrationType && !integrationType) {
return (
@@ -758,13 +765,6 @@ export const RobotIntegrationPage = ({
);
}
const handleBack = () => {
if (!recordingId) return;
setSelectedIntegrationType(null);
const basePath = robotPath === "prebuilt-robots" ? "/prebuilt-robots" : "/robots";
navigate(`${basePath}/${recordingId}/integrate`);
};
return (
<RobotConfigPage title={getIntegrationTitle()} onCancel={handleCancel} cancelButtonText={t("robot_edit.cancel")} showSaveButton={false} onBackToSelection={handleBack} backToSelectionText={"← " + t("right_panel.buttons.back")}>
<div style={{ display: "flex", flexDirection: "column", alignItems: "flex-start", position: "relative", minHeight: "400px" }}>