Skip to content

Commit

Permalink
fix: disable favourites
Browse files Browse the repository at this point in the history
  • Loading branch information
kathaypacific committed Jul 9, 2024
1 parent 662bb87 commit 3056d6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dappsExplorer/DappCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ interface DappCardContentProps {
dapp: Dapp
onFavoriteDapp?: (dapp: Dapp) => void
favoritedFromSection: DappSection
disableFavoriting?: boolean
}

interface Props {
onPressDapp: () => void
dapp: Dapp
testID: string
disableFavoriting?: boolean
onFavoriteDapp?: (dapp: Dapp) => void
showBorder?: boolean
cardContentContainerStyle?: ViewStyle
Expand All @@ -38,12 +40,12 @@ export function DappCardContent({
dapp,
onFavoriteDapp,
favoritedFromSection,
disableFavoriting,
}: DappCardContentProps) {
const dispatch = useDispatch()
const favoriteDappIds = useSelector(favoriteDappIdsSelector)

const isFavorited = favoriteDappIds.includes(dapp.id)
const favouritesEnabled = !!onFavoriteDapp

const onPressFavorite = () => {
const eventProperties = {
Expand Down Expand Up @@ -72,12 +74,12 @@ export function DappCardContent({
<Text style={styles.subtitle}>{dapp.description}</Text>
</View>
<Touchable
disabled={!favouritesEnabled}
disabled={disableFavoriting}
onPress={onPressFavorite}
hitSlop={favoriteIconHitslop}
testID={`Dapp/Favorite/${dapp.id}`}
>
{isFavorited ? <Star /> : favouritesEnabled ? <StarOutline /> : <></>}
{isFavorited ? <Star /> : !disableFavoriting ? <StarOutline /> : <></>}
</Touchable>
</>
)
Expand All @@ -87,6 +89,7 @@ function DappCard({
dapp,
onPressDapp,
onFavoriteDapp,
disableFavoriting,
showBorder,
cardContentContainerStyle,
cardStyle,
Expand All @@ -108,6 +111,7 @@ function DappCard({
<DappCardContent
dapp={dapp}
onFavoriteDapp={onFavoriteDapp}
disableFavoriting={disableFavoriting}
favoritedFromSection={DappSection.All}
/>
</Touchable>
Expand Down
1 change: 1 addition & 0 deletions src/dappsExplorer/DiscoverDappsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function DiscoverDappsCard() {
<DappCard
dapp={dapp}
onPressDapp={() => onPressDapp({ ...dapp, openedFrom: section.dappSection }, index)}
disableFavoriting={true}
testID={`${section.testID}/DappCard`}
cardContentContainerStyle={styles.dappCardContentContainer}
/>
Expand Down

0 comments on commit 3056d6a

Please sign in to comment.