Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sub modal content for success modal #128

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions public/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,15 @@ video {
width: 100vw;
}

.w-\[260px\] {
width: 260px;
}

.w-max {
width: -moz-max-content;
width: max-content;
}

.min-w-fit {
min-width: -moz-fit-content;
min-width: fit-content;
Expand Down Expand Up @@ -971,6 +980,10 @@ video {
max-width: 24rem;
}

.max-w-\[260px\] {
max-width: 260px;
}

.flex-shrink-0 {
flex-shrink: 0;
}
Expand Down Expand Up @@ -1589,6 +1602,11 @@ video {
padding-bottom: 1.25rem;
}

.\!px-4 {
padding-left: 1rem !important;
padding-right: 1rem !important;
}

.pb-0 {
padding-bottom: 0px;
}
Expand Down Expand Up @@ -1673,6 +1691,10 @@ video {
text-align: right;
}

.text-start {
text-align: start;
}

.text-end {
text-align: end;
}
Expand Down Expand Up @@ -1891,6 +1913,11 @@ video {
color: rgb(255 255 255 / 0.8);
}

.text-blue-400 {
--tw-text-opacity: 1;
color: rgb(96 165 250 / var(--tw-text-opacity));
}

.opacity-0 {
opacity: 0;
}
Expand Down Expand Up @@ -2434,6 +2461,11 @@ video {
padding-bottom: 1.5rem;
}

.md\:\!px-6 {
padding-left: 1.5rem !important;
padding-right: 1.5rem !important;
}

.md\:text-left {
text-align: left;
}
Expand Down
55 changes: 50 additions & 5 deletions src/components/creatorsStaking/Creators/modals/SuccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import { openNewWindow } from 'src/components/utils'
import { twitterShareUrl } from 'src/components/urls/social-share'
import Button from '../../tailwind-components/Button'
import { useResponsiveSize } from 'src/components/responsive'
import { MdInfo } from 'react-icons/md'
import clsx from 'clsx'

const twitterText =
'I just staked my #SUB {creator_name} on @SubsocialChain\n\nYou can stake towards your favorite creators here:'

const getTwitterText = (links?: string[]) => {
const twitterUsername = links?.find((link) => link.includes('twitter'))?.split('twitter.com/').pop()
return twitterText.replace('{creator_name}',
twitterUsername ? `to @${twitterUsername}` : '')
const twitterUsername = links
?.find((link) => link.includes('twitter'))
?.split('twitter.com/')
.pop()
return twitterText.replace(
'{creator_name}',
twitterUsername ? `to @${twitterUsername}` : ''
)
}

type SuccessModalProps = {
Expand All @@ -38,12 +45,43 @@ const SuccessModal = ({
const { name, ownedByAccount, image, links } = space || {}
const owner = ownedByAccount?.id

const subModalContent = (
<div
className={clsx(
'md:p-6 p-5 flex items-center justify-between gap-4 rounded-[20px]',
'bg-indigo-50 text-text-primary text-base max-w-lg w-full'
)}
>
<div className='flex gap-4 items-center text-start'>
{!isMobile && (
<div className='text-blue-400'>
<MdInfo size={24} />
</div>
)}
<div className='max-w-[260px]'>
Earn more SUB based on your social activity.
</div>
</div>
<div>
<Button
variant='primary'
href='https://subsocial.network/active-staking-details'
className='w-max md:!px-6 !px-4 text-sm'
size='md'
>
Learn more
</Button>
</div>
</div>
)

return (
<Modal
isOpen={open}
withFooter={false}
title={'🎉 Success'}
withCloseButton
subModalContent={subModalContent}
closeModal={() => {
closeModal()
}}
Expand All @@ -70,8 +108,15 @@ const SuccessModal = ({
className='w-full'
onClick={() =>
openNewWindow(
twitterShareUrl('/creators',
getTwitterText(links), { tags: [ 'CreatorEconomy', 'CreatorStaking', 'Subsocial', 'Web3Social', 'SocialFi' ] })
twitterShareUrl('/creators', getTwitterText(links), {
tags: [
'CreatorEconomy',
'CreatorStaking',
'Subsocial',
'Web3Social',
'SocialFi',
],
})
)
}
>
Expand Down
5 changes: 4 additions & 1 deletion src/components/creatorsStaking/tailwind-components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type ModalProps = ModalFunctionalityProps &
contentClassName?: string
initialFocus?: React.RefObject<HTMLElement>
withFooter?: boolean
subModalContent?: React.ReactNode
}

export default function Modal ({
Expand All @@ -65,6 +66,7 @@ export default function Modal ({
description,
initialFocus,
withFooter,
subModalContent
}: ModalProps) {
return (
<Transition appear show={isOpen} as={Fragment}>
Expand All @@ -90,7 +92,7 @@ export default function Modal ({
<div className='fixed inset-0 w-screen overflow-y-auto'>
<div
className={clsx(
'flex min-h-full items-center justify-center p-4 text-center',
'flex min-h-full flex-col gap-6 items-center justify-center p-4 text-center',
containerClassName
)}
>
Expand Down Expand Up @@ -186,6 +188,7 @@ export default function Modal ({
)}
</Dialog.Panel>
</Transition.Child>
{subModalContent}
</div>
</div>
</Dialog>
Expand Down
Loading