diff --git a/src/components/mainPage/invoice.jsx b/src/components/mainPage/invoice.jsx
index e8f84ea..e8bd3e9 100644
--- a/src/components/mainPage/invoice.jsx
+++ b/src/components/mainPage/invoice.jsx
@@ -1,18 +1,22 @@
import React from "react";
-const Invoice = (props) => {
+// re-arrange to make invoice detail a self-contained element
+const Invoice = ( {invoiceDetails} ) => {
+ let addressInfo = invoiceDetails.purchase_units[0].shipping.address;
+ let address = `${addressInfo.address_line_1} ${addressInfo.admin_area_2}, ${addressInfo.admin_area_1} ${addressInfo.postal_code}`;
return (
- Date Purchased: {props.date}
+ Date Purchased: {invoiceDetails.create_time}
- Item: {props.itemName}
+ Item: {invoiceDetails.purchase_units[0].description}
- Amount Paid: ${props.itemValue}
+ Amount Paid: ${invoiceDetails.purchase_units[0].amount.value}
- Ship to: {props.buyerName}
+ Ship to: {invoiceDetails.purchase_units[0].shipping.name.full_name}
- Shipping address: {props.streetAddr} {props.city}, {props.state} {props.postalCode}
+ {/* Shipping address: {streetAddr} {city}, {state} {postalCode} */}
+ Shpping address: {address}
);
}
diff --git a/src/components/mainPage/landing.jsx b/src/components/mainPage/landing.jsx
index 90e2986..169306e 100644
--- a/src/components/mainPage/landing.jsx
+++ b/src/components/mainPage/landing.jsx
@@ -2,7 +2,8 @@ import React, { useState } from "react";
import "./home.css";
import { PayPal, Purchase, ShowCase, Home } from '.';
-const details = () => {
+// component
+const Details = () => {
return (
<>
@@ -11,12 +12,13 @@ const details = () => {
>
);
};
+
const Landing = () => {
const [showDetails, setShowDetails] = useState(false);
return (
<>
- {showDetails ? details() : setShowDetails(true)} />}
+ {showDetails ? : setShowDetails(true)} />}
>
);
};
diff --git a/src/components/mainPage/paypal.jsx b/src/components/mainPage/paypal.jsx
index fa3b05d..a652bbd 100644
--- a/src/components/mainPage/paypal.jsx
+++ b/src/components/mainPage/paypal.jsx
@@ -48,18 +48,8 @@ const PayPal = () => {
- {showInvoice &&
-
- }
+ {/* This is a nice touch */}
+ {showInvoice && }
>
);
};