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

View File

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

View File

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

View File

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