From 280996877522f1f62b061e90f0fdbc16deaa8d81 Mon Sep 17 00:00:00 2001 From: Vinicius Gabriel Machado <vgm18@inf.ufpr.br> Date: Mon, 7 Jun 2021 15:12:53 -0300 Subject: [PATCH] Fixing bugs reported in the worksheet --- .../Components/DataCards/InstitutionsCard.js | 2 +- .../Components/Inputs/CreateInstitution.js | 2 +- .../Components/Inputs/IntitutionsInputs.js | 2 +- .../Components/Components/Unauthorized.js | 30 +- src/Admin/Pages/AdminLabelTabs/LabelTabs.js | 2 +- src/App.js | 508 +++++++++--------- src/Components/MobileDrawerMenu.js | 4 +- .../TabPanels/PanelComponents/PanelTitle.js | 1 + .../TabPanels/UserPageTabs/PanelAtividades.js | 4 +- .../UploadPageComponents/Forms/Autor.js | 30 +- .../UploadPageComponents/Forms/NewTitle.js | 1 + src/index.css | 10 +- 12 files changed, 311 insertions(+), 285 deletions(-) diff --git a/src/Admin/Components/Components/DataCards/InstitutionsCard.js b/src/Admin/Components/Components/DataCards/InstitutionsCard.js index b4981b7b..1791b22d 100644 --- a/src/Admin/Components/Components/DataCards/InstitutionsCard.js +++ b/src/Admin/Components/Components/DataCards/InstitutionsCard.js @@ -168,7 +168,7 @@ const InstitutionCard = () => { </Typography> </Grid> <Grid item> - <Link style={{ textDecoration: 'none' }} to={`/admin/intitutions`}> + <Link style={{ textDecoration: 'none' }} to={`/admin/institutions`}> <Button startIcon={<ListRoundedIcon />} color="primary" diff --git a/src/Admin/Components/Components/Inputs/CreateInstitution.js b/src/Admin/Components/Components/Inputs/CreateInstitution.js index b4f001f0..378c0960 100644 --- a/src/Admin/Components/Components/Inputs/CreateInstitution.js +++ b/src/Admin/Components/Components/Inputs/CreateInstitution.js @@ -227,7 +227,7 @@ const CreateInstitution = (props) => { </Typography> </Grid> <Grid item> - <Link style={{ textDecoration: 'none' }} to={'/admin/intitutions'}> + <Link style={{ textDecoration: 'none' }} to={'/admin/institutions'}> <Button onClick={props.BackToList} startIcon={<ListRoundedIcon />} diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js index 148f006f..ca1ea9df 100644 --- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js +++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js @@ -262,7 +262,7 @@ const EditInstitution = () => { </Grid> <Grid item> - <Link style={{ textDecoration: 'none' }} to={`/admin/intitutions`}> + <Link style={{ textDecoration: 'none' }} to={`/admin/institutions`}> <Button startIcon={<ListRoundedIcon />} color="primary" diff --git a/src/Admin/Components/Components/Unauthorized.js b/src/Admin/Components/Components/Unauthorized.js index decfa6b5..245a219b 100644 --- a/src/Admin/Components/Components/Unauthorized.js +++ b/src/Admin/Components/Components/Unauthorized.js @@ -19,6 +19,8 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/> import React, {useState} from 'react'; import SnackBar from '../../../Components/SnackbarComponent'; import { Link } from 'react-router-dom'; +import styled from "styled-components"; + const Unauthorized = () => { const [openSnack, setOpenSnack] = useState(true); @@ -31,11 +33,33 @@ const Unauthorized = () => { snackbarOpen={openSnack} handleClose={() => setOpenSnack(false)} /> - <Link to='/'> - Redirecionar para home - </Link> + <> + <StyledDiv><span style={{ fontSize: '50px' }}>Desculpe</span></StyledDiv> + <StyledDiv> + <span style={{ fontSize: '30px' }}> + Você não tem as permissões necessárias para acessar essa página. + </span> + </StyledDiv> + <StyledDiv> + <Link to='/'> + <span style={{ fontSize: '20px' }}> + Voltar para a página inicial + </span> + </Link> + </StyledDiv> + </> </div> ); } +const StyledDiv = styled('div')` + width: 100%; + margin-top: 70px; + margin-bottom: 70px; + justify-content : space-evenly; + display: flex; + color: #757575; + text-align:center; +` + export default Unauthorized; \ No newline at end of file diff --git a/src/Admin/Pages/AdminLabelTabs/LabelTabs.js b/src/Admin/Pages/AdminLabelTabs/LabelTabs.js index 54b2a0fd..ca1f7b5a 100644 --- a/src/Admin/Pages/AdminLabelTabs/LabelTabs.js +++ b/src/Admin/Pages/AdminLabelTabs/LabelTabs.js @@ -64,7 +64,7 @@ const TabsItens = [ }, { label: "Instituições", - href: '/admin/intitutions', + href: '/admin/institutions', icon: <AccountBalanceRoundedIcon style={{ fill: orange }} />, }, { diff --git a/src/App.js b/src/App.js index 18a51891..b5a80b2f 100644 --- a/src/App.js +++ b/src/App.js @@ -152,6 +152,26 @@ export default function App() { return () => window.removeEventListener("resize", setWindowSize); }, [window.innerWidth, window.innerHeight]); + const AdminTemplate = (props) => { + if (CheckUserPermission()) + return ( + <div style={{ backgroundColor: " #D3D3D3" }}> + <AppBarAdmin /> + <div style={{ padding: "2em" }}> + {props.inner} + </div> + </div> + ) + else + return ( + <div style={{ backgroundColor: " #D3D3D3" }}> + <div style={{ padding: "2em" }}> + <Unauthorized /> + </div> + </div> + ) + } + return ( // add piwik later // history={piwik.connectToHistory(customHistory)} @@ -204,263 +224,237 @@ export default function App() { <Route path="/topico" component={FormationMaterialPage} /> <Route path="/iframe-colecao" component={FormationMaterialIframe} /> <Route path="/material-formacao" component={MaterialPage} /> + + <Route + path="/admin/home" + exact={true} + render={() => { + return <AdminTemplate inner={<Inframe/>}/> + }} + /> + <Route + path="/admin/institutions" + render={() => { + return <AdminTemplate inner={<Institution />}/> + }} + /> + <Route + path="/admin/institution" + render={() => { + return <AdminTemplate inner={<InstitutionCard />}/> + }} + /> + <Route + path="/admin/institutionEdit" + render={() => { + return <AdminTemplate inner={<InstitutionsInput />}/> + }} + /> + <Route + path="/admin/InstitutionCreate" + render={() => { + return <AdminTemplate inner={<CreateInstitution />}/> + }} + /> + <Route + path="/admin/noteVars" + render={() => { + return <AdminTemplate inner={<NoteVariables />}/> + }} + /> + <Route + path="/admin/noteVar" + render={() => { + return <AdminTemplate inner={<NoteVarCard />}/> + }} + /> + <Route + path="/admin/noteVarEdit" + render={() => { + return <AdminTemplate inner={<NoteVarInputs />}/> + }} + /> + <Route + path="/admin/languages" + render={() => { + return <AdminTemplate inner={<Languages />}/> + }} + /> + <Route + path="/admin/languageEdit" + render={() => { + return <AdminTemplate inner={<EditLanguage />}/> + }} + /> + <Route + path="/admin/languageCreate" + render={() => { + return <AdminTemplate inner={<CreateLanguage />}/> + }} + /> + <Route + path="/admin/CommunityQuestions" + render={() => { + return <AdminTemplate inner={<CommunityQuestions />}/> + }} + /> + <Route + path="/admin/CommunityQuestion" + render={() => { + return <AdminTemplate inner={<CommunityCard />}/> + }} + /> + <Route + path="/admin/Collections" + render={() => { + return <AdminTemplate inner={<Collections />}/> + }} + /> + <Route + path="/admin/Collection" + render={() => { + return <AdminTemplate inner={<CollectionCard />}/> + }} + /> + <Route + path="/admin/EditCollection" + render={() => { + return <AdminTemplate inner={<EditCollection />}/> + }} + /> + <Route + path="/admin/Ratings" + render={() => { + return <AdminTemplate inner={<Ratings />}/> + }} + /> + <Route + path="/admin/Rating" + render={() => { + return <AdminTemplate inner={<RatingCard />}/> + }} + /> + <Route + path="/admin/EditRating" + render={() => { + return <AdminTemplate inner={<EditRating />}/> + }} + /> + <Route + path="/admin/CreateRating" + render={() => { + return <AdminTemplate inner={<CreateRating />}/> + }} + /> + <Route + path="/admin/Questions" + render={() => { + return <AdminTemplate inner={<Questions />}/> + }} + /> + <Route + path="/admin/CreateQuestion" + render={() => { + return <AdminTemplate inner={<CreateQuestions />}/> + }} + /> + <Route + path="/admin/activities" + render={() => { + return <AdminTemplate inner={<Activity />}/> + }} + /> + <Route + path="/admin/activity" + render={() => { + return <AdminTemplate inner={<ActivityCard />}/> + }} + /> + <Route + path="/admin/learningObjects" + render={() => { + return <AdminTemplate inner={<EducationalObject />}/> + }} + /> + <Route + path="/admin/learningObject" + render={() => { + return <AdminTemplate inner={<EducationalObjectCard />}/> + }} + /> + <Route + path="/admin/learningObjectEdit" + render={() => { + return <AdminTemplate inner={<EducationalObjectEdit />}/> + }} + /> + <Route + path="/admin/complaints" + render={() => { + return <AdminTemplate inner={<Complaints />}/> + }} + /> + <Route + path="/admin/complaint" + render={() => { + return <AdminTemplate inner={<ComplaintCard />}/> + }} + /> + <Route + path="/admin/users/teacher_requests" + render={() => { + return <AdminTemplate inner={<AproveTeacher />}/> + }} /> + <Route + path="/admin/usersList" + render={() => { + return <AdminTemplate inner={<UserList />}/> + }} + /> + <Route + path="/admin/user" + render={() => { + return <AdminTemplate inner={<UserCard />}/> + }} + /> + <Route + path="/admin/EditUser" + render={() => { + return <AdminTemplate inner={<EditUser />}/> + }} + /> + <Route + path="/admin/permissions" + render={() => { + return <AdminTemplate inner={<UserPermissions />}/> + }} + /> + <Route + path="/admin/EditPermissions" + render={() => { + return <AdminTemplate inner={<EditRole />}/> + }} + /> + <Route + path="/admin/CreateRole" + render={() => { + return <AdminTemplate inner={<CreateRole />}/> + }} + /> + <Route + path="/admin/BlockedUsers" + render={() => { + return <AdminTemplate inner={<BlockedUser />}/> + }} + /> + <Route + path="/admin/sendEmail" + render={() => { + return <AdminTemplate inner={<SendEmail />}/> + }} + /> + <Route path='*' component={PageNotFound} /> - <div style={{ backgroundColor: " #D3D3D3" }}> - <AppBarAdmin /> - <div style={{ padding: "2em" }}> - <Route path="/admin/home" exact={true} render={() => { - if (CheckUserPermission()) - return <Inframe /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/intitutions" render={() => { - if (CheckUserPermission()) - return <Institution /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/institution" render={() => { - if (CheckUserPermission()) - return <InstitutionCard /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/institutionEdit" - render={() => { - if (CheckUserPermission()) - return <InstitutionsInput /> - else - return <Unauthorized /> - }} - /> - <Route - path="/admin/InstitutionCreate" - render={() => { - if (CheckUserPermission()) - return <CreateInstitution /> - else - return <Unauthorized /> - }} - /> - <Route path="/admin/noteVars" render={() => { - if (CheckUserPermission()) - return <NoteVariables /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/noteVar" render={() => { - if (CheckUserPermission()) - return <NoteVarCard /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/noteVarEdit" render={() => { - if (CheckUserPermission()) - return <NoteVarInputs /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/languages" render={() => { - if (CheckUserPermission()) - return <Languages /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/languageEdit" render={() => { - if (CheckUserPermission()) - return <EditLanguage /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/languageCreate" render={() => { - if (CheckUserPermission()) - return <CreateLanguage /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/CommunityQuestions" - render={() => { - if (CheckUserPermission()) - return <CommunityQuestions /> - else - return <Unauthorized /> - }} - /> - <Route - path="/admin/CommunityQuestion" - render={() => { - if (CheckUserPermission()) - return <CommunityCard /> - else - return <Unauthorized /> - }} - /> - <Route path="/admin/Collections" render={() => { - if (CheckUserPermission()) - return <Collections /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/Collection" render={() => { - if (CheckUserPermission()) - return <CollectionCard /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/EditCollection" - render={() => { - if (CheckUserPermission()) - return <EditCollection /> - else - return <Unauthorized /> - }} - /> - <Route path="/admin/Ratings" render={() => { - if (CheckUserPermission()) - return <Ratings /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/Rating" render={() => { - if (CheckUserPermission()) - return <RatingCard /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/EditRating" render={() => { - if (CheckUserPermission()) - return <EditRating /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/CreateRating" render={() => { - if (CheckUserPermission()) - return <CreateRating /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/Questions" render={() => { - if (CheckUserPermission()) - return <Questions /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/CreateQuestion" render={() => { - if (CheckUserPermission()) - return <CreateQuestions /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/activities" render={() => { - if (CheckUserPermission()) - return <Activity /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/activity" render={() => { - if (CheckUserPermission()) - return <ActivityCard /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/learningObjects" - render={() => { - if (CheckUserPermission()) - return <EducationalObject /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/learningObject" - render={() => { - if (CheckUserPermission()) - return <EducationalObjectCard /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/learningObjectEdit" - render={() => { - if (CheckUserPermission()) - return <EducationalObjectEdit /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/complaints" render={() => { - if (CheckUserPermission()) - return <Complaints /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/complaint" render={() => { - if (CheckUserPermission()) - return <ComplaintCard /> - else - return <Unauthorized /> - }} /> - <Route - path="/admin/users/teacher_requests" - render={() => { - if (CheckUserPermission()) - return <AproveTeacher /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/usersList" render={() => { - if (CheckUserPermission()) - return <UserList /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/user" render={() => { - if (CheckUserPermission()) - return <UserCard /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/EditUser" render={() => { - if (CheckUserPermission()) - return <EditUser /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/permissions" render={() => { - if (CheckUserPermission()) - return <UserPermissions /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/EditPermissions" render={() => { - if (CheckUserPermission()) - return <EditRole /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/CreateRole" render={() => { - if (CheckUserPermission()) - return <CreateRole /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/BlockedUsers" render={() => { - if (CheckUserPermission()) - return <BlockedUser /> - else - return <Unauthorized /> - }} /> - <Route path="/admin/sendEmail" render={() => { - if (CheckUserPermission()) - return <SendEmail /> - else - return <Unauthorized /> - }} /> - </div> - </div> </Switch> {!hideFooter && ( <div> @@ -470,4 +464,4 @@ export default function App() { )} </BrowserRouter> ); -} +} \ No newline at end of file diff --git a/src/Components/MobileDrawerMenu.js b/src/Components/MobileDrawerMenu.js index 91992ef2..ef63cc87 100644 --- a/src/Components/MobileDrawerMenu.js +++ b/src/Components/MobileDrawerMenu.js @@ -129,7 +129,7 @@ export default function MobileDrawerMenu(props) { state.userIsLoggedIn ? ( <> - <div style={{ display: "flex", justifyContent: "left", marginTop: "10px", marginBottom: "10px" }}> + <div style={{ display: "flex", justifyContent: "left", marginBottom: "10px" }}> <Link to="/termos-publicar-recurso"> <ButtonPublicarRecurso> <CloudUploadIcon style={{ color: "white", marginRight: "10px" }} /> @@ -139,7 +139,7 @@ export default function MobileDrawerMenu(props) { </ButtonPublicarRecurso> </Link> </div> - <div style={{ display: "flex", flexDirection: "column", color: "#666", paddingBottom: "10px" }}> + <div style={{ borderTop: "1px solid #e5e5e5", display: "flex", flexDirection: "column", marginTop: "10px", paddingTop: "10px", color: "#666", paddingBottom: "10px" }}> <MyArea> <div className="user-avatar"> <img alt="user-avatar" diff --git a/src/Components/TabPanels/PanelComponents/PanelTitle.js b/src/Components/TabPanels/PanelComponents/PanelTitle.js index ffe07362..cb139b40 100644 --- a/src/Components/TabPanels/PanelComponents/PanelTitle.js +++ b/src/Components/TabPanels/PanelComponents/PanelTitle.js @@ -19,6 +19,7 @@ const Header = styled(Grid)` .titulo { margin : 0; + line-height: normal; font-style : normal; color : #757575; font-size : 1.857em; diff --git a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js index 1d51d2f1..bd7fd73d 100644 --- a/src/Components/TabPanels/UserPageTabs/PanelAtividades.js +++ b/src/Components/TabPanels/UserPageTabs/PanelAtividades.js @@ -168,7 +168,8 @@ export default function TabPanelAtividades(props) { <NoNotificationsDiv> <div> <div> - <H3Styled><img src={Bolo} alt='bolo' style={{ width: "23px" }} /> Você se cadastrou na Plataforma</H3Styled> + <img src={Bolo} alt='bolo' style={{ width: "23px", display: "block", marginLeft: "auto", marginRight: "auto" }} /> + <H3Styled>Você se cadastrou na Plataforma</H3Styled> </div> <p style={{ fontSize: "15px", fontWeight: "lighter", margin: "0 0 10px", display: "flex", justifyContent: "center", textAlign: "center" }} @@ -259,6 +260,7 @@ const H3Styled = styled.h3` margin-bottom : 10px; display : flex; justify-content : center; + text-align : center; align-items : center; ` diff --git a/src/Components/UploadPageComponents/Forms/Autor.js b/src/Components/UploadPageComponents/Forms/Autor.js index 30a3535b..4ab8bde9 100644 --- a/src/Components/UploadPageComponents/Forms/Autor.js +++ b/src/Components/UploadPageComponents/Forms/Autor.js @@ -51,23 +51,25 @@ function Autor (props) { <b>Autor do recurso</b> </StyledFormLabel> <RadioGroup ara-label="Autor do Recurso" name="Autor do Recurso" value={authorValue} onChange={(e) => {setAuthorValue(e.target.value)}}> - <FormControlLabel value="0" control={<BlueRadio />} label="Sou o(a) autor(a) deste recurso"/> - <FormControlLabel value="1" control={<BlueRadio/>} - label={ - <div style={{display : "flex", alignItems : "center"}}> - Outro: - <OutroAutorTextField - id = {"outro-autor-form"} - placeholder={"Nome dos autores"} - type = {"text"} - value = {outroAutor} - onChange = {e => {setOutroAutor(e.target.value)}} - disabled = {authorValue === "0"} - style={{paddingLeft : "5px", width : "100%"}} + <FormControlLabel value="0" control={<BlueRadio />} label="Sou o(a) autor(a) deste recurso"/> + <FormControlLabel value="1" control={<BlueRadio/>} + label={ + <div style={{display : "flex", alignItems : "center"}}> + Outro: + <OutroAutorTextField + id = {"outro-autor-form"} + placeholder={"Nome dos autores"} + type = {"text"} + value = {outroAutor} + onChange = {e => {setOutroAutor(e.target.value)}} + fullWidth + multiline + disabled = {authorValue === "0"} + style={{paddingLeft : "5px", width : "100%"}} /> </div>} /> - </RadioGroup> + </RadioGroup> </FormControl> ) } diff --git a/src/Components/UploadPageComponents/Forms/NewTitle.js b/src/Components/UploadPageComponents/Forms/NewTitle.js index 0a763dc0..b5d27708 100644 --- a/src/Components/UploadPageComponents/Forms/NewTitle.js +++ b/src/Components/UploadPageComponents/Forms/NewTitle.js @@ -51,6 +51,7 @@ function NewTitle (props) { helperText = {objTitle.value.length + "/100"} error = {objTitle.error} fullWidth + multiline onBlur={() => {props.onBlurCallback("name", objTitle.value, props.draftID)}} /> {objTitle.value.length === 0 && objTitle.error && diff --git a/src/index.css b/src/index.css index 0e81d082..9f97da50 100755 --- a/src/index.css +++ b/src/index.css @@ -17,12 +17,8 @@ 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/>.*/ body { - width: 100%; - height: 100%; - overflow-x: hidden; margin: 0; padding: 0; - overflow-x: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -30,6 +26,12 @@ body { -moz-osx-font-smoothing: grayscale; } +#root { + width: 100%; + height: 100%; + overflow-x: hidden; +} + code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; -- GitLab