Skip to content

Commit

Permalink
Merge pull request #244 from Gateway-DAO/release/oct-25
Browse files Browse the repository at this point in the history
Release - October 25th, 2022
  • Loading branch information
NMCarv authored Oct 26, 2022
2 parents 1989f52 + 71fcab5 commit 905eaf9
Show file tree
Hide file tree
Showing 42 changed files with 1,622 additions and 804 deletions.
3 changes: 2 additions & 1 deletion apps/website/components/atoms/notistack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const NotistackContext = createContext<NotistackContextProps>({
vertical: 'top',
horizontal: 'center',
},
autoHideDuration: 3000,
autoHideDuration: 5000,
});

const Notistack = (props) => {
Expand All @@ -53,6 +53,7 @@ const Notistack = (props) => {
preventDuplicate={notistackContext.preventDuplicate}
anchorOrigin={notistackContext.position}
autoHideDuration={notistackContext.autoHideDuration}
hideIconVariant={notistackContext.variant == 'default' ? true : false}
style={defaultStyle()}
>
{props.children}
Expand Down
18 changes: 5 additions & 13 deletions apps/website/components/atoms/share-button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import useTranslation from 'next-translate/useTranslation';
import { useEffect } from 'react';

import { useSnackbar } from 'notistack';
import { useCopyToClipboard } from 'react-use';

import { useMenu } from '@gateway/ui';
Expand All @@ -19,10 +20,8 @@ import {
ListItemText,
Menu,
MenuItem,
Snackbar,
} from '@mui/material';

import { useSnackbar } from '../../hooks/use-snackbar';
import objectToParams from '../../utils/map-object';

type Props = {
Expand All @@ -49,7 +48,7 @@ export function ShareButton({
title = 'Gateway',
url = typeof window !== 'undefined' ? window.location.href : '',
}: Props) {
const snackbar = useSnackbar();
const { enqueueSnackbar } = useSnackbar();
const [state, copyToClipboard] = useCopyToClipboard();
const menu = useMenu();
const data = { title, url };
Expand All @@ -69,7 +68,9 @@ export function ShareButton({
};

useEffect(() => {
if (state?.value) snackbar.onOpen({ message: 'Copied link!' });
if (state?.value) {
enqueueSnackbar('Copied link!');
}
}, [state]);

return (
Expand Down Expand Up @@ -115,15 +116,6 @@ export function ShareButton({
<ListItemText>{t('actions.share-link')}</ListItemText>
</MenuItem>
</Menu>
<Snackbar
anchorOrigin={{
vertical: snackbar.vertical,
horizontal: snackbar.horizontal,
}}
open={snackbar.open}
onClose={snackbar.handleClose}
message={snackbar.message}
/>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
FileTaskDataError,
} from '../../../templates/create-gate/schema';

const FileLinkTask = ({ taskId, deleteTask }) => {
const FileLinkTask = ({ dragAndDrop, taskId, deleteTask }) => {
const {
register,
setValue,
Expand All @@ -48,7 +48,13 @@ const FileLinkTask = ({ taskId, deleteTask }) => {
}
}, [setValue, taskId, formValues.tasks.data]);

useEffect(() => {
setTaskVisible(dragAndDrop);
setTaskIsMoving(dragAndDrop);
}, [dragAndDrop]);

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

return (
<Stack
Expand All @@ -58,7 +64,7 @@ const FileLinkTask = ({ taskId, deleteTask }) => {
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',
padding: taskIsMoving ? '20px 20px 20px 40px' : '20px',
},
})}
>
Expand Down Expand Up @@ -112,48 +118,50 @@ const FileLinkTask = ({ taskId, deleteTask }) => {
/>
</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>
) : (
{!taskIsMoving && (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<IconButton
onClick={() => setTaskVisible(true)}
onClick={() => deleteTask(taskId)}
sx={(theme) => ({
color: theme.palette.text.secondary,
cursor: 'pointer',
marginRight: '20px',
'&:hover': {
color: theme.palette.text.primary,
},
})}
>
<ExpandLess fontSize="medium" />
<DeleteIcon fontSize="medium" />
</IconButton>
)}
</Box>
{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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import {
} from '../../../templates/create-gate/schema';

type GithubContributeTaskProps = {
dragAndDrop: boolean;
taskId: number;
deleteTask: (taskId: number) => void;
};

export default function GithubContributeTask({
dragAndDrop,
taskId,
deleteTask,
}: GithubContributeTaskProps) {
Expand Down Expand Up @@ -90,7 +92,13 @@ export default function GithubContributeTask({
}
}, [setValue, taskId]);

useEffect(() => {
setTaskVisible(dragAndDrop);
setTaskIsMoving(dragAndDrop);
}, [dragAndDrop]);

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

return (
<Stack
Expand All @@ -100,7 +108,7 @@ export default function GithubContributeTask({
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',
padding: taskIsMoving ? '20px 20px 20px 40px' : '20px',
},
})}
>
Expand Down Expand Up @@ -156,48 +164,50 @@ export default function GithubContributeTask({
/>
</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>
) : (
{!taskIsMoving && (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<IconButton
onClick={() => setTaskVisible(true)}
onClick={() => deleteTask(taskId)}
sx={(theme) => ({
color: theme.palette.text.secondary,
cursor: 'pointer',
marginRight: '20px',
'&:hover': {
color: theme.palette.text.primary,
},
})}
>
<ExpandLess fontSize="medium" />
<DeleteIcon fontSize="medium" />
</IconButton>
)}
</Box>
{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
Expand Down
Loading

1 comment on commit 905eaf9

@vercel
Copy link

@vercel vercel bot commented on 905eaf9 Oct 26, 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.