Skip to content

Commit

Permalink
Merge pull request geyserfund#1361 from geyserfund/fix-final-fixes
Browse files Browse the repository at this point in the history
Fix-final-fixes
  • Loading branch information
sajald77 authored Mar 20, 2024
2 parents 7055011 + 2371e1b commit 4de69a0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 63 deletions.
36 changes: 18 additions & 18 deletions src/context/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useProjectState } from '../hooks/graphqlState'
import { useModal } from '../hooks/useModal'
import { MilestoneAdditionModal } from '../pages/projectView/projectMainBody/components'
import { ProjectCreatorModal } from '../pages/projectView/projectNavigation/components/ProjectCreatorModal'
import { ProjectFragment, ProjectMilestone } from '../types'
import { ProjectFragment, ProjectMilestone, UserMeFragment } from '../types'
import { useAuthContext } from './auth'
import { useNavContext } from './nav'

Expand Down Expand Up @@ -80,6 +80,7 @@ export const ProjectProvider = ({ projectId, children }: { children: React.React

const [mobileView, setMobileView] = useState<MobileViews>(MobileViews.description)
const [isProjectOwner, setIsProjectOwner] = useState<boolean | undefined>()

const { user } = useAuthContext()

const creatorModal = useModal()
Expand Down Expand Up @@ -119,33 +120,32 @@ export const ProjectProvider = ({ projectId, children }: { children: React.React
return Number(ownerInfo.user.id || -1)
}) || [],
})

updateProjectOwner(project)
},
})

const updateProjectOwner = useCallback((project: ProjectFragment, user: UserMeFragment) => {
if (project.id && project.owners[0]?.user.id === user.id) {
setIsProjectOwner(true)
} else {
setIsProjectOwner(false)
}
}, [])

useEffect(() => {
if (!project || !user) {
return
}

updateProjectOwner(project, user)
}, [project, user, updateProjectOwner])

const fundingFlow = useFundingFlow()

const fundForm = useFundingFormState({
rewards: project ? project.rewards : undefined,
rewardCurrency: project && project.rewardCurrency ? project.rewardCurrency : undefined,
})

const updateProjectOwner = useCallback(
(project: ProjectFragment) => {
if (!project || !user) {
return
}

if (project.id && project.owners[0]?.user.id === user.id) {
setIsProjectOwner(true)
} else {
setIsProjectOwner(false)
}
},
[user],
)

useEffect(() => {
const view = getViewFromPath(location.pathname)
if (view) {
Expand Down
47 changes: 4 additions & 43 deletions src/pages/projectCreate/components/ProjectCreateLaunchedModal.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import { Box, Button, HStack, Image, Link, ModalProps, VStack } from '@chakra-ui/react'
import { Box, Button, HStack, Image, ModalProps, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'
import { BsTwitter } from 'react-icons/bs'
import { PiSealCheckBold } from 'react-icons/pi'

import { NostrSvgIcon } from '../../../components/icons'
import { Modal } from '../../../components/layouts/Modal'
import { Body1 } from '../../../components/typography'
import { GeyserPrimalUrl, GeyserTwitterUrl, ProjectLaunchedImageUrl } from '../../../constants'
import { useAuthContext, useProjectContext } from '../../../context'
import { lightModeColors, socialColors } from '../../../styles'
import { hasNostrAccount, hasTwitterAccount, useCustomTheme } from '../../../utils'
import { ProjectLaunchedImageUrl } from '../../../constants'
import { useProjectContext } from '../../../context'
import { useCustomTheme } from '../../../utils'

export const ProjectCreateLaunchedModal = (props: Omit<ModalProps, 'children'>) => {
const { t } = useTranslation()
const { colors } = useCustomTheme()
const { project } = useProjectContext()

const { user } = useAuthContext()

const hasTwitter = hasTwitterAccount(user)
const hasNostr = hasNostrAccount(user)

return (
<Modal size="md" title={t('You’re all set!')} {...props}>
<VStack w="100%" spacing={6} pt={2}>
Expand All @@ -41,37 +33,6 @@ export const ProjectCreateLaunchedModal = (props: Omit<ModalProps, 'children'>)
{t('Follow us and tag us on social media at @geyserfund so we can amplify your content.')}
</Body1>
<VStack spacing="10px" w="full">
{hasTwitter && (
<Button
as={Link}
href={GeyserTwitterUrl}
isExternal
w="100%"
variant="primary"
onClick={props.onClose}
leftIcon={<BsTwitter />}
textDecoration={'none'}
>
@geyserfund
</Button>
)}

{hasNostr && (
<Button
as={Link}
href={GeyserPrimalUrl}
isExternal
w="100%"
onClick={props.onClose}
leftIcon={<NostrSvgIcon boxSize={'20px'} />}
textDecoration={'none'}
color={lightModeColors.neutral[0]}
bgColor={socialColors.nostr}
>
[email protected]
</Button>
)}

<Button w="100%" variant="secondary" onClick={props.onClose}>
{t('Go to project')}
</Button>
Expand Down
6 changes: 4 additions & 2 deletions src/translations/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@
"Your Geyser lightning address is <1>{{projectAddress}}</1>. All funds sent to this address will be instantly routed to the wallet you specify below.":"Your Geyser lightning address is <1>{{projectAddress}}</1>. All funds sent to this address will be instantly routed to the wallet you specify below.",
"The story of the project goes here...":"The story of the project goes here...",
"Confirm project launch":"Confirm project launch",
"By launching your project the project will be visible to and searchable by the public. You will be able to disactivate your project but not to hide your project after launching it.":"By launching your project the project will be visible to and searchable by the public. You will be able to disactivate your project but not to hide your project after launching it.",
"By launching your project the project will be visible to and searchable by the public. You will be able to disactivate your project but not to hide your project after launching it.":"By launching your project, it will be visible to and searchable by the public. You will be able to disactivate your project but not to hide your project after launching it.",
"Lightning Node":"Lightning Node",
"Confirm launch":"Confirm launch",
"You’re all set!":"You’re all set!",
Expand Down Expand Up @@ -900,7 +900,9 @@
"Share your project":"Share your project",
"Launch":"Launch",
"Sharing on social media helps you reach more people and get closer to achieving your goals":"Sharing on social media helps you reach more people and get closer to achieving your goals",
"Your project is in draft mode. Click launch to get it out into the world!":"Your project is in draft mode. Click launch to get it out into the world!"
"Your project is in draft mode. Click launch to get it out into the world!":"Your project is in draft mode. Click launch to get it out into the world!",
"Use Entries to share updates and engage with your community in your own way Use Entries to share updates and engage with your community in your own way":"Use Entries to share updates and engage with your community in your own way Use Entries to share updates and engage with your community in your own way",
"Add Entry":"Add Entry"



Expand Down

0 comments on commit 4de69a0

Please sign in to comment.