Skip to content
Snippets Groups Projects
Commit 33076f2b authored by vgm18's avatar vgm18
Browse files

Fixing bugs (Validacao MECRED 2021004)

parent 515f8b02
Branches
Tags
3 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!45Bug fixing vinicius
......@@ -16,10 +16,19 @@ GNU Affero General Public License for more details.
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, { useState } from 'react';
import React, {useState, useContext} from 'react'
import {Store} from '../Store.js'
import styled from 'styled-components';
import FormInput from "../Components/FormInput.js"
import {postRequest} from './HelperFunctions/getAxiosConfig'
import LoginModal from './LoginModal.js'
import Snackbar from '@material-ui/core/Snackbar';
import SignUpModal from './SignUpModal'
import MuiAlert from '@material-ui/lab/Alert';
function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />;
}
const Button = styled.button`
......@@ -95,6 +104,10 @@ const Button = styled.button`
}
function Formulario (props){
const {state} = useContext(Store)
const [loginOpen, setLogin] = useState(false)
const [successfulLoginOpen, handleSuccessfulLogin] = useState(false)
const [signUpOpen, setSignUp] = useState(false)
const [nome, handleNome] = useState(
{
......@@ -175,7 +188,21 @@ const Button = styled.button`
}
const handleSignUp = () => {
setSignUp(!signUpOpen)
}
const handleLogin = () => {
setLogin(!loginOpen)
}
const toggleSnackbar = (event, reason) => {
if (reason === 'clickaway') {
return;
}
handleSuccessfulLogin(false);
}
const onSubmit = (e) => {
//on submit we should prevent the page from refreshing
......@@ -198,7 +225,18 @@ const Button = styled.button`
return(
<React.Fragment>
<Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar}
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
>
<Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert>
</Snackbar>
{/*-------------------------------MODALS---------------------------------------*/}
<LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp}
openSnackbar={() => { handleSuccessfulLogin(true) }}
/>
<SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} />
{/*----------------------------------------------------------------------------*/}
<form onSubmit={e => onSubmit(e)}>
......@@ -238,10 +276,18 @@ const Button = styled.button`
<br/>
<br/>
<div style={{display: "flex", justifyContent: "center"}}>
{
state.currentUser.id !== '' ? (
<Button onClick={e => onSubmit(e)} >ENVIAR MENSAGEM</Button>
)
:
(
<Button onClick={e => {e.preventDefault(); handleLogin(true);}} >ENVIAR MENSAGEM</Button>
)
}
</div>
</form>
</React.Fragment>
);
......
......@@ -137,7 +137,13 @@ export default function Header(props) {
)
:
(
<MenuBarMobile openSignUp={handleSignUp} openLogin={handleLogin} />
<React.Fragment>
<MenuBarMobile openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} />
{
state.searchOpen &&
<SearchBar />
}
</React.Fragment>
)
}
<SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} />
......
......@@ -130,18 +130,18 @@ export default function MenuBar(props) {
}
const menuSobre = [
{ name: "Sobre a Plataforma", href: "sobre" },
{ name: "Portais Parceiros", href: "sobre#portaisparceiros" },
{ name: "Termos de Uso", href: "termos" },
{ name: "Contato", href: "contato" }
{ name: "Sobre a Plataforma", href: "/sobre" },
{ name: "Portais Parceiros", href: "/sobre#portaisparceiros" },
{ name: "Termos de Uso", href: "/termos" },
{ name: "Contato", href: "/contato" }
]
const menuAjuda = [
{ name: "Central de Ajuda", href: "ajuda" },
{ name: "Publicando Recursos", href: "publicando-recurso" },
{ name: "Encontrando Recursos", href: "encontrando-recurso" },
{ name: "Participando da Rede", href: "participando-da-rede" },
{ name: "Gerenciando a Conta", href: "gerenciando-conta" }
{ name: "Central de Ajuda", href: "/ajuda" },
{ name: "Publicando Recursos", href: "/publicando-recurso" },
{ name: "Encontrando Recursos", href: "/encontrando-recurso" },
{ name: "Participando da Rede", href: "/participando-da-rede" },
{ name: "Gerenciando a Conta", href: "/gerenciando-conta" }
]
const minhaArea = buildMyAreaTabs()
......
......@@ -23,6 +23,7 @@ import { Button } from '@material-ui/core'
import logo from '../img/logo_small.svg'
import { Link } from 'react-router-dom'
import MobileDrawerMenu from './MobileDrawerMenu';
import IconSearch from '@material-ui/icons/Search'
export default function MenuBarMobile(props) {
......@@ -52,6 +53,9 @@ export default function MenuBarMobile(props) {
<img src={logo} alt="logo" style={{ border: "0", verticalAlign: "middle" }} />
</Link>
</DrawerButtonDiv>
<Button style={{ color: "#00bcd4", position: "absolute", right: 0}} onClick={props.openSearchBar}>
<IconSearchStyled/>
</Button>
</OuterDiv>
</>
)
......@@ -79,3 +83,11 @@ const DrawerButtonDiv = styled.div`
margin-left:auto;
margin-right:auto;
`
const IconSearchStyled = styled(IconSearch)`
color: #16b8dd;
height : 38px;
width : 45.55px;
margin-left:auto;
margin-right:auto;
`
\ No newline at end of file
......@@ -33,7 +33,6 @@ import DefaultAvatar from '../img/default_profile0.png'
import SettingsIcon from '@material-ui/icons/Settings';
import { apiDomain } from '../env.js'
import { deleteRequest } from './HelperFunctions/getAxiosConfig'
import SearchIcon from '@material-ui/icons/Search';
export default function MobileDrawerMenu(props) {
const { state, dispatch } = useContext(Store)
......@@ -69,11 +68,11 @@ export default function MobileDrawerMenu(props) {
const menuSobre = [
{ name: "Página Inicial", href: "/", icon: <HomeIcon /> },
{ name: "Sobre a Plataforma", href: "sobre", icon: <InfoIcon /> },
{ name: "Contato", href: "contato", icon: <MailOutlineIcon /> },
{ name: "Central de Ajuda", href: "ajuda", icon: <HelpOutlineIcon /> },
{ name: "Termos de Uso", href: "termos", icon: <AssignmentIcon /> },
{ name: "Busca", href: `busca?query=${state.search.query}&search_class=${state.search.class}`, icon: <SearchIcon /> }
{ name: "Sobre a Plataforma", href: "/sobre", icon: <InfoIcon /> },
{ name: "Contato", href: "/contato", icon: <MailOutlineIcon /> },
{ name: "Central de Ajuda", href: "/ajuda", icon: <HelpOutlineIcon /> },
{ name: "Termos de Uso", href: "/termos", icon: <AssignmentIcon /> },
//{ name: "Busca", href: `/busca?query=${state.search.query}&search_class=${state.search.class}`, icon: <SearchIcon /> }
]
// {/*used in dynamic css selection*/}
......
......@@ -163,12 +163,13 @@ export default function SearchBar(props) {
<ButtonStyled onClick={handleKeyDown} ><IconSearchStyled /></ButtonStyled>
</Link>
{state.windowSize.width >= 900 ?
<React.Fragment>
<Flex style={{ "justifyContent": 'middle', 'flexDirection': 'column' }}>
<div>Pressione "Enter"</div>
<div>ou click na lupa</div>
</Flex>
<DividerVertical />
{state.windowSize.width >= 900 ?
<RadioGroupStyled row={true}
aria-label="Tipo"
name="types" value={searchClass}
......@@ -180,7 +181,10 @@ export default function SearchBar(props) {
<FormControlLabelStyled value="Collection" control={<RadioStyled />} label="Coleções" />
<FormControlLabelStyled value="User" control={<RadioStyled />} label="Usuários" />
</RadioGroupStyled>
</React.Fragment>
:
<React.Fragment>
<DividerVertical />
<FormControl>
<SelectStyled
value={searchClass}
......@@ -191,6 +195,7 @@ export default function SearchBar(props) {
<MenuItemStyled value="User" aria-label="Usuários">Usuários</MenuItemStyled>
</SelectStyled>
</FormControl>
</React.Fragment>
}
</Flex>
</Bar>
......
......@@ -113,9 +113,6 @@ export default function Search(props) {
const query = urlParams.get("query");
const searchClass = urlParams.get("search_class");
console.log(query)
console.log(searchClass)
if (state.search.query !== query || state.search.class !== searchClass) {
dispatch({
type: "SAVE_SEARCH",
......@@ -124,6 +121,8 @@ export default function Search(props) {
class: searchClass,
},
});
state.search.query = query
state.search.class = searchClass
}
currOption = searchClass
setOption(searchClass)
......@@ -135,7 +134,7 @@ export default function Search(props) {
type: "HANDLE_SEARCH_BAR",
opened: false,
});
}, [window.history.state.key, state.currentUser.id])
}, [window.history.state === null ? true : window.history.state.key, state.currentUser.id])
useEffect(() => {
setIsLoading(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment