Skip to content

Commit

Permalink
feat: masqurade hover modified
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-liu-smile authored and CarlLiu2023 committed Apr 6, 2023
1 parent 404fb3b commit 6a948cc
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 70 deletions.
44 changes: 0 additions & 44 deletions apps/storefront/src/components/B3HoverButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
useContext,
Dispatch,
SetStateAction,
useState,
Expand All @@ -12,20 +11,10 @@ import {
Snackbar,
} from '@mui/material'

import GroupIcon from '@mui/icons-material/Group'

import type {
OpenPageState,
} from '@b3/hooks'

import {
useMobile,
} from '@/hooks'

import {
GlobaledContext,
} from '@/shared/global'

import {
B3LStorage,
} from '@/utils'
Expand All @@ -43,15 +32,6 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
productQuoteEnabled,
} = props

const {
state: {
isAgenting,
salesRepCompanyName,
},
} = useContext(GlobaledContext)

const [isMobile] = useMobile()

const [showFinishQuote, setShowFinishQuote] = useState<boolean>(false)

const b2bQuoteDraftList = B3LStorage.get('b2bQuoteDraftList')
Expand All @@ -67,7 +47,6 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
} = window.location

if (href.includes('/checkout')) return <></>
const style = 'backgroundColor:"#ED6C02";fontSize:18px;'
return (
<Snackbar
sx={{
Expand Down Expand Up @@ -100,7 +79,6 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
height: '42px',
}}
onClick={() => {
// B3SStorage.set('nextPath', '/')
setOpenPage({
isOpen: true,
openUrl: '/quoteDraft',
Expand All @@ -116,28 +94,6 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
)
}

{
isAgenting && !isOpen && isMobile && (
<Button
sx={{
backgroundColor: '#ED6C02',
height: '42px',
marginTop: '10px',
}}
onClick={() => {
setOpenPage({
isOpen: true,
openUrl: '/',
})
}}
variant="contained"
startIcon={<GroupIcon />}
>
{salesRepCompanyName}
</Button>
)
}

</Box>

</Snackbar>
Expand Down
100 changes: 74 additions & 26 deletions apps/storefront/src/components/B3MasquradeGobalTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {

import {
Box,
Button,
} from '@mui/material'

import type {
Expand Down Expand Up @@ -99,7 +100,7 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {

if (href.includes('/checkout') || !customerId) return <></>

if (!isAgenting || (!isOpen && isMobile)) return <></>
if (!isAgenting) return <></>

let sx = {}

Expand All @@ -116,28 +117,70 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
}
}
return (
<Snackbar
sx={{
zIndex: '110000',
backgroundColor: '#ED6C02',
borderRadius: '4px',
height: '52px',
color: '#FFFFFF',
...sx,
}}
anchorOrigin={{
vertical: 'bottom', horizontal: 'left',
}}
open
key="123"
>
<Box
sx={{
padding: '5px 15px',
width: '100%',
}}
>
{
<>
{
!isOpen && isMobile && (
<Snackbar
sx={{
zIndex: '110000',
left: '20px',
bottom: '20px',
right: 'auto',
}}
anchorOrigin={{
vertical: 'bottom', horizontal: 'left',
}}
open
key="123"
>

<Button
sx={{
backgroundColor: '#ED6C02',
height: '42px',
marginTop: '10px',
}}
onClick={() => {
setOpenPage({
isOpen: true,
openUrl: '/',
})
}}
variant="contained"
startIcon={<GroupIcon />}
>
{salesRepCompanyName}
</Button>

</Snackbar>
)
}

{

((isOpen && isMobile) || !isMobile) && (
<Snackbar
sx={{
zIndex: '110000',
backgroundColor: '#ED6C02',
borderRadius: '4px',
height: '52px',
color: '#FFFFFF',
...sx,
}}
anchorOrigin={{
vertical: 'bottom', horizontal: 'left',
}}
open
key="123"
>
<Box
sx={{
padding: '5px 15px',
width: '100%',
}}
>
{
!isMobile && (
<Box
sx={{
Expand Down Expand Up @@ -208,7 +251,7 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
)
}

{
{
isMobile && (
<Box
sx={{
Expand Down Expand Up @@ -256,8 +299,13 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
)
}

</Box>
</Box>

</Snackbar>
)
}

</>

</Snackbar>
)
}

0 comments on commit 6a948cc

Please sign in to comment.