Skip to content

Commit

Permalink
Merge pull request #229 from Gateway-DAO/release/oct-18
Browse files Browse the repository at this point in the history
Release/oct 18
  • Loading branch information
NMCarv authored Oct 19, 2022
2 parents 9f6e9cd + 3178369 commit 950a42c
Show file tree
Hide file tree
Showing 46 changed files with 620 additions and 342 deletions.
10 changes: 10 additions & 0 deletions apps/website/components/molecules/add-task/add-task-card.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PhotoCameraBack } from '@mui/icons-material';
import ElectricBoltIcon from '@mui/icons-material/ElectricBolt';
import GitHubIcon from '@mui/icons-material/GitHub';
import InsertLinkIcon from '@mui/icons-material/InsertLink';
Expand Down Expand Up @@ -73,6 +74,15 @@ const AddTaskCard = ({ numberOfTasks, addTask }) => {
/>
</Paper>
</Grid>
<Grid item xs={2} sm={4} md={4}>
<Paper>
<AddTaskButton
icon={<PhotoCameraBack />}
title={'Verify NFT'}
addTask={() => addTask('nft_hold')}
/>
</Paper>
</Grid>
<Grid item xs={2} sm={4} md={4}>
<Paper>
<AddTaskButton
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
import { useEffect, useState } from 'react';

import { useFormContext } from 'react-hook-form';

import { ExpandLess, ExpandMore } from '@mui/icons-material';
import DeleteIcon from '@mui/icons-material/Delete';
import {
Box,
FormControl,
IconButton,
InputLabel,
MenuItem,
Select,
Stack,
TextField,
Typography,
} from '@mui/material';

import { CircleWithNumber } from '../../../atoms/circle-with-number';
import {
CreateGateTypes,
HoldNFTDataError,
} from '../../../templates/create-gate/schema';
import { mockChains } from '../hold-token-task/__mock__';

const HoldNFTTask = ({ taskId, deleteTask }) => {
const {
register,
setValue,
getValues,
formState: { errors },
} = useFormContext<CreateGateTypes>();

const formValues = getValues();

useEffect(() => {
if (formValues.tasks.data[taskId]?.title === '') {
setValue(`tasks.data.${taskId}.title`, 'Untitled Requirement');
}
setValue(`tasks.data.${taskId}.task_type`, 'nft_hold');
}, [taskId, setValue, formValues.tasks.data]);

const [taskVisible, setTaskVisible] = useState(false);

return (
<Stack
sx={(theme) => ({
padding: '50px',
border: '2px solid rgba(229, 229, 229, 0.08)',
background: `linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.05) 100%), ${theme.palette.background.paper}`,
borderRadius: '10px',
[theme.breakpoints.down('sm')]: {
padding: '20px',
},
})}
>
<Stack
direction={'row'}
alignItems={'center'}
marginBottom={!taskVisible ? '40px' : 0}
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<Stack
direction={'row'}
alignItems={'center'}
sx={{ width: '100%', mr: '20px' }}
>
<CircleWithNumber
number={taskId + 1}
sx={(theme) => ({
mr: theme.spacing(3.75),
[theme.breakpoints.down('sm')]: { mr: theme.spacing(2.5) },
})}
/>
<Stack>
<Typography variant="subtitle2">Hold NFT</Typography>
<TextField
variant="standard"
autoFocus
sx={{
minWidth: { md: '600px', xs: '110%' },
maxWidth: { xs: '100%', md: '110%' },
}}
InputProps={{
style: {
fontSize: '20px',
fontWeight: 'bolder',
},
disableUnderline: true,
sx: {
'&.Mui-focused': {
borderBottom: '2px solid #9A53FF',
},
},
}}
id="task-title"
{...register(`tasks.data.${taskId}.title`)}
error={!!errors.tasks?.data[taskId]?.title}
helperText={errors.tasks?.data[taskId]?.title?.message}
/>
</Stack>
</Stack>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<IconButton
onClick={() => deleteTask(taskId)}
sx={(theme) => ({
color: theme.palette.text.secondary,
cursor: 'pointer',
marginRight: '20px',
'&:hover': {
color: theme.palette.text.primary,
},
})}
>
<DeleteIcon fontSize="medium" />
</IconButton>
{taskVisible ? (
<IconButton
onClick={() => setTaskVisible(false)}
sx={(theme) => ({
color: theme.palette.text.secondary,
cursor: 'pointer',
'&:hover': {
color: theme.palette.text.primary,
},
})}
>
<ExpandMore fontSize="medium" />
</IconButton>
) : (
<IconButton
onClick={() => setTaskVisible(true)}
sx={(theme) => ({
color: theme.palette.text.secondary,
cursor: 'pointer',
'&:hover': {
color: theme.palette.text.primary,
},
})}
>
<ExpandLess fontSize="medium" />
</IconButton>
)}
</Box>
</Stack>
<FormControl style={!taskVisible ? {} : { display: 'none' }}>
<TextField
required
multiline
minRows={3}
label="Task Requirement"
id="task-description"
{...register(`tasks.data.${taskId}.description`)}
error={!!errors.tasks?.data[taskId]?.description}
helperText={errors.tasks?.data[taskId]?.description?.message}
sx={{
marginBottom: '60px',
'& fieldset legend span': {
marginRight: '10px',
},
}}
/>
<FormControl>
<InputLabel htmlFor="chains">Chain</InputLabel>
<Select
id="chains"
sx={{ maxWidth: { md: '50%', xs: '100%' } }}
{...register(`tasks.data.${taskId}.task_data.chain`)}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
{mockChains.map((chain) => (
<MenuItem key={chain.value} value={chain.value}>
{chain.label}
</MenuItem>
))}
</Select>
</FormControl>
<TextField
required
label="NFT Contract Address"
sx={{ marginTop: '15px', maxWidth: { md: '50%', xs: '100%' } }}
{...register(`tasks.data.${taskId}.task_data.nft_address`)}
error={
!!(errors.tasks?.data[taskId]?.task_data as HoldNFTDataError)
?.nft_address
}
helperText={
(errors.tasks?.data[taskId]?.task_data as HoldNFTDataError)
?.nft_address?.message
}
/>
</FormControl>
</Stack>
);
};

export default HoldNFTTask;
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
const chainIds = {
Ethereum: 1,
Ropsten: 3,
Rinkeby: 4,
Görli: 5,
Kovan: 6,
'Optimistic (mainnet)': 10,
'Optimistic (kovan)': 69,
'Binance Smart Chain (mainnet)': 56,
'Binance Smart Chain (testnet)': 97,
Optimistic: 10,
'Binance Smart Chain': 56,
Polygon: 137,
'Polygon (Mumbai)': 80001,
Arbitrum: 42161,
'Arbitrum Rinkeby': 421611,
};

export const mockChains = [
'Ethereum',
'Ropsten',
'Rinkeby',
'Görli',
'Kovan',
'Optimistic (mainnet)',
'Optimistic (kovan)',
'Binance Smart Chain (mainnet)',
'Binance Smart Chain (testnet)',
'Optimistic',
'Binance Smart Chain',
'Polygon',
'Polygon (Mumbai)',
'Arbitrum',
'Arbitrum Rinkeby',
].map((chain) => ({
value: chainIds[chain],
label: chain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const TwitterTweetTask = ({ taskId, deleteTask }) => {

const [taskVisible, setTaskVisible] = useState(false);
const [emoji, setEmoji] = useState('');
const [tweetText, setTweetText] = useState('');
const [tweetText, setTweetText] = useState(
formValues.tasks.data[taskId]?.task_data['tweet_text']
? formValues.tasks.data[taskId]?.task_data['tweet_text']
: ''
);

useEffect(() => {
if (
Expand Down Expand Up @@ -74,7 +78,7 @@ const TwitterTweetTask = ({ taskId, deleteTask }) => {
position: 'absolute',
top: '142px',
left: '10px',
zIndex: '1',
zIndex: '2',
},
pickerSxProps: {
position: 'absolute',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export const DefaultMintScreen = ({

<CardContent sx={{ mt: -2.0 }}>
<Typography variant="body2" color="text.secondary">
{details.credential.description.length > 63
? details.credential.description.substring(0, 60) + '...'
{details.credential.description.length > 53
? details.credential.description.substring(0, 50) + '...'
: details.credential.description}
</Typography>
</CardContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ export default function GatePublishedModal({
{...gate}
/>
</Box>
<Stack direction="row" justifyContent="center">
<Stack direction="row" justifyContent="center" sx={{ mt: {xs : 6 , md : 2} }}>
<Link href={ROUTES.GATE_PROFILE.replace('[id]', gate.id)} passHref>
<Button variant="outlined" component="a" size="medium">
<Button
variant="outlined"
component="a"
size="medium"
>
Check Credential
</Button>
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ export default function GateCompletedModal({ gate, open, handleClose }) {
</Box>
<Stack
direction="row"
justifyContent="space-between"
justifyContent={'center'}
sx={{
marginTop: {
xs: (theme) => theme.spacing(10),
md: (theme) => theme.spacing(3),
},
marginTop: { xs: 5 , md :0 },
}}
>
<Stack>
Expand All @@ -128,7 +125,7 @@ export default function GateCompletedModal({ gate, open, handleClose }) {
>
Share on
</Typography>
<Stack direction="row" spacing={1}>
<Stack direction="row" justifyContent={'center'} spacing={1}>
<EmailShareButton
url={URL}
subject={'Congratulations'}
Expand Down Expand Up @@ -157,16 +154,13 @@ export default function GateCompletedModal({ gate, open, handleClose }) {
</TwitterShareButton>
</Stack>
</Stack>
<Link href={'/profile'} passHref>
<Button
variant="outlined"
component="a"
size="medium"
sx={{ margin: '20px 0 0 20px' }}
>
View on Profile
</Button>
</Link>
<Box alignSelf={'flex-end'} marginLeft={4}>
<Link href={'/profile'} passHref>
<Button variant="outlined" component="a" size="large">
View on Profile
</Button>
</Link>
</Box>
</Stack>
</Stack>
</Stack>
Expand Down
Loading

1 comment on commit 950a42c

@vercel
Copy link

@vercel vercel bot commented on 950a42c Oct 19, 2022

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.