-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Melisa Anabella Rossi
authored
Jan 30, 2024
1 parent
c0e9e71
commit 66f5091
Showing
8 changed files
with
738 additions
and
79 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,23 @@ | ||
import React, { useCallback } from 'react' | ||
import { | ||
Navbar as BaseNavbar, | ||
Navbar2 as BaseNavbar2, | ||
UserInformation, | ||
} from 'decentraland-dapps/dist/containers' | ||
import { Navbar as BaseNavbar } from 'decentraland-dapps/dist/containers' | ||
|
||
import { locations } from '../../modules/locations' | ||
import { config } from '../../config' | ||
import { Props } from './Navbar.types' | ||
import './Navbar.css' | ||
|
||
const Navbar = (props: Props) => { | ||
const { | ||
pathname, | ||
onNavigate, | ||
isConnected, | ||
isAuthDappEnabled, | ||
isNavbarV2Enabled, | ||
} = props | ||
|
||
if (isConnected) { | ||
props = { | ||
...props, | ||
rightMenu: <UserInformation />, | ||
} | ||
} | ||
const { pathname, onNavigate, isAuthDappEnabled } = props | ||
|
||
const handleOnSignIn = useCallback(() => { | ||
if (isAuthDappEnabled) { | ||
window.location.replace( | ||
`${config.get('AUTH_URL')}/login?redirectTo=${window.location.href}` | ||
) | ||
window.location.replace(`${config.get('AUTH_URL')}/login?redirectTo=${window.location.href}`) | ||
return | ||
} | ||
onNavigate(locations.signIn()) | ||
}, [isAuthDappEnabled, onNavigate]) | ||
|
||
const handleOnClickAccount = useCallback(() => { | ||
onNavigate(locations.settings()) | ||
}, [onNavigate]) | ||
|
||
return isNavbarV2Enabled ? ( | ||
<BaseNavbar2 | ||
{...props} | ||
isSignIn={pathname === locations.signIn()} | ||
onSignIn={handleOnSignIn} | ||
/> | ||
) : ( | ||
<BaseNavbar | ||
{...props} | ||
isFullscreen={props.isFullscreen} | ||
isSignIn={pathname === locations.signIn()} | ||
onSignIn={handleOnSignIn} | ||
onClickAccount={handleOnClickAccount} | ||
/> | ||
) | ||
return <BaseNavbar {...props} isSignIn={pathname === locations.signIn()} onSignIn={handleOnSignIn} /> | ||
} | ||
|
||
export default React.memo(Navbar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export enum FeatureName { | ||
AUTH_DAPP = 'auth-dapp', | ||
NAVBAR_V2 = 'navbar2_variant', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters