Skip to content

Commit

Permalink
Merge pull request #190 from Arquisoft/develop
Browse files Browse the repository at this point in the history
V1.1
  • Loading branch information
paulasuarezp authored May 3, 2023
2 parents 6773e2a + 478582f commit 515e151
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 33 deletions.
5 changes: 5 additions & 0 deletions webapp/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,9 @@ a {
resize: none;
background-color: transparent;
color: "red" !important;
}

.imgCarrusel {
width: 50vh;
height: auto;
}
30 changes: 20 additions & 10 deletions webapp/src/components/mainComponents/ImgCarrusel.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import ImageList from '@mui/material/ImageList';
import ImageListItem from '@mui/material/ImageListItem';
import { IconButton, ImageListItemBar } from '@mui/material';
import VisibilityIcon from '@mui/icons-material/Visibility';
import Swal from 'sweetalert2';
import { showError } from 'utils/fieldsValidation';
import { Box } from '@mui/material';

export default function StandardImageList() {

/*
const showImg = (img: string, title: string) => {
Swal.fire({
html:
Expand All @@ -16,9 +11,9 @@ export default function StandardImageList() {
}).then(() => { }).catch((e) => {
showError("Error al mostrar fotografías", "Error inesperado mostrando la fotografía, vuelva a probar.", Swal.close)
})
}
}*/

return (
return (/*
<ImageList cols={1} data-testid="imgCarruselComp">
<ImageListItem key="1.png">
<img
Expand Down Expand Up @@ -104,6 +99,21 @@ export default function StandardImageList() {
}
/>
</ImageListItem>
</ImageList>
</ImageList>*/
<Box data-testid="imgCarruselComp">
<img className="imgCarrusel"
src="1.png"
alt="Crea tus propios mapas"
/>
<img className="imgCarrusel"
src="2.png"
alt="Guarda tus lugares favoritos"
/>
<img className="imgCarrusel"
src="3.png"
alt="Ve los mapas de tus amigos"
/>

</Box>
);
}
6 changes: 3 additions & 3 deletions webapp/src/components/profileMenus/EditPassword.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useForm, SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { styled } from '@mui/material/styles';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
Expand Down Expand Up @@ -80,7 +80,7 @@ export function EditPassword() {
resolver: yupResolver(schema)
});

const onSubmit: SubmitHandler<EditSchema> = data => tryToEdit(data);
const onSubmit = handleSubmit(data => tryToEdit(data));


const [confirmPass, setConfirmPass] = useState('')
Expand Down Expand Up @@ -115,7 +115,7 @@ export function EditPassword() {
}

return (
<StyledBox component="form" onSubmit={handleSubmit(onSubmit)}>
<StyledBox component="form" onSubmit={onSubmit}>
<ProfileTemplate>
<CSSTypography variant="h3" align="center"
data-testid="usernameEditProfile"
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/profileMenus/EditProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useForm, SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { styled } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
Expand Down Expand Up @@ -88,7 +88,7 @@ export function EditProfile() {
resolver: yupResolver(schema)
});

const onSubmit: SubmitHandler<EditSchema> = data => tryToEdit(data);
const onSubmit = handleSubmit(data => tryToEdit(data));

const user = getUserInSesion()

Expand Down Expand Up @@ -120,7 +120,7 @@ export function EditProfile() {
}

return (
<StyledBox component="form" onSubmit={handleSubmit(onSubmit)}>
<StyledBox component="form" onSubmit={onSubmit}>

<ProfileTemplate>
<CSSTypography variant="h3" align="center"
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/userIdentification/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useForm, SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { styled } from '@mui/material/styles';
import SForm from './SesionForm';
import TextField from '@mui/material/TextField';
Expand Down Expand Up @@ -70,7 +70,7 @@ export function Login() {
//#endregion

//#region METODOS DE CLASE
const onSubmit: SubmitHandler<User> = data => tryLogin(data);
const onSubmit = handleSubmit(data => tryLogin(data));

const tryLogin = (user: User) => {
login(user).then(function (userApi: User) {
Expand Down Expand Up @@ -102,7 +102,7 @@ export function Login() {
Inicia sesión
</CSSTypography>

<Box component="form" onSubmit={handleSubmit(onSubmit)} noValidate sx={{ mt: "1em" }}>
<Box component="form" onSubmit={onSubmit} noValidate sx={{ mt: "1em" }}>
<CSSTextField
sx={{ mb: "0.5em" }}
id="outlined-required"
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/userIdentification/SignupForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useForm, SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { styled } from '@mui/material/styles';
import SForm from './SesionForm';
import TextField from '@mui/material/TextField';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FriendsComponent } from './FriendsComponent';
import { FriendRequestsComponent } from './FriendRequestsComponent'
import NotificationsActiveIcon from '@mui/icons-material/NotificationsActive';
import GroupIcon from '@mui/icons-material/Group';
import { useForm, SubmitHandler } from "react-hook-form";
import { useForm } from "react-hook-form";
import { temporalSuccessMessage } from 'utils/MessageGenerator';
import { showError } from 'utils/fieldsValidation';
import { verMapaDeAmigo } from 'podManager/MapManager';
Expand Down Expand Up @@ -107,7 +107,7 @@ export const FriendManagerPanel = () => {
const { register, handleSubmit, formState: { errors } } = useForm<User>();


const onSubmit: SubmitHandler<User> = data => searchUser(data);
const onSubmit = handleSubmit(data => searchUser(data));

const searchUser = async (user: User) => {
await searchUserByUsername(user.username).then(async (res) => {
Expand Down Expand Up @@ -166,7 +166,7 @@ export const FriendManagerPanel = () => {
<HorizontalDivider light color="#81c784" />
{op === "main" ?
<>
<AddFriendBox data-testid="addFriendForm" component="form" onSubmit={handleSubmit(onSubmit)}>
<AddFriendBox data-testid="addFriendForm" component="form" onSubmit={onSubmit}>
<AccountCircle sx={{ color: 'action.active', mr: 1, my: 0.5 }} />
<TextField
label="Añadir un amigo"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';
import { styled } from '@mui/material/styles';
import { SubmitHandler, useForm } from 'react-hook-form';
import { useForm } from 'react-hook-form';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
Expand Down Expand Up @@ -77,15 +77,15 @@ export function AddGroupForm(props: { refresh: any }) {
resolver: yupResolver(schema)
});

const onSubmit: SubmitHandler<GroupSchema> = async(data: any) => {
await crearGrupo(data.groupName, session).then((grupo: Group) => {
const onSubmit = handleSubmit((data: any) => {
crearGrupo(data.groupName, session).then((grupo: Group) => {
navigate("/home/groups/main")
props.refresh()
temporalSuccessMessage("Grupo <em><b>" + grupo.name + "</b></em> creado correctamente. ¡A añadir lugares se ha dicho!");
}).catch((e: any) => {
temporalSuccessMessage("Se ha creado todo correctamente en el POD. ¡A añadir grupos se ha dicho!");
})
}
})

const navigate = useNavigate()

Expand All @@ -98,7 +98,7 @@ export function AddGroupForm(props: { refresh: any }) {
<Typography color="black">Nuevo grupo</Typography>
</Breadcrumbs>
</div>
<Box component="form" onSubmit={handleSubmit(onSubmit)}>
<Box component="form" onSubmit={onSubmit}>
<CSSTypography variant="body1" align="center"
sx={{ mt: "1.5em", mb: "1em" }}>
Nuevo grupo de lugares
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default function AddPlaceForm(props: { refresh: any }) {

}

const onSubmit = (data: any) => {
const onSubmit = handleSubmit((data: any) => {
if (selectedImage !== null) {

const fd = new FormData();
Expand All @@ -277,7 +277,7 @@ export default function AddPlaceForm(props: { refresh: any }) {
} else { addPlaceToGroup(data, ""); }


};
})

const handleCategoryChange = (event: SelectChangeEvent) => {
setCategory(event.target.value as string);
Expand Down Expand Up @@ -318,7 +318,7 @@ export default function AddPlaceForm(props: { refresh: any }) {
<Typography color="text.primary">Nuevo lugar</Typography>
</Breadcrumbs>
</div>
<Box component="form" onSubmit={handleSubmit(onSubmit)}>
<Box component="form" onSubmit={onSubmit}>
<CSSTypography variant="body1" align="center"
sx={{ mt: "0.5em", mb: "0.5em" }}>
Añadir lugar
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/test/mainComponents/ImgCarrusel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('renders img carrusel', () => {
let linkElement = screen.getByTestId("imgCarruselComp");
expect(linkElement).toBeInTheDocument();
});

/*
test('renders click on img view button', () => {
render(
<ImgCarrusel />
Expand All @@ -20,4 +20,4 @@ test('renders click on img view button', () => {
fireEvent.click(button);
linkElement = screen.getByTestId("carruselImg");
expect(linkElement).toBeInTheDocument();
});
});*/

0 comments on commit 515e151

Please sign in to comment.