Skip to content

Commit

Permalink
Merge pull request #29 from ethereum-cat-herders/feat/twitter-api
Browse files Browse the repository at this point in the history
Revision to Twitter button integration
  • Loading branch information
geovgy authored Jan 2, 2023
2 parents d87db16 + f7bd2fd commit 9ad3c63
Show file tree
Hide file tree
Showing 8 changed files with 12,698 additions and 44 deletions.
10 changes: 10 additions & 0 deletions app/components/Icons.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Icon } from "@chakra-ui/react"

// Twitter Logo
export function TwitterIcon(props) {
return (
<Icon viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none" {...props}>
<path fill="#1D9BF0" d="M13.567 5.144c.008.123.008.247.008.371 0 3.796-2.889 8.173-8.172 8.173v-.002A8.131 8.131 0 011 12.398a5.768 5.768 0 004.25-1.19 2.876 2.876 0 01-2.683-1.995c.431.083.875.066 1.297-.05A2.873 2.873 0 011.56 6.348v-.036c.4.222.847.345 1.304.36a2.876 2.876 0 01-.89-3.836 8.152 8.152 0 005.92 3 2.874 2.874 0 014.895-2.619 5.763 5.763 0 001.824-.697 2.883 2.883 0 01-1.262 1.588A5.712 5.712 0 0015 3.656a5.834 5.834 0 01-1.433 1.488z"/>
</Icon>
)
}

// Sun Icon
export function SunIcon(props) {
return (
Expand Down
6,149 changes: 6,149 additions & 0 deletions app/package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
"@moralisweb3/common-evm-utils": "^2.10.3",
"@walletconnect/web3-provider": "^1.7.1",
"ethers": "^5.7.2",
"@web3auth/react-native-sdk": "^3.3.0",
"framer-motion": "^6",
"moralis": "^1.3.2",
"moralis-v1": "^1.12.0",
"next": "12.0.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-recaptcha": "^2.1.0",
"react-moralis": "^1.3.1",
"react-moralis": "^1.4.2",
"react-uuid": "^1.0.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion app/pages/courses/[id]/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default function Questions() {
</Button>
</HStack>
:
<VStack gap={5}>
<VStack justifyContent="center" alignItems="center" gap={5} mt={5} width="100%">
<ReCAPTCHA
ref={recaptchaRef}
size="normal"
Expand Down
27 changes: 22 additions & 5 deletions app/pages/courses/[id]/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
Box,
useColorMode,
useToast,
VStack
VStack,
Flex
} from "@chakra-ui/react";
import NextLink from "next/link";
import { useRouter } from "next/router";
Expand All @@ -15,7 +16,8 @@ import { useMoralis } from "react-moralis";
import Layout from "../../../components/Layout";
import { Contract, providers, utils } from "ethers";
import { Web3Context } from "../../../context/Web3Context";
import { EvmChain } from "@moralisweb3/common-evm-utils";
import { TwitterIcon } from "../../../components/Icons";


export default function Result() {
const { devMode } = useContext(Web3Context)
Expand Down Expand Up @@ -256,25 +258,40 @@ export default function Result() {
) : (
<>
<Text>
{mintId && minted ? `You earned NFT #${mintId}!` : 'You earned an NFT as a reward!'}
{mintId && minted ? `You are #${mintId} to earn this NFT reward!` : 'You earned an NFT as a reward!'}
</Text>
<VStack align='center' mt={4}>
<Flex direction="column" align='center' mt={4}>
<Button
backgroundColor='rgba(32, 223, 127, 1)'
_hover={{ backgroundColor: 'rgba(32, 223, 127, 0.5)' }}
onClick={() => !minted ? mint() : router.push('/rewards')}
isLoading={minting}
loadingText="Claiming..."
minW={200}
size="lg"
>
{minted ? 'View NFTs earned' : 'Claim'}
</Button>
{minted && (
<Button
as={Link}
leftIcon={<TwitterIcon/>}
mt={6}
minW={150}
backgroundColor='rgba(255, 255, 255, 0.2)'
_hover={{ backgroundColor: 'rgba(255, 255, 255, 0.1)' }}
isExternal
href="https://twitter.com/intent/tweet?hashtags=quiz%20%23ethereumquiz&amp;original_referer=https%3A%2F%2Fpublish.twitter.com%2F&amp;ref_src=twsrc%5Etfw%7Ctwcamp%5Ebuttonembed%7Ctwterm%5Eshare%7Ctwgr%5E&amp;text=I%20am%20excited%20to%20share%20that%20I%20took%20quiz%20on%20%22ECH%20Learn2Earn%22%20and%20received%20this%20NFT.%20Try%20it%20today%20at%20&amp;url=https%3A%2F%2Fl2e.ethereumcatherders.com%2F%20&amp;via=EthCatHerders"
>
Share to Twitter
</Button>
)}
<NextLink href='/' passHref>
<Link textDecor='underline' mt={2}>
Back to Home
</Link>
</NextLink>
</VStack>
</Flex>
</>
)}
</Box>
Expand Down
Loading

1 comment on commit 9ad3c63

@vercel
Copy link

@vercel vercel bot commented on 9ad3c63 Jan 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.