forked from hackdays-io/mint-rally
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' of github.com:hackdays-io/mint-rally into staging
- Loading branch information
Showing
28 changed files
with
1,061 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
[auth] | ||
token=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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
frontend/src/components/molecules/EventTransferLock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { Box, Button, Flex, Grid, Spinner, Text } from "@chakra-ui/react"; | ||
import { BigNumber } from "ethers"; | ||
import { FC, useEffect } from "react"; | ||
import { useIsNonTransferable, useTransferLock } from "src/hooks/useMintNFT"; | ||
import AlertMessage from "../atoms/form/AlertMessage"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { faLock, faLockOpen } from "@fortawesome/free-solid-svg-icons"; | ||
import { useLocale } from "src/hooks/useLocale"; | ||
|
||
type Props = { | ||
eventId: BigNumber; | ||
}; | ||
|
||
const EventTransferLock: FC<Props> = ({ eventId }) => { | ||
const { t } = useLocale(); | ||
const { isNonTransferable, refetch, isLoading } = | ||
useIsNonTransferable(eventId); | ||
|
||
const { | ||
lock, | ||
isLoading: isLocking, | ||
error, | ||
isSuccess, | ||
status, | ||
} = useTransferLock(eventId, !isNonTransferable); | ||
|
||
useEffect(() => { | ||
refetch(); | ||
}, [status]); | ||
|
||
return ( | ||
<> | ||
<Text fontWeight="bold">{t.EVENT_TRANSFERLOCK_SETTING}</Text> | ||
<Text color="grey.600" fontSize="sm" mb={3}> | ||
{t.EVENT_TRANSFERLOCK_SETTING_DESC} | ||
</Text> | ||
{isLoading ? ( | ||
<Spinner /> | ||
) : ( | ||
<Box> | ||
<Flex alignItems="center"> | ||
<Flex | ||
borderRadius="full" | ||
backgroundColor="white" | ||
p={2} | ||
alignItems="center" | ||
> | ||
<Box | ||
as="span" | ||
color={isNonTransferable ? "mintGreen.800" : "yellow.800"} | ||
background={isNonTransferable ? "gray.300" : "yellow.300"} | ||
width="40px" | ||
height="40px" | ||
borderRadius="full" | ||
display="inline-flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
mr={2} | ||
> | ||
<FontAwesomeIcon | ||
icon={isNonTransferable ? faLock : faLockOpen} | ||
/> | ||
</Box> | ||
<Box> | ||
<Text fontSize="sm" color="yellow.800"> | ||
{isNonTransferable | ||
? t.EVENT_ISNONTRANSFERABLE_TRUE | ||
: t.EVENT_ISNONTRANSFERABLE_FALSE} | ||
</Text> | ||
<Text fontSize="xs" color="gray.600"> | ||
{isNonTransferable | ||
? t.EVENT_ISNONTRANSFERABLE_TRUE_DESC | ||
: t.EVENT_ISNONTRANSFERABLE_FALSE_DESC} | ||
</Text> | ||
</Box> | ||
</Flex> | ||
<Button | ||
ml={3} | ||
size="sm" | ||
disabled={isLocking} | ||
isLoading={isLocking} | ||
onClick={() => lock()} | ||
backgroundColor="transparent" | ||
border="1px solid" | ||
borderColor="yellow.800" | ||
color="yellow.800" | ||
> | ||
{t.EVENT_ADMIN_SUBMIT} | ||
</Button> | ||
</Flex> | ||
</Box> | ||
)} | ||
{error && ( | ||
<AlertMessage title={t.EVENT_TRANSFERLOCK_FAIL}> | ||
{(error as any).reason} | ||
</AlertMessage> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default EventTransferLock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.