|
1 | 1 | import React, { useState, useEffect } from 'react'; |
| 2 | +import { useNavigate } from 'react-router-dom'; |
2 | 3 | import { Parameter } from '../recipe'; |
3 | 4 | import { Button } from './ui/button'; |
4 | | -import { getInitialWorkingDir } from '../utils/workingDir'; |
5 | 5 | import { defineMessages, useIntl } from '../i18n'; |
6 | 6 |
|
7 | 7 | const i18n = defineMessages({ |
@@ -69,6 +69,7 @@ const ParameterInputModal: React.FC<ParameterInputModalProps> = ({ |
69 | 69 | initialValues, |
70 | 70 | }) => { |
71 | 71 | const intl = useIntl(); |
| 72 | + const navigate = useNavigate(); |
72 | 73 | const [inputValues, setInputValues] = useState<Record<string, string>>({}); |
73 | 74 | const [validationErrors, setValidationErrors] = useState<Record<string, string>>({}); |
74 | 75 | const [showCancelOptions, setShowCancelOptions] = useState(false); |
@@ -126,14 +127,7 @@ const ParameterInputModal: React.FC<ParameterInputModalProps> = ({ |
126 | 127 |
|
127 | 128 | const handleCancelOption = (option: 'new-chat' | 'back-to-form'): void => { |
128 | 129 | if (option === 'new-chat') { |
129 | | - try { |
130 | | - const workingDir = getInitialWorkingDir(); |
131 | | - window.electron.createChatWindow({ dir: workingDir }); |
132 | | - window.electron.hideWindow(); |
133 | | - } catch (error) { |
134 | | - console.error('Error creating new window:', error); |
135 | | - onClose(); |
136 | | - } |
| 130 | + navigate('/pair'); |
137 | 131 | } else { |
138 | 132 | setShowCancelOptions(false); // Go back to the parameter form |
139 | 133 | } |
|
0 commit comments