From 376ea48e8c9c3e889b9192186edae4bb05ae6986 Mon Sep 17 00:00:00 2001 From: Kushdeep Singh Date: Fri, 8 Nov 2024 19:29:00 +0530 Subject: [PATCH] DAPP-1957: Integrate UI for Dashboard Social Account Links (Email/Telegram/Discord) --- src/modules/dashboard/Dashboard.constants.ts | 23 +++- src/modules/dashboard/Dashboard.tsx | 2 + src/modules/dashboard/Dashboard.types.ts | 7 ++ .../components/ClaimSocialHandles.tsx | 89 +++++++++++++++ .../components/ConnectSocialHandles.tsx | 105 ++++++++++++++++++ .../dashboard/components/Socialhandles.tsx | 36 ++++++ 6 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 src/modules/dashboard/components/ClaimSocialHandles.tsx create mode 100644 src/modules/dashboard/components/ConnectSocialHandles.tsx create mode 100644 src/modules/dashboard/components/Socialhandles.tsx diff --git a/src/modules/dashboard/Dashboard.constants.ts b/src/modules/dashboard/Dashboard.constants.ts index 4a9342b255..0e6e7db8d2 100644 --- a/src/modules/dashboard/Dashboard.constants.ts +++ b/src/modules/dashboard/Dashboard.constants.ts @@ -1,6 +1,6 @@ import { PushAlpha, PushBot, PushDev } from 'blocks'; -import { ChatType, EnvKeys, SourceKeys } from './Dashboard.types'; +import { ChatType, EnvKeys, SocialHandlesItemType, SourceKeys } from './Dashboard.types'; export const recommendedChatList: ChatType[] = [ { @@ -90,3 +90,24 @@ export const trendingSource: Record = { export const firstEndDate = new Date(Date.now()).toISOString().split('T')[0]; export const secondEndDate = new Date(Date.now() - 7 * 86400000).toISOString().split('T')[0]; export const startDate = new Date(Date.now() - 14 * 86400000).toISOString().split('T')[0]; + +export const socialHandlesList: SocialHandlesItemType[] = [ + { + heading: 'Email', + description: 'Receive notifications in your email inbox', + type: 'email', + isConnected: true, + }, + { + heading: 'Telegram', + description: 'Receive notifications as Telegram messages', + type: 'telegram', + isConnected: false, + }, + { + heading: 'Discord', + description: 'Receive notifications as Discord messages', + type: 'discord', + isConnected: false, + }, +]; diff --git a/src/modules/dashboard/Dashboard.tsx b/src/modules/dashboard/Dashboard.tsx index d1db76e55b..ec2b24553b 100644 --- a/src/modules/dashboard/Dashboard.tsx +++ b/src/modules/dashboard/Dashboard.tsx @@ -9,6 +9,7 @@ import { DashboardHeader } from './components/DashboardHeader'; import { DashboardSubHeader } from './components/DashboardSubHeader'; import { FeaturedChannels } from './components/FeaturedChannels'; import { StakingPools } from './components/StakingPools'; +import { SocialHandles } from './components/Socialhandles'; export type DashboardProps = {}; @@ -35,6 +36,7 @@ const Dashboard: FC = () => { flexDirection="column" gap="spacing-md" > + = () => { + return ( + + + + + Get notified anywhere and earn points + + }>NEW + + + Connect apps and receive notifications directly in your Email, Telegram and Discord + + + + + + + + 1.5x + + + + + + 25,000 + + + + + + ); +}; + +export { ClaimSocialHandles }; diff --git a/src/modules/dashboard/components/ConnectSocialHandles.tsx b/src/modules/dashboard/components/ConnectSocialHandles.tsx new file mode 100644 index 0000000000..4bab0b3bc7 --- /dev/null +++ b/src/modules/dashboard/components/ConnectSocialHandles.tsx @@ -0,0 +1,105 @@ +import { FC } from 'react'; +import { css } from 'styled-components'; + +import { Box, Button, Dropdown, Menu, MenuItem, Text, CaretDown, OptOut } from 'blocks'; +import { socialHandlesList } from '../Dashboard.constants'; +import { SocialHandlesItemType } from '../Dashboard.types'; + +export type ConnectSocialHandlesProps = {}; + +const ConnectSocialHandles: FC = () => { + return ( + <> + + {socialHandlesList.map((item: SocialHandlesItemType) => ( + + + + {/* Social icons will be displayed here */} + {/* Add icons according to the specified type */} + + {item.heading} + + + + + {item.description} + + + + + {item.isConnected ? ( + + } + /> + + } + > + + + ) : ( + + )} + + + ))} + + + ); +}; + +export { ConnectSocialHandles }; diff --git a/src/modules/dashboard/components/Socialhandles.tsx b/src/modules/dashboard/components/Socialhandles.tsx new file mode 100644 index 0000000000..7a02870d0f --- /dev/null +++ b/src/modules/dashboard/components/Socialhandles.tsx @@ -0,0 +1,36 @@ +import { FC } from 'react'; + +import { Box } from 'blocks'; +import { ClaimSocialHandles } from './ClaimSocialHandles'; +import { ConnectSocialHandles } from './ConnectSocialHandles'; +import { useAccount } from 'hooks'; + +export type SocialHandlesProps = {}; + +const SocialHandles: FC = () => { + const { isWalletConnected } = useAccount(); + + // Check if the wallet is connected to the DApp. + // If not, return null. If connected, return SocialHandles. + if (!isWalletConnected) return null; + + return ( + + {/* Render Claim based on Social Handles if wallet is connected */} + + + {/* Render option to connect Social Handles */} + + + ); +}; + +export { SocialHandles };