Skip to content

Commit

Permalink
feat: Upgrade Navbarv2 (#2090)
Browse files Browse the repository at this point in the history
* feat: Add FF navbar2_variant

* feat: Upgrade NavbarV2

* feat: Remove max-width

* feat: Upgrade decentraland-dapps package

* feat: Update decentraland-ui and decentraland-dapps packages

* feat: Update decentraland-dapps package
  • Loading branch information
cyaiox authored Jan 8, 2024
1 parent a70d9d1 commit 1d09532
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 32 deletions.
188 changes: 174 additions & 14 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"dcl-catalyst-commons": "^9.0.1",
"decentraland-connect": "^5.2.4",
"decentraland-crypto-fetch": "^1.0.3",
"decentraland-dapps": "^16.28.1",
"decentraland-dapps": "^16.31.1",
"decentraland-transactions": "^1.50.0",
"decentraland-ui": "^4.34.0",
"decentraland-ui": "^4.35.1",
"dotenv": "^10.0.0",
"ethers": "^5.6.8",
"graphql": "^14.7.0",
Expand Down
8 changes: 6 additions & 2 deletions webapp/src/components/Navbar/Navbar.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { isPending } from 'decentraland-dapps/dist/modules/transaction/utils'

import { RootState } from '../../modules/reducer'
import { getTransactions } from '../../modules/transaction/selectors'
import { getIsAuthDappEnabled } from '../../modules/features/selectors'
import {
getIsAuthDappEnabled,
getIsNavbarV2Enabled
} from '../../modules/features/selectors'
import { MapStateProps, MapDispatch, MapDispatchProps } from './Navbar.types'
import Navbar from './Navbar'
import { getCurrentIdentity } from '../../modules/identity/selectors'
Expand All @@ -15,7 +18,8 @@ const mapState = (state: RootState): MapStateProps => ({
isPending(tx.status)
),
identity: getCurrentIdentity(state) || undefined,
isAuthDappEnabled: getIsAuthDappEnabled(state)
isAuthDappEnabled: getIsAuthDappEnabled(state),
isNavbarV2Enabled: getIsNavbarV2Enabled(state)
})

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
Expand Down
28 changes: 17 additions & 11 deletions webapp/src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import React, { useCallback } from 'react'
import { Navbar as BaseNavbar } from 'decentraland-dapps/dist/containers'
import { Navbar2 as BaseNavbar2 } from 'decentraland-dapps/dist/containers'
import { Navbar2Pages } from 'decentraland-ui/dist/components/Navbar2/Navbar2.types'
import { config } from '../../config'
import { locations } from '../../modules/routing/locations'
import UserInformation from '../UserInformation'
import { Props } from './Navbar.types'
import './Navbar.css'

const Navbar = (props: Props) => {
const {
location,
onNavigate,
isAuthDappEnabled
} = props
const { location, onNavigate, isAuthDappEnabled, isNavbarV2Enabled } = props
const { pathname, search } = location

props = {
...props,
rightMenu: <UserInformation identity={props.identity} withNotifications />
}

const handleOnSignIn = useCallback(() => {
const searchParams = new URLSearchParams(search)
const currentRedirectTo = searchParams.get('redirectTo')
Expand All @@ -38,7 +31,17 @@ const Navbar = (props: Props) => {
onNavigate(locations.settings())
}, [onNavigate])

return (
return isNavbarV2Enabled ? (
<BaseNavbar2
{...props}
withNotifications
activePage={Navbar2Pages.MARKETPLACE}
hasActivity={props.hasPendingTransactions}
identity={props.identity}
onSignIn={handleOnSignIn}
onClickAccountSettings={handleOnClickAccount}
/>
) : (
<BaseNavbar
{...props}
withNotifications
Expand All @@ -47,6 +50,9 @@ const Navbar = (props: Props) => {
isSignIn={pathname === locations.signIn()}
onSignIn={handleOnSignIn}
onClickAccount={handleOnClickAccount}
rightMenu={
<UserInformation identity={props.identity} withNotifications />
}
/>
)
}
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/Navbar/Navbar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type Props = Partial<NavbarProps> & {
onNavigate: (path: string) => void
identity?: AuthIdentity
isAuthDappEnabled: boolean
isNavbarV2Enabled: boolean
}

export type OwnProps = Pick<Props, 'enablePartialSupportAlert'>
Expand All @@ -20,6 +21,7 @@ export type MapStateProps = Pick<
| 'hasPendingTransactions'
| 'identity'
| 'isAuthDappEnabled'
| 'isNavbarV2Enabled'
>
export type MapDispatchProps = Pick<Props, 'onNavigate'>
export type MapDispatch = Dispatch<CallHistoryMethodAction>
1 change: 0 additions & 1 deletion webapp/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ code {

.ui.container {
width: 100%;
max-width: 1360px !important;
}

.dcl.toast .toast-info .body .ui.basic.button.no-padding {
Expand Down
Loading

0 comments on commit 1d09532

Please sign in to comment.