Wrap inputs in fieldsets in Space visibility settings (#7350)
* use fieldset in space settings > visibility Signed-off-by: Kerry Archibald <kerrya@element.io> * add basic tests for space setttings visibility Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * fix toggle button placement Signed-off-by: Kerry Archibald <kerrya@element.io> * i18n Signed-off-by: Kerry Archibald <kerrya@element.io> * update settings separator color to quinary Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
92ee02fe02
commit
b1066a5699
10 changed files with 431 additions and 54 deletions
|
@ -384,6 +384,7 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
return (
|
||||
<div className='mx_AliasSettings'>
|
||||
<SettingsFieldset
|
||||
data-test-id='published-address-fieldset'
|
||||
legend={_t("Published Addresses")}
|
||||
description={<>
|
||||
{ isSpaceRoom
|
||||
|
@ -429,7 +430,9 @@ export default class AliasSettings extends React.Component<IProps, IState> {
|
|||
placeholder={_t('New published address (e.g. #alias:server)')}
|
||||
/>
|
||||
</SettingsFieldset>
|
||||
<SettingsFieldset legend={_t("Local Addresses")}
|
||||
<SettingsFieldset
|
||||
data-test-id='local-address-fieldset'
|
||||
legend={_t("Local Addresses")}
|
||||
description={isSpaceRoom
|
||||
? _t("Set addresses for this space so users can find this space " +
|
||||
"through your homeserver (%(localDomain)s)", { localDomain })
|
||||
|
|
|
@ -28,6 +28,7 @@ import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
|
|||
import { useLocalEcho } from "../../../hooks/useLocalEcho";
|
||||
import JoinRuleSettings from "../settings/JoinRuleSettings";
|
||||
import { useRoomState } from "../../../hooks/useRoomState";
|
||||
import SettingsFieldset from "../settings/SettingsFieldset";
|
||||
|
||||
interface IProps {
|
||||
matrixClient: MatrixClient;
|
||||
|
@ -67,12 +68,16 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn
|
|||
|
||||
let advancedSection;
|
||||
if (joinRule === JoinRule.Public) {
|
||||
if (showAdvancedSection) {
|
||||
advancedSection = <>
|
||||
<AccessibleButton onClick={toggleAdvancedSection} kind="link" className="mx_SettingsTab_showAdvanced">
|
||||
{ _t("Hide advanced") }
|
||||
</AccessibleButton>
|
||||
advancedSection = <div>
|
||||
<AccessibleButton
|
||||
data-test-id='toggle-guest-access-btn'
|
||||
onClick={toggleAdvancedSection}
|
||||
kind="link"
|
||||
className="mx_SettingsTab_showAdvanced">
|
||||
{ showAdvancedSection ? _t("Hide advanced") : _t("Show advanced") }
|
||||
</AccessibleButton>
|
||||
|
||||
{ showAdvancedSection && <div className="mx_SettingsTab_toggleWithDescription">
|
||||
<LabelledToggleSwitch
|
||||
value={guestAccessEnabled}
|
||||
onChange={setGuestAccessEnabled}
|
||||
|
@ -84,14 +89,9 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn
|
|||
<br />
|
||||
{ _t("This may be useful for public spaces.") }
|
||||
</p>
|
||||
</>;
|
||||
} else {
|
||||
advancedSection = <>
|
||||
<AccessibleButton onClick={toggleAdvancedSection} kind="link" className="mx_SettingsTab_showAdvanced">
|
||||
{ _t("Show advanced") }
|
||||
</AccessibleButton>
|
||||
</>;
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>;
|
||||
}
|
||||
|
||||
let addressesSection;
|
||||
|
@ -111,34 +111,34 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn
|
|||
return <div className="mx_SettingsTab">
|
||||
<div className="mx_SettingsTab_heading">{ _t("Visibility") }</div>
|
||||
|
||||
{ error && <div className="mx_SpaceRoomView_errorText">{ error }</div> }
|
||||
{ error && <div data-test-id='space-settings-error' className="mx_SpaceRoomView_errorText">{ error }</div> }
|
||||
|
||||
<div className="mx_SettingsTab_section">
|
||||
<div className="mx_SettingsTab_section_caption">
|
||||
{ _t("Decide who can view and join %(spaceName)s.", { spaceName: space.name }) }
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<JoinRuleSettings
|
||||
room={space}
|
||||
onError={() => setError(_t("Failed to update the visibility of this space"))}
|
||||
closeSettingsFn={closeSettingsFn}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{ advancedSection }
|
||||
|
||||
<LabelledToggleSwitch
|
||||
value={historyVisibility === HistoryVisibility.WorldReadable}
|
||||
onChange={(checked: boolean) => {
|
||||
setHistoryVisibility(checked ? HistoryVisibility.WorldReadable : HistoryVisibility.Shared);
|
||||
}}
|
||||
disabled={!canSetHistoryVisibility}
|
||||
label={_t("Preview Space")}
|
||||
<SettingsFieldset
|
||||
data-test-id='access-fieldset'
|
||||
legend={_t("Access")}
|
||||
description={_t("Decide who can view and join %(spaceName)s.", { spaceName: space.name })}
|
||||
>
|
||||
<JoinRuleSettings
|
||||
room={space}
|
||||
onError={() => setError(_t("Failed to update the visibility of this space"))}
|
||||
closeSettingsFn={closeSettingsFn}
|
||||
/>
|
||||
<div>{ _t("Allow people to preview your space before they join.") }</div>
|
||||
<b>{ _t("Recommended for public spaces.") }</b>
|
||||
</div>
|
||||
{ advancedSection }
|
||||
<div className="mx_SettingsTab_toggleWithDescription">
|
||||
<LabelledToggleSwitch
|
||||
value={historyVisibility === HistoryVisibility.WorldReadable}
|
||||
onChange={(checked: boolean) => {
|
||||
setHistoryVisibility(checked ? HistoryVisibility.WorldReadable : HistoryVisibility.Shared);
|
||||
}}
|
||||
disabled={!canSetHistoryVisibility}
|
||||
label={_t("Preview Space")}
|
||||
/>
|
||||
<p>
|
||||
{ _t("Allow people to preview your space before they join.") }<br />
|
||||
<b>{ _t("Recommended for public spaces.") }</b>
|
||||
</p>
|
||||
</div>
|
||||
</SettingsFieldset>
|
||||
|
||||
{ addressesSection }
|
||||
</div>;
|
||||
|
|
|
@ -1143,11 +1143,12 @@
|
|||
"Failed to update the guest access of this space": "Failed to update the guest access of this space",
|
||||
"Failed to update the history visibility of this space": "Failed to update the history visibility of this space",
|
||||
"Hide advanced": "Hide advanced",
|
||||
"Show advanced": "Show advanced",
|
||||
"Enable guest access": "Enable guest access",
|
||||
"Guests can join a space without having an account.": "Guests can join a space without having an account.",
|
||||
"This may be useful for public spaces.": "This may be useful for public spaces.",
|
||||
"Show advanced": "Show advanced",
|
||||
"Visibility": "Visibility",
|
||||
"Access": "Access",
|
||||
"Decide who can view and join %(spaceName)s.": "Decide who can view and join %(spaceName)s.",
|
||||
"Failed to update the visibility of this space": "Failed to update the visibility of this space",
|
||||
"Preview Space": "Preview Space",
|
||||
|
@ -1580,7 +1581,6 @@
|
|||
"Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>": "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly. <a>Learn more about encryption.</a>",
|
||||
"To link to this room, please add an address.": "To link to this room, please add an address.",
|
||||
"Decide who can join %(roomName)s.": "Decide who can join %(roomName)s.",
|
||||
"Access": "Access",
|
||||
"Failed to update the join rules": "Failed to update the join rules",
|
||||
"Unknown failure": "Unknown failure",
|
||||
"Are you sure you want to make this encrypted room public?": "Are you sure you want to make this encrypted room public?",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue