Web: People: Profile: Fixed displaying user information for "personal" setting

This commit is contained in:
Ilya Oleshko 2021-06-04 12:47:37 +03:00
parent d465b105e7
commit a4ee59974e
4 changed files with 98 additions and 70 deletions

View File

@ -202,6 +202,7 @@ class ProfileInfo extends React.PureComponent {
isAdmin, isAdmin,
isSelf, isSelf,
culture, culture,
personal,
} = this.props; } = this.props;
const { const {
@ -261,10 +262,12 @@ class ProfileInfo extends React.PureComponent {
return ( return (
<InfoContainer> <InfoContainer>
<InfoItem> {!personal && (
<InfoItemLabel>{t("Common:Type")}:</InfoItemLabel> <InfoItem>
<InfoItemValue>{type}</InfoItemValue> <InfoItemLabel>{t("Common:Type")}:</InfoItemLabel>
</InfoItem> <InfoItemValue>{type}</InfoItemValue>
</InfoItem>
)}
{email && ( {email && (
<InfoItem> <InfoItem>
<InfoItemLabel>{t("Common:Email")}:</InfoItemLabel> <InfoItemLabel>{t("Common:Email")}:</InfoItemLabel>
@ -316,13 +319,13 @@ class ProfileInfo extends React.PureComponent {
<InfoItemValue>{birthDayDate}</InfoItemValue> <InfoItemValue>{birthDayDate}</InfoItemValue>
</InfoItem> </InfoItem>
)} )}
{title && ( {!personal && title && (
<InfoItem> <InfoItem>
<InfoItemLabel>{userPostCaption}:</InfoItemLabel> <InfoItemLabel>{userPostCaption}:</InfoItemLabel>
<InfoItemValue>{title}</InfoItemValue> <InfoItemValue>{title}</InfoItemValue>
</InfoItem> </InfoItem>
)} )}
{department && ( {!personal && department && (
<InfoItem> <InfoItem>
<InfoItemLabel>{groupCaption}:</InfoItemLabel> <InfoItemLabel>{groupCaption}:</InfoItemLabel>
<InfoItemValue>{formatedDepartments}</InfoItemValue> <InfoItemValue>{formatedDepartments}</InfoItemValue>
@ -334,7 +337,7 @@ class ProfileInfo extends React.PureComponent {
<InfoItemValue>{location}</InfoItemValue> <InfoItemValue>{location}</InfoItemValue>
</InfoItem> </InfoItem>
)} )}
{workFrom && ( {!personal && workFrom && (
<InfoItem> <InfoItem>
<InfoItemLabel>{regDateCaption}:</InfoItemLabel> <InfoItemLabel>{regDateCaption}:</InfoItemLabel>
<InfoItemValue>{workFromDate}</InfoItemValue> <InfoItemValue>{workFromDate}</InfoItemValue>
@ -391,6 +394,7 @@ export default withRouter(
setIsLoading: peopleStore.setIsLoading, setIsLoading: peopleStore.setIsLoading,
isLoading: peopleStore.isLoading, isLoading: peopleStore.isLoading,
updateProfileCulture: peopleStore.targetUserStore.updateProfileCulture, updateProfileCulture: peopleStore.targetUserStore.updateProfileCulture,
personal: auth.settingsStore.personal,
}))( }))(
observer( observer(
withTranslation(["Profile", "Common", "Translations"])( withTranslation(["Profile", "Common", "Translations"])(

View File

@ -270,7 +270,7 @@ class SectionBodyContent extends React.PureComponent {
}; };
render() { render() {
const { profile, isAdmin, t, isSelf } = this.props; const { profile, isAdmin, t, isSelf, personal } = this.props;
const contacts = profile.contacts && getUserContacts(profile.contacts); const contacts = profile.contacts && getUserContacts(profile.contacts);
const role = getUserRole(profile); const role = getUserRole(profile);
@ -313,7 +313,7 @@ class SectionBodyContent extends React.PureComponent {
//culture={culture} //culture={culture}
/> />
{isSelf && this.oauthDataExists() && ( {!personal && isSelf && this.oauthDataExists() && (
<ToggleWrapper> <ToggleWrapper>
<ToggleContent label={t("LoginSettings")} isOpen={true}> <ToggleContent label={t("LoginSettings")} isOpen={true}>
<ProviderButtonsWrapper> <ProviderButtonsWrapper>
@ -322,7 +322,7 @@ class SectionBodyContent extends React.PureComponent {
</ToggleContent> </ToggleContent>
</ToggleWrapper> </ToggleWrapper>
)} )}
{isSelf && false && ( {!personal && isSelf && false && (
<ToggleWrapper isSelf={true}> <ToggleWrapper isSelf={true}>
<ToggleContent label={t("Subscriptions")} isOpen={true}> <ToggleContent label={t("Subscriptions")} isOpen={true}>
<Text as="span"> <Text as="span">
@ -378,6 +378,7 @@ export default withRouter(
setProviders: peopleStore.usersStore.setProviders, setProviders: peopleStore.usersStore.setProviders,
getOAuthToken: auth.settingsStore.getOAuthToken, getOAuthToken: auth.settingsStore.getOAuthToken,
getLoginLink: auth.settingsStore.getLoginLink, getLoginLink: auth.settingsStore.getLoginLink,
personal: auth.settingsStore.personal,
}))( }))(
observer( observer(
withTranslation(["Profile", "Common", "Translations"])(SectionBodyContent) withTranslation(["Profile", "Common", "Translations"])(SectionBodyContent)

View File

@ -62,7 +62,7 @@ const StyledContainer = styled.div`
} }
.header-headline { .header-headline {
margin-left: 16px; margin-left: ${(props) => (props.personal ? "0px" : "16px")};
} }
`; `;
@ -420,23 +420,35 @@ class SectionHeaderContent extends React.PureComponent {
}; };
render() { render() {
const { profile, isAdmin, viewer, t, filter, history, isMe } = this.props; const {
profile,
isAdmin,
viewer,
t,
filter,
history,
isMe,
personal,
} = this.props;
const { avatar, visibleAvatarEditor, dialogsVisible } = this.state; const { avatar, visibleAvatarEditor, dialogsVisible } = this.state;
const contextOptions = () => this.getUserContextOptions(profile, viewer); const contextOptions = () => this.getUserContextOptions(profile, viewer);
return ( return (
<StyledContainer <StyledContainer
showContextButton={(isAdmin && !profile.isOwner) || isMe} showContextButton={(isAdmin && !profile.isOwner) || isMe}
personal={personal}
> >
<IconButton {!personal && (
iconName="/static/images/arrow.path.react.svg" <IconButton
color="#A3A9AE" iconName="/static/images/arrow.path.react.svg"
size="17" color="#A3A9AE"
hoverColor="#657077" size="17"
isFill={true} hoverColor="#657077"
onClick={this.onClickBack} isFill={true}
className="arrow-button" onClick={this.onClickBack}
/> className="arrow-button"
/>
)}
<Headline className="header-headline" type="content" truncate={true}> <Headline className="header-headline" type="content" truncate={true}>
{profile.displayName} {profile.displayName}
{profile.isLDAP && ` (${t("Translations:LDAPLbl")})`} {profile.isLDAP && ` (${t("Translations:LDAPLbl")})`}
@ -523,6 +535,7 @@ export default withRouter(
isMe: peopleStore.targetUserStore.isMe, isMe: peopleStore.targetUserStore.isMe,
updateProfile: peopleStore.targetUserStore.updateProfile, updateProfile: peopleStore.targetUserStore.updateProfile,
getUserPhoto: peopleStore.targetUserStore.getUserPhoto, getUserPhoto: peopleStore.targetUserStore.getUserPhoto,
personal: auth.settingsStore.personal,
}; };
})( })(
observer( observer(

View File

@ -551,6 +551,7 @@ class UpdateUserForm extends React.Component {
isMy, isMy,
isSelf, isSelf,
language, language,
personal,
} = this.props; } = this.props;
const { const {
guestCaption, guestCaption,
@ -776,36 +777,40 @@ class UpdateUserForm extends React.Component {
radioIsDisabled={isLoading} radioIsDisabled={isLoading}
radioOnChange={this.onInputChange} radioOnChange={this.onInputChange}
/> />
<RadioField {!personal && (
labelText={`${t("Common:Type")}:`} <RadioField
radioName="isVisitor" labelText={`${t("Common:Type")}:`}
radioValue={profile.isVisitor.toString()} radioName="isVisitor"
radioOptions={[ radioValue={profile.isVisitor.toString()}
{ value: "true", label: guestCaption }, radioOptions={[
{ value: "false", label: userCaption }, { value: "true", label: guestCaption },
]} { value: "false", label: userCaption },
radioIsDisabled={ ]}
isLoading || disableProfileType || radioIsDisabled || isMy radioIsDisabled={
} isLoading || disableProfileType || radioIsDisabled || isMy
radioOnChange={this.onUserTypeChange} }
tooltipContent={tooltipTypeContent} radioOnChange={this.onUserTypeChange}
helpButtonHeaderContent={t("Common:Type")} tooltipContent={tooltipTypeContent}
/> helpButtonHeaderContent={t("Common:Type")}
<DateField />
calendarHeaderContent={`${t("CalendarSelectDate")}:`} )}
labelText={`${regDateCaption}:`} {!personal && (
inputName="workFrom" <DateField
inputValue={ calendarHeaderContent={`${t("CalendarSelectDate")}:`}
profile.workFrom ? new Date(profile.workFrom) : undefined labelText={`${regDateCaption}:`}
} inputName="workFrom"
inputIsDisabled={isLoading || !isAdmin} inputValue={
inputOnChange={this.onWorkFromDateChange} profile.workFrom ? new Date(profile.workFrom) : undefined
inputTabIndex={7} }
calendarMinDate={ inputIsDisabled={isLoading || !isAdmin}
profile.birthday ? new Date(profile.birthday) : new Date() inputOnChange={this.onWorkFromDateChange}
} inputTabIndex={7}
locale={language} calendarMinDate={
/> profile.birthday ? new Date(profile.birthday) : new Date()
}
locale={language}
/>
)}
<TextField <TextField
labelText={`${t("Translations:Location")}:`} labelText={`${t("Translations:Location")}:`}
inputName="location" inputName="location"
@ -814,15 +819,17 @@ class UpdateUserForm extends React.Component {
inputOnChange={this.onInputChange} inputOnChange={this.onInputChange}
inputTabIndex={8} inputTabIndex={8}
/> />
<TextField {!personal && (
labelText={`${userPostCaption}:`} <TextField
inputName="title" labelText={`${userPostCaption}:`}
inputValue={profile.title} inputName="title"
inputIsDisabled={isLoading || !isAdmin} inputValue={profile.title}
inputOnChange={this.onInputChange} inputIsDisabled={isLoading || !isAdmin}
inputTabIndex={9} inputOnChange={this.onInputChange}
/> inputTabIndex={9}
{!isMy && ( />
)}
{!isMy && !personal && (
<DepartmentField <DepartmentField
labelText={`${groupCaption}:`} labelText={`${groupCaption}:`}
isDisabled={isLoading || !isAdmin} isDisabled={isLoading || !isAdmin}
@ -840,16 +847,18 @@ class UpdateUserForm extends React.Component {
)} )}
</MainFieldsContainer> </MainFieldsContainer>
</MainContainer> </MainContainer>
<InfoFieldContainer headerText={t("Translations:Comments")}> {!personal && (
<Textarea <InfoFieldContainer headerText={t("Translations:Comments")}>
placeholder={t("WriteComment")} <Textarea
name="notes" placeholder={t("WriteComment")}
value={profile.notes} name="notes"
isDisabled={isLoading} value={profile.notes}
onChange={this.onInputChange} isDisabled={isLoading}
tabIndex={10} onChange={this.onInputChange}
/> tabIndex={10}
</InfoFieldContainer> />
</InfoFieldContainer>
)}
<InfoFieldContainer headerText={t("ContactInformation")}> <InfoFieldContainer headerText={t("ContactInformation")}>
<ContactsField <ContactsField
pattern={pattern.contact} pattern={pattern.contact}
@ -943,6 +952,7 @@ export default withRouter(
getUserPhoto: peopleStore.targetUserStore.getUserPhoto, getUserPhoto: peopleStore.targetUserStore.getUserPhoto,
disableProfileType: peopleStore.targetUserStore.getDisableProfileType, disableProfileType: peopleStore.targetUserStore.getDisableProfileType,
isSelf: peopleStore.targetUserStore.isMe, isSelf: peopleStore.targetUserStore.isMe,
personal: auth.settingsStore.personal,
}))( }))(
observer( observer(
withTranslation(["ProfileAction", "Common", "Translations"])( withTranslation(["ProfileAction", "Common", "Translations"])(