Skip to content

Commit 60c215d

Browse files
feat: Enable the MVMF22 tab while the announcement stage is live (#891)
* feat: Enable the MVMF22 tab while the announcement stage is live * feat: add a custom FF for the MVMF Tab and Page
1 parent 8d5fe11 commit 60c215d

File tree

8 files changed

+36
-14
lines changed

8 files changed

+36
-14
lines changed

webapp/src/components/MVMFPage/MVMFPage.container.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { connect } from 'react-redux'
2-
2+
import { getIsMVMFTabEnabled } from '../../modules/features/selectors'
33
import { RootState } from '../../modules/reducer'
44
import {
55
getIsFullscreen,
@@ -17,7 +17,8 @@ const mapState = (state: RootState): MapStateProps => ({
1717
assetType: getAssetType(state),
1818
section: getSection(state),
1919
isFullscreen: getIsFullscreen(state),
20-
contracts: getData(state)
20+
contracts: getData(state),
21+
isMVMFTabEnabled: getIsMVMFTabEnabled(state)
2122
})
2223

2324
const mapDispatch = (dispatch: MapDispatch) => ({

webapp/src/components/MVMFPage/MVMFPage.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ import './MVMFPage.css'
1717
const MVMFTag = 'MVMF22'
1818

1919
const MVMFPage = (props: Props) => {
20-
const { isFullscreen, section, contracts, onFetchEventContracts } = props
20+
const {
21+
isFullscreen,
22+
section,
23+
contracts,
24+
onFetchEventContracts,
25+
isMVMFTabEnabled
26+
} = props
2127
const vendor = isVendor(props.vendor) ? props.vendor : VendorName.DECENTRALAND
2228

2329
useEffect(() => {
@@ -26,7 +32,7 @@ const MVMFPage = (props: Props) => {
2632

2733
const activeTab = NavigationTab.MVMF
2834

29-
return (
35+
return isMVMFTabEnabled ? (
3036
<>
3137
<Navbar isFullscreen />
3238
<Navigation activeTab={activeTab} isFullscreen={isFullscreen} />
@@ -47,7 +53,7 @@ const MVMFPage = (props: Props) => {
4753
)}
4854
<Footer isFullscreen={isFullscreen} />
4955
</>
50-
)
56+
) : null
5157
}
5258

5359
export default React.memo(MVMFPage)

webapp/src/components/MVMFPage/MVMFPage.types.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ export type Props = {
1414
isFullscreen?: boolean
1515
onFetchEventContracts: typeof fetchEventRequest
1616
contracts: Record<string, string[]>
17+
isMVMFTabEnabled: boolean
1718
}
1819

1920
export type MapStateProps = Pick<
2021
Props,
21-
'vendor' | 'isFullscreen' | 'assetType' | 'section' | 'contracts'
22+
| 'vendor'
23+
| 'isFullscreen'
24+
| 'assetType'
25+
| 'section'
26+
| 'contracts'
27+
| 'isMVMFTabEnabled'
2228
>
2329
export type MapDispatchProps = Pick<Props, 'onFetchEventContracts'>
2430
export type MapDispatch = Dispatch<FetchEventRequestAction>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { connect } from 'react-redux'
2-
import { getIsMVMFEnabled } from '../../modules/features/selectors'
2+
import { getIsMVMFTabEnabled } from '../../modules/features/selectors'
33
import { RootState } from '../../modules/reducer'
44
import { MapStateProps } from './Navigation.types'
55
import Navigation from './Navigation'
66

77
const mapState = (state: RootState): MapStateProps => ({
8-
isMVMFEnabled: getIsMVMFEnabled(state)
8+
isMVMFTabEnabled: getIsMVMFTabEnabled(state)
99
})
1010

1111
export default connect(mapState)(Navigation)

webapp/src/components/Navigation/Navigation.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Props, NavigationTab } from './Navigation.types'
1111
import './Navigation.css'
1212

1313
const Navigation = (props: Props) => {
14-
const { activeTab, isFullscreen, isMVMFEnabled } = props
14+
const { activeTab, isFullscreen, isMVMFTabEnabled } = props
1515
return (
1616
<Tabs isFullscreen={isFullscreen}>
1717
<Tabs.Left>
@@ -20,7 +20,7 @@ const Navigation = (props: Props) => {
2020
{t('navigation.overview')}
2121
</Tabs.Tab>
2222
</Link>
23-
{isMVMFEnabled ? (
23+
{isMVMFTabEnabled ? (
2424
<Link
2525
to={locations.MVMF22({
2626
section: decentraland.Section.WEARABLES,

webapp/src/components/Navigation/Navigation.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export enum NavigationTab {
99
}
1010

1111
export type Props = {
12-
isMVMFEnabled: boolean
12+
isMVMFTabEnabled: boolean
1313
activeTab?: NavigationTab
1414
isFullscreen?: boolean
1515
}
1616

17-
export type MapStateProps = Pick<Props, 'isMVMFEnabled'>
17+
export type MapStateProps = Pick<Props, 'isMVMFTabEnabled'>
1818
export type MapDispatchProps = {}

webapp/src/modules/features/selectors.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@ export const getIsRentalsEnabled = (state: RootState) => {
3030
}
3131

3232
export const getIsMVMFEnabled = (state: RootState) => {
33+
try {
34+
return getIsFeatureEnabled(state, ApplicationName.BUILDER, FeatureName.MVMF)
35+
} catch (e) {
36+
return false
37+
}
38+
}
39+
40+
export const getIsMVMFTabEnabled = (state: RootState) => {
3341
try {
3442
return getIsFeatureEnabled(
3543
state,
3644
ApplicationName.BUILDER,
37-
FeatureName.MVMF
45+
FeatureName.MVMF_TAB
3846
)
3947
} catch (e) {
4048
return false

webapp/src/modules/features/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export enum FeatureName {
44
EMOTE_CATEGORIES = 'emote-categories',
55
RENTALS = 'rentals',
66
MVMF = 'mvmf-2022',
7-
MVMF_ANNOUNCEMENT = 'mvmf-2022-announcement'
7+
MVMF_ANNOUNCEMENT = 'mvmf-2022-announcement',
8+
MVMF_TAB = 'mvmf-2022-tab'
89
}

0 commit comments

Comments
 (0)