diff --git a/apps/storefront/src/components/B3HoverButton.tsx b/apps/storefront/src/components/B3HoverButton.tsx index 73f10a2c..7357bef6 100644 --- a/apps/storefront/src/components/B3HoverButton.tsx +++ b/apps/storefront/src/components/B3HoverButton.tsx @@ -2,6 +2,8 @@ import { useContext, Dispatch, SetStateAction, + useState, + useEffect, } from 'react' import { @@ -15,6 +17,7 @@ import GroupIcon from '@mui/icons-material/Group' import type { OpenPageState, } from '@b3/hooks' + import { useMobile, } from '@/hooks' @@ -23,6 +26,10 @@ import { GlobaledContext, } from '@/shared/global' +import { + B3LStorage, +} from '@/utils' + interface B3HoverButtonProps { isOpen: boolean, productQuoteEnabled: boolean, @@ -45,6 +52,16 @@ export const B3HoverButton = (props: B3HoverButtonProps) => { const [isMobile] = useMobile() + const [showFinishQuote, setShowFinishQuote] = useState(false) + + const b2bQuoteDraftList = B3LStorage.get('b2bQuoteDraftList') + + useEffect(() => { + if (b2bQuoteDraftList.length) { + setShowFinishQuote(true) + } else setShowFinishQuote(false) + }, [isOpen, b2bQuoteDraftList]) + const { href, } = window.location @@ -76,7 +93,7 @@ export const B3HoverButton = (props: B3HoverButtonProps) => { > { - !isOpen && productQuoteEnabled && !href.includes('/cart') && ( + showFinishQuote && !isOpen && productQuoteEnabled && !href.includes('/cart') && ( + ) : ( + - ) - : ( - - - - ) + ) }