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

Order filtering by date #2860

Merged
merged 30 commits into from
Sep 20, 2017
Merged

Conversation

joykare
Copy link
Contributor

@joykare joykare commented Sep 14, 2017

Resolves #2359

How to test

  • Make a couple of orders (better if you change the time orders are created to observe that the date filter works)
  • Pick a range of dates
  • Observe that orders are filtered correctly
  • Try filtering by status and searching for a particular group of orders
  • Observe that the date filter works in tandem with the other filter and search

@rymorgan
Copy link
Contributor

@joykare here are my thoughts on the date picker styling. https://zpl.io/bz8M3ME

@joykare joykare changed the title [WIP] Order filtering by date Order filtering by date Sep 19, 2017
@joykare
Copy link
Contributor Author

joykare commented Sep 19, 2017

@rymorgan I did not add question-label at the bottom of the calendar because it does not have any functionality (the keyboard shortcuts on react-dates don't work with this particular implementation).

Otherwise good for a quick check

@rymorgan
Copy link
Contributor

@joykare I'll check it out. I only added the question mark b/c I thought the react calendar had that to explain how to use the calendar. But, I think, not including it is fine. I'll check out your PR.

@rymorgan
Copy link
Contributor

Some small design tweaks. Looking pretty good though!

date-pick-feedback-2
date-pick-feedback-1

@rymorgan
Copy link
Contributor

rymorgan commented Sep 19, 2017

Also, the date picker doesn't seem to work for end-date. In the following video I can see my order for the 18th when it's my start-date but not for end-date.

date-pick

@rymorgan
Copy link
Contributor

Also, one more thing for the rollover state it looks can you use the hover color from here:
https://styleguide.reactioncommerce.com/reaction/guide/colors

This one:
@rui-info-hover

Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

Haven't tested yet but just some minor style questions


class OrderActions extends Component {
static propTypes = {
className: PropTypes.string,
className: PropTypes.object,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable name sounds like it should be a string but it appears it's not now. Can we give it a more descriptive name?

@@ -18,6 +18,7 @@ class OrderDashboard extends Component {
handleSelect: PropTypes.func,
isLoading: PropTypes.object,
multipleSelect: PropTypes.bool,
onDatesChange: PropTypes.func,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there some sort of pattern you are using for naming functions onThisChange as opposed to handleThisChange? If not I would like to standardize on one or the other. If so, let's codify this in a style guide somewhere so we can be consistent.

import React, { Component } from "react";
import PropTypes from "prop-types";
import { registerComponent } from "@reactioncommerce/reaction-components";
import { DayPickerRangeController } from "react-dates";
Copy link
Collaborator

Choose a reason for hiding this comment

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

import order

});

if (this.props.onDatesChange) {
this.props.onDatesChange(startDate, endDate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we wrapping this in a conditional? Will this function not always exist? And if not shouldn't we throw an error? I feel like this is an anti-pattern that has crept into our code somehow.

Also, maybe this is unavoidable but it seems like having this function and the one passed in via props both having the same name is a recipe for a bug down the road?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason we have that conditional is b/c you dont have to have a prop function for when dates change; but in case you want to add some operations/ or change some stuff onDateChange specific to the component that extends the calendarPicker you could do that under this function.
Other example: https://github.com/reactioncommerce/reaction/blob/master/imports/plugins/core/ui/client/components/menu/menu.js#L7

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, makes sense to me

@@ -3,3 +3,4 @@ import "./favicons";

// Scripts
import "bootstrap/dist/js/npm.js";

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not add a blank line for no reason

@rymorgan
Copy link
Contributor

rymorgan commented Sep 19, 2017

Also, it's not working responsively.

I think we should -
2. HIde shipping status on the phone (and maybe completely if it's not going to make it into marketplace)
3. Make the date picker dropdown fit on mobile. I'm cool with the arrow/triangle being centered?
4. Move the search text and icon to left align with orders.

orders-responsive-issue

@brent-hoover
Copy link
Collaborator

Ran into one problem with filter but doesn't seem to be related to this PR. (#2902). Otherwise this seems to work well. Just had some minor style things to address and this should be ready to go.

@joykare
Copy link
Contributor Author

joykare commented Sep 20, 2017

@zenweasel @kieha @rymorgan good for another look

@rymorgan
Copy link
Contributor

rymorgan commented Sep 20, 2017

Now, when I select a date range the first date isn't showing up. So in the case, I have a bunch of orders on the 18th that don't know up, even though it's selected as the start date for my date range.

date-picker 1

@rymorgan
Copy link
Contributor

In anticipation of merging this PR I made a bug for the mobile responsive issue #2910

@brent-hoover
Copy link
Collaborator

@kieha We're still waiting for your official blessing on this

@joykare
Copy link
Contributor Author

joykare commented Sep 20, 2017

@rymorgan fixed the select. Works both ways now.

Copy link
Contributor

@kieha kieha left a comment

Choose a reason for hiding this comment

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

Works well. LGTM. 👍🏽

@brent-hoover
Copy link
Collaborator

@joykare Is making the filter disappear at more narrow width a quick fix you can do here rather than having it linger in another ticket?

@joykare
Copy link
Contributor Author

joykare commented Sep 20, 2017

@zenweasel not as quick a fix as I thought initially, so I asked Ryan to have that as a separate ticket so that we can move along with getting all the filters in.

@brent-hoover
Copy link
Collaborator

Because BH is not working running ESLint gives me these errors

/Users/brenthoover/Projects/js/reaction/imports/plugins/core/ui/client/components/calendarPicker/calendarPicker.js
  40:1  error  Expected indentation of 4 spaces but found 2  indent
  42:1  error  Expected indentation of 4 spaces but found 2  indent
  43:1  error  Expected indentation of 6 spaces but found 4  indent
  44:1  error  Expected indentation of 6 spaces but found 4  indent
  45:1  error  Expected indentation of 6 spaces but found 4  indent
  46:1  error  Expected indentation of 6 spaces but found 4  indent
  47:1  error  Expected indentation of 4 spaces but found 2  indent
  49:1  error  Expected indentation of 4 spaces but found 2  indent
  50:1  error  Expected indentation of 6 spaces but found 4  indent
  51:1  error  Expected indentation of 8 spaces but found 6  indent
  52:1  error  Expected indentation of 8 spaces but found 6  indent
  53:1  error  Expected indentation of 8 spaces but found 6  indent
  54:1  error  Expected indentation of 8 spaces but found 6  indent
  55:1  error  Expected indentation of 8 spaces but found 6  indent
  56:1  error  Expected indentation of 8 spaces but found 6  indent
  57:1  error  Expected indentation of 8 spaces but found 6  indent
  58:1  error  Expected indentation of 8 spaces but found 6  indent
  59:1  error  Expected indentation of 8 spaces but found 6  indent
  60:1  error  Expected indentation of 6 spaces but found 4  indent
  61:1  error  Expected indentation of 4 spaces but found 2  indent
  62:1  error  Expected indentation of 2 spaces but found 0  indent

@brent-hoover brent-hoover merged commit e4a8cb1 into marketplace Sep 20, 2017
@brent-hoover brent-hoover deleted the joykare-order-filtering-by-date-2359 branch September 20, 2017 23:24
@spencern spencern mentioned this pull request Oct 11, 2017
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.

4 participants