Skip to content

Commit

Permalink
fix: props
Browse files Browse the repository at this point in the history
  • Loading branch information
lauti7 committed Jan 17, 2024
1 parent e9a8a7c commit ddc5d55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/components/Navbar/Navbar.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ import { push } from 'connected-react-router'
import { isPending } from 'decentraland-dapps/dist/modules/transaction/utils'
import { isLoggedIn } from 'modules/identity/selectors'
import { RootState } from 'modules/common/types'
import { getIsNavbarV2Enabled, getIsNewNavbarDropdownEnabled } from 'modules/features/selectors'
import { getIsNewNavbarDropdownEnabled } from 'modules/features/selectors'
import { getTransactions } from 'modules/transaction/selectors'
import { locations } from 'routing/locations'
import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './Navbar.types'
import Navbar from './Navbar'

const mapState = (state: RootState): MapStateProps => ({
hasPendingTransactions: getTransactions(state).some(tx => isPending(tx.status)),
isConnected: isLoggedIn(state),
isSignedIn: isLoggedIn(state),
isNewNavbarEnabled: getIsNewNavbarDropdownEnabled(state),
isNavbarV2Enabled: getIsNavbarV2Enabled(state)
})

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
onSignIn: () => dispatch(push(locations.signIn()))
onClickSignIn: () => dispatch(push(locations.signIn()))
})

const mergeProps = (mapStateProps: MapStateProps, mapDispatchProps: MapDispatchProps, ownProps: OwnProps) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Props } from './Navbar.types'

import './Navbar.css'

const Navbar: React.FC<Props> = ({ hasPendingTransactions, isNavbarV2Enabled, ...props }: Props) => {
const Navbar: React.FC<Props> = ({ hasPendingTransactions, ...props }: Props) => {
return <BaseNavbar activePage={NavbarPages.CREATE} {...props} hasActivity={hasPendingTransactions} />
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/Navbar/Navbar.types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NavbarProps } from 'decentraland-ui'
import { NavbarProps } from 'decentraland-ui/dist/components/Navbar/Navbar.types'
import { Dispatch } from 'redux'

export type Props = Partial<NavbarProps> & { isNewNavbarEnabled: boolean; hasPendingTransactions: boolean }

export type MapStateProps = Pick<Props, 'hasPendingTransactions' | 'isConnected' | 'isNewNavbarEnabled' | 'isNavbarV2Enabled'>
export type MapDispatchProps = Pick<Props, 'onSignIn'>
export type MapStateProps = Pick<Props, 'hasPendingTransactions' | 'isSignedIn' | 'isNewNavbarEnabled'>
export type MapDispatchProps = Pick<Props, 'onClickSignIn'>
export type MapDispatch = Dispatch
export type OwnProps = Partial<Props>

0 comments on commit ddc5d55

Please sign in to comment.