use edit in place (WIP) This is WIP since it will submite -> reload the

page onSave
This commit is contained in:
Timo K
2025-11-21 18:49:30 +01:00
parent e60bc9e98f
commit 7532f72c90
3 changed files with 75 additions and 94 deletions

View File

@@ -64,7 +64,14 @@
"developer_mode": { "developer_mode": {
"always_show_iphone_earpiece": "Show iPhone earpiece option on all platforms", "always_show_iphone_earpiece": "Show iPhone earpiece option on all platforms",
"crypto_version": "Crypto version: {{version}}", "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", "debug_tile_layout_label": "Debug tile layout",
"device_id": "Device ID: {{id}}", "device_id": "Device ID: {{id}}",
"duplicate_tiles_label": "Number of additional tile copies per participant", "duplicate_tiles_label": "Number of additional tile copies per participant",
@@ -90,7 +97,6 @@
}, },
"mute_all_audio": "Mute all audio (participants, reactions, join sounds)", "mute_all_audio": "Mute all audio (participants, reactions, join sounds)",
"show_connection_stats": "Show connection statistics", "show_connection_stats": "Show connection statistics",
"update": "Update",
"url_params": "URL parameters" "url_params": "URL parameters"
}, },
"disconnected_banner": "Connectivity to the server has been lost.", "disconnected_banner": "Connectivity to the server has been lost.",

View File

@@ -21,7 +21,7 @@ import {
} from "matrix-js-sdk"; } from "matrix-js-sdk";
import { logger } from "matrix-js-sdk/lib/logger"; import { logger } from "matrix-js-sdk/lib/logger";
import { import {
Button, EditInPlace,
Root as Form, Root as Form,
Heading, Heading,
HelpMessage, HelpMessage,
@@ -114,7 +114,7 @@ export const DeveloperSettingsTab: FC<Props> = ({
}, [livekitRooms]); }, [livekitRooms]);
return ( return (
<Form> <Form onSubmit={(e) => e.preventDefault()}>
<p> <p>
{t("developer_mode.hostname", { {t("developer_mode.hostname", {
hostname: window.location.hostname || "unknown", hostname: window.location.hostname || "unknown",
@@ -213,48 +213,43 @@ export const DeveloperSettingsTab: FC<Props> = ({
)} )}
/>{" "} />{" "}
</FieldRow> </FieldRow>
{/*// TODO this feels a bit off... There has to be better way to create the desired look. <EditInPlace
Also the indent should be further to the left...*/} onSubmit={(e) => e.preventDefault()}
<InlineField helpLabel={
name={t("developer_mode.custom_livekit_url")} customLivekitUrl === null
control={<></>} ? t("developer_mode.custom_livekit_url.from_config")
> : t("developer_mode.custom_livekit_url.current_url") +
<Label>{t("developer_mode.custom_livekit_url")}</Label> customLivekitUrl
<HelpMessage> }
{customLivekitUrl === null label={t("developer_mode.custom_livekit_url.label")}
? "Use Default" saveButtonLabel={t("developer_mode.custom_livekit_url.save")}
: `Current:${customLivekitUrl}`} savingLabel={t("developer_mode.custom_livekit_url.saving")}
</HelpMessage> cancelButtonLabel={t("developer_mode.custom_livekit_url.reset")}
</InlineField> onSave={useCallback(
<FieldRow> (e: React.FormEvent<HTMLFormElement>) => {
<InputField // e.preventDefault();
id="customLivekitUrl" setCustomLivekitUrl(
type="text" customLivekitUrlTextBuffer === ""
label={t("developer_mode.custom_livekit_url")} ? null
value={customLivekitUrlTextBuffer} : customLivekitUrlTextBuffer,
onChange={useCallback( );
(event: ChangeEvent<HTMLInputElement>): void => { },
setCustomLivekitUrlTextBuffer(event.target.value); [setCustomLivekitUrl, customLivekitUrlTextBuffer],
}, )}
[setCustomLivekitUrlTextBuffer], onChange={useCallback(
)} (event: ChangeEvent<HTMLInputElement>): void => {
/> setCustomLivekitUrlTextBuffer(event.target.value);
<Button },
onClick={useCallback( [setCustomLivekitUrlTextBuffer],
(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { )}
e.preventDefault(); onCancel={useCallback(
setCustomLivekitUrl( (e: React.FormEvent<HTMLFormElement>) => {
customLivekitUrlTextBuffer === "" // e.preventDefault();
? null setCustomLivekitUrl(null);
: customLivekitUrlTextBuffer, },
); [setCustomLivekitUrl],
}, )}
[setCustomLivekitUrl, customLivekitUrlTextBuffer], />
)}
>
{t("developer_mode.update")}
</Button>
</FieldRow>
<Heading as="h3" type="body" weight="semibold" size="lg"> <Heading as="h3" type="body" weight="semibold" size="lg">
{t("developer_mode.matrixRTCMode.title")} {t("developer_mode.matrixRTCMode.title")}
</Heading> </Heading>

View File

@@ -190,14 +190,11 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
</div> </div>
</div> </div>
<div <form
class="_inline-field_19upo_32" class="_root_19upo_16"
> >
<div <div
class="_inline-field-control_19upo_44" class="_field_19upo_26"
/>
<div
class="_inline-field-body_19upo_38"
> >
<label <label
class="_label_19upo_59" class="_label_19upo_59"
@@ -205,42 +202,25 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
> >
Custom Livekit-url Custom Livekit-url
</label> </label>
<div
class="_controls_17lij_8"
>
<input
aria-describedby="radix-«r7»"
class="_control_sqdq4_10"
id="radix-«r6»"
name="input"
title=""
/>
</div>
<span <span
class="_message_19upo_85 _help-message_19upo_91" class="_message_19upo_85 _help-message_19upo_91"
id="radix-«r7»" id="radix-«r7»"
> >
Use Default Currently, no overwrite is set. Url from well-known or config is used.
</span> </span>
</div> </div>
</div> </form>
<div
class="fieldRow"
>
<div
class="field inputField"
>
<input
aria-describedby="«r8»"
id="customLivekitUrl"
type="text"
value=""
/>
<label
for="customLivekitUrl"
>
Custom Livekit-url
</label>
</div>
<button
class="_button_vczzf_8"
data-kind="primary"
data-size="lg"
role="button"
tabindex="0"
>
Update
</button>
</div>
<h3 <h3
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74" class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74"
> >
@@ -256,10 +236,10 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
class="_container_1e0uz_10" class="_container_1e0uz_10"
> >
<input <input
aria-describedby="radix-«ra» radix-«rc» radix-«re»" aria-describedby="radix-«r9» radix-«rb» radix-«rd»"
checked="" checked=""
class="_input_1e0uz_18" class="_input_1e0uz_18"
id="radix-«r9»" id="radix-«r8»"
name="«r0»" name="«r0»"
title="" title=""
type="radio" type="radio"
@@ -275,13 +255,13 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
> >
<label <label
class="_label_19upo_59" class="_label_19upo_59"
for="radix-«r9»" for="radix-«r8»"
> >
Legacy: state events & oldest membership SFU Legacy: state events & oldest membership SFU
</label> </label>
<span <span
class="_message_19upo_85 _help-message_19upo_91" class="_message_19upo_85 _help-message_19upo_91"
id="radix-«ra»" id="radix-«r9»"
> >
Compatible with old versions of EC that do not support multi SFU Compatible with old versions of EC that do not support multi SFU
</span> </span>
@@ -297,9 +277,9 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
class="_container_1e0uz_10" class="_container_1e0uz_10"
> >
<input <input
aria-describedby="radix-«ra» radix-«rc» radix-«re»" aria-describedby="radix-«r9» radix-«rb» radix-«rd»"
class="_input_1e0uz_18" class="_input_1e0uz_18"
id="radix-«rb»" id="radix-«ra»"
name="«r0»" name="«r0»"
title="" title=""
type="radio" type="radio"
@@ -315,13 +295,13 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
> >
<label <label
class="_label_19upo_59" class="_label_19upo_59"
for="radix-«rb»" for="radix-«ra»"
> >
Compatibility: state events & multi SFU Compatibility: state events & multi SFU
</label> </label>
<span <span
class="_message_19upo_85 _help-message_19upo_91" class="_message_19upo_85 _help-message_19upo_91"
id="radix-«rc»" id="radix-«rb»"
> >
Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later) Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later)
</span> </span>
@@ -337,9 +317,9 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
class="_container_1e0uz_10" class="_container_1e0uz_10"
> >
<input <input
aria-describedby="radix-«ra» radix-«rc» radix-«re»" aria-describedby="radix-«r9» radix-«rb» radix-«rd»"
class="_input_1e0uz_18" class="_input_1e0uz_18"
id="radix-«rd»" id="radix-«rc»"
name="«r0»" name="«r0»"
title="" title=""
type="radio" type="radio"
@@ -355,13 +335,13 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
> >
<label <label
class="_label_19upo_59" class="_label_19upo_59"
for="radix-«rd»" for="radix-«rc»"
> >
Matrix 2.0: sticky events & multi SFU Matrix 2.0: sticky events & multi SFU
</label> </label>
<span <span
class="_message_19upo_85 _help-message_19upo_91" class="_message_19upo_85 _help-message_19upo_91"
id="radix-«re»" id="radix-«rd»"
> >
Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later
</span> </span>