This repository was archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
PON-106&80: Subscription related design changes #276
Merged
NawfalAhmed
merged 1 commit into
ponderosa-master
from
nahmed/pon-106/design-orders-and-subs
Apr 25, 2023
+871
−110
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 84 additions & 82 deletions
166
src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,96 +1,98 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`<OrderHistoryPage /> Renders correctly in various states renders orders table with pagination 1`] = ` | ||
| <div | ||
| className="page__order-history container-fluid py-5" | ||
| <section | ||
| className="page__order-history" | ||
| > | ||
| <h1> | ||
| Order History | ||
| </h1> | ||
| <nav | ||
| aria-label="pagination navigation" | ||
| className="pagination-default" | ||
| > | ||
| <div | ||
| aria-atomic={true} | ||
| aria-live="polite" | ||
| aria-relevant="text" | ||
| className="sr-only" | ||
| <div> | ||
| <nav | ||
| aria-label="pagination navigation" | ||
| className="pagination-default" | ||
| > | ||
| Page 2, Current Page, of 10 | ||
| </div> | ||
| <ul | ||
| className="pagination" | ||
| > | ||
| <li | ||
| className="page-item" | ||
| <div | ||
| aria-atomic={true} | ||
| aria-live="polite" | ||
| aria-relevant="text" | ||
| className="sr-only" | ||
| > | ||
| Page 2, Current Page, of 10 | ||
| </div> | ||
| <ul | ||
| className="pagination" | ||
| > | ||
| <button | ||
| aria-label="Previous, Page 1" | ||
| className="previous page-link btn btn-primary" | ||
| disabled={false} | ||
| onClick={[Function]} | ||
| type="button" | ||
| <li | ||
| className="page-item" | ||
| > | ||
| <div> | ||
| <span | ||
| className="pgn__icon" | ||
| > | ||
| <svg | ||
| aria-hidden={true} | ||
| fill="none" | ||
| focusable={false} | ||
| height={24} | ||
| role="img" | ||
| viewBox="0 0 24 24" | ||
| width={24} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| <button | ||
| aria-label="Previous, Page 1" | ||
| className="previous page-link btn btn-primary" | ||
| disabled={false} | ||
| onClick={[Function]} | ||
| type="button" | ||
| > | ||
| <div> | ||
| <span | ||
| className="pgn__icon" | ||
| > | ||
| <path | ||
| d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| Previous | ||
| </div> | ||
| </button> | ||
| </li> | ||
| <li | ||
| className="page-item" | ||
| > | ||
| <button | ||
| aria-label="Next, Page 3" | ||
| className="next page-link btn btn-primary" | ||
| disabled={false} | ||
| onClick={[Function]} | ||
| type="button" | ||
| <svg | ||
| aria-hidden={true} | ||
| fill="none" | ||
| focusable={false} | ||
| height={24} | ||
| role="img" | ||
| viewBox="0 0 24 24" | ||
| width={24} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| Previous | ||
| </div> | ||
| </button> | ||
| </li> | ||
| <li | ||
| className="page-item" | ||
| > | ||
| <div> | ||
| Next | ||
| <span | ||
| className="pgn__icon" | ||
| > | ||
| <svg | ||
| aria-hidden={true} | ||
| fill="none" | ||
| focusable={false} | ||
| height={24} | ||
| role="img" | ||
| viewBox="0 0 24 24" | ||
| width={24} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| <button | ||
| aria-label="Next, Page 3" | ||
| className="next page-link btn btn-primary" | ||
| disabled={false} | ||
| onClick={[Function]} | ||
| type="button" | ||
| > | ||
| <div> | ||
| Next | ||
| <span | ||
| className="pgn__icon" | ||
| > | ||
| <path | ||
| d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| </div> | ||
| </button> | ||
| </li> | ||
| </ul> | ||
| </nav> | ||
| </div> | ||
| <svg | ||
| aria-hidden={true} | ||
| fill="none" | ||
| focusable={false} | ||
| height={24} | ||
| role="img" | ||
| viewBox="0 0 24 24" | ||
| width={24} | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| </span> | ||
| </div> | ||
| </button> | ||
| </li> | ||
| </ul> | ||
| </nav> | ||
| </div> | ||
| </section> | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,7 @@ | ||
| import ConnectedOrderHistoryPage from './OrderHistoryPage'; | ||
| import OrderHistoryPage from './OrderHistoryPage'; | ||
| import reducer from './reducer'; | ||
| import saga from './saga'; | ||
| import { storeName } from './selectors'; | ||
|
|
||
| export { | ||
| ConnectedOrderHistoryPage, | ||
| reducer, | ||
| saga, | ||
| storeName, | ||
| }; | ||
| export default OrderHistoryPage; | ||
| export { reducer, saga, storeName }; |
49 changes: 49 additions & 0 deletions
49
src/orders-and-subscriptions/OrdersAndSubscriptionsPage.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import React, { useEffect } from 'react'; | ||
| import { FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
|
|
||
| import Subscriptions from '../subscriptions'; | ||
| import OrderHistory from '../order-history'; | ||
|
|
||
| const OrdersAndSubscriptionsPage = () => { | ||
| // TODO: get from waffle-flag | ||
| const isB2CSubsEnabled = true; | ||
|
|
||
| useEffect(() => { | ||
| if (isB2CSubsEnabled) { | ||
| document.title = 'Orders and Subscriptions | edX'; | ||
| } | ||
| }, [isB2CSubsEnabled]); | ||
|
|
||
| if (!isB2CSubsEnabled) { | ||
| return ( | ||
| <div className="page__orders-and-subscriptions container-fluid py-5"> | ||
| <OrderHistory isB2CSubsEnabled={false} /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="page__orders-and-subscriptions container-fluid py-4.5"> | ||
| <div className="section"> | ||
| <FormattedMessage | ||
| id="ecommerce.order.history.main.heading" | ||
| defaultMessage="My orders and subscriptions" | ||
| description="Heading for orders and subscriptions page." | ||
| > | ||
| {(text) => <h1 className="text-primary-700">{text}</h1>} | ||
| </FormattedMessage> | ||
| <FormattedMessage | ||
| id="ecommerce.order.history.main.subtitle" | ||
| defaultMessage="Manage your program subscriptions and view your order history." | ||
| description="Subtitle of Heading for orders and subscriptions page." | ||
| > | ||
| {(text) => <span className="text-dark-900">{text}</span>} | ||
| </FormattedMessage> | ||
| </div> | ||
| <Subscriptions /> | ||
| <OrderHistory isB2CSubsEnabled /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default OrdersAndSubscriptionsPage; |
30 changes: 30 additions & 0 deletions
30
src/orders-and-subscriptions/OrdersAndSubscriptionsPage.test.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* eslint-disable global-require */ | ||
| import React from 'react'; | ||
| import renderer from 'react-test-renderer'; | ||
| import { Provider } from 'react-redux'; | ||
| import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
| import configureMockStore from 'redux-mock-store'; | ||
|
|
||
| import OrdersAndSubscriptionsPage from './OrdersAndSubscriptionsPage'; | ||
|
|
||
| const mockStore = configureMockStore(); | ||
| const storeMocks = { | ||
| ordersLoaded: require('../order-history/__mocks__/ordersLoaded.mockStore'), | ||
| }; | ||
|
|
||
| describe('<OrdersAndSubscriptions />', () => { | ||
| describe('Renders correctly in various states', () => { | ||
| it('renders with orders and subscriptions', () => { | ||
| const tree = renderer | ||
| .create( | ||
| <IntlProvider locale="en"> | ||
| <Provider store={mockStore(storeMocks.ordersLoaded)}> | ||
| <OrdersAndSubscriptionsPage /> | ||
| </Provider> | ||
| </IntlProvider>, | ||
| ) | ||
| .toJSON(); | ||
| expect(tree).toMatchSnapshot(); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.