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
β¨(front) add new SaleTunnel π #2355
Conversation
281dbb7
to
8fac024
Compare
8fac024
to
f7bb135
Compare
src/frontend/js/components/SaleTunnel/CreditCardSelector/_styles.scss
Outdated
Show resolved
Hide resolved
Nice work, reviewable with ease π |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a first look and i'll go back on it tomorow
next commit:
π§βπ»(front) add Cunningham test utils
|
||
.c__modal__backdrop { | ||
// Make sure the overlay is above any random 0-1-2 z-indexes in content and 200 z-index to the top bar | ||
z-index:300; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use variable for z-index ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but here it is a special case only because richie uses different z-indexes
src/frontend/js/components/SaleTunnel/CreditCardSelector/index.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/CreditCardSelector/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty and yes easy to review.
it's quite big so i'm sure i missed some things tho.
src/frontend/js/components/PaymentInterfaces/PayplugLightbox.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/PaymentInterfaces/PayplugLightbox.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/PaymentInterfaces/PayplugLightbox.tsx
Outdated
Show resolved
Hide resolved
// This pattern is ugly but I couldn't find a better way to achieve it in a nicer way. | ||
// Without this, when we call onPaymentSuccess() directly from the after polling function, | ||
// it is not the latest version of the function, so the value of `order` inside the context function (defined in GenericSaleTunnel.tsx) | ||
// will be undefined, then calling onFinish(order) with an undefined order. | ||
const onPaymentSuccessRef = useRef(onPaymentSuccess); | ||
onPaymentSuccessRef.current = onPaymentSuccess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving most part of onPaymentSuccess
here ?
We could have this function define here with :
WebAnalyticsAPIHandler()?.sendCourseProductEvent(
CourseProductEvent.PAYMENT_SUCCEED,
props.eventKey,
);
// Once the user has completed the purchase, we need to refetch the orders
// to update the ordersQuery cache
invalidateOrders();
refetchOmniscientOrders();
queryClient.invalidateQueries({ queryKey: ['user', 'enrollments'] });
props.onFinish?.(order!);
GenericSaleTunnel would just keep the step change.
Then you already retrieve the new order in this component(GenericPaymentButton), it could be used for onFinish()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your point. My approach is to make sure that this button can be generic, in the V2 we will have different buttons based on which type of sale tunnel we're in so I think having this logic inside the generic sale tunnel for know better split the SRPs
0d03ccd
to
0ef4c66
Compare
0ef4c66
to
1eaa2f8
Compare
e7cd02d
to
97bcb0a
Compare
src/frontend/js/components/SaleTunnel/CreditCardSelector/index.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/AddressSelector/CreateAddressFormModal.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/AddressSelector/CreateAddressFormModal.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/AddressSelector/EditAddressFormModal.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/AddressSelector/index.spec.tsx
Outdated
Show resolved
Hide resolved
export function getAddressLabel(address: Address) { | ||
const part = [ | ||
address.first_name, | ||
address.last_name, | ||
address.address, | ||
address.postcode, | ||
address.city, | ||
address.country, | ||
].join(' '); | ||
if (address.title) { | ||
return `${address.title} - ${part}`; | ||
} | ||
return part; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it could be cool on two lines, but I think we will have to use a custom component to use a smaller font-size.
Work
13 quai des anglais, 75000 Paris - FR
Home
11 rue stine, 75000 Paris - FR
src/frontend/js/components/SaleTunnel/Sponsors/SaleTunnelSponsors.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/index.full-process.spec.tsx
Outdated
Show resolved
Hide resolved
@jbpenrath I can't reply to your comment about having address title on top (why?) Here is the result. We can only render the custom content in the dropdown, inside the field it break the height of the select which has a hard-defined height, so I used the option to display the label instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss that, but you must not use color token directly in sass files. Instead you must create a dedicated scheme for a component then use r-theme-val
to set the color in the component sass file.
e.g:
color: r-theme-val(dashboard-credit-cards, empty-color); |
richie/src/frontend/scss/colors/_theme.scss
Lines 250 to 252 in 72653ad
dashboard-credit-cards: ( | |
empty-color: r-color(slate-grey), | |
), |
src/frontend/js/components/SaleTunnel/AddressSelector/_styles.scss
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/AddressSelector/index.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/SaleTunnelInformation/index.tsx
Outdated
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/Sponsors/SaleTunnelSponsors.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And finally it looks good to me. Well done ! π
db976ea
to
a81aee6
Compare
The existing script was not generating all the files.
We will need this color in the PaymentSchedule component.
This in needed in order to be able to use Cunningham components in its children. We also define the modal parent selector.
This helper is currently needed to change the button fullWidth flags based on the size of the screen.
This component will be used to display upcoming and paid transactions.
For the address forms used in the sale tunnel we need to be able to reset its values.
This component is used to select / create or edit addresses.
The credit card logo used in the CreditCardSelector have a different style than the existing ones.
This component is used to select an existing credit card or to choose to register a new one during payment.
These components will be used by different sale tunnels to display informations for each product. There are generic components. It is mainly used to display target courses of the matching product course.
Those mainly focus on Select test utils that are really handy.
This one will be replaced with the new SaleTunnel, it is not longer needed.
The sale tunnel will be replaced by a new one that is able to handle numerous new features.
This new SaleTunnel is a one page components providing a versatile generic component that can be used to create various versions of sale tunnels. At the moment there are two main variants which are CertificateSaleTunnel and CredentialSaleTunnel.
We now want to use the new sale tunnel to buy product.
By adding this full name form we extract the responsability to save the form up to the sale tunnel via submitCallbacks. Under the hood it stays the same.
Previously we were using an input to render a read only field, which was not indeal. Here is the new design based on sketches.
It was lacking a11y, giving initials to a title is great, but it's better to give the full title via aria label.
When the avatar was used standalone the initials positionned with absolute we not contextualized via their own container, so they were positionned based on the nearest relative/absolute parent.
Previously the credit card logos were rendered on top of a blue background, but as it is not the case in the sale tunnel, we got white logos on top of white background, which was not ideal. Now the approach is to make sure logos are self-visible on their own.
a81aee6
to
32a29b4
Compare
Sketches
https://www.figma.com/file/TZi5QztVxCxIaiH2kGDzm8/Untitled?type=design&node-id=63-2&mode=design&t=pO3rMuirTe10eCxP-0
Help for reviewers
In order to be able to compile and test this PR you need to build your project with the following line in your
package.json
You need to checkout and
yarn install
your local Cunningham project on this PR: openfun/cunningham#315V1 Todo List
V2 Todo List