Skip to content

Commit

Permalink
feat: login modal copy update
Browse files Browse the repository at this point in the history
  • Loading branch information
Agill-Sheron committed Jun 19, 2024
1 parent 060381e commit 8231b4e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/graphql/fragments/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const FRAGMENT_PROJECT_FOR_COMMUNITY_VOTE_GRANT = gql`
fragment ProjectCommunityVoteGrant on CommunityVoteGrant {
id
status
title
}
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ export const ContributeButton = (props: ButtonProps) => {
const isFundingDisabled = !isActive(project.status)

const isInProjectPage = location.pathname.includes(PathName.project) && project?.rewards?.length > 0

const isProjectAcceptedInOpenCommunityVoteGrant = project.grantApplications.some(
const acceptedApplication = project.grantApplications.find(
(application) =>
application.status === GrantApplicantStatus.Accepted &&
application.grant?.__typename === 'CommunityVoteGrant' &&
application.grant.status === GrantStatusEnum.FundingOpen,
)

const isProjectAcceptedInOpenCommunityVoteGrant = Boolean(acceptedApplication)
const grantName =
acceptedApplication?.grant?.__typename === 'CommunityVoteGrant' ? acceptedApplication.grant.title : ''

const handleContribute = () => {
setMobileView(MobileViews.funding)
if (isInProjectPage && !isMobile) {
Expand All @@ -51,7 +54,7 @@ export const ContributeButton = (props: ButtonProps) => {

return (
<>
<LoginToVoteModal isOpen={isOpen} onClose={onClose} onContribute={handleContribute} />
<LoginToVoteModal isOpen={isOpen} onClose={onClose} onContribute={handleContribute} grantName={grantName} />
<Button
variant="primary"
leftIcon={<BoltIcon />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@ type LoginToVoteModalProps = {
isOpen: boolean
onClose: () => void
onContribute: () => void
grantName: string
}

export const LoginToVoteModal = ({ isOpen, onClose, onContribute }: LoginToVoteModalProps) => {
export const LoginToVoteModal = ({ isOpen, onClose, onContribute, grantName }: LoginToVoteModalProps) => {
const { t } = useTranslation()

const { isOpen: isAuthModalOpen, onOpen: onAuthModalOpen, onClose: onAuthModalClose } = useDisclosure()

return (
<>
<Modal isOpen={isOpen} onClose={onClose} title={t('Login for your vote to count')}>
<VStack py={4} px={4} gap={10} w="full">
<VStack p={1} gap={10} w="full">
<Box w="full">
<Text>
{t('This project is part of the ')}
<Text as="span" fontWeight="bold">
{grantName}
</Text>
{t(
"Make sure to login before contributing otherwise your contribution won't be counted as votes in the grant.",
" community voting grant. Make sure to login before contributing otherwise your contribution won't be counted as votes in the grant.",
)}
</Text>
</Box>
Expand Down
4 changes: 3 additions & 1 deletion src/translations/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -1011,5 +1011,7 @@
"Sats sent":"Sats sent",
"votes":"votes",
"voters":"voters",
"sats sent":"sats sent"
"sats sent":"sats sent",
"This project is part of the ": "This project is part of the ",
"community voting grant. Make sure to login before contributing otherwise your contribution won't be counted as votes in the grant.":"community voting grant. Make sure to login before contributing otherwise your contribution won't be counted as votes in the grant."
}
3 changes: 2 additions & 1 deletion src/types/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4087,7 +4087,7 @@ export type ProfileOrderFragment = { __typename?: 'Order', id: any, referenceCod

export type PaginationFragment = { __typename?: 'CursorPaginationResponse', take?: number | null, count?: number | null, cursor?: { __typename?: 'PaginationCursor', id?: any | null } | null };

export type ProjectCommunityVoteGrantFragment = { __typename?: 'CommunityVoteGrant', id: any, status: GrantStatusEnum };
export type ProjectCommunityVoteGrantFragment = { __typename?: 'CommunityVoteGrant', id: any, status: GrantStatusEnum, title: string };

export type ProjectGrantApplicationsFragment = { __typename?: 'Project', grantApplications: Array<{ __typename?: 'GrantApplicant', id: any, status: GrantApplicantStatus, grant: { __typename?: 'BoardVoteGrant' } | (
{ __typename?: 'CommunityVoteGrant' }
Expand Down Expand Up @@ -5566,6 +5566,7 @@ export const ProjectCommunityVoteGrantFragmentDoc = gql`
fragment ProjectCommunityVoteGrant on CommunityVoteGrant {
id
status
title
}
`;
export const ProjectGrantApplicationsFragmentDoc = gql`
Expand Down

0 comments on commit 8231b4e

Please sign in to comment.