summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2024-04-15 16:03:42 +0200
committerOskar Nyberg <oskar@mullvad.net>2024-04-15 16:05:01 +0200
commitc396d7099944ae2e4f096c9fdedbe64e6242e75e (patch)
treeb44cd6a2baa19f52227028c59482903f1f481512 /gui/src/renderer
parent71b9e7fbe4a00a37975b35d6d646cec125a9884b (diff)
downloadmullvadvpn-c396d7099944ae2e4f096c9fdedbe64e6242e75e.tar.xz
mullvadvpn-c396d7099944ae2e4f096c9fdedbe64e6242e75e.zip
Fix Add/Save button in ProxyForm
Diffstat (limited to 'gui/src/renderer')
-rw-r--r--gui/src/renderer/components/ProxyForm.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/gui/src/renderer/components/ProxyForm.tsx b/gui/src/renderer/components/ProxyForm.tsx
index 5fbcf34d0f..7e006f65c0 100644
--- a/gui/src/renderer/components/ProxyForm.tsx
+++ b/gui/src/renderer/components/ProxyForm.tsx
@@ -80,7 +80,7 @@ export function ProxyForm(props: ProxyFormContextProviderProps) {
<ProxyFormContextProvider {...props}>
<SettingsForm>
<ProxyFormInner />
- <ProxyFormButtons />
+ <ProxyFormButtons new={props.proxy === undefined} />
</SettingsForm>
</ProxyFormContextProvider>
);
@@ -128,7 +128,7 @@ export function NamedProxyForm(props: NamedProxyFormContainerProps) {
<SettingsForm>
<ProxyFormNameField />
<ProxyFormInner />
- <ProxyFormButtons />
+ <ProxyFormButtons new={props.proxy === undefined} />
</SettingsForm>
</ProxyFormContextProvider>
</namedProxyFormContext.Provider>
@@ -149,8 +149,12 @@ function ProxyFormNameField() {
);
}
-export function ProxyFormButtons() {
- const { proxy, onSave, onCancel, onDelete } = useContext(proxyFormContext);
+interface ProxyFormButtonsProps {
+ new: boolean;
+}
+
+export function ProxyFormButtons(props: ProxyFormButtonsProps) {
+ const { onSave, onCancel, onDelete } = useContext(proxyFormContext);
// Contains form submittability to know whether or not to enable the Add/Save button.
const formSubmittable = useSettingsFormSubmittable();
@@ -166,7 +170,7 @@ export function ProxyFormButtons() {
)}
<SmallButton onClick={onCancel}>{messages.gettext('Cancel')}</SmallButton>
<SmallButton onClick={onSave} disabled={!formSubmittable}>
- {proxy === undefined ? messages.gettext('Add') : messages.gettext('Save')}
+ {props.new ? messages.gettext('Add') : messages.gettext('Save')}
</SmallButton>
</SmallButtonGroup>
);