Skip to content

Commit

Permalink
Merge pull request #1712 from geyserfund/sajal/gys-9033-heroes-fronte…
Browse files Browse the repository at this point in the history
…nd-implementation

sajal/gys-9033-heroes-frontend-implementation
  • Loading branch information
sajald77 authored Nov 20, 2024
2 parents 2a30ac2 + 02d5fe1 commit 2df0bf4
Show file tree
Hide file tree
Showing 112 changed files with 4,912 additions and 881 deletions.
2 changes: 1 addition & 1 deletion cypress/assertions/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const fundingAmountScreenIsVisible = () => {
}

export const commentScreenIsVisible = () => {
cy.get('h1').contains('Public message').should('be.visible')
cy.get('h1').contains('Public comment').should('be.visible')
}

export const lightningQrScreenIsVisible = () => {
Expand Down
57 changes: 52 additions & 5 deletions language/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,6 @@
"Select rewards": "Select rewards",
"Email will be sent to": "Email will be sent to",
"members.": "members.",
"Completed Goals": "Completed Goals",
"Welcome to the Bitcoin Crowdfunding Platform": "Welcome to the Bitcoin Crowdfunding Platform",
"Projects exposing new stories through film and documentaries.": "Projects exposing new stories through film and documentaries.",
"Projects building or bringing about Nostr adoption around the world.": "Projects building or bringing about Nostr adoption around the world.",
Expand All @@ -1260,10 +1259,19 @@
"Successfully deleted post!": "Successfully deleted post!",
"Back to posts": "Back to posts",
"Failed to fetch featured project": "Failed to fetch featured project",
"Post saved successfully!": "Post saved successfully!",
"failed to upload image": "failed to upload image",
"Contribute without login": "Contribute without login",
"Completed Goals": "Completed Goals",
"Provide your Lightning Address for a full or partial refund": "Provide your Lightning Address for a full or partial refund",
"Download and securely store your Refund File; if in doubt, re-download to ensure its safety.": "Download and securely store your Refund File; if in doubt, re-download to ensure its safety.",
"Transaction is being processed": "Transaction is being processed",
"Get notified via email (optional)": "Get notified via email (optional)",
"Enter notified by email (optional)": "Enter notified by email (optional)",
"Wallets are marked as unstable when a transaction fails due to a transaction failure, not enough inbound liquidity, or other. Consider making a small transaction to set your project back to active, or change your wallet.": "Wallets are marked as unstable when a transaction fails due to a transaction failure, not enough inbound liquidity, or other. Consider making a small transaction to set your project back to active, or change your wallet.",
"Your project cannot receive contributions but is visible to the public. To reactivate your project go to Setting.": "Your project cannot receive contributions but is visible to the public. To reactivate your project go to Setting.",
"Your wallet is not functional. Please change your wallet to receive contributions. ": "Your wallet is not functional. Please change your wallet to receive contributions. ",
"Your project is in review and therefore cannot receive contributions": "Your project is in review and therefore cannot receive contributions",
"Your project is live and can receive contributions. Share your project to get more visibility.": "Your project is live and can receive contributions. Share your project to get more visibility.",
"Your project is in review and therefore cannot receive contributions, and is not visible by the public.": "Your project is in review and therefore cannot receive contributions, and is not visible by the public.",
"You project has been flagged for violating our Terms & Conditions. You should have received an email with further detail on how to proceed. Your project is currently not visible to the public.": "You project has been flagged for violating our Terms & Conditions. You should have received an email with further detail on how to proceed. Your project is currently not visible to the public.",
"To a goal": "To a goal",
"Email and Updates": "Email and Updates",
"Rewards total": "Rewards total",
Expand Down Expand Up @@ -1307,5 +1315,44 @@
"Receive One Time Password": "Receive One Time Password",
"We sent you an OTP code to": "We sent you an OTP code to",
"Paste (or type) it below to continue.": "Paste (or type) it below to continue.",
"Resend code": "Resend code"
"No contributions have been made to this project.": "No contributions have been made to this project.",
"Banner": "Banner",
"Spread the word": "Spread the word",
"Hall of fame": "Hall of fame",
"Hero Card": "Hero Card",
"This month": "This month",
"Hall of Fame": "Hall of Fame",
"The Projects and Heroes bringing Bitcoin closer to mass adoption": "The Projects and Heroes bringing Bitcoin closer to mass adoption",
"Top Projects": "Top Projects",
"Top Heroes": "Top Heroes",
"Creators": "Creators",
"Ambassadors": "Ambassadors",
"Discover the top projects making a significant impact on Bitcoin’s mass adoption": "Discover the top projects making a significant impact on Bitcoin’s mass adoption",
"Raised <1>{{usdAmount}}</1> ({{satsAmount}} sats) with <3>{{numberOfContributions}}</3> contributions from <5>{{numberOfFunders}}</5> users": "Raised <1>{{usdAmount}}</1> ({{satsAmount}} sats) with <3>{{numberOfContributions}}</3> contributions from <5>{{numberOfFunders}}</5> users",
"Those bringing the most successful projects to life": "Those bringing the most successful projects to life",
"Those whose contributions power projects on Geyser, driving Bitcoin adoption": "Those whose contributions power projects on Geyser, driving Bitcoin adoption",
"Heroes Hall of Fame": "Heroes Hall of Fame",
"Those spreading the word about valuable projects and enabling contributions to happen": "Those spreading the word about valuable projects and enabling contributions to happen",
"Share the Heroes Hall of Fame to showcase the top Contributors, Creators, and Ambassadors of the Bitcoin ecosystem!": "Share the Heroes Hall of Fame to showcase the top Contributors, Creators, and Ambassadors of the Bitcoin ecosystem!",
"Hero link:": "Hero link:",
"Top Contributors": "Top Contributors",
"Contributed <1>{{usdAmount}}</1> ({{satsAmount}} sats) with <3>{{numberOfContributions}}</3> contributions to <5>{{numberOfProjects}}</5> projects": "Contributed <1>{{usdAmount}}</1> ({{satsAmount}} sats) with <3>{{numberOfContributions}}</3> contributions to <5>{{numberOfProjects}}</5> projects",
"Top Creators": "Top Creators",
"Raised <1>{{usdAmount}}</1> ({{satsAmount}} sats) across <3>{{numberOfProjects}}</3> projects": "Raised <1>{{usdAmount}}</1> ({{satsAmount}} sats) across <3>{{numberOfProjects}}</3> projects",
"Top Ambassadors": "Top Ambassadors",
"made in contributions": "made in contributions",
"raised in contributions": "raised in contributions",
"Hero Rank": "Hero Rank",
"Ambassador": "Ambassador",
"of enabled contributions": "of enabled contributions",
"Error fetching user profile": "Error fetching user profile",
"Copy card": "Copy card",
"Hero cards are a summary of your activity in the Bitcoin space. You can share them with your friends!": "Hero cards are a summary of your activity in the Bitcoin space. You can share them with your friends!",
"Creator Ranking": "Creator Ranking",
"Contributor Ranking": "Contributor Ranking",
"Ambassador Ranking": "Ambassador Ranking",
"Current month": "Current month",
"Current week": "Current week",
"Resend code": "Resend code",
"Geyser Manifesto": "Geyser Manifesto"
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@
"react-icons": "^5.2.1",
"react-jss": "^10.9.2",
"react-otp-input": "^3.1.1",
"react-parallax-tilt": "^1.7.257",
"react-player": "^2.16.0",
"react-qr-code": "^2.0.11",
"react-qrcode-logo": "^3.0.0",
"react-router": "^6.25.1",
"react-router-dom": "^6.25.1",
"react-simple-pull-to-refresh": "^1.3.3",
"react-swipeable": "^7.0.1",
"react-truncate-inside": "^1.0.3",
"react-tweet-embed": "^2.0.0",
"react-use-websocket": "^4.8.1",
"recharts": "^2.12.7",
Expand Down
7 changes: 7 additions & 0 deletions src/api/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ const getUsdQuote = async (): Promise<number> => {
}

export const fetchBitcoinRates = ({ currency: _ }: { currency: 'usd' }) => getUsdQuote()

export const getBlockHeight = async (): Promise<number> => {
const response = await fetch('https://blockstream.info/api/blocks/tip/height')
const data = await response.json()

return data
}
108 changes: 108 additions & 0 deletions src/components/molecules/ShareView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { Box, Button, HStack, Icon, Link, useClipboard, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'
import { PiCopy, PiShareFat } from 'react-icons/pi'
import Truncate from 'react-truncate-inside'

import { FlowingGifBackground } from '@/modules/discovery/pages/hallOfFame/components/FlowingGifBackground'
import { Body } from '@/shared/components/typography'
import { lightModeColors } from '@/shared/styles'
import { useNotification } from '@/utils'

export const ShareView = ({
shareOnXUrl,
shareUrl,
shareUrlLabel,
children,
}: {
shareOnXUrl: string
shareUrl: string
shareUrlLabel: string
children: React.ReactNode
}) => {
const { onCopy } = useClipboard(shareUrl)
const toast = useNotification()
const { t } = useTranslation()

const handleCopy = () => {
onCopy()
toast.success({
title: t('Copied!'),
description: t('Hero link copied to clipboard'),
})
}

return (
<VStack w="100%">
<VStack
bgGradient={`linear(to-r, ${lightModeColors.primary1[4]}, ${lightModeColors.indigo[3]})`}
p={4}
borderRadius="md"
width="100%"
spacing={2}
position="relative"
>
<Body size="md" textAlign="center" color={lightModeColors.neutral1[11]}>
<FlowingGifBackground />
<Body zIndex={1}>{children}</Body>
</Body>
</VStack>
<VStack width="100%" p={3} bgColor="neutral1.2" borderRadius="md" border="1px solid" borderColor="neutral1.6">
<HStack
h="40px"
w="full"
p={2}
bg="neutral1.2"
borderRadius={10}
border="1px solid"
borderColor="neutral1.6"
zIndex={1}
onClick={handleCopy}
cursor="pointer"
_hover={{
bg: 'neutral1.3',
}}
overflow={'hidden'}
>
<Body color="neutral1.12" whiteSpace={'nowrap'}>
<strong>{shareUrlLabel}</strong>
</Body>

<>
{shareUrlLabel || shareUrl.replace('https://', '').length > 40 ? (
<Box flex={1} overflow={'hidden'}>
<Truncate text={shareUrl.replace('https://', '')} offset={20} />
</Box>
) : (
<Body color="neutral1.12">{shareUrl.replace('https://', '')}</Body>
)}
<Icon as={PiCopy} color="neutral1.11" />
</>
</HStack>
<HStack w="full" justifyContent="center" spacing={2}>
<Button
variant="soft"
colorScheme="neutral1"
borderRadius={8}
rightIcon={<PiShareFat />}
as={Link}
isExternal
href={shareOnXUrl}
w="full"
>
{t('Share on X')}
</Button>
<Button
variant="solid"
colorScheme="primary1"
w="full"
rightIcon={<PiCopy />}
onClick={handleCopy}
fontSize="md"
>
{t('Copy link')}
</Button>
</HStack>
</VStack>
</VStack>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const ProjectFundingContributorsItem = ({ contributor, project, ...rest }
return (
<Box
as={Link}
to={contributor?.user?.id ? getPath('userProfile', contributor.user.id) : '/'}
to={contributor?.user?.heroId ? getPath('heroProfile', contributor.user.heroId) : '/'}
style={{ textDecoration: 'none', width: '100%' }}
px={1}
py={3}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ui/CustomSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export interface CustomSelectProps<Option, IsMulti extends boolean = false>
dropdownIndicator?: React.ReactNode
width?: ResponsiveValue<number | string>
fontSize?: string
dropdownIndicatorPosition?: 'left' | 'right'
}

export function CustomSelect<Option, IsMulti extends boolean = false>({
customChakraStyles,
dropdownIndicator,
width,
dropdownIndicatorPosition = 'right',
...props
}: CustomSelectProps<Option, IsMulti>) {
const chakraStyles: ChakraStylesConfig<Option, IsMulti> = {
Expand Down Expand Up @@ -64,6 +66,7 @@ export function CustomSelect<Option, IsMulti extends boolean = false>({
control: (provided) => ({
...provided,
borderColor: 'neutral1.6',
flexDirection: dropdownIndicatorPosition === 'left' ? 'row-reverse' : 'row',
_hover: {
borderColor: 'neutral1.7',
},
Expand Down
3 changes: 2 additions & 1 deletion src/config/GlobalStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const GlobalStyles = () => (
@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Livvic:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Hubot+Sans:ital,wght@0,200..900;1,200..900&display=swap');
@font-face {
font-family: "Figtree", sans-serif;
Expand Down
12 changes: 12 additions & 0 deletions src/config/routes/routeGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ export const discoveryRoutes = [
getPath('discoveryLeaderboard'),
getPath('discoveryGrants'),
getPath('discoveryGrant', PathName.grantId),
getPath('discoveryHallOfFame'),
getPath('hallOfFameProjects'),
getPath('hallOfFameHeroesCreator'),
getPath('hallOfFameHeroesAmbassador'),
getPath('hallOfFameHeroesContributor'),
]

export const profileSettingsRoutes = [
Expand All @@ -136,6 +141,13 @@ export const profileSettingsRoutes = [
getPath('userProfileSettingsNotifications', PathName.userId),
]

export const heroProfileSettingsRoutes = [
getPath('heroProfileSettings', PathName.heroId),
getPath('heroProfileSettingsGeneral', PathName.heroId),
getPath('heroProfileSettingsNotifications', PathName.heroId),
]

export const profileRoutes = [getPath('userProfile', PathName.userId), ...profileSettingsRoutes]
export const heroProfileRoutes = [getPath('heroProfile', PathName.heroId), ...heroProfileSettingsRoutes]

export const fallBackRoutes = [getPath('notFound'), getPath('notAuthorized')]
Loading

0 comments on commit 2df0bf4

Please sign in to comment.