Commit a5d43c78 authored by Max Alekseenko's avatar Max Alekseenko

hide rating if feature is disabled

parent 91520016
...@@ -7,6 +7,7 @@ import React, { useCallback } from 'react'; ...@@ -7,6 +7,7 @@ import React, { useCallback } from 'react';
import type { MarketplaceAppWithSecurityReport } from 'types/client/marketplace'; import type { MarketplaceAppWithSecurityReport } from 'types/client/marketplace';
import { ContractListTypes } from 'types/client/marketplace'; import { ContractListTypes } from 'types/client/marketplace';
import config from 'configs/app';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
import { nbsp } from 'lib/html-entities'; import { nbsp } from 'lib/html-entities';
import * as mixpanel from 'lib/mixpanel/index'; import * as mixpanel from 'lib/mixpanel/index';
...@@ -17,6 +18,9 @@ import AppSecurityReport from './AppSecurityReport'; ...@@ -17,6 +18,9 @@ import AppSecurityReport from './AppSecurityReport';
import MarketplaceAppModalLink from './MarketplaceAppModalLink'; import MarketplaceAppModalLink from './MarketplaceAppModalLink';
import Rating from './Rating/Rating'; import Rating from './Rating/Rating';
const feature = config.features.marketplace;
const isRatingEnabled = feature.isEnabled && feature.rating;
type Props = { type Props = {
onClose: () => void; onClose: () => void;
isFavorite: boolean; isFavorite: boolean;
...@@ -160,24 +164,26 @@ const MarketplaceAppModal = ({ ...@@ -160,24 +164,26 @@ const MarketplaceAppModal = ({
By{ nbsp }{ author } By{ nbsp }{ author }
</Text> </Text>
<Box { isRatingEnabled && (
gridColumn={{ base: '1 / 3', md: 2 }} <Box
marginTop={{ base: 6, md: 3 }} gridColumn={{ base: '1 / 3', md: 2 }}
py={{ base: 0, md: 1.5 }} marginTop={{ base: 6, md: 3 }}
width="fit-content" py={{ base: 0, md: 1.5 }}
> width="fit-content"
<Rating >
appId={ id } <Rating
rating={ rating } appId={ id }
recordId={ ratingRecordId } rating={ rating }
userRating={ userRating } recordId={ ratingRecordId }
rate={ rateApp } userRating={ userRating }
isSending={ isSendingRating } rate={ rateApp }
isLoading={ isRatingLoading } isSending={ isSendingRating }
fullView isLoading={ isRatingLoading }
canRate={ canRate } fullView
/> canRate={ canRate }
</Box> />
</Box>
) }
<Box <Box
gridColumn={{ base: '1 / 3', md: 2 }} gridColumn={{ base: '1 / 3', md: 2 }}
......
import { Text, PopoverTrigger, PopoverBody, PopoverContent, useDisclosure, Skeleton, useOutsideClick, Box } from '@chakra-ui/react'; import { Text, PopoverTrigger, PopoverBody, PopoverContent, useDisclosure, Skeleton, useOutsideClick, Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import config from 'configs/app';
import Popover from 'ui/shared/chakra/Popover'; import Popover from 'ui/shared/chakra/Popover';
import Content from './PopoverContent'; import Content from './PopoverContent';
import Stars from './Stars'; import Stars from './Stars';
import TriggerButton from './TriggerButton'; import TriggerButton from './TriggerButton';
const feature = config.features.marketplace;
const isEnabled = feature.isEnabled && feature.rating;
type Props = { type Props = {
appId: string; appId: string;
rating?: number; rating?: number;
...@@ -28,6 +32,10 @@ const Rating = ({ ...@@ -28,6 +32,10 @@ const Rating = ({
const popoverRef = React.useRef(null); const popoverRef = React.useRef(null);
useOutsideClick({ ref: popoverRef, handler: onClose }); useOutsideClick({ ref: popoverRef, handler: onClose });
if (!isEnabled) {
return null;
}
return ( return (
<Skeleton <Skeleton
display="flex" display="flex"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment