Skip to content

Commit

Permalink
fix: Remove rentals FF (decentraland#1283)
Browse files Browse the repository at this point in the history
* fix: Remove rentals FF

* fix: Remove isRentalsEnabled from AccountSidebar

* fix: Remove unused import
  • Loading branch information
LautaroPetaccio authored Jan 11, 2023
1 parent 6c3516f commit df4c19a
Show file tree
Hide file tree
Showing 39 changed files with 58 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux'
import { RootState } from '../../modules/reducer'
import { browse } from '../../modules/routing/actions'
import { getSection } from '../../modules/routing/selectors'
import { getIsRentalsEnabled } from '../../modules/features/selectors'
import {
MapDispatch,
MapDispatchProps,
Expand All @@ -12,8 +11,7 @@ import {
import AccountSidebar from './AccountSidebar'

const mapState = (state: RootState): MapStateProps => ({
section: getSection(state),
isRentalsEnabled: getIsRentalsEnabled(state)
section: getSection(state)
})

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
Expand Down
9 changes: 2 additions & 7 deletions webapp/src/components/AccountSidebar/AccountSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const AccountSidebar = ({
address,
section,
isCurrentAccount,
onBrowse,
isRentalsEnabled
onBrowse
}: Props) => {
const handleOnBrowse = useCallback(
(vendor: VendorName, section: string, assetType?: AssetType) => {
Expand All @@ -23,11 +22,7 @@ const AccountSidebar = ({
return (
<div className="AccountSidebar">
{isCurrentAccount ? (
<CurrentAccountSidebar
section={section}
onBrowse={handleOnBrowse}
isRentalsEnabled={isRentalsEnabled}
/>
<CurrentAccountSidebar section={section} onBrowse={handleOnBrowse} />
) : (
<OtherAccountSidebar section={section} />
)}
Expand Down
3 changes: 1 addition & 2 deletions webapp/src/components/AccountSidebar/AccountSidebar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ export type Props = {
address: string
isCurrentAccount?: boolean
onBrowse: typeof browse
isRentalsEnabled: boolean
}

export type MapStateProps = Pick<Props, 'section' | 'isRentalsEnabled'>
export type MapStateProps = Pick<Props, 'section'>
export type MapDispatchProps = Pick<Props, 'onBrowse'>
export type MapDispatch = Dispatch<BrowseAction>
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ const {
STORE_SETTINGS
} = Sections.decentraland

const CurrentAccountSidebar = ({
section,
onBrowse,
isRentalsEnabled
}: Props) => (
const CurrentAccountSidebar = ({ section, onBrowse }: Props) => (
<>
<Menu>
<Header sub>{t('account_sidebar.assets')}</Header>
Expand All @@ -52,14 +48,12 @@ const CurrentAccountSidebar = ({
currentValue={section}
onClick={section => onBrowse(decentraland, section)}
/>
{isRentalsEnabled ? (
<MenuItem
key={ON_RENT}
value={ON_RENT}
currentValue={section}
onClick={section => onBrowse(decentraland, section)}
/>
) : null}
<MenuItem
key={ON_RENT}
value={ON_RENT}
currentValue={section}
onClick={section => onBrowse(decentraland, section)}
/>
<MenuItem
key={SALES}
value={SALES}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { VendorName } from '../../../modules/vendor'
export type Props = {
section: string
onBrowse: (vendor: VendorName, section: string) => void
isRentalsEnabled: boolean
}
2 changes: 0 additions & 2 deletions webapp/src/components/AssetBrowse/AssetBrowse.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
} from '../../modules/routing/selectors'
import { getView } from '../../modules/ui/browse/selectors'
import { FETCH_ITEMS_REQUEST } from '../../modules/item/actions'
import { getIsRentalsEnabled } from '../../modules/features/selectors'
import { isMapSet } from '../../modules/routing/utils'
import {
MapDispatch,
Expand All @@ -43,7 +42,6 @@ const mapState = (state: RootState): MapStateProps => {
assetType: getAssetType(state),
viewInState: getView(state),
onlySmart: getOnlySmart(state),
isRentalsEnabled: getIsRentalsEnabled(state),
onlyOnRent: getOnlyOnRent(state)
}
}
Expand Down
7 changes: 2 additions & 5 deletions webapp/src/components/AssetBrowse/AssetBrowse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const AssetBrowse = (props: Props) => {
onlyOnSale,
onlySmart,
viewInState,
isRentalsEnabled,
onlyOnRent
} = props

Expand Down Expand Up @@ -270,9 +269,7 @@ const AssetBrowse = (props: Props) => {
/>
</div>
) : (
<AssetList
isManager={view === View.CURRENT_ACCOUNT && isRentalsEnabled}
/>
<AssetList isManager={view === View.CURRENT_ACCOUNT} />
)}
</>
)
Expand All @@ -285,7 +282,7 @@ const AssetBrowse = (props: Props) => {
Sections.decentraland.EMOTES,
Sections.decentraland.ENS,
Sections.decentraland.ON_SALE,
isRentalsEnabled ? Sections.decentraland.ON_RENT : undefined,
Sections.decentraland.ON_RENT,
Sections.decentraland.SALES,
Sections.decentraland.BIDS,
Sections.decentraland.STORE_SETTINGS
Expand Down
2 changes: 0 additions & 2 deletions webapp/src/components/AssetBrowse/AssetBrowse.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type Props = {
section?: Section
sections?: Section[]
isLoading: boolean
isRentalsEnabled: boolean
onSetView: typeof setView
onFetchAssetsFromRoute: typeof fetchAssetsFromRoute
onBrowse: typeof browse
Expand All @@ -43,7 +42,6 @@ export type MapStateProps = Pick<
| 'section'
| 'assetType'
| 'onlySmart'
| 'isRentalsEnabled'
| 'onlyOnRent'
>
export type MapDispatchProps = Pick<
Expand Down
8 changes: 2 additions & 6 deletions webapp/src/components/AssetPage/AssetPage.container.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { connect } from 'react-redux'
import { Dispatch } from 'redux'
import { getIsRentalsEnabled } from '../../modules/features/selectors'
import { RootState } from '../../modules/reducer'
import { goBack } from '../../modules/routing/actions'
import AssetPage from './AssetPage'
import { MapStateProps, MapDispatchProps } from './AssetPage.types'
import { MapDispatchProps } from './AssetPage.types'

const mapState = (state: RootState): MapStateProps => ({
isRentalsEnabled: getIsRentalsEnabled(state)
})
const mapState = () => ({})

const mapDispatch = (dispatch: Dispatch): MapDispatchProps => ({
onBack: (location?: string) => dispatch(goBack(location))
Expand Down
4 changes: 1 addition & 3 deletions webapp/src/components/AssetPage/AssetPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ENSDetail } from './ENSDetail'
import { EmoteDetail } from './EmoteDetail'
import './AssetPage.css'

const AssetPage = ({ type, isRentalsEnabled, onBack }: Props) => {
const AssetPage = ({ type, onBack }: Props) => {
return (
<>
<Navbar isFullscreen />
Expand Down Expand Up @@ -98,15 +98,13 @@ const AssetPage = ({ type, isRentalsEnabled, onBack }: Props) => {
nft={nft}
order={order}
rental={rental}
isRentalsEnabled={isRentalsEnabled}
/>
),
parcel: nft => (
<ParcelDetail
nft={nft}
order={order}
rental={rental}
isRentalsEnabled={isRentalsEnabled}
/>
),
wearable: nft => <WearableDetail nft={nft} />,
Expand Down
2 changes: 0 additions & 2 deletions webapp/src/components/AssetPage/AssetPage.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { AssetType } from '../../modules/asset/types'

export type Props = {
type: AssetType
isRentalsEnabled: boolean
onBack: (location?: string) => void
}

export type MapStateProps = Pick<Props, 'isRentalsEnabled'>
export type MapDispatchProps = Pick<Props, 'onBack'>
21 changes: 5 additions & 16 deletions webapp/src/components/AssetPage/EstateDetail/EstateDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Props } from './EstateDetail.types'
import { ParcelCoordinates } from './ParcelCoordinates'
import './EstateDetail.css'

const EstateDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
const EstateDetail = ({ nft, order, rental }: Props) => {
const estate = nft.data.estate!
let x = 0
let y = 0
Expand All @@ -36,7 +36,7 @@ const EstateDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
className="EstateDetail"
asset={nft}
rental={rental ?? undefined}
showDetails={isRentalsEnabled && isLand(nft)}
showDetails={isLand(nft)}
assetImage={
<>
<AssetImage
Expand All @@ -55,18 +55,7 @@ const EstateDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
)}
</>
}
actions={
<>
{isRentalsEnabled ? (
<SaleRentActionBox
isRentalsEnabled={isRentalsEnabled}
order={order}
nft={nft}
rental={rental}
/>
) : null}
</>
}
actions={<SaleRentActionBox order={order} nft={nft} rental={rental} />}
isOnSale={!!nft.activeOrderId}
badges={
<>
Expand All @@ -77,7 +66,7 @@ const EstateDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
left={
<>
<Description text={estate.description} />
{!isRentalsEnabled ? <Owner asset={nft} /> : null}
<Owner asset={nft} />
<ProximityHighlights nft={nft} />
</>
}
Expand All @@ -94,7 +83,7 @@ const EstateDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
<BidList nft={nft} />
{estate.size > 0 && <ParcelCoordinates estateId={nft.tokenId} />}
<TransactionHistory asset={nft} />
{isRentalsEnabled ? <RentalHistory asset={nft} /> : null}
<RentalHistory asset={nft} />
</>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ export type Props = {
nft: NFT<VendorName.DECENTRALAND>
order: Order | null
rental: RentalListing | null
isRentalsEnabled: boolean
}
21 changes: 5 additions & 16 deletions webapp/src/components/AssetPage/ParcelDetail/ParcelDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Owner } from '../Owner'
import { Props } from './ParcelDetail.types'
import styles from './ParcelDetail.module.css'

const ParcelDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
const ParcelDetail = ({ nft, order, rental }: Props) => {
const parcel = nft.data.parcel!
const { x, y } = parcel
const isPartOfEstate = nft.category === NFTCategory.PARCEL && parcel.estate
Expand All @@ -34,7 +34,7 @@ const ParcelDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
assetImage={
<AssetImage asset={nft} isDraggable withNavigation hasPopup />
}
showDetails={isRentalsEnabled && isLand(nft)}
showDetails={isLand(nft)}
isOnSale={!!nft.activeOrderId}
badges={
<>
Expand All @@ -45,22 +45,11 @@ const ParcelDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
left={
<>
<Description text={parcel.description} />
{!isRentalsEnabled ? <Owner asset={nft} /> : null}
<Owner asset={nft} />
<ProximityHighlights nft={nft} />
</>
}
actions={
<>
{isRentalsEnabled ? (
<SaleRentActionBox
isRentalsEnabled={isRentalsEnabled}
order={order}
nft={nft}
rental={rental}
/>
) : null}
</>
}
actions={<SaleRentActionBox order={order} nft={nft} rental={rental} />}
box={
<>
{isPartOfEstate && (
Expand Down Expand Up @@ -90,7 +79,7 @@ const ParcelDetail = ({ nft, order, rental, isRentalsEnabled }: Props) => {
<>
<BidList nft={nft} />
<TransactionHistory asset={nft} />
{isRentalsEnabled ? <RentalHistory asset={nft} /> : null}
<RentalHistory asset={nft} />
</>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ export type Props = {
nft: NFT<VendorName.DECENTRALAND>
order: Order | null
rental: RentalListing | null
isRentalsEnabled: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const SaleRentActionBox = ({
order,
rental,
userHasAlreadyBidsOnNft,
isRentalsEnabled,
currentMana,
getContract,
onRent
Expand Down Expand Up @@ -142,7 +141,7 @@ const SaleRentActionBox = ({

return (
<div className={styles.main}>
{isRentalOpen && maxPriceOfPeriods && isRentalsEnabled ? (
{isRentalOpen && maxPriceOfPeriods ? (
<div className={styles.viewSelector}>
<button
onClick={toggleView}
Expand All @@ -165,10 +164,7 @@ const SaleRentActionBox = ({
</div>
) : null}
<div className={styles.actions}>
{view === View.RENT &&
isRentalOpen &&
maxPriceOfPeriods &&
isRentalsEnabled ? (
{view === View.RENT && isRentalOpen && maxPriceOfPeriods ? (
<>
<div className={styles.price}>
<div className={styles.title}>{t('global.price')}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type Props = {
rental: RentalListing | null
order: Order | null
userHasAlreadyBidsOnNft: boolean
isRentalsEnabled: boolean
currentMana: number | undefined
getContract: (query: Partial<Contract>) => ReturnType<typeof getContract>
onRent: (selectedPeriodIndex: number) => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import { AssetType } from '../../modules/asset/types'
import { isConnecting } from '../../modules/wallet/selectors'
import { MapStateProps, OwnProps } from './AssetProviderPage.types'
import AssetProviderPage from './AssetProviderPage'
import { getIsRentalsEnabled } from '../../modules/features/selectors'

const mapState = (state: RootState): MapStateProps => ({
isConnecting: isConnecting(state),
isRentalsEnabled: getIsRentalsEnabled(state)
isConnecting: isConnecting(state)
})

const mapDispatch = () => ({})
Expand Down
12 changes: 3 additions & 9 deletions webapp/src/components/AssetProviderPage/AssetProviderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,13 @@ export const NotFound = () => (
)

const AssetProviderPage = (props: Props) => {
const {
type,
isConnecting,
isRentalsEnabled,
children,
fullWidth = false
} = props
const { type, isConnecting, children, fullWidth = false } = props
const rentalStatuses: RentalStatus[] | undefined = useMemo(
() =>
type === AssetType.NFT && isRentalsEnabled
type === AssetType.NFT
? [RentalStatus.OPEN, RentalStatus.EXECUTED, RentalStatus.CANCELLED]
: undefined,
[type, isRentalsEnabled]
[type]
)

return (
Expand Down
Loading

0 comments on commit df4c19a

Please sign in to comment.