forked from decentraland/marketplace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add hands category ftu (decentraland#1924)
- Loading branch information
Melisa Anabella Rossi
authored
Jul 13, 2023
1 parent
79426aa
commit 62b503e
Showing
11 changed files
with
154 additions
and
18 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
.../src/components/Modals/FTU/HandsCategoryLaunchModal/HandsCategoryLaunchModal.container.ts
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { connect } from 'react-redux' | ||
import { isLoadingFeatureFlags } from 'decentraland-dapps/dist/modules/features/selectors' | ||
import { RootState } from '../../../../modules/reducer' | ||
import { getIsHandsCategoryEnabled } from '../../../../modules/features/selectors' | ||
import { MapStateProps } from './HandsCategoryLaunchModal.types' | ||
import { HandsCategoryLaunchModal } from './HandsCategoryLaunchModal' | ||
|
||
const mapState = (state: RootState): MapStateProps => { | ||
return { | ||
isLoadingFeatureFlags: isLoadingFeatureFlags(state), | ||
isHandsCategoryEnabled: getIsHandsCategoryEnabled(state) | ||
} | ||
} | ||
|
||
export default connect(mapState, {})(HandsCategoryLaunchModal) |
19 changes: 19 additions & 0 deletions
19
...pp/src/components/Modals/FTU/HandsCategoryLaunchModal/HandsCategoryLaunchModal.module.css
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.handCategoryModal :global(.dcl.modal-navigation-title) { | ||
font-size: 26px; | ||
font-weight: 600; | ||
margin-top: 25px; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 30px; | ||
padding: 25px; | ||
padding-bottom: 40px; | ||
} | ||
|
||
.actionButton { | ||
max-width: 380px; | ||
} |
67 changes: 67 additions & 0 deletions
67
webapp/src/components/Modals/FTU/HandsCategoryLaunchModal/HandsCategoryLaunchModal.tsx
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useCallback, useEffect, useState } from 'react' | ||
import { Link } from 'react-router-dom' | ||
import { t } from 'decentraland-dapps/dist/modules/translation/utils' | ||
import { Modal, Button, ModalNavigation } from 'decentraland-ui' | ||
import { locations } from '../../../../modules/routing/locations' | ||
import { Section } from '../../../../modules/vendor/decentraland' | ||
import { AssetStatusFilter } from '../../../../utils/filters' | ||
import handsCategoryImg from '../../../../images/hands_category_img.png' | ||
import { Props } from './HandsCategoryLaunchModal.types' | ||
import styles from './HandsCategoryLaunchModal.module.css' | ||
|
||
const HANDS_CATEGORY_FTU_KEY = 'hands-category-ftu-key' | ||
|
||
export const HandsCategoryLaunchModal = ({ | ||
isHandsCategoryEnabled, | ||
isLoadingFeatureFlags | ||
}: Props) => { | ||
const [isOpen, setIsOpen] = useState(false) | ||
|
||
const onClose = useCallback(() => { | ||
localStorage.setItem(HANDS_CATEGORY_FTU_KEY, 'true') | ||
setIsOpen(false) | ||
}, []) | ||
|
||
useEffect(() => { | ||
if ( | ||
!isLoadingFeatureFlags && | ||
isHandsCategoryEnabled && | ||
!localStorage.getItem(HANDS_CATEGORY_FTU_KEY) | ||
) { | ||
setIsOpen(true) | ||
} | ||
}, [isLoadingFeatureFlags, isHandsCategoryEnabled]) | ||
|
||
return ( | ||
<Modal | ||
open={isOpen} | ||
size={'small'} | ||
onClose={onClose} | ||
className={styles.handCategoryModal} | ||
> | ||
<ModalNavigation | ||
title={t('hands_category_ftu.title')} | ||
onClose={onClose} | ||
/> | ||
<div className={styles.container}> | ||
<img | ||
src={handsCategoryImg} | ||
aria-label={t('hands_category_ftu.img_alt')} | ||
/> | ||
<span>{t('hands_category_ftu.subtitle')}</span> | ||
<Button | ||
as={Link} | ||
to={locations.browse({ | ||
section: Section.WEARABLES_HANDS, | ||
status: AssetStatusFilter.ON_SALE | ||
})} | ||
className={styles.actionButton} | ||
onClick={onClose} | ||
primary | ||
> | ||
{t('hands_category_ftu.action')} | ||
</Button> | ||
</div> | ||
</Modal> | ||
) | ||
} |
9 changes: 9 additions & 0 deletions
9
webapp/src/components/Modals/FTU/HandsCategoryLaunchModal/HandsCategoryLaunchModal.types.ts
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type Props = { | ||
isLoadingFeatureFlags: boolean | ||
isHandsCategoryEnabled: boolean | ||
} | ||
|
||
export type MapStateProps = Pick< | ||
Props, | ||
'isHandsCategoryEnabled' | 'isLoadingFeatureFlags' | ||
> |
3 changes: 3 additions & 0 deletions
3
webapp/src/components/Modals/FTU/HandsCategoryLaunchModal/index.ts
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import HandsCategoryLaunchModal from "./HandsCategoryLaunchModal.container"; | ||
|
||
export default HandsCategoryLaunchModal |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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