Skip to content

Commit

Permalink
feat: Navbar revamp (#10401)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the menu functionality and UI components in
the application. It introduces new sub-menu items, modifies existing
components, and improves styling for better user experience.

### Detailed summary
- Added `activeSubItemChildItem` to multiple type definitions.
- Adjusted positioning in `InPageBanner.tsx`.
- Introduced `SubMenu` component in various views.
- Added new icons like `GameIcon`.
- Updated footer links for better navigation.
- Improved menu item rendering with child items support.

> The following files were skipped due to too many changes:
`packages/uikit/src/__tests__/widgets/__snapshots__/menu.test.tsx.snap`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
ChefMomota authored Oct 1, 2024
1 parent d640cda commit dfc1615
Show file tree
Hide file tree
Showing 27 changed files with 671 additions and 451 deletions.
52 changes: 32 additions & 20 deletions apps/aptos/components/Menu/footerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ export const footerLinks: (t: ContextApi['t']) => FooterLinkType[] = (t) => [
href: 'https://pancakeswap.games/',
},
{
label: t('NFT'),
href: 'https://pancakeswap.finance/nfts',
label: t('Play'),
href: 'https://pancakeswap.finance/prediction',
},
{
label: t('Tokenomics'),
href: 'https://docs.pancakeswap.finance/governance-and-tokenomics/cake-tokenomics',
},
{
label: t('CAKE Emission Projection'),
href: 'https://analytics.pancakeswap.finance/',
label: t('veCAKE'),
href: 'https://pancakeswap.finance/cake-staking',
},
{
label: t('Merchandise'),
Expand All @@ -39,16 +35,20 @@ export const footerLinks: (t: ContextApi['t']) => FooterLinkType[] = (t) => [
label: 'Business',
items: [
{
label: t('Farms and Syrup Pools'),
label: t('CAKE Incentives'),
href: 'https://docs.pancakeswap.finance/ecosystem-and-partnerships/business-partnerships/syrup-pools-and-farms',
},
{
label: t('IFO'),
label: t('Staking Pools'),
href: 'https://pancakeswap.finance/pools',
},
{
label: t('Token Launches'),
href: 'https://docs.pancakeswap.finance/ecosystem-and-partnerships/business-partnerships/initial-farm-offerings-ifos',
},
{
label: t('NFT Marketplace'),
href: 'https://docs.pancakeswap.finance/ecosystem-and-partnerships/business-partnerships/nft-market-applications',
label: t('Brand Assets'),
href: 'https://docs.pancakeswap.finance/ecosystem-and-partnerships/brand',
},
],
},
Expand All @@ -68,7 +68,7 @@ export const footerLinks: (t: ContextApi['t']) => FooterLinkType[] = (t) => [
href: 'https://docs.pancakeswap.finance/developers/bug-bounty',
},
{
label: t('v4'),
label: t('V4'),
href: 'https://pancakeswap.finance/v4',
},
],
Expand All @@ -77,7 +77,7 @@ export const footerLinks: (t: ContextApi['t']) => FooterLinkType[] = (t) => [
label: t('Support'),
items: [
{
label: t('Contact'),
label: t('Get Help'),
href: 'https://docs.pancakeswap.finance/contact-us/customer-support',
},
{
Expand All @@ -88,27 +88,39 @@ export const footerLinks: (t: ContextApi['t']) => FooterLinkType[] = (t) => [
label: t('Documentation'),
href: 'https://docs.pancakeswap.finance/',
},
{
label: t('Audits'),
href: 'https://docs.pancakeswap.finance/readme/audits',
},
{
label: t('Legacy products'),
href: 'https://docs.pancakeswap.finance/products/legacy-products',
},
],
},
{
label: t('About'),
items: [
{
label: t('Terms Of Service'),
href: 'https://pancakeswap.finance/terms-of-service',
label: t('Tokenomics'),
href: 'https://docs.pancakeswap.finance/governance-and-tokenomics/cake-tokenomics',
},
{
label: t('Blog'),
href: 'https://blog.pancakeswap.finance/',
label: t('CAKE Emission Projection'),
href: 'https://analytics.pancakeswap.finance/',
},
{
label: t('Brand Assets'),
href: 'https://docs.pancakeswap.finance/ecosystem-and-partnerships/brand',
label: t('Blog'),
href: 'https://blog.pancakeswap.finance/',
},
{
label: t('Careers'),
href: 'https://docs.pancakeswap.finance/team/become-a-chef',
},
{
label: t('Terms Of Service'),
href: 'https://pancakeswap.finance/terms-of-service',
},
],
},
]
32 changes: 5 additions & 27 deletions apps/web/src/__tests__/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ describe('getActiveMenuItem', () => {

it('should return an active item if pathname found in subitems', () => {
// Given
const pathname = '/pools'
const pathname = '/liquidity/pools'

// When
const result = getActiveMenuItem({ pathname, menuConfig: menuConfig(mockT, false, undefined) })

// Then
expect(result).toEqual(menuConfig(mockT, false, undefined)[2])
expect(result).toEqual(menuConfig(mockT, false, undefined)[1])
})

it('should not return an item that only includes pathname but not starts with', () => {
Expand All @@ -34,7 +34,7 @@ describe('getActiveMenuItem', () => {
const result = getActiveMenuItem({ pathname, menuConfig: menuConfig(mockT, false, undefined) })

// Then
expect(result).toEqual(menuConfig(mockT, false, undefined)[6])
expect(result).toEqual(menuConfig(mockT, false, undefined)[4])
})

it('should return undefined if item is not found', () => {
Expand Down Expand Up @@ -63,24 +63,13 @@ describe('getActiveSubMenuItem', () => {

it('should return an active sub item', () => {
// Given
const pathname = '/pools'
const pathname = '/liquidity/pools'

// When
const result = getActiveSubMenuItem({ pathname, menuItem: menuConfig(mockT, false, undefined)[1] })

// Then
expect(result).toEqual(menuConfig(mockT, false, undefined)[1].items?.[2])
})

it('should return the item with the longest href when multiple items are found', () => {
// Given
const pathname = '/nfts/collections/0xDf7952B35f24aCF7fC0487D01c8d5690a60DBa07'

// When
const result = getActiveSubMenuItem({ pathname, menuItem: menuConfig(mockT, false, undefined)[4] })

// Then
expect(result).toEqual(menuConfig(mockT, false, undefined)[4].items?.[1])
expect(result).toEqual(menuConfig(mockT, false, undefined)[1].items?.[0])
})

it('should return undefined if item is not found', () => {
Expand All @@ -94,16 +83,5 @@ describe('getActiveSubMenuItem', () => {
expect(result).toEqual(undefined)
})

it('should return the item with the longest href when multiple items are found', () => {
// Given
const pathname = '/nfts/collections/0xDf7952B35f24aCF7fC0487D01c8d5690a60DBa07'

// When
const result = getActiveSubMenuItem({ pathname, menuItem: menuConfig(mockT, false, undefined)[4] })

// Then
expect(result).toEqual(menuConfig(mockT, false, undefined)[4].items?.[1])
})

it.todo('should return items with supportChainId')
})
Loading

0 comments on commit dfc1615

Please sign in to comment.