From b71bb22af11e0067c53ed9339e7bb7cc532718c5 Mon Sep 17 00:00:00 2001 From: Monalisha Mishra Date: Thu, 19 Sep 2024 18:53:25 +0530 Subject: [PATCH] added preview --- src/common/components/ChannelDetailsCard.tsx | 46 +++-- src/common/components/CopyButton.tsx | 30 ++++ src/common/components/index.ts | 1 + .../components/ChannelDashboardHeader.tsx | 18 +- src/modules/channelDetails/ChannelDetails.tsx | 2 +- .../channelDetails/ChannelDetails.utils.ts | 5 + .../components/ChannelDetail.tsx | 158 ++++++------------ .../components/ChannelDetailSubscribe.tsx | 16 +- .../channelDetails/components/ChannelList.tsx | 22 ++- .../components/ChannelTutorialContent.tsx | 110 ++++++++++++ .../components/RecentNotifications.tsx | 83 +++++++++ .../components/UserJourneyPreview.tsx | 30 ++++ .../components/FeaturedChannelsListItem.tsx | 2 +- 13 files changed, 377 insertions(+), 146 deletions(-) create mode 100644 src/common/components/CopyButton.tsx create mode 100644 src/modules/channelDetails/ChannelDetails.utils.ts create mode 100644 src/modules/channelDetails/components/ChannelTutorialContent.tsx create mode 100644 src/modules/channelDetails/components/RecentNotifications.tsx create mode 100644 src/modules/channelDetails/components/UserJourneyPreview.tsx diff --git a/src/common/components/ChannelDetailsCard.tsx b/src/common/components/ChannelDetailsCard.tsx index c369af0345..eb2f01d2c0 100644 --- a/src/common/components/ChannelDetailsCard.tsx +++ b/src/common/components/ChannelDetailsCard.tsx @@ -11,7 +11,6 @@ import { Box, Button, CaretDown, - Ethereum, NotificationMobile, ResponsiveProp, Skeleton, @@ -22,6 +21,7 @@ import { import { SubscribeChannelDropdown } from 'common/components/SubscribeChannelDropdown'; import { UnsubscribeChannelDropdown } from 'common/components/UnsubscribeChannelDropdown'; import { UserSetting } from 'helpers/channel/types'; +import { appConfig } from 'config'; export type ChannelDetailsCardProps = { channelDetails: ChannelDetails | undefined; @@ -42,10 +42,12 @@ const ChannelDetailsCard: FC = ({ userSettings, width, }) => { - const AliasChain = channelDetails?.alias_blockchain_id && LOGO_ALIAS_CHAIN[+channelDetails.alias_blockchain_id]; - - const hasAliasAddress = - channelDetails && channelDetails?.alias_address != null && channelDetails?.alias_address != 'NULL'; + let verifiedAliasChainIds = [ + appConfig.coreContractChain, + ...(channelDetails?.aliases + ?.filter((item) => item.is_alias_verified) + .map((item) => parseInt(item.alias_blockchain_id)) || []), + ]; return ( = ({ )} - - - {hasAliasAddress && AliasChain && ( - + {verifiedAliasChainIds.length > 0 && ( + + {verifiedAliasChainIds.map((aliasChainId: number) => { + const LogoComponent = LOGO_ALIAS_CHAIN[aliasChainId]; + return LogoComponent ? ( + + + + ) : null; + })} + )} diff --git a/src/common/components/CopyButton.tsx b/src/common/components/CopyButton.tsx new file mode 100644 index 0000000000..724c2e470a --- /dev/null +++ b/src/common/components/CopyButton.tsx @@ -0,0 +1,30 @@ +import { Copy, Tooltip, Text, Box } from 'blocks'; +import { copyToClipboard } from 'helpers/UtilityHelper'; +import { FC, useState } from 'react'; + +type CopyButtonProps = { + tooltipTitle: string; + content: string; +}; + +const CopyButton: FC = ({ tooltipTitle, content }) => { + const [hover, setHover] = useState(false); + return ( + + copyToClipboard(content)} + onMouseEnter={() => setHover(true)} + onMouseLeave={() => setHover(false)} + > + + + + ); +}; + +export { CopyButton }; diff --git a/src/common/components/index.ts b/src/common/components/index.ts index 196eee5103..1e60e3c355 100644 --- a/src/common/components/index.ts +++ b/src/common/components/index.ts @@ -6,4 +6,5 @@ export * from './UnsubscribeChannelDropdown'; export * from './ModalHeader'; export * from './StakingVariant'; export * from './TokenFaucet'; +export * from './CopyButton'; export * from './VerifiedChannelTooltipContent'; diff --git a/src/modules/channelDashboard/components/ChannelDashboardHeader.tsx b/src/modules/channelDashboard/components/ChannelDashboardHeader.tsx index 8f4aa58e76..837c2a245b 100644 --- a/src/modules/channelDashboard/components/ChannelDashboardHeader.tsx +++ b/src/modules/channelDashboard/components/ChannelDashboardHeader.tsx @@ -10,7 +10,7 @@ import { KebabMenuHorizontal, Menu, MenuItem, - Skeleton + Skeleton, } from 'blocks'; import { Alias, ChannelDetails } from 'queries'; @@ -32,7 +32,7 @@ const ChannelDashboardHeader: FC = ({ channelDetails, setActiveState, onActiveNetwork, - currentAliasDetails + currentAliasDetails, }) => { const { chainId } = useAccount(); const isAliasVerified = currentAliasDetails && currentAliasDetails?.is_alias_verified === 0; @@ -54,7 +54,12 @@ const ChannelDashboardHeader: FC = ({ {/* Edit Channel and Dropdown only visible on Core network */} {onCoreNetwork && ( - + )} diff --git a/src/modules/channelDetails/components/ChannelList.tsx b/src/modules/channelDetails/components/ChannelList.tsx index 471ad06aae..dc368604be 100644 --- a/src/modules/channelDetails/components/ChannelList.tsx +++ b/src/modules/channelDetails/components/ChannelList.tsx @@ -10,6 +10,7 @@ import { ChannelDetails, ChannelsListModelledResponse } from 'queries'; export type ChannelListProps = { channels: Array; hasMoreData: boolean; + isFetchingNextPage: boolean; isLoading: boolean; setSelectedChannelId: React.Dispatch>; fetchNextPage: ( @@ -22,6 +23,7 @@ const ChannelList: FC = ({ setSelectedChannelId, isLoading, hasMoreData, + isFetchingNextPage, }) => { return ( = ({ fetchNextPage(); }} hasMore={hasMoreData} - loader={ - - - - } useWindow={false} threshold={150} > @@ -78,6 +72,18 @@ const ChannelList: FC = ({ ))} + {isFetchingNextPage && ( + + + + )} ); }; diff --git a/src/modules/channelDetails/components/ChannelTutorialContent.tsx b/src/modules/channelDetails/components/ChannelTutorialContent.tsx new file mode 100644 index 0000000000..08ce246fc2 --- /dev/null +++ b/src/modules/channelDetails/components/ChannelTutorialContent.tsx @@ -0,0 +1,110 @@ +import { FC, useState } from 'react'; + +import { Box, Button, Dropdown, ExternalLink, Link, Text, Tutorial } from 'blocks'; + +import { useBlocksTheme } from 'blocks/Blocks.hooks'; +import { UserJourney } from './UserJourneyPreview'; +import { useDisclosure } from 'common'; + +export type ChannelTutorialContentProps = { tutotrialDetails: any }; +const ChannelTutorialContent: FC = ({ tutotrialDetails }) => { + const { mode } = useBlocksTheme(); + const modalControl = useDisclosure(); + + return ( + + {tutotrialDetails.userjourneyshort && ( + + + Subscribe to enable + + + + {`${tutotrialDetails?.userjourneyshort}`} + + + )} + + {tutotrialDetails?.userjourneyyoutube && ( + + )} + {tutotrialDetails?.article && ( + +