Skip to content

Commit

Permalink
fix: repair shopping list issues
Browse files Browse the repository at this point in the history
  • Loading branch information
b3aton committed Jan 5, 2023
1 parent 183244d commit c72614f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 10 additions & 6 deletions apps/storefront/src/components/layout/B3Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {

import {
useContext,
useRef,
} from 'react'
import {
useNavigate,
Expand All @@ -29,6 +28,10 @@ import {
GlobaledContext,
} from '@/shared/global'

import {
B3SStorage,
} from '@/utils'

// import {
// NavMessage,
// } from './styled'
Expand All @@ -43,7 +46,6 @@ export const B3Nav = ({
const [isMobile] = useMobile()
const navigate = useNavigate()
const location = useLocation()
const nextPath = useRef<null | string>(null)

const {
state: globalState,
Expand All @@ -68,14 +70,16 @@ export const B3Nav = ({
borderRadius: '4px',
}
if (location.pathname === path) {
nextPath.current = path
B3SStorage.set('nextPath', path)
return activeStyle
}
if (nextPath.current === path && location.pathname.includes('orderDetail')) {
return activeStyle

if (location.pathname.includes('orderDetail')) {
const gotoOrderPath = B3SStorage.get('nextPath') === '/company-orders' ? '/company-orders' : '/orders'
if (path === gotoOrderPath) return activeStyle
}

if (nextPath.current === path && location.pathname.includes('shoppingList')) {
if (location.pathname.includes('shoppingList') && path === '/shoppingLists') {
return activeStyle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,19 @@ export const ChooseOptionsDialog = (props: ChooseOptionsDialogProps) => {
quantity: parseInt(quantity.toString(), 10) || 1,
variantId: parseInt(variantId.toString(), 10) || 1,
}])

reset()
})()
}

const handleCancelClicked = () => {
reset()
onCancel()
}

useEffect(() => {
if (!isOpen) {
reset()
}
}, [isOpen])

return (
<B3Dialog
isOpen={isOpen}
Expand Down

0 comments on commit c72614f

Please sign in to comment.