From 9c8c41db10efa675bb3172a6e686f605d1210e84 Mon Sep 17 00:00:00 2001 From: corlard3y Date: Mon, 18 Nov 2024 10:33:49 +0100 Subject: [PATCH] add upgrade plan modal --- .../userPlanAndBillings/UpgradePlanModal.tsx | 89 ++++++++++ .../UserPlanAndBillings.tsx | 150 +++++++++++++++++ src/components/userSettings/UserSettings.tsx | 155 +++++++++++++++--- src/config/Themization.js | 6 + 4 files changed, 375 insertions(+), 25 deletions(-) create mode 100644 src/components/userPlanAndBillings/UpgradePlanModal.tsx create mode 100644 src/components/userPlanAndBillings/UserPlanAndBillings.tsx diff --git a/src/components/userPlanAndBillings/UpgradePlanModal.tsx b/src/components/userPlanAndBillings/UpgradePlanModal.tsx new file mode 100644 index 0000000000..f4827ee2d5 --- /dev/null +++ b/src/components/userPlanAndBillings/UpgradePlanModal.tsx @@ -0,0 +1,89 @@ +import { Box, Cross, Modal, Text } from 'blocks'; +import { ModalResponse } from 'common'; +import { FC } from 'react'; + +type UpgradePlanModalProps = { + modalControl: ModalResponse; +}; + +const UpgradePlanModal: FC = ({ modalControl }) => { + const { isOpen, onClose } = modalControl; + + const planFeatures = [ + { + text: 'Telegram delivery will reduce to 1,000 from 5,000', + }, + { + text: 'Email delivery will reduce to 1,000 from 5,000', + }, + { + text: 'Features will reset to Free plan', + }, + ]; + return ( + { + // handleAddSettings(formValues); + }, + }} + cancelButtonProps={{ + children: 'Cancel', + }} + > + + + We’re sorry to see you go + + + If you cancel you will be able to continue using Pro features until November 20, 2024. Once the billing term + ends: + + + + {planFeatures.map((item) => ( + + + + + {item.text} + + + ))} + + + + ); +}; + +export default UpgradePlanModal; diff --git a/src/components/userPlanAndBillings/UserPlanAndBillings.tsx b/src/components/userPlanAndBillings/UserPlanAndBillings.tsx new file mode 100644 index 0000000000..7e543c7001 --- /dev/null +++ b/src/components/userPlanAndBillings/UserPlanAndBillings.tsx @@ -0,0 +1,150 @@ +import { Box, Button, ProgressBar, Text } from 'blocks'; +import { useDisclosure } from 'common'; +import UpgradePlanModal from './UpgradePlanModal'; + +const UserPlanAndBillings = () => { + const modalControl = useDisclosure(); + + const itemNotifications = [ + { title: 'Email Notification Delivery', subtitle: '750 remaining' }, + { title: 'Telegram Notification Delivery', subtitle: '750 remaining' }, + { title: 'Discord Notification Delivery', subtitle: '750 remaining' }, + ]; + return ( + + + Take full control of your Push Notification plan, manage and stay up to date with your plan usage + + + + + + Pro Plan + + + $14.99/mo + + + + + + For individuals + + + billed yearly + + + + + + + modalControl.open()} + > + Cancel Plan + + + + + + + Plan Usage + + + Keep track of usage in your current cycle + + + + + {itemNotifications.map((item) => ( + + + {item.title} + + + + + + {item.subtitle} + + + ))} + + + {modalControl.isOpen && } + + ); +}; + +export default UserPlanAndBillings; diff --git a/src/components/userSettings/UserSettings.tsx b/src/components/userSettings/UserSettings.tsx index c65f4dba5a..92f5453127 100644 --- a/src/components/userSettings/UserSettings.tsx +++ b/src/components/userSettings/UserSettings.tsx @@ -12,11 +12,13 @@ import { useAccount } from 'hooks'; import { Button } from 'primaries/SharedStyling'; import { ImageV2 } from 'components/reusables/SharedStylingV2'; import { updateBulkSubscriptions, updateBulkUserSettings } from 'redux/slices/channelSlice'; +import { Alert, Box, Text } from 'blocks'; // Internal Configs import { device } from 'config/Globals'; import ChannelListSettings from 'components/channel/ChannelListSettings'; import PushSnapSettings from 'components/PushSnap/PushSnapSettings'; +import UserPlanAndBillings from 'components/userPlanAndBillings/UserPlanAndBillings'; interface ChannelListItem { channel: string; @@ -97,11 +99,19 @@ function UserSettings() { value: 0, label: 'Notification Settings', title: 'Notification Settings', + section: 'top', }, { value: 1, label: 'Push Snap', title: '', + section: 'top', + }, + { + value: 2, + label: 'Plan & Billing', + title: 'Plan & Billing', + section: 'bottom', }, ]; @@ -111,26 +121,82 @@ function UserSettings() { Customize your Push profile or manage your notification preferences - {selectOptions.map((selectOptions) => ( - setSelectedOption(selectOptions.value)} - key={selectOptions.value} - isSelected={selectOptions.value === selectedOption} + {selectOptions + .filter((option) => option.section === 'top') + .map((option) => ( + setSelectedOption(option.value)} + key={option.value} + isSelected={option.value === selectedOption} + > + {option.label} + + ))} + + - {selectOptions.label} - - ))} + Developers + + + + {selectOptions + .filter((option) => option.section === 'bottom') + .map((option) => ( + setSelectedOption(option.value)} + key={option.value} + isSelected={option.value === selectedOption} + > + {option.label} + + ))} - - - {selectOptions[selectedOption]?.title && ( - {selectOptions[selectedOption]?.title} - )} - - {selectedOption === 0 && } - {selectedOption === 1 && } - - + + + {/* {successMessage && ( + + + + )} + + {errorMessage && ( + + + + )} */} + + {selectedOption === 2 && ( + console.log('idea')} + actionText="Upgrade Plan" + variant="info" + /> + )} + + + + {selectOptions[selectedOption]?.title && ( + + {selectOptions[selectedOption]?.title} + + )} + + {selectedOption === 0 && } + {selectedOption === 1 && } + {selectedOption === 2 && } + + + ); @@ -142,6 +208,8 @@ export default UserSettings; const Container = styled.div` padding: 32px 24px; flex: 1; + height: 100%; + overflow: hidden; @media ${device.tablet} { padding: 24px 12px; @@ -182,6 +250,10 @@ const Wrapper = styled.div` flex-direction: row; justify-content: space-between; + height: 100%; + flex: 1; + min-height: 0; + @media ${device.tablet} { flex-direction: column; } @@ -220,10 +292,9 @@ const SelectListOption = styled(Button)<{ isSelected: boolean }>` `; const ChannelWrapper = styled.div` - border: 1px solid ${(props) => props.theme.default.borderColor}; + border: 1px solid ${(props) => props.theme.userSettingsBorder}; padding: 12px; - border-radius: 16px; - flex-grow: 1; + border-radius: 24px; @media ${device.tablet} { margin: 8px 0px; @@ -231,9 +302,43 @@ const ChannelWrapper = styled.div` } `; -const ChannelContainer = styled.div` +const ChannelBlock = styled.div` overflow: hidden; - overflow-y: scroll; + display: flex; + overflow-y: auto; + flex-direction: column; + height: auto; + flex-grow: 1; + min-height: 0; + gap: 16px; + padding-right: 12px; + overflow-y: auto; + &::-webkit-scrollbar-track { + background-color: transparent; + position: absolute; + right: 10px; + } + &::-webkit-scrollbar { + background-color: transparent; + width: 4px; + position: absolute; + right: 10px; + } + &::-webkit-scrollbar-thumb { + background-color: #d53a94; + border-radius: 99px; + width: 4px; + position: absolute; + right: 10px; + } + // Adding margin-bottom to the last child + & > *:last-child { + margin-bottom: 100px; + } +`; + +const ChannelContainer = styled.div<{ selectedOption: number }>` + overflow-y: auto; height: 55vh; padding: 12px; @@ -264,13 +369,13 @@ const ChannelContainer = styled.div` } `; -const SectionTitle = styled.div` +const SectionTitle = styled.div<{ bottomSpacing: boolean }>` font-size: 22px; font-weight: 500; line-height: 33px; letter-spacing: normal; text-align: left; - margin-bottom: 20px; + margin-bottom: ${(props) => (props.bottomSpacing ? '20px' : '0px')}; color: ${(props) => props.theme.default.color}; @media ${device.tablet} { diff --git a/src/config/Themization.js b/src/config/Themization.js index 8a1933a90e..7194737191 100644 --- a/src/config/Themization.js +++ b/src/config/Themization.js @@ -311,6 +311,9 @@ const themeLight = { //Connect Wallet and Push user Flow Modal userSecText: '#8C93A0', disabledBtnColor: '#E5E5E5', + + //userSettings + userSettingsBorder: '#EAEBF2', }; const themeDark = { @@ -627,6 +630,9 @@ const themeDark = { //Connect Wallet and Push user Flow Modal userSecText: '#484D58', disabledBtnColor: '#484D58', + + //userSettings + userSettingsBorder: '#313338', }; export { themeDark, themeLight };