Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit ea152e7

Browse files
Briannagmak
authored andcommitted
PR changes requested by team members
Added Translations, removed margins and incorporated Chakra UI Stacks. Co-Authored-By: Nagma <[email protected]>
1 parent f13c202 commit ea152e7

File tree

5 files changed

+57
-21
lines changed

5 files changed

+57
-21
lines changed

frontend/public/locales/en/common.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,16 @@
1515
"hosting": "Hosting by:",
1616
"copyLinkToNFT": "Copy link to NFT",
1717
"linkCopied": "Link copied to clipboard",
18-
"projects": "A list of community projects created by the Developer DAO community."
18+
"projects": "A list of community projects created by the Developer DAO community.",
19+
"tokenUnavailable": "Token ID may not be available",
20+
"errorString": "error",
21+
"successString" : "success",
22+
"NFTMintSuccess": "Your NFT should now be in your wallet!",
23+
"TokenMintMessage": "Token Minted",
24+
"tokenIDPlaceholder": "Enter Token ID",
25+
"mintTokenText" : "Mint your Token",
26+
"connectWalletText": "Connect Wallet",
27+
"ethereumNetworkPrompt": "Please Connect to the Ethereum Network",
28+
"availableTokensText": "View the available Token IDs",
29+
"mintPageHeader": "DDAO Token Minter"
1930
}

frontend/src/components/DirectMint/DirectMint.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import React, {
44
useState,
55
useEffect,
66
} from 'react';
7-
import { useToast, Button, Input } from '@chakra-ui/react';
7+
import { useToast, Button, Input, Stack } from '@chakra-ui/react';
88
import { ethers } from 'ethers';
99
import WalletConnectProvider from '@walletconnect/web3-provider';
1010
import Web3Modal from 'web3modal';
11-
import { useTranslation } from 'react-i18next';
11+
import { useTranslation } from 'next-i18next';
12+
import {
13+
CONTRACT_ADDRESS,
14+
ERROR_CODE_TX_REJECTED_BY_USER,
15+
MAINNET_NETWORK_ID,
16+
INFURA_ID,
17+
} from '../../utils/DeveloperDaoConstants';
1218

1319
import MINT_CONTRACT from '../../artifacts/ddao.json';
14-
const CONTRACT_ADDRESS = '0x25ed58c027921e14d86380ea2646e3a1b5c55a8b';
15-
const ERROR_CODE_TX_REJECTED_BY_USER = 4001;
16-
const MAINNET_NETWORK_ID = 1;
1720
let _provider: any = null;
1821
let _signer: any = null;
1922
let mint_contract: Partial<ethers.Contract>;
@@ -26,7 +29,7 @@ const providerOptions = {
2629
walletconnect: {
2730
package: WalletConnectProvider, // required
2831
options: {
29-
infuraId: '86ddbc7b94ff40af908eaed373ac95d6', // required
32+
infuraId: INFURA_ID, // required
3033
},
3134
},
3235
};
@@ -158,8 +161,8 @@ const DirectMint = ({ developerId }: DirectMintProps) => {
158161
//console.error(error);
159162
toast({
160163
title: error.code,
161-
description: 'Token ID may not be available',
162-
status: 'error',
164+
description: t('tokenUnavailable'),
165+
status: t('errorString'),
163166
isClosable: true,
164167
});
165168
setTokenID('');
@@ -168,9 +171,9 @@ const DirectMint = ({ developerId }: DirectMintProps) => {
168171
// If we leave the try/catch, we aren't sending a tx anymore, so we clear
169172
// this part of the state.
170173
toast({
171-
title: 'Token Minted',
172-
description: 'Your NFT should now be in your wallet!',
173-
status: 'success',
174+
title: t('TokenMintMessage'),
175+
description: t('NFTMintSuccess'),
176+
status: t('successString'),
174177
isClosable: true,
175178
});
176179
setTokenID('');
@@ -180,7 +183,7 @@ const DirectMint = ({ developerId }: DirectMintProps) => {
180183
<>
181184
{!userWallet && (
182185
<Button w="100%" colorScheme="blue" onClick={connectWallet} mt="10">
183-
Connect Wallet
186+
{t('connectWalletText')}
184187
</Button>
185188
)}
186189
{userWallet && (
@@ -190,21 +193,23 @@ const DirectMint = ({ developerId }: DirectMintProps) => {
190193
value={tokenID}
191194
onChange={tokenNameHandler}
192195
type="text"
193-
placeholder="Enter Token ID"
196+
placeholder={t('tokenIDPlaceholder')}
194197
mt="10"
195198
></Input>
196199
)}
200+
197201
<Button
198202
w="100%"
199203
colorScheme="green"
200204
onClick={createTokenHandler}
201205
disabled={!userWallet || networkError}
202206
mt="10"
203207
>
204-
Mint your token
208+
{t('mintTokenText')}
205209
</Button>
210+
206211
{networkError && (
207-
<p className="network_error">Please Connect to the Ethereum Network</p>
212+
<p className="network_error">{t('EthereumNetworkPrompt')}</p>
208213
)}
209214
</>
210215
);

frontend/src/components/DirectMint/DirectMintBox.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
11
import React from 'react';
22
import DirectMint from './DirectMint';
33
import Logo from '../../components/Logo';
4-
import { Box, Container, Flex, Heading } from '@chakra-ui/react';
4+
import {
5+
Box,
6+
Container,
7+
Flex,
8+
Heading,
9+
Stack,
10+
Text,
11+
Link,
12+
} from '@chakra-ui/react';
13+
import { useTranslation } from 'next-i18next';
514

615
// Layout for the Direct Mint Box
716
// used on the minting page
817
const DirectMintBox = () => {
18+
const { t } = useTranslation();
919
return (
1020
<>
1121
<Container maxW="container.md" centerContent>
1222
<Box borderWidth="4px" borderRadius="lg" w="75%" padding="20">
13-
<Flex flexDirection="column" justify="center" align="center">
23+
<Stack spacing={6} align="center">
1424
<Logo w={52} h={52} />
15-
<Heading marginTop="6">DDAO Token Minter</Heading>
25+
<Heading>{t('mintPageHeader')}</Heading>
26+
<Text>
27+
{t('availableTokensText')}{' '}
28+
<Link href="https://ddao.ibby.dev" isExternal>
29+
here
30+
</Link>
31+
</Text>
1632
<DirectMint />
17-
</Flex>
33+
</Stack>
1834
</Box>
1935
</Container>
2036
</>

frontend/src/pages/mint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import DirectMintBox from '../components/DirectMint/DirectMintBox';
33
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
4+
import { useTranslation } from 'next-i18next';
45
import PageLayout from '../layout/Page';
5-
import { useTranslation } from 'react-i18next';
66
import { chakra } from '@chakra-ui/react';
77

88
const Mint = () => {

frontend/src/utils/DeveloperDaoConstants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ export const DEVELOPER_DAO_WEBSITE = 'https://www.developerdao.com';
44
export const OPENSEA_DIRECT_LINK_PREFIX = `https://opensea.io/assets/${DEVELOPER_DAO_CONTRACT}`;
55
export const ETHER_SCAN_LINK_PREFIX = 'https://etherscan.io/address';
66
export const SITE_URL = 'https://developerdao.com';
7+
export const CONTRACT_ADDRESS = '0x25ed58c027921e14d86380ea2646e3a1b5c55a8b';
8+
export const ERROR_CODE_TX_REJECTED_BY_USER = 4001;
9+
export const MAINNET_NETWORK_ID = 1;
10+
export const INFURA_ID = '86ddbc7b94ff40af908eaed373ac95d6';

0 commit comments

Comments
 (0)