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
[CHEC-1009] Customer account page #149
Conversation
CHEC-1009 Build a customer's home page
After a user has logged in they'll be sent to this page. We can show some super basic information such as:
These are available from the following APIs:
Both of those APIs require knowledge of the customer ID, which is returned in the login handler (CHEC-1008), and the customer JWT which is also returned in that task. We can probably store these in session storage or something… cc @guy |
A couple of minor things from your screenshots: can you use sentence casing, and your dates don't look like they're being parsed correctly |
334a826
to
e4b459b
Compare
I've rebased locally this onto #152 in order to test it because we broke things. Some feedback:
There are also a couple of console errors on this page for me: I don't think this is related to this PR specifically, but I think we should change the "Logout" link in the top right header when you're logged in to "Account" which sends you to your account, then put the Logout link somewhere on the account page: |
…dding and containers, adding breadcrumbs
Hey @kvisca, still a few things: Functionally, I notice that every click from "My account" to an order, back again, to another order etc, reloads everything in Redux (categories, products, cart). This is definitely not ideal. Good news is this looks good on mobile! |
…ed date generators to check for invalid dates.
@robbieaverill Thanks for the feedback, should be good to go now. Let me know if you catch anything else! |
Thanks, @robbieaverill. I've updated as requested. |
This shows when I first log in. I can navigate into an order view and back again and it will still show. When I refresh the page it renders the date correctly. At that point the
This is still happening |
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.
Lots of these comments are about linting. Please make sure you lint your code (yarn lint
).
import moment from 'moment'; | ||
import { useSelector } from 'react-redux' | ||
|
||
export default function SingleOrderPage() { |
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.
The rest of this repository uses components, it feels weird to me to move away from that in one place. Can you please refactor this so it uses components instead?
useEffect(() => { | ||
const fetchOrderById = async (id) => { | ||
try { | ||
const order = await commerce.customer.getOrder(id, customer.id); |
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.
Do you want to store these in Redux instead, so they'll persist between pages and avoid refetching?
setData(order.data); | ||
} catch (err) { | ||
setLoading(false); | ||
setError(err?.message); |
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.
Is this operator supported enough to use yet? If our transpiler supports it then all good, otherwise it's not supported in IE which is a good reason not to use it in this repository
Just so you're aware, yarn lint doesn't catch any of this on this project. |
Cool, I'll update the linting rules later. In the meantime please take advantage of the human linting results above 😄 |
Much appreciated 👍 |
Nice work. We can address any outstanding issues in new PRs in future 👍 |
Adding a customer's account page with an individual order view page.
Account Page
Order Page