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

feat: add Orders to Account Profile #507

Merged
merged 57 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
c4d7d1e
add header / title to Address Book
kieckhafer Feb 12, 2019
5448681
add ProfileOrders component to Profile page
kieckhafer Feb 12, 2019
c4a172e
add query and HOC to get multiple orders per accountId
kieckhafer Feb 12, 2019
201c761
Merge remote-tracking branch 'origin/develop' into feat-kieckhafer-ne…
kieckhafer Feb 13, 2019
baa027e
use primaryShopId instead of shop._id in withORders
kieckhafer Feb 14, 2019
96bf62e
add date-fns for date formatting on account orders page
kieckhafer Feb 14, 2019
886c093
Merge remote-tracking branch 'origin/develop' into feat-kieckhafer-ne…
kieckhafer Feb 14, 2019
458a24a
update gql with new edges / node
kieckhafer Feb 14, 2019
5af41df
add language to query
kieckhafer Feb 20, 2019
4eaecf6
fix proptype
kieckhafer Feb 20, 2019
fb67fac
add spacing around container
kieckhafer Feb 20, 2019
39d7b08
add ProfileOrders component
kieckhafer Feb 20, 2019
80e6920
add tracking info to gql query
kieckhafer Feb 21, 2019
fb34f49
add new components for OrderCard
kieckhafer Feb 21, 2019
d82ab80
ProfileOrders component
kieckhafer Feb 22, 2019
c340aa3
OrderCard component
kieckhafer Feb 22, 2019
b3e0692
destructure some variables
kieckhafer Feb 22, 2019
499d4d7
add filter to gql query
kieckhafer Feb 22, 2019
38dad5a
add header to addressbook page
kieckhafer Feb 22, 2019
3ada014
OrderCardSummary component
kieckhafer Feb 22, 2019
3158c57
OrderCardFulfillmentGroup component
kieckhafer Feb 22, 2019
8256e4f
update OrderCardSummary to remove styles no longer needed with Compon…
kieckhafer Feb 22, 2019
1acaf8e
add order summary to Order fragment
kieckhafer Feb 22, 2019
4d170f5
lint fixes
kieckhafer Feb 22, 2019
336f6e8
OrderCardHeader component
kieckhafer Feb 25, 2019
f1eb1aa
update reaction component library version
kieckhafer Feb 25, 2019
a4721bb
update test snapshots
kieckhafer Feb 25, 2019
4edbb59
Merge remote-tracking branch 'origin/develop' into feat-kieckhafer-ne…
kieckhafer Feb 25, 2019
6347b4c
move order status into it's own badge component
kieckhafer Feb 25, 2019
a5b5289
update tests for all new components
kieckhafer Feb 25, 2019
cb6cd88
Merge remote-tracking branch 'origin/develop' into feat-kieckhafer-ne…
kieckhafer Feb 26, 2019
ab1f6f8
fix console warnings
kieckhafer Feb 26, 2019
de74413
separate account profile UIstore data
kieckhafer Feb 27, 2019
f4f647d
udpate test with new data
kieckhafer Feb 27, 2019
a23823c
move language to display query
kieckhafer Feb 27, 2019
cf2444c
update with new data format
kieckhafer Feb 27, 2019
b9929ce
add pagination info to queries
kieckhafer Feb 27, 2019
f70a0a1
fix proptypes
kieckhafer Feb 27, 2019
fd9994c
move error check below dropdown
kieckhafer Feb 27, 2019
bd61059
update select with new dropdown names
kieckhafer Feb 27, 2019
5de3153
add pagination component to ProfileOrders
kieckhafer Feb 27, 2019
71cdd6f
split profile page to deal with pagination issues
kieckhafer Feb 27, 2019
b61e315
add ProfileMenu component
kieckhafer Feb 27, 2019
3251034
use imported toJS to appease test gods
kieckhafer Feb 27, 2019
f5a068f
pass correct query name
kieckhafer Feb 27, 2019
02adb5f
updated snapshots with new data
kieckhafer Feb 27, 2019
e8ce8d4
lint fix
kieckhafer Feb 27, 2019
57bbca5
add more sizes to pagination defaults to allow smaller result groupin…
kieckhafer Feb 27, 2019
3522b09
reset search params when switching order type
kieckhafer Feb 27, 2019
152d437
tests and linting
kieckhafer Feb 27, 2019
48fa874
use new `OrderCard` for order thank you page
kieckhafer Feb 27, 2019
08849ac
Merge branch 'develop' into feat-kieckhafer-newAccountPage
kieckhafer Feb 27, 2019
0778b80
refactor: change isHeaderOpen to isExpanded for better syncronicity a…
kieckhafer Feb 27, 2019
1b0e5c2
Merge branch 'feat-kieckhafer-newAccountPage' of github.com:/reaction…
kieckhafer Feb 27, 2019
31a60ec
Merge remote-tracking branch 'origin/develop' into feat-kieckhafer-ne…
kieckhafer Mar 6, 2019
241713a
add fulfillmentGroup._id as key
kieckhafer Mar 6, 2019
3b70679
update snapshots
kieckhafer Mar 7, 2019
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@material-ui/core": "^3.9.2",
"@reactioncommerce/components": "^0.63.0",
"@reactioncommerce/components": "^0.64.0",
"@reactioncommerce/components-context": "^1.2.0",
"@segment/snippet": "^4.4.0",
"apollo-cache-inmemory": "^1.4.2",
Expand All @@ -48,6 +48,7 @@
"compression": "^1.7.3",
"cookie-parser": "^1.4.3",
"cookie-session": "^2.0.0-beta.3",
"date-fns": "^1.30.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a decision to use date-fns instead of moment for new projects? It's fine with me but I'd like to see the decision recorded and communicated if it hasn't been.

Copy link
Member Author

Choose a reason for hiding this comment

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

We had a chat in Slack about a light(er)weight solution for dates, considering we need very little. Made a DR and tagged you in Notion.

"envalid": "^4.2.0",
"express": "^4.16.4",
"graphql": "14.1.1",
Expand Down
5 changes: 5 additions & 0 deletions src/components/CartItems/CartItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class CartItems extends Component {
productURLPath: PropTypes.string
}

static defaultProps = {
onChangeCartItemQuantity() { },
onRemoveItemFromCart() { }
};

handleItemQuantityChange = (quantity, _id) => {
const { onChangeCartItemQuantity } = this.props;

Expand Down
3 changes: 3 additions & 0 deletions src/components/CheckoutActions/CheckoutActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export default class CheckoutActions extends Component {
onSetShippingAddress: PropTypes.func.isRequired
}),
clearAuthenticatedUsersCart: PropTypes.func.isRequired,
client: PropTypes.shape({
mutate: PropTypes.func.isRequired
}),
orderEmailAddress: PropTypes.string.isRequired,
paymentMethods: PropTypes.array
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ exports[`basic snapshot 1`] = `
}

.c11 {
position: absolute;
position: initial;
bottom: 16px;
right: 0;
text-align: right;
}

.c14 {
position: initial;
position: absolute;
margin-top: 10px;
bottom: 16px;
right: 0;
Expand Down Expand Up @@ -228,14 +228,14 @@ exports[`basic snapshot 1`] = `
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 16px;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .03em;
-moz-letter-spacing: .03em;
-ms-letter-spacing: .03em;
letter-spacing: .03em;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
border-top-color: #e6e6e6;
border-top-style: solid;
Expand All @@ -247,18 +247,18 @@ exports[`basic snapshot 1`] = `
text-align: left;
}

.c20 {
.c24 {
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 16px;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .03em;
-moz-letter-spacing: .03em;
-ms-letter-spacing: .03em;
letter-spacing: .03em;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
border-top-color: #e6e6e6;
border-top-style: solid;
Expand All @@ -274,23 +274,92 @@ exports[`basic snapshot 1`] = `
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 16px;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .03em;
-moz-letter-spacing: .03em;
-ms-letter-spacing: .03em;
letter-spacing: .03em;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
text-align: right;
}

.c20 {
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
border-top-color: #e6e6e6;
border-top-style: solid;
border-top-width: 0;
padding-bottom: 16px;
padding-left: 0;
padding-right: 0;
padding-top: 8px;
text-align: left;
}

.c21 {
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 16px;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
padding-bottom: 16px;
text-align: right;
}

.c22 {
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 14px;
font-style: normal;
font-stretch: normal;
font-weight: 400;
-webkit-letter-spacing: .02em;
-moz-letter-spacing: .02em;
-ms-letter-spacing: .02em;
letter-spacing: .02em;
line-height: 1;
border-top-color: #e6e6e6;
border-top-style: solid;
border-top-width: 1px;
padding-bottom: 16px;
padding-left: 0;
padding-right: 0;
padding-top: 16px;
text-align: left;
}

.c23 {
text-align: right;
padding-bottom: 16px;
padding-top: 16px;
}

.c25 {
-webkit-font-smoothing: antialiased;
color: #3c3c3c;
font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,sans-serif;
font-size: 18px;
font-style: normal;
font-stretch: normal;
font-weight: 700;
Expand Down Expand Up @@ -585,7 +654,7 @@ exports[`basic snapshot 1`] = `
<td
className="c18"
>
Item total
Items:
</td>
<td
className="c19 c18"
Expand All @@ -597,7 +666,7 @@ exports[`basic snapshot 1`] = `
<td
className="c18"
>
Shipping
Shipping:
</td>
<td
className="c19 c18"
Expand All @@ -609,7 +678,7 @@ exports[`basic snapshot 1`] = `
<td
className="c18"
>
Surcharge
Surcharges:
</td>
<td
className="c19 c18"
Expand All @@ -619,27 +688,27 @@ exports[`basic snapshot 1`] = `
</tr>
<tr>
<td
className="c18"
className="c20"
>
Tax
Tax:
</td>
<td
className="c19 c18"
className="c21 c18"
>
-
</td>
</tr>
<tr>
<td
className="c20"
className="c22"
>
Order total
Order total:
</td>
<td
className="c19 c20"
className="c23 c24"
>
<span
className="c21"
className="c25"
>
$118
</span>
Expand Down
94 changes: 94 additions & 0 deletions src/components/OrderCard/OrderCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, { Component, Fragment } from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
import OrderCardHeader from "components/OrderCardHeader";
import OrderCardFulfillmentGroup from "components/OrderCardFulfillmentGroup";
import OrderCardSummary from "components/OrderCardSummary";
import PageLoading from "components/PageLoading";

const styles = (theme) => ({
orderCard: {
border: `solid 1px ${theme.palette.reaction.black10}`,
borderRadius: "2px",
marginBottom: theme.spacing.unit * 2.5
},
orderCardHeader: {},
orderCardFulfillmentGroups: {},
orderCardSummary: {
borderTop: theme.palette.borders.default,
paddingBottom: theme.spacing.unit * 2,
paddingLeft: theme.spacing.unit * 2,
paddingRight: theme.spacing.unit * 2,
paddingTop: theme.spacing.unit * 2
}
});

@withStyles(styles, { withTheme: true })
class OrderCard extends Component {
static propTypes = {
classes: PropTypes.object,
isExpanded: PropTypes.bool,
isLoadingOrders: PropTypes.bool,
order: PropTypes.shape({
email: PropTypes.string.isRequired,
fulfillmentGroups: PropTypes.arrayOf(PropTypes.object).isRequired,
payments: PropTypes.arrayOf(PropTypes.object),
referenceId: PropTypes.string.isRequired
})
};

renderFulfillmentGroups() {
const { order: { fulfillmentGroups } } = this.props;

return (
<Fragment>
{fulfillmentGroups.map((fulfillmentGroup, index) => (
<OrderCardFulfillmentGroup
key={`${fulfillmentGroup._id}`}
fulfillmentGroup={fulfillmentGroup}
currentGroupCount={index + 1}
totalGroupsCount={fulfillmentGroups.length}
/>
))}
</Fragment>
);
}

renderHeader() {
const { isExpanded, order } = this.props;

return <OrderCardHeader isExpanded={isExpanded} order={order} />;
}

renderSummary() {
const { order: { summary } } = this.props;
return <OrderCardSummary summary={summary} />;
}

render() {
const { classes, isLoadingOrders } = this.props;

if (isLoadingOrders) return <PageLoading message="Loading order details..." />;

return (
<Grid container>
<Grid item xs={12} md={12}>
<div className={classes.orderCard}>
<header className={classes.orderCardHeader}>
{this.renderHeader()}
</header>
<section className={classes.orderCardFulfillmentGroups}>
{this.renderFulfillmentGroups()}
</section>
<section className={classes.orderCardSummary}>
{this.renderSummary()}
</section>
</div>
</Grid>
</Grid>
);
}
}

export default OrderCard;
Loading