From 094d2afb52f37a41a1772baa2c8bef6b449b8de3 Mon Sep 17 00:00:00 2001 From: Luis Felipe Risch <lfr20@inf.ufpr.br> Date: Thu, 8 Apr 2021 11:48:25 -0300 Subject: [PATCH] Optmized the code --- src/Admin/Pages/Pages/SubPages/Activity.js | 66 ++-- .../Pages/Pages/SubPages/AproveTeacher.js | 320 +++++++++--------- .../Pages/Pages/SubPages/BlockedUsers.js | 171 ++++------ src/Admin/Pages/Pages/SubPages/Collections.js | 124 +++---- .../Pages/SubPages/CommunityQuestions.js | 132 +++----- src/Admin/Pages/Pages/SubPages/Complaints.js | 131 +++---- .../Pages/SubPages/EducationalObjects.js | 139 +++----- .../Pages/Pages/SubPages/Institutions.js | 164 +++------ src/Admin/Pages/Pages/SubPages/Languages.js | 112 ++---- .../Pages/Pages/SubPages/NoteVariables.js | 89 ++--- src/Admin/Pages/Pages/SubPages/Permissions.js | 111 ++---- src/Admin/Pages/Pages/SubPages/Questions.js | 112 ++---- src/Admin/Pages/Pages/SubPages/Rating.js | 110 ++---- src/Admin/Pages/Pages/SubPages/Users.js | 153 +++------ 14 files changed, 692 insertions(+), 1242 deletions(-) diff --git a/src/Admin/Pages/Pages/SubPages/Activity.js b/src/Admin/Pages/Pages/SubPages/Activity.js index b8a4448a..7e0e5ded 100644 --- a/src/Admin/Pages/Pages/SubPages/Activity.js +++ b/src/Admin/Pages/Pages/SubPages/Activity.js @@ -24,6 +24,8 @@ import SnackBar from "../../../../Components/SnackbarComponent"; import { Url } from "../../../Filters"; import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobilePageHeader from '../../../Components/Components/MobileComponents/MobilePageHeader' +import PageHeader from '../../../Components/Components/PageHeader' //imports from material ui import { withStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -43,7 +45,6 @@ import AllOutIcon from "@material-ui/icons/AllOut"; import { Link } from 'react-router-dom'; import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import styled from "styled-components" -import PageHeader from "../../../Components/Components/PageHeader" const StyledTableCell = withStyles((theme) => ({ head: { @@ -191,44 +192,27 @@ const Activity = () => { } /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4">Atividades</Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <MobilePageHeader + title="Atividades" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <> <div style={{ height: "1em" }}></div> @@ -237,7 +221,7 @@ const Activity = () => { <TextField select label="Filtro" - value={option} + value={option ? option : ""} onChange={handleChange} helperText="Por favor, selecione uma das opções" > @@ -254,7 +238,7 @@ const Activity = () => { </div> </> ) : null} - </Paper> + </MobilePageHeader> <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js index 5b3ad8b2..003b3c1f 100644 --- a/src/Admin/Pages/Pages/SubPages/AproveTeacher.js +++ b/src/Admin/Pages/Pages/SubPages/AproveTeacher.js @@ -18,6 +18,7 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, { useEffect, useState, useContext } from "react"; import moment from "moment"; +import styled from "styled-components"; //imports from local files import TableData from "../../../Components/Components/Table"; import SnackBar from "../../../../Components/SnackbarComponent"; @@ -28,6 +29,12 @@ import { getRequest, postRequest, } from "../../../../Components/HelperFunctions/getAxiosConfig"; +import Unauthorized from "../../../Components/Components/Unauthorized"; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList"; +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader"; +import PageHeader from "../../../Components/Components/PageHeader"; +import { apiDomain } from '../../../../env'; +import noAvatar from "../../../../img/default_profile.png" //imports from material ui import { withStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -44,14 +51,10 @@ import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; import VisibilityIcon from "@material-ui/icons/Visibility"; import CheckRoundedIcon from "@material-ui/icons/CheckRounded"; import CloseRoundedIcon from "@material-ui/icons/CloseRounded"; +import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; //routers import { Link } from "react-router-dom"; -import Unauthorized from "../../../Components/Components/Unauthorized"; -import styled from "styled-components"; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList"; -import { apiDomain } from '../../../../env'; -import noAvatar from "../../../../img/default_profile.png"; -import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; + const StyledTableCell = withStyles((theme) => ({ head: { @@ -374,95 +377,82 @@ const AproveTeacher = () => { }) } /> - - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Lista de pedidos para professores - </Typography> - </Grid> - - <Grid item xs={12}> - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <MobilePageHeader + title="Aprovação de professores" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( - <Grid - container - direction="row" - justify="space-between" - alignItems="center" - alignContent="flex-end" - spacing={3} - xs={12} - > - <Grid item> - <TextField - select - label="Estado" - value={option ? option : ""} - onChange={handleChange} - helperText="Por favor, selecione uma das opções" + <> + <div style={{ height: "1em" }}></div> + {showFilter ? ( + <Grid + container + direction="row" + justify="space-between" + alignItems="center" + alignContent="flex-end" + spacing={3} + xs={12} > - {StateOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} + <Grid item> + <TextField + select + label="Estado" + value={option ? option : ""} + onChange={handleChange} + helperText="Por favor, selecione uma das opções" > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - <Grid item> - <TextField - label="Nome" - onChange={NameHandler} - value={nameValue} - onBlur={(event) => { setName(event.target.value) }} - helperText="Retire o foco do campo de texto ao terminar de digitar" - /> - </Grid> - <Grid item> - <TextField - label="Email" - onChange={EmailHandler} - value={emailValue} - onBlur={(event) => { setEmail(event.target.value) }} - helperText="Retire o foco do campo de texto ao terminar de digitar" - /> - </Grid> - </Grid> + {StateOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> + </Grid> + <Grid item> + <TextField + label="Nome" + onChange={NameHandler} + value={nameValue} + onBlur={(event) => { setName(event.target.value) }} + helperText="Retire o foco do campo de texto ao terminar de digitar" + /> + </Grid> + <Grid item> + <TextField + label="Email" + onChange={EmailHandler} + value={emailValue} + onBlur={(event) => { setEmail(event.target.value) }} + helperText="Retire o foco do campo de texto ao terminar de digitar" + /> + </Grid> + </Grid> + ) : null} + </> ) : null} - </Paper> + </MobilePageHeader> <div style={{ height: "2em" }}></div> @@ -596,86 +586,82 @@ const AproveTeacher = () => { } /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Lista de pedidos para professores - </Typography> - </Grid> - - <Grid item xs={6}> - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <PageHeader + title="Aprovação de professores" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( - <Grid - container - direction="row" - justify="space-between" - alignItems="center" - alignContent="flex-end" - spacing={3} - xs={12} - > - <Grid item> - <TextField - select - label="Estado" - value={option ? option : ""} - onChange={handleChange} - helperText="Por favor, selecione uma das opções" + <> + <div style={{ height: "1em" }}></div> + {showFilter ? ( + <Grid + container + direction="row" + justify="space-between" + alignItems="center" + alignContent="flex-end" + spacing={3} + xs={12} > - {StateOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} + <Grid item> + <TextField + select + label="Estado" + value={option ? option : ""} + onChange={handleChange} + helperText="Por favor, selecione uma das opções" > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - <Grid item> - <TextField label="Nome" onChange={NameHandler} value={name} /> - </Grid> - <Grid item> - <TextField - label="Email" - onChange={EmailHandler} - value={email} - /> - </Grid> - </Grid> + {StateOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> + </Grid> + <Grid item> + <TextField + label="Nome" + onChange={NameHandler} + value={nameValue} + onBlur={(event) => { setName(event.target.value) }} + helperText="Retire o foco do campo de texto ao terminar de digitar" + /> + </Grid> + <Grid item> + <TextField + label="Email" + onChange={EmailHandler} + value={emailValue} + onBlur={(event) => { setEmail(event.target.value) }} + helperText="Retire o foco do campo de texto ao terminar de digitar" + /> + </Grid> + </Grid> + ) : null} + </> ) : null} - </Paper> + </PageHeader> <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js index eb170763..0141b5c9 100644 --- a/src/Admin/Pages/Pages/SubPages/BlockedUsers.js +++ b/src/Admin/Pages/Pages/SubPages/BlockedUsers.js @@ -17,6 +17,7 @@ You should have received a copy of the GNU Affero General Public License along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ import React, { useEffect, useState } from 'react'; import moment from "moment"; +import styled from "styled-components" //Material ui componets import { withStyles } from '@material-ui/core/styles'; import TableBody from '@material-ui/core/TableBody'; @@ -37,15 +38,16 @@ import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; import TableData from '../../../Components/Components/Table'; import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import { apiDomain } from '../../../../env'; +import noAvatar from "../../../../img/default_profile.png"; +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //Services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { Url } from '../../../Filters'; //routers import { Link } from 'react-router-dom'; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" -import styled from "styled-components" -import { apiDomain } from '../../../../env'; -import noAvatar from "../../../../img/default_profile.png"; const StyledTableCell = withStyles((theme) => ({ head: { @@ -176,7 +178,7 @@ const BlockedUsers = () => { const removeItemFromList = (index) => { const copyList = [...items] - copyList.splice(index, 1) + copyList.splice(index, 1) setItems(copyList) } @@ -245,56 +247,38 @@ const BlockedUsers = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container direction="row" alignItems="center"> - <Grid container spacing={3} > - <Grid item xs={12}> - <Typography variant="h4"> - Lista de usuários bloqueados - </Typography> - </Grid> - <Grid - item - xs={12} - - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - <Grid item> - <TextField - select - label="Estado de bloqueio" - onChange={handleChange} - helperText="Por favor, selecione uma das opções" - > - {StateOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} - > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - + <MobilePageHeader + title="Lista de usuários bloqueados" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + <Grid item> + <TextField + select + label="Estado de bloqueio" + onChange={handleChange} + helperText="Por favor, selecione uma das opções" + > + {StateOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> </Grid> - </Paper> + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -397,55 +381,38 @@ const BlockedUsers = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container direction="row" alignItems="center"> - <Grid container spacing={3} > - <Grid item xs={6}> - <Typography variant="h4"> - Lista de usuários bloqueados - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - <Grid item> - <TextField - select - label="Estado de bloqueio" - onChange={handleChange} - helperText="Por favor, selecione uma das opções" - > - {StateOptions.map((option, index) => ( - <MenuItem - key={option.value} - value={option.name} - name={option.value} - > - {option.value} - </MenuItem> - ))} - </TextField> - </Grid> - + <PageHeader + title="Lista de usuários bloqueados" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + <Grid item> + <TextField + select + label="Estado de bloqueio" + onChange={handleChange} + helperText="Por favor, selecione uma das opções" + > + {StateOptions.map((option, index) => ( + <MenuItem + key={option.value} + value={option.name} + name={option.value} + > + {option.value} + </MenuItem> + ))} + </TextField> </Grid> - </Paper> + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Collections.js b/src/Admin/Pages/Pages/SubPages/Collections.js index 08502d06..381c96f0 100644 --- a/src/Admin/Pages/Pages/SubPages/Collections.js +++ b/src/Admin/Pages/Pages/SubPages/Collections.js @@ -24,6 +24,9 @@ import SnackBar from "../../../../Components/SnackbarComponent"; import { Url, DeleteFilter } from "../../../Filters"; import AlertDialog from "../../../Components/Components/AlertDialog"; import LoadingSpinner from "../../../../Components/LoadingSpinner"; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //imports from material ui import { withStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -46,7 +49,6 @@ import { } from "../../../../Components/HelperFunctions/getAxiosConfig"; //routers import { Link } from "react-router-dom"; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import styled from 'styled-components' const StyledTableCell = withStyles((theme) => ({ @@ -197,7 +199,7 @@ const Collections = () => { break } } - if(index !== -1) { + if (index !== -1) { const cpyItems = [...items] cpyItems.splice(index, 1) setItems(cpyItems) @@ -276,41 +278,27 @@ const Collections = () => { HandleStateCircularProgress(null); }} /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4">Coleções</Typography> - </Grid> - <Grid item xs={12}> - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <MobilePageHeader + title="Coleções" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <> <div style={{ height: "1em" }}></div> @@ -355,7 +343,7 @@ const Collections = () => { </Grid> </> ) : null} - </Paper> + </MobilePageHeader> <div style={{ height: "2em" }}></div> @@ -456,41 +444,27 @@ const Collections = () => { } /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4">Coleções</Typography> - </Grid> - <Grid item xs={6}> - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <PageHeader + title="Coleções" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <> <div style={{ height: "1em" }}></div> @@ -507,7 +481,7 @@ const Collections = () => { <TextField select label="Filtro" - value={option ? option : ""} + value={option} onChange={handleChange} helperText="Por favor, selecione uma das opções" > @@ -535,7 +509,7 @@ const Collections = () => { </Grid> </> ) : null} - </Paper> + </PageHeader> <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js index 8ffa8a15..0bbb585f 100644 --- a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js +++ b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js @@ -26,6 +26,9 @@ import { Url } from "../../../Filters"; import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig'; +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import PageHeader from "../../../Components/Components/PageHeader" //imports from material ui import { withStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -43,7 +46,6 @@ import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; import ContactSupportRoundedIcon from "@material-ui/icons/ContactSupportRounded"; //routers import { Link } from 'react-router-dom'; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import styled from "styled-components" const StyledTableCell = withStyles((theme) => ({ @@ -237,47 +239,27 @@ const CommunityQuestion = () => { }) } /> - - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4">Dúvidas da comunidade</Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter) - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - - <div style={{ height: '1.5em' }}></div> - + <MobilePageHeader + title="Dúvidas da comunidade" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <Grid container @@ -320,8 +302,7 @@ const CommunityQuestion = () => { </Grid> </Grid> ) : null} - - </Paper> + </MobilePageHeader> <div style={{ height: "2em" }}></div> @@ -411,46 +392,27 @@ const CommunityQuestion = () => { } /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4">Dúvidas da comunidade</Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter) - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - - <div style={{ height: '1.5em' }}></div> - + <PageHeader + title="Dúvidas da comunidade" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <Grid container @@ -493,7 +455,7 @@ const CommunityQuestion = () => { </Grid> </Grid> ) : null} - </Paper> + </PageHeader> <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Complaints.js b/src/Admin/Pages/Pages/SubPages/Complaints.js index 7d96f842..c8fce513 100644 --- a/src/Admin/Pages/Pages/SubPages/Complaints.js +++ b/src/Admin/Pages/Pages/SubPages/Complaints.js @@ -25,6 +25,10 @@ import { Url } from "../../../Filters"; import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" +import Unauthorized from "../../../Components/Components/Unauthorized"; //imports from material ui import { withStyles } from "@material-ui/core/styles"; import TableBody from "@material-ui/core/TableBody"; @@ -42,9 +46,7 @@ import VisibilityIcon from "@material-ui/icons/Visibility"; import LaunchRoundedIcon from "@material-ui/icons/LaunchRounded"; //routers import { Link } from "react-router-dom"; -import Unauthorized from "../../../Components/Components/Unauthorized"; import styled from "styled-components" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import AnnouncementRoundedIcon from "@material-ui/icons/AnnouncementRounded"; const StyledTableCell = withStyles((theme) => ({ @@ -311,46 +313,27 @@ const Complaints = () => { }) } /> - - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4">Denúncias</Typography> - </Grid> - - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <MobilePageHeader + title="Denúncias" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <Grid container @@ -404,7 +387,7 @@ const Complaints = () => { </Grid> </Grid> ) : null} - </Paper> + </MobilePageHeader> <div style={{ height: "2em" }}></div> @@ -489,45 +472,27 @@ const Complaints = () => { } /> - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4">Denúncias</Typography> - </Grid> - - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter); - }} - startIcon={<FilterListRoundedIcon />} - > - Filtrar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - + <PageHeader + title="Denúncias" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > {showFilter ? ( <Grid container @@ -581,7 +546,7 @@ const Complaints = () => { </Grid> </Grid> ) : null} - </Paper> + </PageHeader> <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js index 6cf1defe..f2427776 100644 --- a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js +++ b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js @@ -23,6 +23,9 @@ import TableData from "../../../Components/Components/Table"; import SnackBar from "../../../../Components/SnackbarComponent"; import AlertDialog from "../../../Components/Components/AlertDialog"; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" // Imports about icon import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; import AddRoundedIcon from "@material-ui/icons/AddRounded"; @@ -48,7 +51,6 @@ import { Url, DeleteFilter } from "../../../Filters"; import { Link } from 'react-router-dom'; import styled from 'styled-components' import MenuBookRoundedIcon from "@material-ui/icons/MenuBookRounded"; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" const StyledTableCell = withStyles((theme) => ({ head: { @@ -331,51 +333,27 @@ const EducationalObjects = () => { }} /> {/************** Start of the header **************/} - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography className={classes.paper} variant="h4"> - Lista de objetos educacionais - </Typography> - </Grid> - <Grid - item - xs={12} - - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - onClick={() => { - setShowFilter(!showFilter) - }} - startIcon={ - <FilterListRoundedIcon style={{ fill: "white" }} /> - } - > - Filtrar - </Button> - </Grid> - - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<UpdateRoundedIcon />} - onClick={() => { - setCurrPage(0) - }} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> + <MobilePageHeader + title="Objetos educacionais" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter && <Grid item xs={12}> @@ -396,7 +374,7 @@ const EducationalObjects = () => { </Grid> </Grid> } - </Paper> + </MobilePageHeader> {/************** End of the header **************/} <div style={{ height: "2em" }}></div> @@ -497,50 +475,27 @@ const EducationalObjects = () => { } /> {/************** Start of the header **************/} - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography className={classes.paper} variant="h4"> - Lista de objetos educacionais - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - onClick={(event) => { - setShowFilter(!showFilter) - }} - startIcon={ - <FilterListRoundedIcon style={{ fill: "white" }} /> - } - > - Filtrar - </Button> - </Grid> - - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<UpdateRoundedIcon />} - onClick={() => { - setCurrPage(0) - }} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> + <PageHeader + title="Objetos educacionais" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter && <Grid item xs={12}> @@ -561,7 +516,7 @@ const EducationalObjects = () => { </Grid> </Grid> } - </Paper> + </PageHeader> {/************** End of the header **************/} <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js index 870af752..874292c1 100644 --- a/src/Admin/Pages/Pages/SubPages/Institutions.js +++ b/src/Admin/Pages/Pages/SubPages/Institutions.js @@ -22,6 +22,9 @@ import TableData from "../../../Components/Components/Table"; import SnackBar from "../../../../Components/SnackbarComponent"; import AlertDialog from "../../../Components/Components/AlertDialog"; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" // Imports about icon import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; import AddRoundedIcon from "@material-ui/icons/AddRounded"; @@ -46,7 +49,6 @@ import { Url, DeleteFilter } from "../../../Filters"; //router import { Link } from 'react-router-dom'; import styled from "styled-components" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import AccountBalanceRoundedIcon from "@material-ui/icons/AccountBalanceRounded"; const StyledTableCell = withStyles((theme) => ({ @@ -324,61 +326,27 @@ const Institutions = () => { }} /> {/************** Start of the header **************/} - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography className={classes.paper} variant="h4"> - Lista de Instituições - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - onClick={() => { setShowFilter(!showFilter) }} - startIcon={ - <FilterListRoundedIcon style={{ fill: "white" }} /> - } - > - Filtrar - </Button> - </Grid> - - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/InstitutionCreate'}> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<AddRoundedIcon style={{ fill: "white" }} />} - > - Novo - </Button> - </Link> - </Grid> - - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<UpdateRoundedIcon />} - onClick={() => { - setCurrPage(0) - }} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> + <MobilePageHeader + title="Instituições" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter && <Grid item xs={12}> @@ -398,7 +366,7 @@ const Institutions = () => { </Grid> </Grid> } - </Paper> + </MobilePageHeader> {/************** End of the header **************/} <div style={{ height: "2em" }}></div> @@ -500,73 +468,39 @@ const Institutions = () => { } /> {/************** Start of the header **************/} - <Paper style={{ padding: "1em" }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography className={classes.paper} variant="h4"> - Lista de Instituições - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - onClick={() => { setShowFilter(!showFilter) }} - startIcon={ - <FilterListRoundedIcon style={{ fill: "white" }} /> - } - > - Filtrar - </Button> - </Grid> - - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/InstitutionCreate'}> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<AddRoundedIcon style={{ fill: "white" }} />} - > - Novo - </Button> - </Link> - </Grid> - - <Grid item> - <Button - variant="contained" - color="secondary" - className={classes.button} - startIcon={<UpdateRoundedIcon />} - onClick={() => { - setCurrPage(0) - }} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> + <PageHeader + title="Instituições" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter && <Grid item xs={12}> <Grid container justify="space-between" spacing={3}> {TextFieldOfTheFilter.map((field, index) => ( - <Grid item key={field.value}> + <Grid item key={field.label}> <TextField id={index} label={field.label} value={field.value} - onChange={field.onChange} helperText={field.helperText} + onChange={field.onChange} onBlur={field.onBlur} /> </Grid> @@ -574,7 +508,7 @@ const Institutions = () => { </Grid> </Grid> } - </Paper> + </PageHeader> {/************** End of the header **************/} <div style={{ height: "2em" }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js index ee01f1ed..6eee28f6 100644 --- a/src/Admin/Pages/Pages/SubPages/Languages.js +++ b/src/Admin/Pages/Pages/SubPages/Languages.js @@ -25,6 +25,9 @@ import { Url } from '../../../Filters'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { DeleteFilter } from '../../../Filters'; import { getRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //imports from material ui import { withStyles } from '@material-ui/core/styles'; import TableBody from '@material-ui/core/TableBody'; @@ -41,7 +44,6 @@ import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; import { Link } from 'react-router-dom'; import styled from "styled-components" import LanguageRoundedIcon from "@material-ui/icons/LanguageRounded"; -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" const StyledTableCell = withStyles((theme) => ({ head: { @@ -213,46 +215,20 @@ const Languages = () => { HandleStateCircularProgress(null); }} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Linguagens - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - - <Link style={{ textDecoration: 'none' }} to={'/admin/languageCreate'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <MobilePageHeader + title="Linguagens" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -336,46 +312,20 @@ const Languages = () => { })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Linguagens - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - - <Link style={{ textDecoration: 'none' }} to={'/admin/languageCreate'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <PageHeader + title="Linguagens" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/NoteVariables.js b/src/Admin/Pages/Pages/SubPages/NoteVariables.js index c700790b..6cd26de5 100644 --- a/src/Admin/Pages/Pages/SubPages/NoteVariables.js +++ b/src/Admin/Pages/Pages/SubPages/NoteVariables.js @@ -35,13 +35,16 @@ import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded' import TableData from '../../../Components/Components/Table'; import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" + //Services import { getRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { Url } from '../../../Filters'; //routers import { Link } from 'react-router-dom'; import styled from "styled-components" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import TrendingUpRoundedIcon from "@material-ui/icons/TrendingUpRounded"; const StyledTableCell = withStyles((theme) => ({ @@ -146,34 +149,20 @@ const NoteVariables = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Variáveis de nota - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <MobilePageHeader + title="Variáveis de nota" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -249,34 +238,20 @@ const NoteVariables = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Variáveis de nota - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <PageHeader + title="Linguagens" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Permissions.js b/src/Admin/Pages/Pages/SubPages/Permissions.js index 5a4702fa..b5a32783 100644 --- a/src/Admin/Pages/Pages/SubPages/Permissions.js +++ b/src/Admin/Pages/Pages/SubPages/Permissions.js @@ -25,6 +25,9 @@ import { Url } from '../../../Filters'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { DeleteFilter } from '../../../Filters'; import { getRequest, deleteRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //imports from material ui import { withStyles } from '@material-ui/core/styles'; import TableBody from '@material-ui/core/TableBody'; @@ -40,7 +43,6 @@ import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; import { Link } from 'react-router-dom'; import styled from "styled-components" import AccountCircleRoundedIcon from "@material-ui/icons/AccountCircleRounded" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" const StyledTableCell = withStyles((theme) => ({ head: { @@ -210,45 +212,20 @@ const UserPermissions = () => { HandleStateCircularProgress(null); }} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Lista de permissões de usuário - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateRole'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <MobilePageHeader + title="Lista de permissões de usuário" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -330,46 +307,20 @@ const UserPermissions = () => { })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Lista de permissões de usuário - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateRole'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <PageHeader + title="Lista de permissões de usuário" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js index d01e5b1b..affb59e8 100644 --- a/src/Admin/Pages/Pages/SubPages/Questions.js +++ b/src/Admin/Pages/Pages/SubPages/Questions.js @@ -26,6 +26,9 @@ import { Url, EditFilter } from '../../../Filters'; import { Store } from '../../../../Store'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //imports from material ui import { withStyles } from '@material-ui/core/styles'; import TableBody from '@material-ui/core/TableBody'; @@ -39,7 +42,6 @@ import Switch from '@material-ui/core/Switch'; //router import { Link } from 'react-router-dom'; import styled from "styled-components" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import HelpRoundedIcon from "@material-ui/icons/HelpRounded"; const StyledTableCell = withStyles((theme) => ({ @@ -227,46 +229,20 @@ const Questions = () => { })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Perguntas da curadoria - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateQuestion'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <MobilePageHeader + title="Questões da curadoria" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -357,46 +333,20 @@ const Questions = () => { })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Perguntas da curadoria - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateQuestion'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <PageHeader + title="Questões da curadoria" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Rating.js b/src/Admin/Pages/Pages/SubPages/Rating.js index a8e9c4e8..80feabfa 100644 --- a/src/Admin/Pages/Pages/SubPages/Rating.js +++ b/src/Admin/Pages/Pages/SubPages/Rating.js @@ -35,6 +35,9 @@ import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded'; import TableData from '../../../Components/Components/Table'; import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //Services import AlertDialog from "../../../Components/Components/AlertDialog"; import { Url } from '../../../Filters'; @@ -44,7 +47,6 @@ import { getRequest, deleteRequest } from '../../../../Components/HelperFunction import { Link } from 'react-router-dom'; import StarRoundedIcon from "@material-ui/icons/StarRounded"; import styled from "styled-components" -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" const StyledTableCell = withStyles((theme) => ({ head: { @@ -216,45 +218,20 @@ const Ratings = () => { HandleStateCircularProgress(null); }} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Lista de ratings - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateRating'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon style={{ fill: "white" }} />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <MobilePageHeader + title="Lista de ratings" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -337,45 +314,20 @@ const Ratings = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Lista de ratings - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/CreateRating'}> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon style={{ fill: "white" }} />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> - </Paper> + <PageHeader + title="Lista de ratings" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + ]} + > + </PageHeader> <div style={{ height: '2em' }}></div> diff --git a/src/Admin/Pages/Pages/SubPages/Users.js b/src/Admin/Pages/Pages/SubPages/Users.js index 66644dc2..75c75440 100644 --- a/src/Admin/Pages/Pages/SubPages/Users.js +++ b/src/Admin/Pages/Pages/SubPages/Users.js @@ -30,10 +30,14 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import AddRoundedIcon from '@material-ui/icons/AddRounded'; import TextField from '@material-ui/core/TextField'; import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded' +import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded"; //Local files import TableData from '../../../Components/Components/Table'; import SnackBar from '../../../../Components/SnackbarComponent'; import LoadingSpinner from '../../../../Components/LoadingSpinner'; +import MobileList from "../../../Components/Components/MobileComponents/SimpleList" +import MobilePageHeader from "../../../Components/Components/MobileComponents/MobilePageHeader" +import PageHeader from "../../../Components/Components/PageHeader" //Services import { getRequest, putRequest } from '../../../../Components/HelperFunctions/getAxiosConfig' import { Url } from '../../../Filters'; @@ -41,7 +45,6 @@ import { Url } from '../../../Filters'; import { Link } from 'react-router-dom'; import moment from 'moment'; import styled from 'styled-components' -import MobileList from "../../../Components/Components/MobileComponents/SimpleList" import EmailRoundedIcon from '@material-ui/icons/EmailRounded'; import { apiDomain } from '../../../../env'; import noAvatar from "../../../../img/default_profile.png"; @@ -131,7 +134,7 @@ const Users = () => { if (index !== -1) { const cpyItems = [...items] cpyItems[index].roles.push({ - id: 10, + id: 10, name: "publisher" }) setItems(cpyItems) @@ -244,56 +247,27 @@ const Users = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={12}> - <Typography variant="h4"> - Lista de usuários - </Typography> - </Grid> - <Grid - item - xs={12} - > - <Grid container justify="flex-start" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter) - }} - startIcon={<UpdateRoundedIcon />} - > - filtrar - </Button> - </Grid> - <Grid item> - <Link to="/admin/EditUser/-1"> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> + <MobilePageHeader + title="Lista de usuários" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter ? ( <Grid container direction="row" justify="space-between" alignItems="center"> @@ -318,7 +292,7 @@ const Users = () => { </Grid> ) : null } - </Paper> + </MobilePageHeader> <div style={{ height: '2em' }}></div> @@ -434,56 +408,27 @@ const Users = () => { color: '' })} /> - <Paper style={{ padding: '1em' }}> - <Grid container spacing={3} direction="row" alignItems="center"> - <Grid item xs={6}> - <Typography variant="h4"> - Lista de usuários - </Typography> - </Grid> - <Grid - item - xs={6} - > - <Grid container justify="flex-end" spacing={3}> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setCurrPage(0) - }} - startIcon={<UpdateRoundedIcon />} - > - Atualizar - </Button> - </Grid> - <Grid item> - <Button - variant="contained" - color="secondary" - onClick={() => { - setShowFilter(!showFilter) - }} - startIcon={<UpdateRoundedIcon />} - > - filtrar - </Button> - </Grid> - <Grid item> - <Link to="/admin/EditUser/-1"> - <Button - variant="contained" - color="secondary" - startIcon={<AddRoundedIcon />} - > - Novo - </Button> - </Link> - </Grid> - </Grid> - </Grid> - </Grid> + <PageHeader + title="Lista de usuários" + actions={[ + { + name: "Atualizar", + isLoading: false, + func: () => { + setCurrPage(0) + }, + icon: <UpdateRoundedIcon /> + }, + { + name: "Filtrar", + isLoading: false, + func: () => { + setShowFilter(!showFilter); + }, + icon: <FilterListRoundedIcon /> + } + ]} + > { showFilter ? ( <Grid container direction="row" justify="space-between" alignItems="center"> @@ -508,7 +453,7 @@ const Users = () => { </Grid> ) : null } - </Paper> + </PageHeader> <div style={{ height: '2em' }}></div> -- GitLab