diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 543355fd48..2e2f71d838 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -11,7 +11,7 @@ on: concurrency: preview-${{ github.ref }} jobs: deploy-preview: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up environment variables run: | diff --git a/src/modules/channelDetails/ChannelDetails.tsx b/src/modules/channelDetails/ChannelDetails.tsx index 782304f122..8795bf80ed 100644 --- a/src/modules/channelDetails/ChannelDetails.tsx +++ b/src/modules/channelDetails/ChannelDetails.tsx @@ -1,5 +1,5 @@ +import { css } from 'styled-components'; import { FC, useEffect, useState } from 'react'; - import { useNavigate, useParams } from 'react-router-dom'; import { useGetChannelDetails, useGetChannelslist } from 'queries'; @@ -7,14 +7,22 @@ import { useGetChannelDetails, useGetChannelslist } from 'queries'; import { ChannelDetail } from './components/ChannelDetail'; import { ChannelList } from './components/ChannelList'; import { Box } from 'blocks'; +import { ProfileModalVisibilityType } from 'common'; import { isAddress } from 'ethers/lib/utils'; import APP_PATHS from 'config/AppPaths'; +import UnlockProfileWrapper, { UNLOCK_PROFILE_TYPE } from 'components/chat/unlockProfile/UnlockProfileWrapper'; + const ChannelDetails: FC = () => { const { id } = useParams(); const navigate = useNavigate(); const [selectedChannelId, setSelectedChannelId] = useState(id || ''); + // State to handle the profile modal + const [profileModalVisibility, setProfileModalVisibility] = useState({ + isVisible: false, + channel_id: null, + }); const { data, fetchNextPage, hasNextPage, isLoading, isFetchingNextPage } = useGetChannelslist({ pageSize: 15, @@ -55,7 +63,34 @@ const ChannelDetails: FC = () => { setProfileModalVisibility(data)} + profileModalVisibility={profileModalVisibility} /> + + {/* Render Unlock profile modal if the profile is not enabled */} + {profileModalVisibility?.isVisible && ( + + + setProfileModalVisibility({ + isVisible: false, + channel_id: null, + }) + } + description="Unlock your profile to proceed." + /> + + )} ) ); diff --git a/src/modules/channelDetails/components/ChannelDetail.tsx b/src/modules/channelDetails/components/ChannelDetail.tsx index 57285993a9..8121495ef9 100644 --- a/src/modules/channelDetails/components/ChannelDetail.tsx +++ b/src/modules/channelDetails/components/ChannelDetail.tsx @@ -10,6 +10,7 @@ import { Box, Text, Back, Tag, Skeleton, Tooltip, TickDecoratedCircleFilled } fr import { CopyButton, LOGO_ALIAS_CHAIN, + ProfileModalVisibilityType, VerifiedChannelTooltipContent, channelCategoriesMap, formatSubscriberCount, @@ -24,8 +25,18 @@ import { appConfig } from 'config'; // import { getChannelTutorialDetails } from '../ChannelDetails.utils'; -export type ChannelDetailProps = { channel: ChannelDetails; isLoading: boolean }; -const ChannelDetail: FC = ({ channel, isLoading }) => { +export type ChannelDetailProps = { + channel: ChannelDetails; + isLoading: boolean; + onChangeProfileModalVisibility: (value: ProfileModalVisibilityType) => void; + profileModalVisibility: ProfileModalVisibilityType; +}; +const ChannelDetail: FC = ({ + channel, + isLoading, + onChangeProfileModalVisibility, + profileModalVisibility, +}) => { const [showMore, setShowMore] = useState(false); const navigate = useNavigate(); const isInfoMore = (channel?.info || '').length > 250; @@ -232,7 +243,11 @@ const ChannelDetail: FC = ({ channel, isLoading }) => { - + diff --git a/src/modules/channelDetails/components/ChannelDetailSubscribe.tsx b/src/modules/channelDetails/components/ChannelDetailSubscribe.tsx index 03e3ac4d6b..15edef3655 100644 --- a/src/modules/channelDetails/components/ChannelDetailSubscribe.tsx +++ b/src/modules/channelDetails/components/ChannelDetailSubscribe.tsx @@ -4,15 +4,21 @@ import { useAccount } from 'hooks'; import { ChannelDetails, useGetUserSubscriptions } from 'queries'; import { Button, CaretDown, NotificationMobile, Skeleton } from 'blocks'; -import { SubscribeChannelDropdown, UnsubscribeChannelDropdown } from 'common'; +import { ProfileModalVisibilityType, SubscribeChannelDropdown, UnsubscribeChannelDropdown } from 'common'; import { UserSetting } from 'helpers/channel/types'; export type ChannelDetailSubscribeProps = { channel: ChannelDetails; + onChangeProfileModalVisibility?: (value: ProfileModalVisibilityType) => void; + profileModalVisibility?: ProfileModalVisibilityType; }; -const ChannelDetailSubscribe: FC = ({ channel }) => { +const ChannelDetailSubscribe: FC = ({ + channel, + onChangeProfileModalVisibility, + profileModalVisibility, +}) => { const { wallet } = useAccount(); const isWalletConnected = !!wallet?.accounts?.length; @@ -28,12 +34,15 @@ const ChannelDetailSubscribe: FC = ({ channel }) => const handleRefetch = () => { refetchUserSubscription(); }; + return ( {channel && !isSubscribed && (