@evenicanpm/storefront-core 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/api-manager/datasources/d365/d365-address.datasource.ts +1 -1
- package/src/api-manager/datasources/d365/d365-user.datasource.ts +0 -19
- package/src/api-manager/datasources/e4/e4-cart.datasource.ts +2 -2
- package/src/api-manager/datasources/e4/e4-product.datasource.ts +19 -4
- package/src/api-manager/datasources/e4/e4.datasource.ts +1 -2
- package/src/api-manager/datasources/e4/e4.remaps.ts +24 -0
- package/src/api-manager/datasources/e4/e4.translator.ts +17 -0
- package/src/api-manager/datasources/e4/{e4-user.datasource.ts → user/e4-user.datasource.ts} +5 -7
- package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +4 -0
- package/src/api-manager/datasources/e4/user/e4-user.translator.ts +10 -0
- package/src/api-manager/index.ts +21 -6
- package/src/api-manager/schemas/product.schema.ts +1 -1
- package/src/api-manager/services/address/queries/get-states.ts +1 -1
- package/src/api-manager/services/create-query.ts +10 -3
- package/src/api-manager/types/Datasource.ts +9 -9
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +6 -6
- package/src/components/_components/navbar/category-based-menu/components/categories.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +2 -2
- package/src/components/_components/product-dimensions/product-dimensions.tsx +114 -0
- package/src/components/_components/product-quantity-buttons/product-quantity-buttons.tsx +88 -0
- package/src/components/_components/section-header/section-header.tsx +1 -1
- package/src/components/_components/settings/setting.tsx +1 -1
- package/src/components/_components/wishlist-modal/TODO.md +10 -0
- package/src/components/_components/wishlist-modal/add-to-wishlist-button.tsx +68 -0
- package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +161 -0
- package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +174 -0
- package/src/components/_components/wishlist-modal/wishlist-modal-item.tsx +65 -0
- package/src/components/countries-input.tsx +1 -0
- package/src/hooks/use-cart.tsx +82 -0
- package/src/hooks/use-variants.tsx +85 -0
- package/src/pages/account/addresses/address-form.tsx +289 -0
- package/src/pages/account/addresses/address-item.tsx +104 -0
- package/src/pages/account/dashboard-header.tsx +123 -0
- package/src/pages/account/navigation.tsx +84 -0
- package/src/pages/account/no-records.tsx +20 -0
- package/src/pages/account/orders/icons/delivery.tsx +14 -0
- package/src/pages/account/orders/icons/package-box.tsx +13 -0
- package/src/pages/account/orders/icons/truck-filled.tsx +14 -0
- package/src/pages/account/orders/order-progress.tsx +111 -0
- package/src/pages/account/orders/order-row.tsx +61 -0
- package/src/pages/account/orders/order-summary.tsx +83 -0
- package/src/pages/account/orders/ordered-products.tsx +114 -0
- package/src/pages/account/profile/profile-button.test.tsx +59 -0
- package/src/pages/account/profile/profile-button.tsx +50 -0
- package/src/pages/account/profile/user-info.tsx +59 -0
- package/src/pages/account/styles.ts +32 -0
- package/src/pages/account/table-row.tsx +19 -0
- package/src/pages/account/wishlist/create-new-list.tsx +167 -0
- package/src/pages/account/wishlist/create-wishlist-button.tsx +40 -0
- package/src/pages/account/wishlist/wishlist-item.tsx +82 -0
- package/src/pages/blog/pagination.tsx +38 -0
- package/src/pages/cart/cart-item.tsx +312 -0
- package/src/pages/cart/checkout-form.tsx +122 -0
- package/src/pages/cart/coupon-entry.tsx +90 -0
- package/src/pages/cart/estimate-shipping.tsx +183 -0
- package/src/pages/cart/wrapper.tsx +30 -0
- package/src/pages/checkout/checkout-alt-form/address-card.tsx +73 -0
- package/src/pages/checkout/checkout-alt-form/checkout-form.tsx +133 -0
- package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +120 -0
- package/src/pages/checkout/checkout-alt-form/customer-information.tsx +94 -0
- package/src/pages/checkout/checkout-alt-form/delivery-address.tsx +170 -0
- package/src/pages/checkout/checkout-alt-form/delivery-date.tsx +114 -0
- package/src/pages/checkout/checkout-alt-form/delivery-options.tsx +186 -0
- package/src/pages/checkout/checkout-alt-form/edit-address-form.tsx +130 -0
- package/src/pages/checkout/checkout-alt-form/heading.tsx +50 -0
- package/src/pages/checkout/checkout-alt-form/index.ts +1 -0
- package/src/pages/checkout/checkout-alt-form/new-address-form.tsx +294 -0
- package/src/pages/checkout/checkout-alt-form/node.tsx +9 -0
- package/src/pages/checkout/checkout-alt-form/payment-details.tsx +344 -0
- package/src/pages/checkout/checkout-alt-form/safe-card-preview-data.tsx +36 -0
- package/src/pages/checkout/checkout-alt-form/types.ts +20 -0
- package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +39 -0
- package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +40 -0
- package/src/pages/checkout/checkout-alt-summary/index.ts +1 -0
- package/src/pages/checkout/checkout-alt-summary/list-item.tsx +31 -0
- package/src/pages/confirmation/address.tsx +22 -0
- package/src/pages/confirmation/confirmation-summary.tsx +52 -0
- package/src/pages/confirmation/ordered-products.tsx +108 -0
- package/src/pages/product-details/available-shops.tsx +48 -0
- package/src/pages/product-details/bopis/find-in-store-button.tsx +63 -0
- package/src/pages/product-details/bopis/find-in-store-modal.tsx +257 -0
- package/src/pages/product-details/bopis/pickup-option-select.tsx +127 -0
- package/src/pages/product-details/bopis/search-header.tsx +69 -0
- package/src/pages/product-details/checkbox-label.tsx +20 -0
- package/src/pages/product-details/currency.ts +64 -0
- package/src/pages/product-details/frequently-bought.tsx +90 -0
- package/src/pages/product-details/frequently-product-card.tsx +60 -0
- package/src/pages/product-details/product-comment.tsx +44 -0
- package/src/pages/product-details/product-description.tsx +22 -0
- package/src/pages/product-details/product-filter-card.tsx +257 -0
- package/src/pages/product-details/product-intro/product-intro-images.tsx +87 -0
- package/src/pages/product-details/product-intro/product-intro.tsx +250 -0
- package/src/pages/product-details/product-review.tsx +131 -0
- package/src/pages/product-details/product-tabs.tsx +51 -0
- package/src/pages/product-details/related-products.tsx +42 -0
- package/src/pages/product-details/types.ts +11 -0
- package/src/pages/product-list/breadcrumbs.tsx +39 -0
- package/src/pages/product-list/checkbox-label.tsx +20 -0
- package/src/pages/product-list/facet-group.tsx +125 -0
- package/src/pages/product-list/facet.tsx +36 -0
- package/src/pages/product-list/list-filter.tsx +40 -0
- package/src/pages/product-list/pagination.tsx +80 -0
- package/src/pages/product-list/product-list-context.tsx +302 -0
- package/src/pages/product-list/product-list-state.ts +187 -0
- package/src/pages/product-list/product-rating.tsx +16 -0
- package/src/pages/product-list/quick-view-dialog-content.tsx +205 -0
- package/src/pages/product-list/quick-view-dialog.tsx +54 -0
- package/src/pages/product-list/range-filter.tsx +125 -0
- package/src/pages/product-list/scrollbar.tsx +38 -0
- package/src/pages/product-list/search-bar.tsx +162 -0
- package/src/pages/product-list/selected-facets.tsx +80 -0
- package/src/pages/product-list/side-nav.tsx +49 -0
- package/src/pages/product-list/swatch.tsx +80 -0
- package/src/pages/product-list/types.ts +18 -0
- package/src/pages/product-list/use-product-list.ts +12 -0
- package/src/pages/product-list/useCategoryFilter.tsx +26 -0
- package/src/pages/product-list/utils/facet-helpers.ts +5 -0
- package/src/pages/product-list/utils/generate-breadcrumbs.ts +30 -0
- package/src/pages/product-list/utils/getCategoryFilterFromSlug.ts +153 -0
- package/src/pages/product-list/utils/product-list-helper.ts +111 -0
- package/src/pages/product-list/utils/product-list-types.ts +41 -0
- package/src/pages/product-list/utils/search-for-category.ts +76 -0
- package/src/pages/product-list/utils/sort-options.ts +44 -0
- package/src/pages/product-list/utils/use-previous-refiners.ts +14 -0
- package/src/pages/quickorder/order-upload.tsx +150 -0
- package/src/pages/quickorder/quick-order-form.tsx +343 -0
- package/src/pages/quickorder/quick-order-row.tsx +144 -0
- package/tsconfig.json +1 -0
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +0 -10464
- /package/src/{components/_components/hooks/useOverflowDetect.ts → hooks/use-overflow-detect.ts} +0 -0
- /package/src/{components/_components/hooks/useSettings.ts → hooks/use-settings.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { H4 } from "@/components/_components/Typography";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
|
|
6
|
+
type Props = { message: string };
|
|
7
|
+
|
|
8
|
+
export default function NoRecords({ message }: Props) {
|
|
9
|
+
const t = useTranslations();
|
|
10
|
+
return (
|
|
11
|
+
<Box
|
|
12
|
+
display="flex"
|
|
13
|
+
justifyContent="center"
|
|
14
|
+
alignItems="center"
|
|
15
|
+
height="50vh"
|
|
16
|
+
>
|
|
17
|
+
<H4 color="grey.500">{t(message)}</H4>
|
|
18
|
+
</Box>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import createSvgIcon from "@mui/material/utils/createSvgIcon";
|
|
2
|
+
|
|
3
|
+
const Delivery = createSvgIcon(
|
|
4
|
+
<svg fill="currentColor" viewBox="0 0 32 32">
|
|
5
|
+
<path d="M24.0531 1.69349L23.7031 2.33374C23.5704 2.57647 23.3708 2.77603 23.1281 2.90874L22.4878 3.25874C22.4584 3.27482 22.4339 3.29852 22.4167 3.32735C22.3996 3.35619 22.3906 3.38909 22.3906 3.42262C22.3906 3.45614 22.3996 3.48905 22.4167 3.51788C22.4339 3.54671 22.4584 3.57041 22.4878 3.58649L23.1281 3.93649C23.3708 4.0692 23.5704 4.26876 23.7031 4.51149L24.0531 5.15174C24.0691 5.18122 24.0928 5.20583 24.1217 5.22297C24.1506 5.24011 24.1835 5.24916 24.2171 5.24916C24.2506 5.24916 24.2836 5.24011 24.3124 5.22297C24.3413 5.20583 24.365 5.18122 24.3811 5.15174L24.7311 4.51149C24.8639 4.26884 25.0634 4.0693 25.3061 3.93649L25.9463 3.58649C25.9757 3.57041 26.0003 3.54671 26.0174 3.51788C26.0345 3.48905 26.0435 3.45614 26.0435 3.42262C26.0435 3.38909 26.0345 3.35619 26.0174 3.32735C26.0003 3.29852 25.9757 3.27482 25.9463 3.25874L25.3061 2.90874C25.0634 2.77593 24.8639 2.5764 24.7311 2.33374L24.3811 1.69349C24.365 1.66401 24.3413 1.63941 24.3124 1.62226C24.2836 1.60512 24.2506 1.59607 24.2171 1.59607C24.1835 1.59607 24.1506 1.60512 24.1217 1.62226C24.0928 1.63941 24.0691 1.66401 24.0531 1.69349Z" />
|
|
6
|
+
<path d="M27.4868 6.42496L27.2408 6.87496C27.1475 7.04555 27.0072 7.18577 26.8366 7.27896L26.3866 7.52496C26.3659 7.53626 26.3487 7.55292 26.3367 7.57317C26.3247 7.59343 26.3184 7.61654 26.3184 7.64008C26.3184 7.66363 26.3247 7.68674 26.3367 7.70699C26.3487 7.72725 26.3659 7.7439 26.3866 7.75521L26.8366 8.00121C27.0072 8.0944 27.1475 8.23462 27.2408 8.40521L27.4868 8.85521C27.4981 8.87593 27.5147 8.89323 27.535 8.90528C27.5552 8.91733 27.5784 8.9237 27.602 8.9237C27.6255 8.9237 27.6487 8.91733 27.6689 8.90528C27.6892 8.89323 27.7058 8.87593 27.7171 8.85521L27.9631 8.40521C28.0562 8.23422 28.1964 8.09357 28.3671 7.99996L28.8171 7.75396C28.8377 7.74265 28.855 7.726 28.867 7.70574C28.879 7.68549 28.8853 7.66238 28.8853 7.63883C28.8853 7.61529 28.879 7.59218 28.867 7.57192C28.855 7.55167 28.8377 7.53501 28.8171 7.52371L28.3671 7.27771C28.1966 7.18443 28.0564 7.04423 27.9631 6.87371L27.7171 6.42371C27.7057 6.40305 27.689 6.38584 27.6687 6.37389C27.6483 6.36195 27.6252 6.35571 27.6016 6.35584C27.578 6.35596 27.5549 6.36245 27.5347 6.37462C27.5145 6.38678 27.498 6.40417 27.4868 6.42496Z" />
|
|
7
|
+
<path d="M22.72 27.117C22.2155 26.7778 21.395 26.9463 20.616 27.144C20.3484 27.2145 20.0852 27.3007 19.8278 27.402C19.3339 27.6067 18.806 27.717 18.2715 27.727C17.6673 27.717 16.961 27.5575 16.5123 27.8078C16.4668 27.8331 16.4165 27.8487 16.3647 27.8536C16.3129 27.8584 16.2606 27.8524 16.2112 27.8359C16.1618 27.8195 16.1164 27.7929 16.0779 27.7579C16.0393 27.723 16.0084 27.6803 15.9873 27.6328C15.951 27.541 15.9505 27.439 15.9859 27.3469C16.0214 27.2548 16.0901 27.1794 16.1785 27.1355C16.8433 26.7855 17.6623 27.0173 18.3395 27.1148C18.742 27.1795 19.1513 27.1907 19.5568 27.1483C19.6799 27.1304 19.7915 27.066 19.8685 26.9684C19.9456 26.8707 19.9823 26.7472 19.971 26.6233C19.9497 26.5028 19.8999 26.3892 19.8257 26.2919C19.7515 26.1946 19.6551 26.1165 19.5445 26.064C19.1475 25.8553 17.709 25.464 16.7735 25.273C15.285 24.9739 13.739 25.1859 12.386 25.8748C11.6408 26.2278 9.50876 27.6795 8.98101 28.504C8.90689 28.6092 8.8747 28.7382 8.89076 28.8658C8.94426 29.3465 10.3875 30.7326 10.8303 30.8761C10.9111 30.9062 10.9981 30.9159 11.0836 30.9044C11.1692 30.8929 11.2505 30.8605 11.3205 30.8101C11.5873 30.6386 12.174 30.0625 12.765 29.855C13.8595 29.47 15.6748 29.8025 16.5585 29.7815C17.8585 29.7503 22.201 28.6373 22.8718 28.0315C23.1388 27.7913 23.0415 27.333 22.72 27.117Z" />
|
|
8
|
+
<path d="M13.1345 8.16596L13.8048 5.48721H17.1298L17.799 8.16596H24.5925L21.679 5.69996C21.5161 5.56197 21.3095 5.48623 21.096 5.48621H9.8383C9.62479 5.48623 9.41822 5.56197 9.2553 5.69996L6.3418 8.16596H13.1345Z" />
|
|
9
|
+
<path d="M17.8989 8.91602V14.55C17.899 14.6265 17.8796 14.7017 17.8426 14.7686C17.8056 14.8355 17.7523 14.8919 17.6875 14.9325C17.6228 14.9731 17.5488 14.9967 17.4725 15.0009C17.3961 15.0051 17.32 14.9898 17.2512 14.9565L15.7702 14.13C15.6883 14.0597 15.584 14.0211 15.476 14.0211C15.3681 14.0211 15.2638 14.0597 15.1819 14.13L13.6854 14.9598C13.6166 14.9926 13.5406 15.0075 13.4645 15.003C13.3884 14.9986 13.3146 14.9749 13.2501 14.9342C13.1856 14.8936 13.1325 14.8373 13.0956 14.7705C13.0588 14.7038 13.0395 14.6288 13.0394 14.5525V8.91602H5.95117V22.7145C5.95117 22.9143 6.03052 23.1059 6.17178 23.2472C6.31303 23.3885 6.50462 23.468 6.70442 23.468H24.2347C24.4345 23.468 24.6262 23.3886 24.7675 23.2473C24.9088 23.106 24.9882 22.9144 24.9882 22.7145V8.91602H17.8989Z" />
|
|
10
|
+
</svg>,
|
|
11
|
+
"Delivery",
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export default Delivery;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import createSvgIcon from "@mui/material/utils/createSvgIcon";
|
|
2
|
+
|
|
3
|
+
const PackageBox = createSvgIcon(
|
|
4
|
+
<svg fill="currentColor" viewBox="0 0 32 32">
|
|
5
|
+
<path d="M7.40692 11.3465L20.5779 4.304L16.0004 2L2.41992 8.836L7.40692 11.3465Z" />
|
|
6
|
+
<path d="M24.5773 6.3175L11.4062 13.36L15.9998 15.6725L29.5803 8.83601L24.5773 6.3175Z" />
|
|
7
|
+
<path d="M15.625 16.3275L11 13.9995V19.1145L9 17.101H7V11.986L2 9.46948V23.1415L15.625 30V16.3275Z" />
|
|
8
|
+
<path d="M16.375 16.3275V30L30 23.1415V9.46948L16.375 16.3275Z" />
|
|
9
|
+
</svg>,
|
|
10
|
+
"PackageBox",
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default PackageBox;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import createSvgIcon from "@mui/material/utils/createSvgIcon";
|
|
2
|
+
|
|
3
|
+
const TruckFilled = createSvgIcon(
|
|
4
|
+
<svg fill="currentColor" viewBox="0 0 36 36">
|
|
5
|
+
<path
|
|
6
|
+
fillRule="evenodd"
|
|
7
|
+
clipRule="evenodd"
|
|
8
|
+
d="M5.1302 7.5H22.4118C22.8992 7.5 23.2941 7.89504 23.2941 8.38236V10.1471H28.322C28.8735 10.1471 29.3583 10.5127 29.5098 11.043L31.0223 16.3368C31.1997 16.368 31.3647 16.4529 31.4937 16.5819L32.7416 17.8298C32.907 17.9952 33 18.2198 33 18.4538V24.2648C33 24.752 32.6049 25.1471 32.1177 25.1471H29.4707C29.4707 27.0963 27.8904 28.6764 25.9412 28.6764C23.9919 28.6764 22.4118 27.0963 22.4118 25.1471H13.5882C13.5882 27.0963 12.0081 28.6764 10.0588 28.6764C8.10959 28.6764 6.52941 27.0963 6.52941 25.1471H3.88236C3.39504 25.1471 3 24.752 3 24.2648V9.63019C3 9.39618 3.09296 9.17175 3.25844 9.00627L4.50627 7.75843C4.67175 7.59295 4.89618 7.5 5.1302 7.5ZM29.1833 16.3236L27.9227 11.9118H23.2941V15.4412C23.2941 15.9285 23.6892 16.3236 24.1764 16.3236H29.1833ZM25.9412 23.3823C26.9159 23.3823 27.7059 24.1725 27.7059 25.1471C27.7059 26.1218 26.9159 26.9118 25.9412 26.9118C24.9666 26.9118 24.1764 26.1218 24.1764 25.1471C24.1764 24.1725 24.9666 23.3823 25.9412 23.3823ZM8.29412 25.1471C8.29412 26.1218 9.08421 26.9118 10.0588 26.9118C11.0334 26.9118 11.8235 26.1218 11.8235 25.1471C11.8235 24.1725 11.0334 23.3823 10.0588 23.3823C9.08421 23.3823 8.29412 24.1725 8.29412 25.1471Z"
|
|
9
|
+
/>
|
|
10
|
+
</svg>,
|
|
11
|
+
"TruckFilled",
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export default TruckFilled;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Fragment } from "react";
|
|
2
|
+
import { useTranslations } from "next-intl";
|
|
3
|
+
// MUI
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import Card from "@mui/material/Card";
|
|
6
|
+
import Avatar from "@mui/material/Avatar";
|
|
7
|
+
import styled from "@mui/material/styles/styled";
|
|
8
|
+
import { MdDone as Done } from "react-icons/md";
|
|
9
|
+
// CUSTOM ICON COMPONENTS
|
|
10
|
+
import Delivery from "./icons/delivery";
|
|
11
|
+
import PackageBox from "./icons/package-box";
|
|
12
|
+
import TruckFilled from "./icons/truck-filled";
|
|
13
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
14
|
+
import { Paragraph } from "@/components/_components/Typography";
|
|
15
|
+
import { FlexBetween, FlexBox } from "@/components/_components/flex-box/index";
|
|
16
|
+
|
|
17
|
+
// STYLED COMPONENTS
|
|
18
|
+
const StyledFlexbox = styled(FlexBetween)(({ theme }) => ({
|
|
19
|
+
flexWrap: "wrap",
|
|
20
|
+
marginTop: "2rem",
|
|
21
|
+
marginBottom: "2rem",
|
|
22
|
+
[theme.breakpoints.down("sm")]: { flexDirection: "column" },
|
|
23
|
+
"& .line": {
|
|
24
|
+
height: 4,
|
|
25
|
+
minWidth: 50,
|
|
26
|
+
flex: "1 1 0",
|
|
27
|
+
[theme.breakpoints.down("sm")]: { flex: "unset", height: 50, minWidth: 4 },
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const StyledAvatar = styled(Avatar)(({ theme }) => ({
|
|
32
|
+
top: -5,
|
|
33
|
+
right: -5,
|
|
34
|
+
width: 22,
|
|
35
|
+
height: 22,
|
|
36
|
+
position: "absolute",
|
|
37
|
+
bgcolor: theme.palette.grey[200],
|
|
38
|
+
color: theme.palette.success.main,
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
type Props = {
|
|
42
|
+
status: number;
|
|
43
|
+
};
|
|
44
|
+
export default function OrderProgress({ status }: Props) {
|
|
45
|
+
const t = useTranslations("Account.OrderDetails");
|
|
46
|
+
|
|
47
|
+
let ORDER_STATUS = "";
|
|
48
|
+
|
|
49
|
+
// Map API statuses to ORDER_STATUS_LIST values
|
|
50
|
+
if ([1, 2, 4, 5].includes(status)) ORDER_STATUS = "Packaging";
|
|
51
|
+
if ([3].includes(status)) ORDER_STATUS = "Complete";
|
|
52
|
+
|
|
53
|
+
const hideDeliveryDate = !![4, 5].includes(status);
|
|
54
|
+
|
|
55
|
+
const STEP_ICONS = [PackageBox, TruckFilled, Delivery];
|
|
56
|
+
const ORDER_STATUS_LIST = ["Packaging", "Shipping", "Delivering", "Complete"];
|
|
57
|
+
|
|
58
|
+
const statusIndex = ORDER_STATUS_LIST.indexOf(ORDER_STATUS);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Card sx={{ p: "2rem 1.5rem", mb: 4 }}>
|
|
62
|
+
<StyledFlexbox>
|
|
63
|
+
{STEP_ICONS.map((Icon, index) => (
|
|
64
|
+
<Fragment key={index}>
|
|
65
|
+
<Box position="relative">
|
|
66
|
+
<Avatar
|
|
67
|
+
alt="shipping"
|
|
68
|
+
sx={{
|
|
69
|
+
width: 64,
|
|
70
|
+
height: 64,
|
|
71
|
+
color: index <= statusIndex ? "white" : "primary.main",
|
|
72
|
+
bgcolor: index <= statusIndex ? "primary.main" : "grey.300",
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<Icon color="inherit" fontSize="large" />
|
|
76
|
+
</Avatar>
|
|
77
|
+
|
|
78
|
+
{index < statusIndex ? (
|
|
79
|
+
<StyledAvatar alt="done">
|
|
80
|
+
<Done color="inherit" size={16} />
|
|
81
|
+
</StyledAvatar>
|
|
82
|
+
) : null}
|
|
83
|
+
</Box>
|
|
84
|
+
|
|
85
|
+
{index < STEP_ICONS.length - 1 ? (
|
|
86
|
+
<Box
|
|
87
|
+
className="line"
|
|
88
|
+
bgcolor={index < statusIndex ? "primary.main" : "grey.300"}
|
|
89
|
+
/>
|
|
90
|
+
) : null}
|
|
91
|
+
</Fragment>
|
|
92
|
+
))}
|
|
93
|
+
</StyledFlexbox>
|
|
94
|
+
|
|
95
|
+
{!hideDeliveryDate && (
|
|
96
|
+
<FlexBox justifyContent={{ xs: "center", sm: "flex-end" }}>
|
|
97
|
+
<Paragraph
|
|
98
|
+
p="0.5rem 1rem"
|
|
99
|
+
textAlign="center"
|
|
100
|
+
borderRadius="300px"
|
|
101
|
+
color="primary.main"
|
|
102
|
+
bgcolor="primary.light"
|
|
103
|
+
>
|
|
104
|
+
{t(statusIndex === 3 ? "deliveredDate" : "estimatedDeliveryDate")}
|
|
105
|
+
<b> 4th October</b>
|
|
106
|
+
</Paragraph>
|
|
107
|
+
</FlexBox>
|
|
108
|
+
)}
|
|
109
|
+
</Card>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import Box from "@mui/material/Box";
|
|
3
|
+
import Chip from "@mui/material/Chip";
|
|
4
|
+
import IconButton from "@mui/material/IconButton";
|
|
5
|
+
import { MdEast as East } from "react-icons/md";
|
|
6
|
+
import { ChipProps } from "@mui/material";
|
|
7
|
+
import { format } from "date-fns";
|
|
8
|
+
// GLOBAL CUSTOM COMPONENT
|
|
9
|
+
import { H6, Paragraph } from "@/components/_components/Typography";
|
|
10
|
+
// Local CUSTOM COMPONENT
|
|
11
|
+
import TableRow from "../table-row";
|
|
12
|
+
// CUSTOM UTILS LIBRARY FUNCTION
|
|
13
|
+
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
14
|
+
import { SalesOrder } from "@/api-manager/schemas/order.schema";
|
|
15
|
+
|
|
16
|
+
// =================================================
|
|
17
|
+
type Props = { order: SalesOrder };
|
|
18
|
+
// =================================================
|
|
19
|
+
const STATUS_MAP: Record<number, { label: string; color: ChipProps["color"] }> =
|
|
20
|
+
{
|
|
21
|
+
1: { label: "Open", color: "secondary" },
|
|
22
|
+
2: { label: "Processing", color: "secondary" },
|
|
23
|
+
3: { label: "Complete", color: "success" },
|
|
24
|
+
4: { label: "On Hold", color: "primary" },
|
|
25
|
+
5: { label: "Cancelled", color: "primary" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const getStatusInfo = (status: number) => {
|
|
29
|
+
return STATUS_MAP[status] ?? { label: "Unknown", color: "default" };
|
|
30
|
+
};
|
|
31
|
+
export default function OrderRow({ order }: Props) {
|
|
32
|
+
const { formatCurrency } = useCurrencyFormatter();
|
|
33
|
+
|
|
34
|
+
const { label, color } = getStatusInfo(order.StatusValue ?? 0);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Link href={`/account/orders/${order.Id}`}>
|
|
38
|
+
<TableRow sx={{ gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr" }}>
|
|
39
|
+
<H6 ellipsis>{order?.ChannelReferenceId}</H6>
|
|
40
|
+
|
|
41
|
+
<Box textAlign="center">
|
|
42
|
+
<Chip size="small" label={label} color={color} />
|
|
43
|
+
</Box>
|
|
44
|
+
|
|
45
|
+
<Paragraph textAlign={{ sm: "center", xs: "left" }}>
|
|
46
|
+
{format(new Date(order.TransactionDate ?? ""), "MMM dd, yyyy")}
|
|
47
|
+
</Paragraph>
|
|
48
|
+
|
|
49
|
+
<Paragraph textAlign="center">
|
|
50
|
+
{formatCurrency(order.TotalAmount ?? 0)}
|
|
51
|
+
</Paragraph>
|
|
52
|
+
|
|
53
|
+
<Box display={{ sm: "inline-flex", xs: "none" }} justifyContent="end">
|
|
54
|
+
<IconButton sx={{ color: "grey.500" }}>
|
|
55
|
+
<East fontSize="large" />
|
|
56
|
+
</IconButton>
|
|
57
|
+
</Box>
|
|
58
|
+
</TableRow>
|
|
59
|
+
</Link>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import Grid from "@mui/material/Grid2";
|
|
2
|
+
import Card from "@mui/material/Card";
|
|
3
|
+
import Divider from "@mui/material/Divider";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
6
|
+
import { FlexBetween } from "@/components/_components/flex-box/index";
|
|
7
|
+
import { H5, H6, Paragraph } from "@/components/_components/Typography";
|
|
8
|
+
// CUSTOM UTILS LIBRARY FUNCTION
|
|
9
|
+
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
10
|
+
import { SalesOrder } from "@/api-manager/schemas/order.schema";
|
|
11
|
+
|
|
12
|
+
// ==============================================================
|
|
13
|
+
type Props = { order: SalesOrder };
|
|
14
|
+
// ==============================================================
|
|
15
|
+
|
|
16
|
+
function ListItem({ title, value }: { title: string; value: string }) {
|
|
17
|
+
const t = useTranslations("Account.OrderDetails");
|
|
18
|
+
return (
|
|
19
|
+
<FlexBetween mb={1}>
|
|
20
|
+
<Paragraph color="grey.600">{t(title)}</Paragraph>
|
|
21
|
+
<H6>{value}</H6>
|
|
22
|
+
</FlexBetween>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function OrderSummary({ order }: Props) {
|
|
27
|
+
const t = useTranslations("Account.OrderDetails");
|
|
28
|
+
const { formatCurrency } = useCurrencyFormatter();
|
|
29
|
+
const shippingAddress = order.ShippingAddress;
|
|
30
|
+
return (
|
|
31
|
+
<Grid container spacing={3}>
|
|
32
|
+
{/* SHIPMENT ADDRESS SECTION */}
|
|
33
|
+
<Grid size={{ lg: 6, md: 6, xs: 12 }}>
|
|
34
|
+
<Card sx={{ p: 3 }}>
|
|
35
|
+
<H5 mt={0} mb={2}>
|
|
36
|
+
{t("addressHeading")}
|
|
37
|
+
</H5>
|
|
38
|
+
|
|
39
|
+
{shippingAddress && (
|
|
40
|
+
<Paragraph fontSize={14} my={0}>
|
|
41
|
+
{`${shippingAddress.Name}, ${shippingAddress.Street}, ${shippingAddress.City} ${shippingAddress.State} ${shippingAddress.ThreeLetterISORegionName} ${shippingAddress.ZipCode}`}
|
|
42
|
+
</Paragraph>
|
|
43
|
+
)}
|
|
44
|
+
</Card>
|
|
45
|
+
</Grid>
|
|
46
|
+
|
|
47
|
+
{/* TOTAL SUMMERY SECTION */}
|
|
48
|
+
<Grid size={{ lg: 6, md: 6, xs: 12 }}>
|
|
49
|
+
<Card sx={{ p: 3 }}>
|
|
50
|
+
<H5 mt={0} mb={2}>
|
|
51
|
+
{t("headingSummary")}
|
|
52
|
+
</H5>
|
|
53
|
+
|
|
54
|
+
<ListItem
|
|
55
|
+
title="subTotal"
|
|
56
|
+
value={formatCurrency(order.SubtotalAmount ?? 0)}
|
|
57
|
+
/>
|
|
58
|
+
<ListItem
|
|
59
|
+
title="shippingTotal"
|
|
60
|
+
value={formatCurrency(order.ShippingChargeAmount ?? 0)}
|
|
61
|
+
/>
|
|
62
|
+
<ListItem
|
|
63
|
+
title="taxTotal"
|
|
64
|
+
value={formatCurrency(order.TaxAmount ?? 0)}
|
|
65
|
+
/>
|
|
66
|
+
<ListItem
|
|
67
|
+
title="discountTotal"
|
|
68
|
+
value={formatCurrency(order.DiscountAmount ?? 0)}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<Divider sx={{ mb: 1 }} />
|
|
72
|
+
|
|
73
|
+
<FlexBetween mb={2}>
|
|
74
|
+
<H6>{t("total")}</H6>
|
|
75
|
+
<H6>{formatCurrency(order.TotalAmount ?? 0)}</H6>
|
|
76
|
+
</FlexBetween>
|
|
77
|
+
|
|
78
|
+
<Paragraph>{t("paidBy")}</Paragraph>
|
|
79
|
+
</Card>
|
|
80
|
+
</Grid>
|
|
81
|
+
</Grid>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import Card from "@mui/material/Card";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import Avatar from "@mui/material/Avatar";
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import Grid from "@mui/material/Grid2";
|
|
6
|
+
import { format } from "date-fns";
|
|
7
|
+
import Link from "next/link";
|
|
8
|
+
import { useTranslations } from "next-intl";
|
|
9
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
10
|
+
import { H6, Paragraph, Span } from "@/components/_components/Typography";
|
|
11
|
+
import { FlexBetween, FlexBox } from "@/components/_components/flex-box/index";
|
|
12
|
+
// CUSTOM UTILS LIBRARY FUNCTION
|
|
13
|
+
import useCurrencyFormatter from "@/lib/currency-formatter";
|
|
14
|
+
import { SalesLine, SalesOrder } from "@/api-manager/schemas/order.schema";
|
|
15
|
+
import { ProductDimensionType } from "@msdyn365-commerce/retail-proxy";
|
|
16
|
+
import buildDetailUrl from "@/lib/build-detail-url";
|
|
17
|
+
|
|
18
|
+
// ==============================================================
|
|
19
|
+
type Props = { order: SalesOrder };
|
|
20
|
+
// ==============================================================
|
|
21
|
+
|
|
22
|
+
export default function OrderedProducts({ order }: Props) {
|
|
23
|
+
const t = useTranslations("Account.OrderDetails");
|
|
24
|
+
const { formatCurrency } = useCurrencyFormatter();
|
|
25
|
+
|
|
26
|
+
const deliveredDate = "";
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Card sx={{ p: 0, mb: "30px" }}>
|
|
30
|
+
<FlexBetween px={3} py={2} flexWrap="wrap" bgcolor="grey.200">
|
|
31
|
+
<Item title="orderId" value={order?.ChannelReferenceId ?? ""} />
|
|
32
|
+
<Item
|
|
33
|
+
title="orderDate"
|
|
34
|
+
value={format(new Date(order?.TransactionDate ?? ""), "dd MMM, yyyy")}
|
|
35
|
+
/>
|
|
36
|
+
<Item
|
|
37
|
+
title="deliveredOn"
|
|
38
|
+
value={
|
|
39
|
+
deliveredDate
|
|
40
|
+
? format(new Date(deliveredDate), "dd MMM, yyyy")
|
|
41
|
+
: t("deliveredOnValue")
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
</FlexBetween>
|
|
45
|
+
|
|
46
|
+
<Grid
|
|
47
|
+
container
|
|
48
|
+
spacing={2}
|
|
49
|
+
padding={"20px 15px 10px"}
|
|
50
|
+
alignItems={"center"}
|
|
51
|
+
>
|
|
52
|
+
{order?.SalesLines?.map((item: SalesLine, index: number) => (
|
|
53
|
+
<Link
|
|
54
|
+
href={buildDetailUrl(
|
|
55
|
+
item?.Product?.Name ?? "",
|
|
56
|
+
item?.Product?.RecordId ?? 0,
|
|
57
|
+
)}
|
|
58
|
+
key={index}
|
|
59
|
+
style={{ display: "contents" }}
|
|
60
|
+
>
|
|
61
|
+
<Grid size={{ xs: 12, sm: 5 }}>
|
|
62
|
+
<FlexBox gap={2.5} alignItems="center" padding={"12px 15px"}>
|
|
63
|
+
<Avatar
|
|
64
|
+
alt={item?.Product?.Name}
|
|
65
|
+
src={item?.Product?.PrimaryImageUrl}
|
|
66
|
+
sx={{ height: 64, width: 64 }}
|
|
67
|
+
/>
|
|
68
|
+
<div>
|
|
69
|
+
<H6>{item?.Product?.Name}</H6>
|
|
70
|
+
<Paragraph color="grey.600">
|
|
71
|
+
{formatCurrency(item?.Price ?? 0)} x {item?.Quantity || 1}
|
|
72
|
+
</Paragraph>
|
|
73
|
+
</div>
|
|
74
|
+
</FlexBox>
|
|
75
|
+
</Grid>
|
|
76
|
+
|
|
77
|
+
<Grid size={{ xs: 8, sm: 4 }}>
|
|
78
|
+
{item.Product?.Dimensions?.length ? (
|
|
79
|
+
item.Product.Dimensions.map((dim, dimInd) => (
|
|
80
|
+
<Paragraph key={dimInd} paddingLeft={"15px"}>
|
|
81
|
+
<Span>
|
|
82
|
+
{ProductDimensionType[dim.DimensionTypeValue || 0]}:
|
|
83
|
+
</Span>
|
|
84
|
+
<Span sx={{ ml: 1 }}>{dim.DimensionValue?.Value}</Span>
|
|
85
|
+
</Paragraph>
|
|
86
|
+
))
|
|
87
|
+
) : (
|
|
88
|
+
<Box />
|
|
89
|
+
)}
|
|
90
|
+
</Grid>
|
|
91
|
+
|
|
92
|
+
<Grid size={{ xs: 4, sm: 3 }}>
|
|
93
|
+
<Box justifySelf={"end"}>
|
|
94
|
+
<Button variant="text" color="primary">
|
|
95
|
+
{t("writeReview")}
|
|
96
|
+
</Button>
|
|
97
|
+
</Box>
|
|
98
|
+
</Grid>
|
|
99
|
+
</Link>
|
|
100
|
+
))}
|
|
101
|
+
</Grid>
|
|
102
|
+
</Card>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function Item({ title, value }: { title: string; value: string }) {
|
|
107
|
+
const t = useTranslations("Account.OrderDetails");
|
|
108
|
+
return (
|
|
109
|
+
<FlexBox gap={1} alignItems="center">
|
|
110
|
+
<Paragraph color="grey.600">{t(title)}</Paragraph>
|
|
111
|
+
<Paragraph>{value}</Paragraph>
|
|
112
|
+
</FlexBox>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import ProfileButton from "./profile-button";
|
|
4
|
+
import { getMsalInstance, initializeMsal, getRequestConfig } from "@/auth/msal";
|
|
5
|
+
|
|
6
|
+
vi.mock("@/auth/msal", () => ({
|
|
7
|
+
initializeMsal: vi.fn(),
|
|
8
|
+
getMsalInstance: vi.fn(),
|
|
9
|
+
getRequestConfig: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
vi.mock("@/components/T/index", () => ({
|
|
13
|
+
default: ({ path }: { path: string }) => <span>{path}</span>,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
describe("ProfileButton Component", () => {
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
vi.restoreAllMocks();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders disabled button initially (MSAL not ready)", () => {
|
|
22
|
+
render(<ProfileButton type="edit" path="Account.Profile.btnEditProfile" />);
|
|
23
|
+
const button = screen.getByRole("button");
|
|
24
|
+
expect(button).toBeDisabled();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("initializes MSAL on mount", async () => {
|
|
28
|
+
render(<ProfileButton type="edit" path="Account.Profile.btnEditProfile" />);
|
|
29
|
+
await waitFor(() => {
|
|
30
|
+
expect(initializeMsal).toHaveBeenCalled();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("calls MSAL loginRedirect when clicked", async () => {
|
|
35
|
+
(initializeMsal as ReturnType<typeof vi.fn>).mockImplementation(() =>
|
|
36
|
+
Promise.resolve(),
|
|
37
|
+
);
|
|
38
|
+
(getRequestConfig as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
39
|
+
scopes: ["user.read"],
|
|
40
|
+
});
|
|
41
|
+
(getMsalInstance as ReturnType<typeof vi.fn>).mockReturnValue({
|
|
42
|
+
loginRedirect: vi.fn(),
|
|
43
|
+
});
|
|
44
|
+
render(<ProfileButton type="edit" path="Account.Profile.btnEditProfile" />);
|
|
45
|
+
|
|
46
|
+
await waitFor(() => {
|
|
47
|
+
expect(initializeMsal).toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const button = screen.getByRole("button");
|
|
51
|
+
fireEvent.click(button);
|
|
52
|
+
|
|
53
|
+
await waitFor(() => {
|
|
54
|
+
expect(getMsalInstance().loginRedirect).toHaveBeenCalledWith({
|
|
55
|
+
scopes: ["user.read"],
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { getMsalInstance, initializeMsal, getRequestConfig } from "@/auth/msal";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Button } from "@mui/material";
|
|
6
|
+
import T from "@/components/T/index";
|
|
7
|
+
import { RedirectRequest } from "@azure/msal-browser";
|
|
8
|
+
interface Props {
|
|
9
|
+
type: string;
|
|
10
|
+
path: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ProfileButton = ({ type, path }: Props) => {
|
|
14
|
+
const [isMsalReady, setIsMsalReady] = useState(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const initMsal = async () => {
|
|
18
|
+
await initializeMsal();
|
|
19
|
+
setIsMsalReady(true);
|
|
20
|
+
};
|
|
21
|
+
initMsal();
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
const handleProfile = async () => {
|
|
25
|
+
if (!isMsalReady) {
|
|
26
|
+
console.error("MSAL is not initialized yet.");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const req = getRequestConfig(type);
|
|
32
|
+
await getMsalInstance().loginRedirect(req as RedirectRequest); // "handleRedirectPromise" is in user component.
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Profile update through MSAL failed", error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Button
|
|
40
|
+
onClick={() => handleProfile()}
|
|
41
|
+
disabled={!isMsalReady}
|
|
42
|
+
color="primary"
|
|
43
|
+
sx={{ bgcolor: "primary.light", px: 4 }}
|
|
44
|
+
>
|
|
45
|
+
<T path={path} />
|
|
46
|
+
</Button>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ProfileButton;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
3
|
+
import { Theme } from "@mui/material/styles";
|
|
4
|
+
import Card from "@mui/material/Card";
|
|
5
|
+
import { useTranslations } from "next-intl";
|
|
6
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
7
|
+
import FlexBox from "@/components/_components/flex-box/flex-box";
|
|
8
|
+
import { Small, Span } from "@/components/_components/Typography";
|
|
9
|
+
// API
|
|
10
|
+
import { User } from "@/api-manager/schemas/user.schema";
|
|
11
|
+
type Props = {
|
|
12
|
+
user: User;
|
|
13
|
+
};
|
|
14
|
+
export default function UserInfo({ user }: Props) {
|
|
15
|
+
const downMd = useMediaQuery((theme: Theme) => theme.breakpoints.down("sm"));
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Card
|
|
19
|
+
sx={{
|
|
20
|
+
mt: 3,
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexWrap: "wrap",
|
|
23
|
+
gap: "5rem",
|
|
24
|
+
p: "0.75rem 1.5rem",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
justifyContent: "flex-start",
|
|
27
|
+
...(downMd && {
|
|
28
|
+
gap: "1rem",
|
|
29
|
+
alignItems: "start",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
justifyContent: "flex-start",
|
|
32
|
+
}),
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<TableRowItem
|
|
36
|
+
title="labelFirstName"
|
|
37
|
+
value={_.capitalize(user?.FirstName)}
|
|
38
|
+
/>
|
|
39
|
+
<TableRowItem
|
|
40
|
+
title="labelLastName"
|
|
41
|
+
value={_.capitalize(user?.LastName)}
|
|
42
|
+
/>
|
|
43
|
+
<TableRowItem title="labelEmail" value={user?.Email ?? ""} />
|
|
44
|
+
</Card>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function TableRowItem({ title, value = "" }: { title: string; value: string }) {
|
|
49
|
+
const t = useTranslations("Account.Profile");
|
|
50
|
+
return (
|
|
51
|
+
<FlexBox flexDirection="column" p={1}>
|
|
52
|
+
<Small color="grey.600" mb={0.5}>
|
|
53
|
+
{t(title)}
|
|
54
|
+
</Small>
|
|
55
|
+
|
|
56
|
+
<Span>{value}</Span>
|
|
57
|
+
</FlexBox>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Card from "@mui/material/Card";
|
|
2
|
+
import styled from "@mui/material/styles/styled";
|
|
3
|
+
import NavLink from "@/components/_components/nav-link/nav-link";
|
|
4
|
+
|
|
5
|
+
export const MainContainer = styled(Card)(({ theme }) => ({
|
|
6
|
+
paddingBottom: "1.5rem",
|
|
7
|
+
[theme.breakpoints.down("md")]: {
|
|
8
|
+
boxShadow: "none",
|
|
9
|
+
overflowY: "auto",
|
|
10
|
+
height: "calc(100vh - 64px)",
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export const StyledNavLink = styled(NavLink, {
|
|
15
|
+
shouldForwardProp: (prop) => prop !== "isCurrentPath",
|
|
16
|
+
})<{ isCurrentPath: boolean }>(({ theme, isCurrentPath }) => ({
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
borderLeft: "4px solid",
|
|
20
|
+
paddingLeft: "1.5rem",
|
|
21
|
+
paddingRight: "1.5rem",
|
|
22
|
+
marginBottom: "1.25rem",
|
|
23
|
+
justifyContent: "space-between",
|
|
24
|
+
borderColor: isCurrentPath ? theme.palette.primary.main : "transparent",
|
|
25
|
+
"& .nav-icon": {
|
|
26
|
+
color: isCurrentPath ? theme.palette.primary.main : theme.palette.grey[600],
|
|
27
|
+
},
|
|
28
|
+
"&:hover": {
|
|
29
|
+
borderColor: theme.palette.primary.main,
|
|
30
|
+
"& .nav-icon": { color: theme.palette.primary.main },
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Card from "@mui/material/Card";
|
|
2
|
+
import styled from "@mui/material/styles/styled";
|
|
3
|
+
|
|
4
|
+
const TableRow = styled(Card)(({ theme }) => ({
|
|
5
|
+
gap: 16,
|
|
6
|
+
marginBlock: 16,
|
|
7
|
+
display: "grid",
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
cursor: "pointer",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
padding: ".6rem 1.2rem",
|
|
12
|
+
gridTemplateColumns: "1.5fr 2fr 1.5fr auto",
|
|
13
|
+
[theme.breakpoints.down("sm")]: {
|
|
14
|
+
gap: 8,
|
|
15
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
export default TableRow;
|