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

fix: preview of new products for new sellers #1078

Merged
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
524 changes: 370 additions & 154 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@apollo/client": "^3.8.1",
"@bosonprotocol/chat-sdk": "^1.3.1-alpha.9",
"@bosonprotocol/react-kit": "^0.30.0-alpha.0",
"@bosonprotocol/react-kit": "^0.30.0-alpha.7",
"@davatar/react": "^1.10.4",
"@ethersproject/address": "^5.6.1",
"@ethersproject/units": "^5.7.0",
Expand Down
30 changes: 15 additions & 15 deletions src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ const CustomGridContainer = styled.div`
`;

interface INavigationLinks {
flexDirection?: "row" | "column";
gap?: string;
$flexDirection?: "row" | "column";
$gap?: string;
}

const NavigationLinks = styled.nav<INavigationLinks>`
display: flex;
gap: ${({ gap }) => gap || "16px"};
gap: ${({ $gap }) => $gap || "16px"};
flex-wrap: wrap;
align-items: self-start;
max-width: 100%;
justify-content: center;
flex-direction: ${({ flexDirection }) => flexDirection || "row"};
flex-direction: ${({ $flexDirection }) => $flexDirection || "row"};

a {
cursor: pointer;
Expand Down Expand Up @@ -163,7 +163,7 @@ function Socials() {
</Typography>
)}
<NavigationLinks
gap={isLteS && !isXXS ? "16px" : "32px"}
$gap={isLteS && !isXXS ? "16px" : "32px"}
style={{ justifyContent: "flex-start" }}
>
{renderSocialLinks}
Expand Down Expand Up @@ -228,8 +228,8 @@ function ContactInfoLinks() {
GET IN TOUCH
</Typography>
<NavigationLinks
flexDirection="column"
gap={"0"}
$flexDirection="column"
$gap={"0"}
style={{ alignItems: "center", justifyContent: "flex-end" }}
>
{renderContactInfoLinks}
Expand Down Expand Up @@ -266,8 +266,8 @@ function CustomStoreAdditionalLinks() {
CLIENT SERVICE
</Typography>
<NavigationLinks
flexDirection="column"
gap={"0"}
$flexDirection="column"
$gap={"0"}
style={{ alignItems: "flex-start", justifyContent: "flex-end" }}
>
{renderAdditionalLinks}
Expand Down Expand Up @@ -476,8 +476,8 @@ function FullFooter() {
<div>
<Typography tag="h5">Shop</Typography>
<NavigationLinks
flexDirection="column"
gap={"0"}
$flexDirection="column"
$gap={"0"}
style={{ width: "fit-content" }}
>
{shopLinks}
Expand All @@ -488,8 +488,8 @@ function FullFooter() {
<div>
<Typography tag="h5">Sell</Typography>
<NavigationLinks
flexDirection="column"
gap={"0"}
$flexDirection="column"
$gap={"0"}
style={{ width: "fit-content" }}
>
{sellLinks}
Expand All @@ -500,8 +500,8 @@ function FullFooter() {
<div>
<Typography tag="h5">Help</Typography>
<NavigationLinks
flexDirection="column"
gap={"0"}
$flexDirection="column"
$gap={"0"}
style={{ width: "fit-content" }}
>
{helpLinks}
Expand Down
16 changes: 8 additions & 8 deletions src/components/header/DrCenterHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ const Header = styled.header`
`;

const HeaderContainer = styled(Layout)<{
fluidHeader?: boolean;
$fluidHeader?: boolean;
}>`
${({ fluidHeader }) => {
${({ $fluidHeader }) => {
return css`
display: flex;
justify-content: space-between;
align-items: center;
height: ${HEADER_HEIGHT};
${breakpoint.xs} {
max-width: ${fluidHeader ? "none" : "93.75rem;"};
max-width: ${$fluidHeader ? "none" : "93.75rem;"};
}
`;
}}
`;

const HeaderItems = styled.nav<{
fluidHeader?: boolean;
$fluidHeader?: boolean;
}>`
gap: 1rem;
${({ fluidHeader }) => {
${({ $fluidHeader }) => {
return css`
display: flex;
align-items: center;
justify-content: end;
width: 100%;
margin-left: ${fluidHeader ? "2.3rem" : "0"};
margin-left: ${$fluidHeader ? "2.3rem" : "0"};
`;
}}
`;
Expand Down Expand Up @@ -103,7 +103,7 @@ export const DrCenterHeader = forwardRef<HTMLElement, DrCenterHeaderProps>(
return (
<>
<Header ref={ref}>
<HeaderContainer fluidHeader={fluidHeader}>
<HeaderContainer $fluidHeader={fluidHeader}>
<>
<Grid flexDirection="row" alignItems="center" width="initial">
<LinkWithQuery
Expand All @@ -119,7 +119,7 @@ export const DrCenterHeader = forwardRef<HTMLElement, DrCenterHeaderProps>(
/>
</LinkWithQuery>
</Grid>
<HeaderItems fluidHeader={fluidHeader}>
<HeaderItems $fluidHeader={fluidHeader}>
{burgerMenuBreakpoint && (
<>
<ChainSelector />
Expand Down
8 changes: 4 additions & 4 deletions src/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ const Header = styled.header<{
`;

const HeaderContainer = styled(Layout)<{
fluidHeader?: boolean;
$fluidHeader?: boolean;
$navigationBarPosition: string;
}>`
${({ $navigationBarPosition, fluidHeader }) => {
${({ $navigationBarPosition, $fluidHeader }) => {
if (["left", "right"].includes($navigationBarPosition)) {
return css`
display: flex;
Expand All @@ -170,7 +170,7 @@ const HeaderContainer = styled(Layout)<{
align-items: center;
height: ${HEADER_HEIGHT};
${breakpoint.xs} {
max-width: ${fluidHeader ? "none" : "93.75rem;"};
max-width: ${$fluidHeader ? "none" : "93.75rem;"};
}
`;
}}
Expand Down Expand Up @@ -340,7 +340,7 @@ export const HeaderComponent = forwardRef<HTMLElement, Props>(
>
{!isCustomStoreFront && <AnnouncementBanner />}
<HeaderContainer
fluidHeader={fluidHeader}
$fluidHeader={fluidHeader}
$navigationBarPosition={navigationBarPosition}
>
{isSideBurgerVisible ? (
Expand Down
26 changes: 13 additions & 13 deletions src/components/header/HeaderLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import Search from "./Search";
export const HEADER_HEIGHT = "5.4rem";

const NavigationLinks = styled.div<{
isMobile: boolean;
isOpen: boolean;
$isMobile: boolean;
$isOpen: boolean;
$navigationBarPosition?: string;
$hoverHeaderTextColor: string;
}>`
Expand All @@ -40,16 +40,16 @@ const NavigationLinks = styled.div<{
color: ${({ $hoverHeaderTextColor }) => $hoverHeaderTextColor};
}
}
${({ isMobile, isOpen, $navigationBarPosition }) =>
isMobile
${({ $isMobile, $isOpen, $navigationBarPosition }) =>
$isMobile
? css`
position: absolute;
top: calc(${HEADER_HEIGHT} + 1px);
left: 0;
right: 0;
bottom: 0;
height: 100vh;
transform: ${isOpen ? "translateX(0%)" : "translateX(100%)"};
transform: ${$isOpen ? "translateX(0%)" : "translateX(100%)"};

a,
[data-anchor] {
Expand Down Expand Up @@ -131,22 +131,22 @@ const NavigationLinks = styled.div<{
`;

const ItemsList = styled.div<{
isMobile: boolean;
$isMobile: boolean;
$navigationBarPosition?: string;
}>`
display: flex;
justify-content: end;
flex-direction: ${({ isMobile, $navigationBarPosition }) =>
isMobile || ["left", "right"].includes($navigationBarPosition ?? "")
flex-direction: ${({ $isMobile, $navigationBarPosition }) =>
$isMobile || ["left", "right"].includes($navigationBarPosition ?? "")
? "column"
: "row"};
align-items: ${({ $navigationBarPosition }) =>
["left", "right"].includes($navigationBarPosition ?? "") ? "center" : ""};
> * {
padding: 2rem;
}
${({ isMobile }) =>
!isMobile &&
${({ $isMobile }) =>
!$isMobile &&
css`
gap: 1rem;
`}
Expand Down Expand Up @@ -191,8 +191,8 @@ export default function HeaderLinks({

return (
<NavigationLinks
isMobile={isMobile}
isOpen={isOpen}
$isMobile={isMobile}
$isOpen={isOpen}
$navigationBarPosition={navigationBarPosition}
$hoverHeaderTextColor={getColor1OverColor2WithContrast({
color2: useCSSVariable("--headerBgColor") || colors.white,
Expand All @@ -206,7 +206,7 @@ export default function HeaderLinks({
/>
)}
<ItemsList
isMobile={isMobile}
$isMobile={isMobile}
$navigationBarPosition={navigationBarPosition}
>
{!onlySeller && withExploreProducts && (
Expand Down
8 changes: 4 additions & 4 deletions src/components/header/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import BosonButton from "../ui/BosonButton";
import { Grid } from "../ui/Grid";

const InputWrapper = styled(Grid)<{
isMobile: boolean;
$isMobile: boolean;
$navigationBarPosition?: string;
}>`
flex: 1;
Expand All @@ -22,8 +22,8 @@ const InputWrapper = styled(Grid)<{

margin: 0rem;

${({ isMobile, $navigationBarPosition }) =>
isMobile
${({ $isMobile, $navigationBarPosition }) =>
$isMobile
? ""
: ["left", "right"].includes($navigationBarPosition ?? "")
? css`
Expand Down Expand Up @@ -82,7 +82,7 @@ export default function Search({ isMobile, navigationBarPosition }: Props) {

return (
<InputWrapper
isMobile={isMobile}
$isMobile={isMobile}
$navigationBarPosition={navigationBarPosition}
>
{!isMobile && <MagnifyingGlass size={24} style={{ minWidth: "24px" }} />}
Expand Down
8 changes: 2 additions & 6 deletions src/components/header/accountDrawer/miniPortfolio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Nav = styled(Grid)`
gap: 20px;
`;

const NavItem = styled(Typography)<{ active?: boolean }>`
const NavItem = styled(Typography)`
align-items: center;
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -65,11 +65,7 @@ export default function MiniPortfolio({ account }: { account: string }) {
setCurrentPage(index);
};
return (
<NavItem
onClick={handleNavItemClick}
active={currentPage === index}
key={key}
>
<NavItem onClick={handleNavItemClick} key={key}>
<span>{title}</span>
</NavItem>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/header/identicon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import useENSAvatar from "lib/utils/hooks/useENSAvatar";
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
import styled from "styled-components";

const StyledIdenticon = styled.div<{ iconSize: number }>`
height: ${({ iconSize }) => `${iconSize}px`};
width: ${({ iconSize }) => `${iconSize}px`};
const StyledIdenticon = styled.div<{ $iconSize: number }>`
height: ${({ $iconSize }) => `${$iconSize}px`};
width: ${({ $iconSize }) => `${$iconSize}px`};
border-radius: 50%;
background-color: ${colors.lightGrey};
font-size: initial;
Expand Down Expand Up @@ -52,7 +52,7 @@ export default function Identicon({
const handleError = useCallback(() => setFetchable(false), []);

return (
<StyledIdenticon iconSize={iconSize}>
<StyledIdenticon $iconSize={iconSize}>
{avatar && fetchable ? (
<StyledAvatar
alt="avatar"
Expand Down
8 changes: 4 additions & 4 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const layoutPadding = css`
}
`;

export const LayoutRoot = styled.div<{ fullWidth?: boolean }>`
export const LayoutRoot = styled.div<{ $fullWidth?: boolean }>`
position: relative;
${({ fullWidth }) => {
if (fullWidth) {
${({ $fullWidth }) => {
if ($fullWidth) {
return css``;
}
return css`
Expand Down Expand Up @@ -55,7 +55,7 @@ export default function Layout({
const [fullWidth, setFullWidth] = useState<boolean>(!!initialFullWidth);
return (
<LayoutContext.Provider value={{ fullWidth: fullWidth, setFullWidth }}>
<LayoutRoot {...props} fullWidth={fullWidth} data-layout>
<LayoutRoot {...props} $fullWidth={fullWidth} data-layout>
{children}
</LayoutRoot>
</LayoutContext.Provider>
Expand Down
17 changes: 16 additions & 1 deletion src/components/product/Preview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Grid, subgraph } from "@bosonprotocol/react-kit";
import { CommitDetailWidget } from "components/detail/DetailWidget/CommitDetailWidget";
import { Spinner } from "components/loading/Spinner";
import Loading from "components/ui/Loading";
import { ChatInitializationStatus } from "lib/utils/hooks/chat/useChatStatus";
import map from "lodash/map";
import { useChatContext } from "pages/chat/ChatProvider/ChatContext";
Expand All @@ -25,7 +26,7 @@ import BosonButton from "../ui/BosonButton";
import { Typography } from "../ui/Typography";
import Video from "../ui/Video";
import { ConfirmProductDetailsButtonGroup } from "./confirmProductDetailsPage/ConfirmProductDetails.styles";
import { usePreviewOffers } from "./utils/usePreviewOffer";
import { usePreviewOffers } from "./utils/usePreviewOffers";
const ObjectContainImage = styled(Image)`
> * {
object-fit: contain;
Expand Down Expand Up @@ -88,6 +89,20 @@ export default function Preview({
});
// Build the Offer structure (in the shape of SubGraph request), based on temporary data (values)
const [offer] = previewOffers;
if (!offer.seller) {
return (
<>
<Loading />
<BosonButton
variant="accentInverted"
type="button"
onClick={handleClosePreview}
>
Back to overview
</BosonButton>
</>
);
}
Comment on lines +92 to +105
Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of the fix

/*
// TODO: hidden for now
const redemptionPointUrl =
Expand Down
Loading
Loading