Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43,409 changes: 13,650 additions & 29,759 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@stripe/react-stripe-js": "^1.10.0",
"@stripe/stripe-js": "^1.35.0",
"@types/react-stripe-elements": "^6.0.6",
"algoliasearch": "^4.14.2",
"braintree-web": "^3.87.0",
"braintree-web-drop-in": "^1.33.4",
"clsx": "^1.2.1",
Expand All @@ -37,8 +36,6 @@
"react": "^18.2.0",
"react-device-detect": "^2.2.2",
"react-dom": "^18.2.0",
"react-instantsearch-hooks-server": "^6.32.0",
"react-instantsearch-hooks-web": "^6.32.0",
"rxjs": "^7.5.7",
"yup": "^1.0.0-beta.7",
"zlib": "^1.0.5"
Expand Down
1 change: 1 addition & 0 deletions src/components/product/Price.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface IPriceProps {
const Price = ({ price, currency, size = "2xl" }: IPriceProps): JSX.Element => {
return (
<Text
as="span"
color={useColorModeValue("gray.900", "gray.400")}
fontWeight={300}
marginTop="15px"
Expand Down
1 change: 1 addition & 0 deletions src/components/product/StrikePrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface IPrice {
const StrikePrice = ({ price, currency }: IPrice): JSX.Element => {
return (
<Text
as="span"
color={useColorModeValue("red.500", "red.200")}
fontWeight={300}
marginTop="15px"
Expand Down
150 changes: 0 additions & 150 deletions src/components/search/CustomHierarchicalMenu.tsx

This file was deleted.

41 changes: 24 additions & 17 deletions src/components/search/Hit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SearchHit } from "./SearchHit";
import { ProductSearchResultItems } from "./search-hit-types";
import {
Button,
Center,
Expand All @@ -19,7 +19,11 @@ import StrikePrice from "../product/StrikePrice";
import { useDisclosure } from "@chakra-ui/react";
import { ProductModalContainer } from "../product-modal/ProductModalContainer";

export default function HitComponent({ hit }: { hit: SearchHit }): JSX.Element {
export default function HitComponent({
hit,
}: {
hit: ProductSearchResultItems;
}): JSX.Element {
const { ep_price, ep_name, objectID, ep_main_image_url, ep_description } =
hit;
const { isOpen, onOpen, onClose } = useDisclosure();
Expand Down Expand Up @@ -64,21 +68,24 @@ export default function HitComponent({ hit }: { hit: SearchHit }): JSX.Element {
>
{ep_description}
</Text>
<Text fontSize="md" fontWeight="semibold" mt="1">
{ep_price && (
<Flex alignItems="center">
<Price price={ep_price["USD"].formatted_price} currency="USD" />
{ep_price["USD"].sale_prices && (
<StrikePrice
price={
ep_price["USD"].sale_prices.original_price.formatted_price
}
currency="USD"
/>
)}
</Flex>
)}
</Text>
<Flex alignItems="center">
<Text fontSize="md" fontWeight="semibold" mt="1">
{ep_price && (
<Price
price={ep_price["USD"]?.formatted_price || ""}
currency="USD"
/>
)}
{ep_price["USD"].sale_prices && (
<StrikePrice
price={
ep_price["USD"].sale_prices.original_price.formatted_price
}
currency="USD"
/>
)}
</Text>
</Flex>
<Button
rounded="md"
w="full"
Expand Down
9 changes: 5 additions & 4 deletions src/components/search/Hits.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Grid, GridItem } from "@chakra-ui/react";
import { useHits } from "react-instantsearch-hooks-web";
import { SearchHit } from "./SearchHit";
import NoResults from "./NoResults";
import HitComponent from "./Hit";
import { ProductSearchResultItems } from "./search-hit-types";

export default function Hits(): JSX.Element {
const { hits } = useHits<SearchHit>();
interface IHitsProps {
hits: ProductSearchResultItems[];
}

export default function Hits({ hits }: IHitsProps): JSX.Element {
if (hits.length) {
return (
<Grid
Expand Down
23 changes: 0 additions & 23 deletions src/components/search/HitsPerPage.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions src/components/search/HitsProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Hits from "./Hits";
import { ProductSearchResultItems } from "./search-hit-types";

export interface IHitsProps {
hits?: ProductSearchResultItems[];
}

export default function HitsProvider({ hits = [] }: IHitsProps) {
return <Hits hits={hits} />;
}
54 changes: 2 additions & 52 deletions src/components/search/MobileFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,13 @@ import {
DrawerContent,
DrawerHeader,
DrawerOverlay,
Heading,
useDisclosure,
} from "@chakra-ui/react";
import CustomHierarchicalMenu from "./CustomHierarchicalMenu";
import { hierarchicalAttributes } from "../../lib/hierarchical-attributes";
import { BreadcrumbLookup } from "../../lib/types/breadcrumb-lookup";
import {
InstantSearch,
usePagination,
useSearchBox,
useSortBy,
} from "react-instantsearch-hooks-web";
import { searchClient } from "../../lib/search-client";
import { algoliaEnvData } from "../../lib/resolve-algolia-env";
import { ChevronDownIcon } from "@chakra-ui/icons";

interface IMobileFilters {
lookup?: BreadcrumbLookup;
NextRouterHandler: any;
}

export default function MobileFilters({
lookup,
NextRouterHandler,
}: IMobileFilters): JSX.Element {
export default function MobileFilters(): JSX.Element {
const { isOpen, onOpen, onClose } = useDisclosure();

const VirtualSearchBox = () => {
useSearchBox();
return null;
};
const VirtualPagination = () => {
usePagination();
return null;
};
const VirtualSortBy = () => {
useSortBy({ items: [] });
return null;
};

return (
<Box display={{ base: "block", md: "none" }}>
<Button variant="ghost" rightIcon={<ChevronDownIcon />} onClick={onOpen}>
Expand All @@ -58,24 +25,7 @@ export default function MobileFilters({
<DrawerCloseButton />
<DrawerHeader>Filters</DrawerHeader>

<DrawerBody>
<InstantSearch
searchClient={searchClient}
indexName={algoliaEnvData.indexName}
>
<VirtualSearchBox />
<VirtualPagination />
<VirtualSortBy />
<NextRouterHandler />
<Heading as="h3" size="sm" pb={2}>
Category
</Heading>
<CustomHierarchicalMenu
lookup={lookup}
attributes={hierarchicalAttributes}
/>
</InstantSearch>
</DrawerBody>
<DrawerBody></DrawerBody>
</DrawerContent>
</Drawer>
</Box>
Expand Down
Loading