fix: Minor usability improves to team domain management

This commit is contained in:
Tom Moor
2022-05-19 18:28:19 +01:00
parent 34576dd008
commit 39e146b4e6
2 changed files with 23 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ import { useTranslation, Trans } from "react-i18next";
import styled from "styled-components";
import Button from "~/components/Button";
import ConfirmationDialog from "~/components/ConfirmationDialog";
import Fade from "~/components/Fade";
import Flex from "~/components/Flex";
import Heading from "~/components/Heading";
import Input from "~/components/Input";
@@ -138,7 +139,6 @@ function Security() {
};
setData(newData);
setDomainsChanged(true);
};
const createOnDomainChangedHandler = (index: number) => (
@@ -276,8 +276,10 @@ function Security() {
key={index}
id={`allowedDomains${index}`}
value={domain}
autoFocus={!domain}
placeholder="example.com"
flex={true}
required
flex
onChange={createOnDomainChangedHandler(index)}
/>
<Remove>
@@ -293,21 +295,29 @@ function Security() {
<Flex justify="space-between" gap={4} style={{ flexWrap: "wrap" }}>
{!data.allowedDomains?.length ||
data.allowedDomains[data.allowedDomains.length - 1] !== "" ? (
<Button type="button" onClick={handleAddDomain} neutral>
<Trans>Add another</Trans>
</Button>
<Fade>
<Button type="button" onClick={handleAddDomain} neutral>
{data.allowedDomains?.length ? (
<Trans>Add another</Trans>
) : (
<Trans>Add a domain</Trans>
)}
</Button>
</Fade>
) : (
<span />
)}
{domainsChanged && (
<Button
type="button"
onClick={handleChange}
disabled={auth.isSaving}
>
<Trans>Save changes</Trans>
</Button>
<Fade>
<Button
type="button"
onClick={handleChange}
disabled={auth.isSaving}
>
<Trans>Save changes</Trans>
</Button>
</Fade>
)}
</Flex>
</SettingRow>

View File

@@ -661,6 +661,7 @@
"Allowed Domains": "Allowed Domains",
"The domains which should be allowed to create accounts. This applies to both SSO and Email logins. Changing this setting does not affect existing user accounts.": "The domains which should be allowed to create accounts. This applies to both SSO and Email logins. Changing this setting does not affect existing user accounts.",
"Remove domain": "Remove domain",
"Add a domain": "Add a domain",
"Save changes": "Save changes",
"Sharing is currently disabled.": "Sharing is currently disabled.",
"You can globally enable and disable public document sharing in the <em>security settings</em>.": "You can globally enable and disable public document sharing in the <em>security settings</em>.",