From 7532f72c9094926cb3971680b437f76221fd955c Mon Sep 17 00:00:00 2001 From: Timo K Date: Fri, 21 Nov 2025 18:49:30 +0100 Subject: [PATCH] use edit in place (WIP) This is WIP since it will submite -> reload the page onSave --- locales/en/app.json | 10 ++- src/settings/DeveloperSettingsTab.tsx | 83 +++++++++---------- .../DeveloperSettingsTab.test.tsx.snap | 76 +++++++---------- 3 files changed, 75 insertions(+), 94 deletions(-) diff --git a/locales/en/app.json b/locales/en/app.json index 8bc121bd..4d3d5d6c 100644 --- a/locales/en/app.json +++ b/locales/en/app.json @@ -64,7 +64,14 @@ "developer_mode": { "always_show_iphone_earpiece": "Show iPhone earpiece option on all platforms", "crypto_version": "Crypto version: {{version}}", - "custom_livekit_url": "Custom Livekit-url", + "custom_livekit_url": { + "current_url": "Overwrite: ", + "from_config": "Currently, no overwrite is set. Url from well-known or config is used.", + "label": "Custom Livekit-url", + "reset": "Reset overwrite", + "save": "Save", + "saving": "Saving..." + }, "debug_tile_layout_label": "Debug tile layout", "device_id": "Device ID: {{id}}", "duplicate_tiles_label": "Number of additional tile copies per participant", @@ -90,7 +97,6 @@ }, "mute_all_audio": "Mute all audio (participants, reactions, join sounds)", "show_connection_stats": "Show connection statistics", - "update": "Update", "url_params": "URL parameters" }, "disconnected_banner": "Connectivity to the server has been lost.", diff --git a/src/settings/DeveloperSettingsTab.tsx b/src/settings/DeveloperSettingsTab.tsx index 5374b978..ed022370 100644 --- a/src/settings/DeveloperSettingsTab.tsx +++ b/src/settings/DeveloperSettingsTab.tsx @@ -21,7 +21,7 @@ import { } from "matrix-js-sdk"; import { logger } from "matrix-js-sdk/lib/logger"; import { - Button, + EditInPlace, Root as Form, Heading, HelpMessage, @@ -114,7 +114,7 @@ export const DeveloperSettingsTab: FC = ({ }, [livekitRooms]); return ( -
+ e.preventDefault()}>

{t("developer_mode.hostname", { hostname: window.location.hostname || "unknown", @@ -213,48 +213,43 @@ export const DeveloperSettingsTab: FC = ({ )} />{" "} - {/*// TODO this feels a bit off... There has to be better way to create the desired look. - Also the indent should be further to the left...*/} - } - > - - - {customLivekitUrl === null - ? "Use Default" - : `Current:${customLivekitUrl}`} - - - - ): void => { - setCustomLivekitUrlTextBuffer(event.target.value); - }, - [setCustomLivekitUrlTextBuffer], - )} - /> - - + e.preventDefault()} + helpLabel={ + customLivekitUrl === null + ? t("developer_mode.custom_livekit_url.from_config") + : t("developer_mode.custom_livekit_url.current_url") + + customLivekitUrl + } + label={t("developer_mode.custom_livekit_url.label")} + saveButtonLabel={t("developer_mode.custom_livekit_url.save")} + savingLabel={t("developer_mode.custom_livekit_url.saving")} + cancelButtonLabel={t("developer_mode.custom_livekit_url.reset")} + onSave={useCallback( + (e: React.FormEvent) => { + // e.preventDefault(); + setCustomLivekitUrl( + customLivekitUrlTextBuffer === "" + ? null + : customLivekitUrlTextBuffer, + ); + }, + [setCustomLivekitUrl, customLivekitUrlTextBuffer], + )} + onChange={useCallback( + (event: ChangeEvent): void => { + setCustomLivekitUrlTextBuffer(event.target.value); + }, + [setCustomLivekitUrlTextBuffer], + )} + onCancel={useCallback( + (e: React.FormEvent) => { + // e.preventDefault(); + setCustomLivekitUrl(null); + }, + [setCustomLivekitUrl], + )} + /> {t("developer_mode.matrixRTCMode.title")} diff --git a/src/settings/__snapshots__/DeveloperSettingsTab.test.tsx.snap b/src/settings/__snapshots__/DeveloperSettingsTab.test.tsx.snap index ddaa9b7f..ca861eb6 100644 --- a/src/settings/__snapshots__/DeveloperSettingsTab.test.tsx.snap +++ b/src/settings/__snapshots__/DeveloperSettingsTab.test.tsx.snap @@ -190,14 +190,11 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = ` -

-
+
+ +
- Use Default + Currently, no overwrite is set. Url from well-known or config is used.
-
-
-
- - -
- -
+

@@ -256,10 +236,10 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = ` class="_container_1e0uz_10" > renders and matches snapshot 1`] = ` > Compatible with old versions of EC that do not support multi SFU @@ -297,9 +277,9 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = ` class="_container_1e0uz_10" > renders and matches snapshot 1`] = ` > Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later) @@ -337,9 +317,9 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = ` class="_container_1e0uz_10" > renders and matches snapshot 1`] = ` > Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later