added select language
This commit is contained in:
parent
779eb155b5
commit
621d04db58
@ -17,6 +17,12 @@ import {
|
||||
|
||||
import { getWizardInfo, getPortalTimezones, getPortalCultures, setIsWizardLoaded } from '../../../store/wizard/actions';
|
||||
|
||||
const mapTimezonesToArray = (timezones) => {
|
||||
return timezones.map((timezone) => {
|
||||
return { key: timezone.id, label: timezone.displayName };
|
||||
});
|
||||
};
|
||||
|
||||
const { EmailSettings } = utils.email;
|
||||
const settings = new EmailSettings();
|
||||
settings.allowDomainPunycode = true;
|
||||
@ -308,6 +314,10 @@ class Body extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
const { t } = props;
|
||||
|
||||
document.title = t('title');
|
||||
|
||||
this.state = {
|
||||
password: '',
|
||||
isValidPass: false,
|
||||
@ -318,7 +328,8 @@ class Body extends Component {
|
||||
email: '',
|
||||
newEmail: '',
|
||||
license: false,
|
||||
selectLanguage: props.portalCulture,
|
||||
languages: null,
|
||||
selectLanguage: {},
|
||||
selectTimezone: props.portalTimezone
|
||||
}
|
||||
|
||||
@ -327,16 +338,29 @@ class Body extends Component {
|
||||
|
||||
async componentDidMount() {
|
||||
const { t, wizardToken, getWizardInfo, getPortalCultures, getPortalTimezones, setIsWizardLoaded } = this.props;
|
||||
document.title = t('title');
|
||||
|
||||
|
||||
//await getPortalTimezones()
|
||||
await getPortalCultures();
|
||||
await getPortalCultures()
|
||||
.then(() => {
|
||||
const { cultures, portalCulture } = this.props;
|
||||
const languages = this.mapCulturesToArray(cultures, t);
|
||||
const select = languages.filter(lang => lang.key === portalCulture);
|
||||
this.setState({ languages: languages, selectLanguage: {
|
||||
key: select[0].key,
|
||||
label: select[0].label
|
||||
}})
|
||||
});
|
||||
|
||||
await getWizardInfo(wizardToken);
|
||||
setIsWizardLoaded(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
mapCulturesToArray = (cultures, t) => {
|
||||
return cultures.map((culture) => {
|
||||
return { key: culture, label: t(`Culture_${culture}`) };
|
||||
});
|
||||
};
|
||||
|
||||
isValidPassHandler = val => {
|
||||
this.setState({ isValidPass: val });
|
||||
}
|
||||
@ -427,8 +451,12 @@ class Body extends Component {
|
||||
}
|
||||
|
||||
onSelectLanguageHandler = lang => {
|
||||
console.log('on select lang');
|
||||
this.setState({ selectLanguage: lang })
|
||||
console.log('on select lang', lang);
|
||||
this.setState({
|
||||
selectLanguage: {
|
||||
key: lang.key,
|
||||
label: lang.label
|
||||
}});
|
||||
}
|
||||
|
||||
renderModalDialog = () => {
|
||||
@ -577,9 +605,9 @@ class Body extends Component {
|
||||
}
|
||||
|
||||
renderSettingsBox = () => {
|
||||
const { selectLanguage, selectTimezone } = this.state;
|
||||
const { isOwner, t, domain, cultures, timezones, ownerEmail } = this.props;
|
||||
|
||||
const { selectLanguage, selectTimezone, languages } = this.state;
|
||||
const { isOwner, t, domain, timezones, ownerEmail } = this.props;
|
||||
console.log(languages)
|
||||
const titleEmail = isOwner
|
||||
? <Text className="settings-title">{t('email')}</Text>
|
||||
: null
|
||||
@ -599,15 +627,15 @@ class Body extends Component {
|
||||
<Box className="values">
|
||||
<Text className="text value">{domain ? domain : "someDomain"}</Text>
|
||||
{contentEmail}
|
||||
<GroupButton className="drop-down value" label={selectLanguage} isDropdown={true}>
|
||||
<GroupButton className="drop-down value" label={selectLanguage.label} isDropdown={true}>
|
||||
{
|
||||
cultures.map(el => (
|
||||
languages.map(el => (
|
||||
<DropDownItem
|
||||
key={el}
|
||||
label={el}
|
||||
key={el.key}
|
||||
label={el.label}
|
||||
onClick={() => this.onSelectLanguageHandler(el)}
|
||||
/>
|
||||
))
|
||||
))
|
||||
}
|
||||
</GroupButton>
|
||||
<GroupButton className="drop-down value" label={selectTimezone} isDropdown={true}>
|
||||
|
@ -20,5 +20,9 @@
|
||||
"tooltipPasswordLength": "characters",
|
||||
"tooltipPasswordDigits": "digits",
|
||||
"tooltipPasswordCapital": "capital letters",
|
||||
"tooltipPasswordSpecial": "special characters (!@#$%^&*)"
|
||||
"tooltipPasswordSpecial": "special characters (!@#$%^&*)",
|
||||
|
||||
"Culture_en": "English (United Kingdom)",
|
||||
"Culture_en-US": "English (United States)",
|
||||
"Culture_ru-RU": "Russian (Russia)"
|
||||
}
|
@ -20,5 +20,9 @@
|
||||
"tooltipPasswordLength": "символов",
|
||||
"tooltipPasswordDigits": "цыфры",
|
||||
"tooltipPasswordCapital": "Заглавные буквы",
|
||||
"tooltipPasswordSpecial": "Специальные символы (!@#$%^&*)"
|
||||
"tooltipPasswordSpecial": "Специальные символы (!@#$%^&*)",
|
||||
|
||||
"Culture_en": "Английский (Великобритания)",
|
||||
"Culture_en-US": "Английский (США)",
|
||||
"Culture_ru-RU": "Русский (Россия)"
|
||||
}
|
Loading…
Reference in New Issue
Block a user