Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: profile POC from master #926

Merged
merged 39 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
88b5838
fix(deps): update dependency @edx/paragon to v20.46.3
renovate[bot] Oct 16, 2023
4cc9e53
chore(deps): update commitlint monorepo to v17.8.0
renovate[bot] Oct 16, 2023
e6c3d10
fix(deps): update dependency @edx/frontend-component-footer to v12.4.0
renovate[bot] Oct 16, 2023
779c507
chore: bump frontend-platform (#869)
Syed-Ali-Abbas-Zaidi Oct 16, 2023
8f6b969
fix: Add ID attribute to the main content (#845)
Lunyachek Oct 16, 2023
69cacc1
chore: update browserslist DB (#871)
edx-requirements-bot Oct 16, 2023
e216036
fix(deps): update dependency @edx/frontend-platform to v5.6.1 (#875)
renovate[bot] Oct 16, 2023
ce616fa
build(deps): bump @babel/traverse from 7.22.5 to 7.23.2 (#879)
dependabot[bot] Oct 16, 2023
6957ad0
fix(deps): update dependency core-js to v3.33.0 (#876)
renovate[bot] Oct 16, 2023
2f8b996
chore: Update to the new version of brand-openedx in the new scope. (…
Oct 20, 2023
dc068cb
chore(deps): update commitlint monorepo to v17.8.1
renovate[bot] Oct 23, 2023
1baf21a
fix(deps): update dependency core-js to v3.33.1
renovate[bot] Oct 23, 2023
c396800
fix(deps): update dependency @edx/frontend-component-footer to v12.5.0
renovate[bot] Oct 23, 2023
d677d11
fix(deps): update dependency @edx/frontend-component-header to v4.8.0
renovate[bot] Oct 23, 2023
48d2766
feat: babel-plugin-react-intl to babel-plugin-formatjs migration (#855)
abdullahwaheed Oct 23, 2023
f48a06b
chore: update browserslist DB (#890)
edx-requirements-bot Oct 23, 2023
7ae5956
refactor: updated README file to reflect template changes
Oct 25, 2023
e195dbf
chore: update browserslist DB
jsnwesson Oct 30, 2023
8b48dc8
chore(deps): update dependency @edx/frontend-build to v13.0.3
renovate[bot] Oct 30, 2023
943ff02
Merge pull request #901 from openedx/update-browserslist-db
deborahgu Oct 30, 2023
47a7d77
Merge pull request #898 from openedx/mashal-m/update-README
deborahgu Oct 31, 2023
a384949
fix(deps): update dependency @edx/brand to v1.2.3
renovate[bot] Oct 31, 2023
efeedb3
feat: fixing a conflict
deborahgu Oct 31, 2023
8566cf9
Merge pull request #903 from openedx/renovate/edx-brand-1.x-lockfile
deborahgu Oct 31, 2023
7175183
chore(deps): update dependency @edx/frontend-build to v13.0.4
renovate[bot] Nov 6, 2023
c6c5521
fix(deps): update dependency @edx/frontend-component-footer to v12.5.1
renovate[bot] Nov 6, 2023
a434c0a
chore: update browserslist DB (#905)
edx-requirements-bot Nov 8, 2023
860d2e6
feat: fixed displaying field and visibility forms (#864)
vladislavkeblysh Nov 8, 2023
5cf7db1
fix: trim long text in form controls and username block (#888)
ihor-romaniuk Nov 8, 2023
1401c8b
chore(deps): update dependency @edx/frontend-build to v13.0.5
renovate[bot] Nov 13, 2023
8a27557
fix(deps): update dependency core-js to v3.33.2
renovate[bot] Nov 13, 2023
a9ce16a
chore: remove unused codecov package from package.json (#915)
justinhynes Nov 17, 2023
cad60cf
chore: update browserslist DB
jsnwesson Nov 20, 2023
4d5562e
chore(deps): update dependency @edx/frontend-build to v13.0.8
renovate[bot] Nov 20, 2023
9403fd8
fix(deps): update dependency core-js to v3.33.3
renovate[bot] Nov 20, 2023
9948527
Merge pull request #917 from openedx/update-browserslist-db
deborahgu Nov 21, 2023
cf6b4da
fix(deps): update dependency @edx/frontend-component-footer to v12.6.0
renovate[bot] Nov 27, 2023
c365951
fix(deps): update dependency @edx/frontend-component-header to v4.10.1
renovate[bot] Nov 27, 2023
daf5c08
Merge branch 'aperture/PluginPOCFeature' into jwesson/update-poc-with…
jsnwesson Nov 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 44 additions & 190 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
],
"dependencies": {
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-footer": "12.5.1",
"@edx/frontend-component-header": "4.8.0",
"@edx/frontend-component-footer": "12.6.0",
"@edx/frontend-component-header": "4.10.1",
"@edx/frontend-platform": "5.6.1",
"@edx/paragon": "^20.44.0",
"@fortawesome/fontawesome-svg-core": "1.2.36",
Expand All @@ -40,7 +40,7 @@
"@fortawesome/react-fontawesome": "0.2.0",
"@pact-foundation/pact": "^11.0.2",
"classnames": "2.3.2",
"core-js": "3.33.1",
"core-js": "3.33.3",
"history": "5.3.0",
"lodash.camelcase": "4.3.0",
"lodash.get": "4.4.2",
Expand All @@ -67,11 +67,10 @@
"@commitlint/cli": "17.8.1",
"@commitlint/config-angular": "17.8.1",
"@edx/browserslist-config": "^1.1.1",
"@edx/frontend-build": "13.0.4",
"@edx/frontend-build": "13.0.8",
"@edx/reactifex": "2.2.0",
"@testing-library/react": "12.1.5",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"codecov": "3.8.3",
"enzyme": "3.11.0",
"glob": "10.3.10",
"react-test-renderer": "17.0.2",
Expand Down
114 changes: 70 additions & 44 deletions src/profile/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

return (
<span data-hj-suppress>
<h1 className="h2 mb-0 font-weight-bold">{this.props.params.username}</h1>
<h1 className="h2 mb-0 font-weight-bold text-truncate">{this.props.params.username}</h1>
<DateJoined date={dateJoined} />
{this.isYOBDisabled() && <UsernameDescription />}
<hr className="d-none d-md-block" />
Expand Down Expand Up @@ -178,6 +178,7 @@
visibilityLearningGoal,
languageProficiencies,
visibilityLanguageProficiencies,
courseCertificates,
visibilityCourseCertificates,
bio,
visibilityBio,
Expand All @@ -196,6 +197,17 @@
changeHandler: this.handleChange,
};

const isBlockVisible = (blockInfo) => this.isAuthenticatedUserProfile()
|| (!this.isAuthenticatedUserProfile() && Boolean(blockInfo));

Check warning on line 201 in src/profile/ProfilePage.jsx

View check run for this annotation

Codecov / codecov/patch

src/profile/ProfilePage.jsx#L201

Added line #L201 was not covered by tests

const isLanguageBlockVisible = isBlockVisible(languageProficiencies.length);
const isEducationBlockVisible = isBlockVisible(levelOfEducation);
const isSocialLinksBLockVisible = isBlockVisible(socialLinks.some((link) => link.socialLink !== null));
const isBioBlockVisible = isBlockVisible(bio);
const isCertificatesBlockVisible = isBlockVisible(courseCertificates.length);
const isNameBlockVisible = isBlockVisible(name);
const isLocationBlockVisible = isBlockVisible(country);

return (
<div className="container-fluid">
<div className="row align-items-center pt-4 mb-4 pt-md-0 mb-md-0">
Expand All @@ -213,7 +225,7 @@
</div>
</div>
<div>PluginPOC</div>
<div className="col pl-0">
<div className="col">
<div className="d-md-none">
{this.renderHeadingLockup()}
</div>
Expand All @@ -231,46 +243,58 @@
<div className="d-md-none mb-4">
{this.renderViewMyRecordsButton()}
</div>
<Name
name={name}
visibilityName={visibilityName}
formId="name"
{...commonFormProps}
/>
<Country
country={country}
visibilityCountry={visibilityCountry}
formId="country"
{...commonFormProps}
/>
<PreferredLanguage
languageProficiencies={languageProficiencies}
visibilityLanguageProficiencies={visibilityLanguageProficiencies}
formId="languageProficiencies"
{...commonFormProps}
/>
<Education
levelOfEducation={levelOfEducation}
visibilityLevelOfEducation={visibilityLevelOfEducation}
formId="levelOfEducation"
{...commonFormProps}
/>
<SocialLinks
socialLinks={socialLinks}
draftSocialLinksByPlatform={draftSocialLinksByPlatform}
visibilitySocialLinks={visibilitySocialLinks}
formId="socialLinks"
{...commonFormProps}
/>
{isNameBlockVisible && (
<Name
name={name}
visibilityName={visibilityName}
formId="name"
{...commonFormProps}
/>
)}
{isLocationBlockVisible && (
<Country
country={country}
visibilityCountry={visibilityCountry}
formId="country"
{...commonFormProps}
/>
)}
{isLanguageBlockVisible && (
<PreferredLanguage
languageProficiencies={languageProficiencies}
visibilityLanguageProficiencies={visibilityLanguageProficiencies}
formId="languageProficiencies"
{...commonFormProps}
/>
)}
{isEducationBlockVisible && (
<Education
levelOfEducation={levelOfEducation}
visibilityLevelOfEducation={visibilityLevelOfEducation}
formId="levelOfEducation"
{...commonFormProps}
/>
)}
{isSocialLinksBLockVisible && (
<SocialLinks
socialLinks={socialLinks}
draftSocialLinksByPlatform={draftSocialLinksByPlatform}
visibilitySocialLinks={visibilitySocialLinks}
formId="socialLinks"
{...commonFormProps}
/>
)}
</div>
<div className="pt-md-3 col-md-8 col-lg-7 offset-lg-1">
{!this.isYOBDisabled() && this.renderAgeMessage()}
<Bio
bio={bio}
visibilityBio={visibilityBio}
formId="bio"
{...commonFormProps}
/>
{isBioBlockVisible && (
<Bio
bio={bio}
visibilityBio={visibilityBio}
formId="bio"
{...commonFormProps}
/>
)}
{getConfig().ENABLE_SKILLS_BUILDER_PROFILE && (
<LearningGoal
learningGoal={learningGoal}
Expand All @@ -279,11 +303,13 @@
{...commonFormProps}
/>
)}
<Certificates
visibilityCourseCertificates={visibilityCourseCertificates}
formId="certificates"
{...commonFormProps}
/>
{isCertificatesBlockVisible && (
<Certificates
visibilityCourseCertificates={visibilityCourseCertificates}
formId="certificates"
{...commonFormProps}
/>
)}
</div>
</div>
</div>
Expand Down
24 changes: 21 additions & 3 deletions src/profile/ProfilePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,34 @@ describe('<ProfilePage />', () => {
expect(tree).toMatchSnapshot();
});

it('viewing other profile', () => {
it('viewing other profile with all fields', () => {
const contextValue = {
authenticatedUser: { userId: 123, username: 'staff', administrator: true },
config: getConfig(),
};

const component = (
<ProfilePageWrapper
contextValue={contextValue}
store={mockStore(storeMocks.viewOtherProfile)}
params={{ username: 'verified' }} // Override default params
store={mockStore({
...storeMocks.viewOtherProfile,
profilePage: {
...storeMocks.viewOtherProfile.profilePage,
account: {
...storeMocks.viewOtherProfile.profilePage.account,
name: 'user',
country: 'EN',
bio: 'bio',
courseCertificates: ['course certificates'],
levelOfEducation: 'some level',
languageProficiencies: ['some lang'],
socialLinks: ['twitter'],
timeZone: 'time zone',
accountPrivacy: 'all_users',
},
},
})}
match={{ params: { username: 'verified' } }} // Override default match
/>
);
const tree = renderer.create(component).toJSON();
Expand Down
Loading
Loading