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

✨(frontend) add open edx profile information in learner dashboard #2329

Merged
merged 7 commits into from
Apr 10, 2024

Conversation

rlecellier
Copy link
Collaborator

@rlecellier rlecellier commented Mar 14, 2024

Purpose

image

  • display language when open edx return it.

Missing parts:

  • openEdx endpoint do not return language

@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 5 times, most recently from b22b510 to d20dcd5 Compare March 20, 2024 13:38
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 3 times, most recently from 013bc65 to 7bfeff5 Compare March 21, 2024 14:06
it('uses its own route to get user profile', async () => {
const openEdxProfile = OpenEdxApiProfileFactory().one();
fetchMock.get(
`https://demo.endpoint.api/api/user/v1/accounts/${openEdxProfile.username}`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbpenrath
Why does this route use api/user/v1/ where other api route use /api/v1.0/user ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/api/v1.0/user are routes developed by us in fonzie so we follow versionned route pattern we are using in our projects.

api/user/v1/ are routes of OpenEdX.

@rlecellier rlecellier self-assigned this Mar 21, 2024
@rlecellier rlecellier marked this pull request as ready for review March 21, 2024 14:08
@rlecellier rlecellier changed the title 🚧(frontend) add open edx profile information in learner dashboard ✨(frontend) add open edx profile information in learner dashboard Mar 21, 2024
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch from 7bfeff5 to ee68a0f Compare March 22, 2024 13:59
CHANGELOG.md Outdated Show resolved Hide resolved
src/frontend/js/api/lms/dummy.ts Outdated Show resolved Hide resolved
src/frontend/js/api/lms/dummy.ts Show resolved Hide resolved
src/frontend/js/hooks/useOpenEdxProfile/index.ts Outdated Show resolved Hide resolved
src/frontend/js/api/lms/openedx-fonzie.ts Outdated Show resolved Hide resolved
src/frontend/js/hooks/useOpenEdxProfile/utils/index.ts Outdated Show resolved Hide resolved
src/frontend/js/pages/DashboardOpenEdxProfile/index.tsx Outdated Show resolved Hide resolved
src/frontend/js/pages/DashboardOpenEdxProfile/index.tsx Outdated Show resolved Hide resolved
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 2 times, most recently from 781b733 to b5cf7ca Compare March 29, 2024 14:13
src/frontend/js/components/Form/Form/_styles.scss Outdated Show resolved Hide resolved
src/frontend/js/components/Form/Form/_styles.scss Outdated Show resolved Hide resolved
src/frontend/js/components/Form/Form/index.tsx Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
src/frontend/js/hooks/useOpenEdxProfile/index.ts Outdated Show resolved Hide resolved
src/frontend/js/hooks/useOpenEdxProfile/utils/index.ts Outdated Show resolved Hide resolved
src/frontend/js/pages/DashboardOpenEdxProfile/index.tsx Outdated Show resolved Hide resolved
src/frontend/js/hooks/useOpenEdxProfile/utils/index.ts Outdated Show resolved Hide resolved
src/frontend/js/types/openEdx.ts Outdated Show resolved Hide resolved
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 7 times, most recently from 0cd1be7 to b8af23b Compare April 8, 2024 07:50
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch from b8af23b to 19c83de Compare April 8, 2024 12:37
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 5 times, most recently from 88a4923 to 367ccf7 Compare April 9, 2024 12:32
Copy link
Member

@jbpenrath jbpenrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comments batch then LGTM ✅

src/frontend/js/api/utils.ts Outdated Show resolved Hide resolved
src/frontend/scss/objects/_form.scss Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 100 to 111
get: (username: string) => {
return Promise.resolve({
username: 'j_do',
name: 'John Do',
email: '[email protected]',
country: 'fr',
level_of_education: OpenEdxLevelOfEducation.MASTER_OR_PROFESSIONNAL_DEGREE,
gender: OpenEdxGender.MALE,
year_of_birth: '1971',
'pref-lang': OpenEdxLanguageIsoCode.ENGLISH,
language_proficiencies: [{ code: OpenEdxLanguageIsoCode.ENGLISH }],
} as OpenEdxApiProfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get: (username: string) => {
return Promise.resolve({
username: 'j_do',
name: 'John Do',
email: '[email protected]',
country: 'fr',
level_of_education: OpenEdxLevelOfEducation.MASTER_OR_PROFESSIONNAL_DEGREE,
gender: OpenEdxGender.MALE,
year_of_birth: '1971',
'pref-lang': OpenEdxLanguageIsoCode.ENGLISH,
language_proficiencies: [{ code: OpenEdxLanguageIsoCode.ENGLISH }],
} as OpenEdxApiProfile);
get: (username: string): Promise<OpenEdxApiProfile> => {
return Promise.resolve({
NathanVss marked this conversation as resolved.
username: 'j_do',
name: 'John Do',
email: '[email protected]',
country: 'fr',
level_of_education: OpenEdxLevelOfEducation.MASTER_OR_PROFESSIONNAL_DEGREE,
gender: OpenEdxGender.MALE,
year_of_birth: '1971',
'pref-lang': OpenEdxLanguageIsoCode.ENGLISH,
date_joined: '1970-01-01T00:00:00Z'
language_proficiencies: [{ code: OpenEdxLanguageIsoCode.ENGLISH }],
});

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why defined the type again where it's already done in types/api.ts ?

export interface APIAuthentication {
  login: () => void;
  logout: () => Promise<void>;
  me: () => Promise<Nullable<User>>;
  register: () => void;
  // routes below are only defined for fonzie auth backend
  accessToken?: () => Nullable<string>;
  account?: {
    get: (username: string) => Promise<OpenEdxApiProfile>;
  };
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed you could remove the returned type. By purpose was mainly to remove the as OpenEdxApiProfile

src/frontend/js/api/lms/openedx-fonzie.ts Outdated Show resolved Hide resolved
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch 3 times, most recently from c991bc6 to b8f74e4 Compare April 9, 2024 14:55
checkStatus function is used outside of api/joanie.ts and therefor need
to be in a utility file.
we'll have new usage of list of DashboardBox, it's better to have a
centralize component to set generic gap between them
Use new DashboardBox.List on address list page.
To easly reuse form layout, we add a Form component that centralize
form's blocks
use new Form component were form classes were used
We want to display OpenEdx read-only informations about the user.
To edit theses informations, a link open a new tab with OpenEdx profile
form page.
use test wrapper in DashboardEditCreditCard.spec.tsx and
DashboardCreditCardsManagement/index.spec.tsx
@rlecellier rlecellier force-pushed the rlecellier/open_edx_profile_form branch from b8f74e4 to 3e22273 Compare April 10, 2024 12:17
@rlecellier rlecellier merged commit 0e3ee92 into master Apr 10, 2024
21 checks passed
@rlecellier rlecellier deleted the rlecellier/open_edx_profile_form branch April 10, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants