Skip to content

Commit

Permalink
fix: click target flag
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and CarlLiu2023 committed Sep 8, 2023
1 parent bf96bda commit 9e613c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
14 changes: 9 additions & 5 deletions apps/storefront/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ export default function App() {
currentClickedUrl,
isRegisterAndLogin,
} = useSelector(globalStateSelector)
const [isClickBtn, setIsClickEnterBtn] = useState<boolean>(false)

const handleAccountClick = (href: string, isRegisterAndLogin: boolean) => {
setIsClickEnterBtn(!isClickBtn)
const [clickTimeTarget, setClickTimeTarget] = useState<number>(0)

const handleAccountClick = (
href: string,
isRegisterAndLogin: boolean,
timeTarget: number
) => {
setClickTimeTarget(timeTarget)
showPageMask(dispatch, true)
storeDispatch(
setGlabolCommonState({
Expand Down Expand Up @@ -276,7 +280,7 @@ export default function App() {
})
)
}
}, [isPageComplete, currentClickedUrl, isClickBtn])
}, [isPageComplete, currentClickedUrl, clickTimeTarget])

useEffect(() => {
const handleHashChange = () => {
Expand Down
9 changes: 7 additions & 2 deletions packages/hooks/useB3AppOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface OpenPageState {
isOpen: boolean
openUrl?: string
isPageComplete?: boolean
handleEnterClick?: (href: string, bool: boolean) => void
handleEnterClick?: (href: string, bool: boolean, timeTarget: number) => void
params?: { [key: string]: string }
// gotoPageByClick: ({
// href,
Expand Down Expand Up @@ -54,6 +54,7 @@ export const useB3AppOpen = (initOpenState: OpenPageState) => {
const isRegisterArrInclude = registerArr.includes(e.target)
const tagHref = (e.target as HTMLAnchorElement)?.href
let href = tagHref || '/orders'
const timeTarget = Date.now()
if (!tagHref) {
const parentNode = (e.target as HTMLAnchorElement)?.parentNode
const parentNodeOrigin = (e.target as HTMLAnchorElement)?.parentNode
Expand All @@ -76,7 +77,11 @@ export const useB3AppOpen = (initOpenState: OpenPageState) => {
}
}
if (initOpenState?.handleEnterClick) {
initOpenState.handleEnterClick(href, isRegisterArrInclude)
initOpenState.handleEnterClick(
href,
isRegisterArrInclude,
timeTarget
)
}
}
return false
Expand Down

0 comments on commit 9e613c6

Please sign in to comment.