Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Hasan/Pr 1827 api page 404 (#5608)
Browse files Browse the repository at this point in the history
* fix: added link items state to nav provider

* fix: removed console from destop menu

* fix: added drop items state to nav provider and removed items variables

* fix: loadable import footer in old layout

* fix: remove unused usememo hook

* fix: reset gatsby browser

* chore: reset gatsby brower js

* empty: 🚀 to redeploy and trigger build

* fix: use effect

* fix: removed commented lines from old layout
  • Loading branch information
hasan-deriv authored Sep 22, 2023
1 parent 4b284a7 commit 7901972
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/components/layout/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactNode, Ref } from 'react'
import loadable from '@loadable/component'
import styled from 'styled-components'
import { LocationProvider } from './location-context'
import LayoutOverlay from './layout-overlay'
Expand All @@ -13,13 +14,11 @@ import PaymentAgentAffiliateNav from 'features/components/templates/navigation/p
import BugBountyNav from 'features/components/templates/navigation/bug-bounty-nav'
import CareerNav from 'features/components/templates/navigation/career-nav'
import MarketNav from 'features/components/templates/navigation/market-nav'
import RebrandingFooter from 'features/components/templates/footer'
import PpcProvider from 'features/contexts/ppc-campaign/ppc.provider'
import BannerAlert from 'components/custom/_banner-alert'
import { bannerTypes } from 'common/constants'

// const LoadableFooter = Loadable(() => import('./footer'))
// const BeSquareFooter = Loadable(() => import('./besquare/footer'))
const RebrandingFooter = loadable(() => import('features/components/templates/footer'))

type LayoutProps = {
children: ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode, useContext, useMemo } from 'react'
import React, { ReactNode, useContext, useState, useEffect } from 'react'
import {
NavItem,
SmartMultiColumnItems,
Expand Down Expand Up @@ -33,25 +33,29 @@ export const isSingleItem = (item: NavItem): item is SmartSingleItem => {
export const NavProvider = ({ is_menu_open, onCloseMenu, children, items }: NavProviderProps) => {
const { is_mobile_or_tablet } = useBreakpoints()
const { is_eu, is_row } = useRegion()
const [link_items, setLinkItems] = useState<SmartSingleItem[]>([])
const [drop_items, setDropItems] = useState<(SmartSingleColumnItems | SmartMultiColumnItems)[]>(
[],
)

const visible_items = useVisibleContent({
content: items,
config: { is_mobile: is_mobile_or_tablet, is_eu, is_row },
})

const { drop_items, link_items } = useMemo(() => {
const link_items: SmartSingleItem[] = []
const drop_items: (SmartSingleColumnItems | SmartMultiColumnItems)[] = []

useEffect(() => {
const links = []
const drops = []
visible_items.forEach((item) => {
if (isSingleItem(item)) {
link_items.push(item)
links.push(item)
} else {
drop_items.push(item)
drops.push(item)
}
})
return { link_items, drop_items }
}, [visible_items])
setLinkItems(links)
setDropItems(drops)
}, [visible_items.length])

return (
<NavContext.Provider value={{ is_menu_open, onCloseMenu, link_items, drop_items }}>
Expand Down

1 comment on commit 7901972

@vercel
Copy link

@vercel vercel bot commented on 7901972 Sep 22, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

deriv-com – ./

deriv-com.binary.sx
deriv-com-git-master.binary.sx

Please sign in to comment.