Skip to content

Commit

Permalink
[WIP] development to marketplace (#2730)
Browse files Browse the repository at this point in the history
development to marketplace
  • Loading branch information
jshimko authored Aug 24, 2017
1 parent e405fd6 commit b2a192c
Show file tree
Hide file tree
Showing 49 changed files with 293 additions and 477 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.fileStorage/
.vscode
.idea
.c9
*.csv
*.dat
*.gz
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Diversity is one of our huge strengths, but it can also lead to communication is

This isn’t an exhaustive list of things that you can’t do. Rather, take it in the spirit in which it’s intended - a guide to make it easier to enrich all of us and the broader communities in which we participate.

This code of conduct applies to all spaces managed by Reaction Commerce. This includes our [development chat room](https://gitter.im/reactioncommerce/reaction), [forums](https://forums.reactioncommerce.com), [blog](https://blog.reactioncommerce.com), mailing lists, [issue tracker](https://github.com/reactioncommerce/reaction/issues), [project board](https://waffle.io/reactioncommerce/reaction), Reaction events and meetups, and any other forums or service created by the core project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.
This code of conduct applies to all spaces managed by Reaction Commerce. This includes our [development chat room](https://gitter.im/reactioncommerce/reaction), [forums](https://forums.reactioncommerce.com), [blog](https://blog.reactioncommerce.com), mailing lists, [issue tracker](https://github.com/reactioncommerce/reaction/issues), [project boards](https://github.com/reactioncommerce/reaction/projects), Reaction events and meetups, and any other forums or service created by the core project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.

If you believe someone is violating the code of conduct, we ask that you report it by emailing [conduct@reactioncommerce.com](mailto:conduct@reactioncommerce.com). For more details, please see our [Reporting Guidelines](https://docs.reactioncommerce.com/reaction-docs/master/reporting-guide).

Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Explore the interface and the code to give you a good overview of the product an

**Step 3:**

Explore the [GitHub issues already open on our main repo](https://waffle.io/reactioncommerce/reaction). If you find something you want to work on, let us know right there in the comments. If you are interested in a specific aspect of the project but aren't sure where to begin, feel free to ask. Start small and open up a dialogue with us. This will help to get your contributions accepted easily.
Explore the [GitHub issues already open on our main repo](https://github.com/reactioncommerce/reaction/issues) and our [GitHub project boards](https://github.com/reactioncommerce/reaction/projects). If you find something you want to work on, let us know right there in the comments. [`Pull Requests Encouraged`](https://github.com/reactioncommerce/reaction/issues?q=is%3Aissue+is%3Aopen+label%3Apull-requests-encouraged) and [`Verified Reproducible`](https://github.com/reactioncommerce/reaction/issues?q=is%3Aopen+is%3Aissue+label%3Averified-reproducible) labeled issues are a great place to start.

If you are interested in a specific aspect of the project but aren't sure where to begin, feel free to ask. Start small and open up a dialogue with us. This will help to get your contributions accepted easily.

**Step 4:**

Expand All @@ -28,7 +30,7 @@ Let us know how we can make the contribution process easier. We want to find the
[Create a pull request](https://help.github.com/articles/creating-a-pull-request/) to propose and collaborate on changes to Reaction. These changes are proposed in a PR branch, and are reviewed before merge acceptance into `development` for release.

- Should reference an issue if one exists, or provide detailed information on the goal of the PR.
- Should pass CI / Tests. New functionality should include new tests.
- Should passing a linter code review and follow Reaction style guidelines.
- Pass both [acceptance tests and unit testing](https://docs.reactioncommerce.com/reaction-docs/master/testing-reaction). New functionality should include new tests.
- Lint and adhere to the [Reaction style guide](https://docs.reactioncommerce.com/reaction-docs/master/styleguide).
- Contributors should review the CLA.
- Code reviewed before merge acceptance.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,24 @@ Multiple branches, release documentation is found at <https://docs.reactioncomme

The Reaction documentation source is located in the [reaction-docs](https://github.com/reactioncommerce/reaction-docs) repository, while the documentation site is the [reactioncommerce/redoc](https://github.com/reactioncommerce/redoc) application.

### Community

There are many ways to get connected with the Reaction core team and community:

- [Reaction Commece Gitter chat](https://gitter.im/reactioncommerce/reaction)
- [Reaction Commerce forum](https://forums.reactioncommerce.com/)
- [Reaction Community calls](http://getrxn.io/2rcCal): Join our biweekly community calls every other Wednesday at 7AM PST/10AM EST. Subscribe to our [Reaction Community Google Calendar](http://getrxn.io/2rcCal) to RSVP to the next call and check out the [agenda](https://docs.google.com/document/d/1PwenrammgQJpQfFoUUJZ96i_JJYCM_4glAjB1_ZzgwA/edit?usp=sharing).
- [Reaction Action](https://www.crowdcast.io/reactioncommerce): Follow us on [Crowdcast](https://www.crowdcast.io/reactioncommerce) to RSVP for the monthly Reaction Action livestreams.

Our [community guidelines](https://docs.reactioncommerce.com/reaction-docs/master/guidelines) can be found in our [documentation](https://docs.reactioncommerce.com/).

### Contributing

Star us on GitHub, it helps!

If you are interested in participating in the development of Reaction, that's really great!

The [Reaction Gitter channel](https://gitter.im/reactioncommerce/reaction) and [forum](https://forums.reactioncommerce.com/) are good places to engage with core contributors, the community, and to get familiar with Reaction. Our [community guidelines](https://docs.reactioncommerce.com/reaction-docs/master/guidelines) can be found in our [documentation](https://docs.reactioncommerce.com/).
If you are interested in participating in the development of Reaction, that's great! Check out the [issues](https://github.com/reactioncommerce/reaction/issues) page, starting with the [`Pull Requests Encouraged`](https://github.com/reactioncommerce/reaction/issues?q=is%3Aissue+is%3Aopen+label%3Apull-requests-encouraged) and [`Verified Reproducible`](https://github.com/reactioncommerce/reaction/issues?q=is%3Aopen+is%3Aissue+label%3Averified-reproducible) labeled issues. If you find something you want to work on, let us know in the issue comments.

Check out the [issues](https://github.com/reactioncommerce/reaction/issues) page, and if you find something you want to work on, let us know in the comments. If you're interested in a particular [project](https://github.com/reactioncommerce/reaction/projects) and you aren’t sure where to begin, feel free to ask. Start small!
If you're interested in a particular [project](https://github.com/reactioncommerce/reaction/projects), like [Marketplace](https://github.com/reactioncommerce/reaction/projects/9) and you aren’t sure where to begin, feel free to ask a core team member in the corresponding project [forum](https://gitter.im/reactioncommerce/home).

If your contribution doesn't fit with an existing issue, go ahead and [create an issue](https://github.com/reactioncommerce/reaction/issues/new) before submitting a [Pull Request](https://help.github.com/articles/about-pull-requests/). This will allow the Reaction team to give feedback if necessary.

Expand Down
1 change: 1 addition & 0 deletions client/modules/accounts/templates/members/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Template.memberSettings.helpers({
});
}
});

return permissionGroups;
},

Expand Down
5 changes: 4 additions & 1 deletion client/modules/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,14 @@ export default {

setActionViewDetail(viewData, options = {}) {
const { open } = options;
const currentRouteName = this.Router.getRouteName();

Session.set("admin/showActionView", true);
Session.set("admin/showActionViewDetail", typeof open === "boolean" ? open : true);

if (viewData) {
if (currentRouteName !== "index") {
Session.set("admin/actionView", [viewData]);
} else if (viewData) {
Session.set("admin/detailView", [viewData]);
}
},
Expand Down
2 changes: 1 addition & 1 deletion imports/plugins/core/components/lib/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function registerHOC(name, hocs = []) {
/**
* Get a component registered with registerComponent(name, component, ...hocs).
* @param {String} name The name of the component to get.
* @return {Function|React.Component|null} A (wrapped) React component
* @return {Function|React.Component} A (wrapped) React component
*/
export function getComponent(name) {
const component = ComponentsTable[name];
Expand Down
4 changes: 2 additions & 2 deletions imports/plugins/core/components/lib/hoc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { composeWithTracker } from "./composer";
import _ from "lodash";
import { Meteor } from "meteor/meteor";
import { Roles } from "meteor/alanning:roles";
import _ from "lodash";
import { Accounts, Groups } from "/lib/collections";
import { composeWithTracker } from "./composer";

let Reaction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ CoreLayout.propTypes = {
structure: PropTypes.object
};

// lowercased to match the legacy blaze "coreLayout"
registerComponent("coreLayout", CoreLayout);

export default CoreLayout;
186 changes: 186 additions & 0 deletions imports/plugins/core/orders/client/components/ordersList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames/dedupe";
import Avatar from "react-avatar";
import moment from "moment";
import { formatPriceString } from "/client/api";
import { Badge, ClickToCopy, Icon, Translation } from "@reactioncommerce/reaction-ui";
import ProductImage from "./productImage";

class OrdersList extends Component {
static propTypes = {
displayMedia: PropTypes.func,
handleClick: PropTypes.func,
orders: PropTypes.array
}

/**
* Fullfilment Badge
* @param {Object} order object containing info for order and coreOrderWorkflow
* @return {string} A string containing the type of Badge
*/
fulfillmentBadgeStatus(order) {
const orderStatus = order.workflow.status;

if (orderStatus === "new") {
return "info";
} else if (orderStatus === "coreOrderWorkflow/processing") {
return "success";
} else if (orderStatus === "coreOrderWorkflow/canceled") {
return "danger";
} else if (orderStatus === "coreOrderWorkflow/completed") {
return "primary";
}

return "default";
}

/**
* Shipping Badge
* TODO: any logic here, we don't have shipping status changes at the moment
* @return {string} A string containing the type of Badge
*/
shippingBadgeStatus() {
return "basic";
}

renderOrderButton(order) {
const startWorkflow = order.workflow.status === "new";
const classes = classnames({
"rui": true,
"btn": true,
"btn-success": startWorkflow
});

return (
<button className={classes} onClick={() => this.props.handleClick(order, startWorkflow)}>
<Icon icon="fa fa-chevron-right" />
</button>
);
}

renderOrderInfo(order) {
const { displayMedia } = this.props;

return (
<div className="order-info">
<div className="order-totals">
<span className="order-data order-data-date">
<strong>Date: </strong>
{moment(order.createdAt).fromNow()} | {moment(order.createdAt).format("MM/D/YYYY")}
</span>

<span className="order-data order-data-id">
<strong>Order ID: </strong>
<ClickToCopy
copyToClipboard={order._id}
displayText={order._id}
i18nKeyTooltip="admin.orderWorkflow.summary.copyOrderLink"
tooltip="Copy Order Link"
/>
</span>

<span className="order-data order-data-total">
<strong>Total: {formatPriceString(order.billing[0].invoice.total)}</strong>
</span>
</div>

<div className="order-items">
{order.items.map((item, i) => {
return (
<div className="order-item" key={i}>
<div className="order-item-media">
<ProductImage
item={item}
displayMedia={displayMedia}
size="small"
badge={true}
/>
</div>
</div>
);
})}
</div>
</div>
);
}

renderShipmentInfo(order) {
const emailAddress = order.email || <Translation defaultValue={"Email not availabe"} i18nKey={"admin.orderWorkflow.ordersList.emailNotFound"} />;
return (
<div className="shipment-info">
<div className="customer-info">
<Avatar
email={order.email}
round={true}
name={order.shipping[0].address.fullName}
size={30}
className="rui-order-avatar"
/>
<strong>{order.shipping[0].address.fullName}</strong> | {emailAddress}
</div>
<div className="workflow-info">
<Badge
badgeSize="large"
i18nKeyLabel={`cartDrawer.${order.shipping[0].workflow.status}`}
label={order.shipping[0].workflow.status}
status={this.shippingBadgeStatus(order)}
/>
<Badge
badgeSize="large"
i18nKeyLabel={`cartDrawer.${order.workflow.status}`}
label={order.workflow.status}
status={this.fulfillmentBadgeStatus(order)}
/>
</div>
</div>
);
}


renderOrderCard(order) {
const { handleClick } = this.props;

return (
<div className="rui card order">
<div className="content" onClick={() => handleClick(order, false)}>
{this.renderShipmentInfo(order)}
{this.renderOrderInfo(order)}
</div>
<div className="controls" onClick={() => handleClick(order)}>
{this.renderOrderButton(order)}
</div>
</div>
);
}


render() {
const { orders } = this.props;

if (orders.length) {
return (
<div className="container-fluid-sm">
{orders.map((order, i) => {
return (
<div key={i}>
{this.renderOrderCard(order)}
</div>
);
})}
</div>
);
}

return (
<div className="container-fluid-sm">
<div className="empty-view-message">
<Icon icon="fa fa-sun-o" />
<Translation defaultValue={"No orders found"} i18nKey={"order.ordersNotFound"} />
</div>
</div>
);
}
}

export default OrdersList;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { composeWithTracker } from "@reactioncommerce/reaction-components";
import { Meteor } from "meteor/meteor";
import { Media } from "/lib/collections";
import { Reaction } from "/client/api";
import { Loading } from "/imports/plugins/core/ui/client/components";
import OrdersList from "../components/orderList.js";
import {
PACKAGE_NAME,
Expand Down Expand Up @@ -168,4 +167,4 @@ const composer = (props, onData) => {
}
};

export default composeWithTracker(composer, Loading)(OrdersListContainer);
export default composeWithTracker(composer)(OrdersListContainer);
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Template.coreOrderWorkflow.helpers({
* @return {Object|Boolean} An order or false
*/
order() {
const id = this.order._id || Reaction.Router.getQueryParam("_id");
const id = this.order ? this.order._id : Reaction.Router.getQueryParam("_id");
if (id) {
return Orders.findOne(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Badge snapshot test 1`] = `
<span
className="rui badge Classes to apply"
className="rui badge"
style={
Object {
"display": "inline-flex",
Expand Down
1 change: 0 additions & 1 deletion imports/plugins/core/ui/client/components/table/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default as SortableTable } from "./sortableTable";
export { default as SortableTableLegacy } from "./sortableTableLegacy";
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ class SortableTablePagination extends Component {
</div>
<div className="-previous">
<PreviousComponent
onClick={e => { // eslint-disable-line no-unused-vars
if (!canPrevious) return;
this.changePage(page - 1);
onClick={(e) => { // eslint-disable-line no-unused-vars
if (!canPrevious) {
return this.changePage(page - 1);
}
}}
disabled={!canPrevious}
>
Expand All @@ -125,9 +126,10 @@ class SortableTablePagination extends Component {
<span className="-divider">|</span>
<div className="-next">
<NextComponent
onClick={e => { // eslint-disable-line no-unused-vars
if (!canNext) return;
this.changePage(page + 1);
onClick={(e) => { // eslint-disable-line no-unused-vars
if (!canNext) {
return this.changePage(page + 1);
}
}}
disabled={!canNext}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ import PropTypes from "prop-types";
import { registerComponent } from "@reactioncommerce/reaction-components";
import { i18next } from "/client/api";

const Translation = ({ i18nKey, defaultValue, className }) => {
const Translation = ({ i18nKey, defaultValue, ...rest }) => {
const key = i18nKey || camelCase(defaultValue);
const translation = i18next.t(key, { defaultValue });

return (
<span className={className}>{translation}</span>
<span {...rest}>{translation}</span>
);
};

Translation.propTypes = {
className: PropTypes.string,
defaultValue: PropTypes.string,
i18nKey: PropTypes.string
};
Expand Down
Loading

0 comments on commit b2a192c

Please sign in to comment.