Skip to content

Commit

Permalink
Merge pull request #90 from heronlancellot/feat/refactorCode
Browse files Browse the repository at this point in the history
Feat/refactor code
  • Loading branch information
heronlancellot authored Oct 15, 2023
2 parents b99f123 + 8f6ee49 commit 5493c08
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 1,748 deletions.
48 changes: 20 additions & 28 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#1975ff" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400&display=swap"
rel="stylesheet"
/>
<title>Web3Dev</title>
<meta
name="description"
content="High performance React template built with lots of powerful Material-UI components across multiple product niches for fast & perfect apps development processes."
/>
<meta
name="keywords"
content="material-ui, admin dashboard, admin template, react, react template, react admin template, react dashboard, react admin panel"
/>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#1975ff" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400&display=swap" rel="stylesheet" />
<title>Web3Task</title>
<meta name="description"
content="High performance React template built with lots of powerful Material-UI components across multiple product niches for fast & perfect apps development processes." />
<meta name="keywords"
content="material-ui, admin dashboard, admin template, react, react template, react admin template, react dashboard, react admin panel" />
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>

</html>
4 changes: 4 additions & 0 deletions src/content/applications/Tasks/HomeTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CoverHomeTasks from "../../../components/Cover/CoverHomeTasks";
import usePagination from "src/components/Pagination";
import SearchFilters from "src/components/Task/SearchFiltersTasks";
import { useSearchFilters } from "src/hooks/useSearchFilters";
import { Helmet } from "react-helmet-async";

const HomeTasks = () => {
const taskService = useTaskService();
Expand Down Expand Up @@ -50,6 +51,9 @@ const HomeTasks = () => {

return (
<>
<Helmet>
<title>Web3Task</title>
</Helmet>

<Box
>
Expand Down
2 changes: 1 addition & 1 deletion src/content/applications/Tasks/details/DetailsTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DetailsTask = () => {
return (
<>
<Helmet>
<title>Web3Task - Profile</title>
<title>Web3Task - Task Details</title>
</Helmet>

<Container sx={{
Expand Down
8 changes: 6 additions & 2 deletions src/content/applications/Tasks/settings/AdminOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useState } from 'react';
import { useTaskService } from 'src/services/tasks-service';
import { useTaskServiceHook } from '../../../../hooks/TaskServiceHook';
import CoverAdminOptions from 'src/components/Cover/CoverAdminOptions';
import { Helmet } from 'react-helmet-async';

const AdminOptions = () => {

Expand Down Expand Up @@ -74,7 +75,7 @@ const AdminOptions = () => {
case "setRole": {
try {
await handleRole(role.roleId, role.authorizedAddress, role.isAuthorized);

} catch (error) {
console.error('Erro ao enviar o formulário:', error);
}
Expand Down Expand Up @@ -112,11 +113,14 @@ const AdminOptions = () => {

return (
<>
<Helmet>
<title>Web3Task - Adm Settings</title>
</Helmet>
<Box>
<CoverAdminOptions />
<Box display={'flex'} justifyContent={'center'} alignItems={'center'} flexDirection={'column'}>
<Stack>
<Box m={2}>
<Box m={2}>
<Typography sx={{ alignItems: 'left' }} fontWeight={'bold'} fontSize={'24px'} mb={2}>Deposit</Typography>
<TextField label={'Role ID'} sx={{ mr: 2 }} onChange={(event) => (handleInputChange('deposit', event))} name='roleId' />
<TextField label={'Amount'} sx={{ mr: 2 }} onChange={(event) => (handleInputChange('deposit', event))} name='amount' />
Expand Down
195 changes: 100 additions & 95 deletions src/content/applications/Tasks/settings/CreateTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Task } from "src/models/task";
import SuspenseLoader from 'src/components/SuspenseLoader';
import CoverCreateTask from '../../../../components/Cover/CoverCreateTask';
import { useSnackBar } from 'src/contexts/SnackBarContext';
import { Helmet } from 'react-helmet-async';

let newTask: Task = {
status: 0,
Expand Down Expand Up @@ -151,111 +152,115 @@ const CreateTask = ({ data }) => {
}, [setLoading]);

return (
<Stack spacing={2} sx={{ width: '100%' }}>
<Box
display={'flex'}
justifyContent={'center'}
alignItems={'center'}
height={'100%'}
flexDirection={'column'}>

<>
<Helmet>
<title>Web3Task - Create Task</title>
</Helmet>
<Stack spacing={2} sx={{ width: '100%' }}>
<Box
width={'100%'}>
<CoverCreateTask />
</Box>
{
loading ? <SuspenseLoader /> : (
<Box marginTop={2} component="form" onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={2} alignItems={'center'} >
<TextField {...register("title")}
fullWidth
id="outlined-required"
label={'Title'}
onBlur={handleTitle}
placeholder={'Describe the activity or link to a document'}
/>
<p>{errors.title?.message}</p>
display={'flex'}
justifyContent={'center'}
alignItems={'center'}
height={'100%'}
flexDirection={'column'}>

<TextField {...register("authorizedRoles")}
fullWidth
id="outlined-required"
label={'Authorized Roles (separate by `,`)'}
onBlur={handleAuthorizedRoles}
placeholder={'The authorized roles to perform the task'}
/>
<p>{errors.authorizedRoles?.message}</p>
<Box
width={'100%'}>
<CoverCreateTask />
</Box>
{
loading ? <SuspenseLoader /> : (
<Box marginTop={2} component="form" onSubmit={handleSubmit(onSubmit)}>
<Stack spacing={2} alignItems={'center'} >
<TextField {...register("title")}
fullWidth
id="outlined-required"
label={'Title'}
onBlur={handleTitle}
placeholder={'Describe the activity or link to a document'}
/>
<p>{errors.title?.message}</p>

<TextField {...register("creatorRole")}
fullWidth
id="outlined-required"
label={'Creator Role'}
onBlur={handleCreatorRole}
placeholder={'Creator Role 5..10..'}
/>
<p>{errors.creatorRole?.message}</p>
<TextField {...register("authorizedRoles")}
fullWidth
id="outlined-required"
label={'Authorized Roles (separate by `,`)'}
onBlur={handleAuthorizedRoles}
placeholder={'The authorized roles to perform the task'}
/>
<p>{errors.authorizedRoles?.message}</p>

<TextField
fullWidth
id="outlined-required"
label={'Assignee Address (leave blank to allow anyone to perform the task)'}
onBlur={handleAssignee}
placeholder={'Assignee address'}
/>
<TextField {...register("creatorRole")}
fullWidth
id="outlined-required"
label={'Creator Role'}
onBlur={handleCreatorRole}
placeholder={'Creator Role 5..10..'}
/>
<p>{errors.creatorRole?.message}</p>

<TextField
fullWidth
id="outlined-required"
label={'Metadata (IPFS)'}
onBlur={handleMetadata}
placeholder={'https://ipfs.io/ipfs/QmY5D...7CEh'}
/>
<TextField
fullWidth
id="outlined-required"
label={'Assignee Address (leave blank to allow anyone to perform the task)'}
onBlur={handleAssignee}
placeholder={'Assignee address'}
/>

<TextField fullWidth
id="outlined-required"
label={'Description'}
onBlur={handleDescription}
placeholder={'A full description about the ativity.'}
multiline
maxRows="18"
onChange={handleChange}
/>
<TextField
fullWidth
id="outlined-required"
label={'Metadata (IPFS)'}
onBlur={handleMetadata}
placeholder={'https://ipfs.io/ipfs/QmY5D...7CEh'}
/>

<Stack spacing={2} direction={'row'} alignItems="center" justifyContent="center">
<Box>
<img src={logoImage} width={'100px'} height={'100px'} alt='Pod3LabsRecompensaIcon' />
</Box>
<div>
<TextField {...register("valueReward")}
label={'Reward in USD'}
onBlur={handleReward}
/>
<p>{errors.valueReward?.message}</p>
</div>
<div>
<DatePicker
label={'Deliver Date'}
onChange={(newValue: any) => setExpireDate(newValue)}
slotProps={{
textField: { size: 'medium' },
openPickerIcon: { style: { color: theme.palette.primary.main } },
switchViewButton: { style: { color: 'info' } }
}}
/>
{/* <p>{errors.endDate?.message}</p> */}
</div>
</Stack>
<TextField fullWidth
id="outlined-required"
label={'Description'}
onBlur={handleDescription}
placeholder={'A full description about the ativity.'}
multiline
maxRows="18"
onChange={handleChange}
/>

<Button type="submit" variant='contained' color='primary'>
Enviar
</Button>
<Stack spacing={2} direction={'row'} alignItems="center" justifyContent="center">
<Box>
<img src={logoImage} width={'100px'} height={'100px'} alt='Pod3LabsRecompensaIcon' />
</Box>
<div>
<TextField {...register("valueReward")}
label={'Reward in USD'}
onBlur={handleReward}
/>
<p>{errors.valueReward?.message}</p>
</div>
<div>
<DatePicker
label={'Deliver Date'}
onChange={(newValue: any) => setExpireDate(newValue)}
slotProps={{
textField: { size: 'medium' },
openPickerIcon: { style: { color: theme.palette.primary.main } },
switchViewButton: { style: { color: 'info' } }
}}
/>
{/* <p>{errors.endDate?.message}</p> */}
</div>
</Stack>

</Stack>
</Box>
)
}
</Box>
</Stack>
<Button type="submit" variant='contained' color='primary'>
Enviar
</Button>

</Stack>
</Box>
)
}
</Box>
</Stack>
</>
);
}

Expand Down
Loading

0 comments on commit 5493c08

Please sign in to comment.