Fixed required for + localization (#2784)

This commit is contained in:
Erik Jan de Wit 2022-06-13 11:42:17 +02:00 committed by GitHub
parent 4eb0b90d75
commit 741c09cca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View file

@ -347,6 +347,11 @@
"required": "Required",
"requiredFor": "Required for",
"requiredWhen": "Required when",
"requiredForLabel": {
"both": "Both users and admins",
"users": "Only users",
"admins": "Only admins"
},
"whoCanEdit": "Who can edit?",
"whoCanView": "Who can view?",
"user": "User",

View file

@ -162,6 +162,7 @@ export default function NewAttributeSettings() {
return attribute;
}
delete attribute.required;
return Object.assign(
{
...attribute,

View file

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable prettier/prettier */
import React, { useState } from "react";
import {
Divider,
@ -24,9 +22,9 @@ import { isEqual } from "lodash-es";
import "../../realm-settings-section.css";
const REQUIRED_FOR = [
{ label: "Both users and admins", value: ["admin", "user"] },
{ label: "Only users", value: ["user"] },
{ label: "Only admins", value: ["admin"] },
{ label: "requiredForLabel.both", value: ["admin", "user"] },
{ label: "requiredForLabel.users", value: ["user"] },
{ label: "requiredForLabel.admins", value: ["admin"] },
] as const;
export const AttributeGeneralSettings = () => {
@ -292,7 +290,7 @@ export const AttributeGeneralSettings = () => {
onChange={() => {
onChange(option.value);
}}
label={option.label}
label={t(option.label)}
className="kc-requiredFor-option"
/>
))}