Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

01 components #7

Merged
merged 36 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ec66b7e
Initial setup to test components
Apr 20, 2023
c178419
TextArea(form) Component added
OscarNieto113 Apr 20, 2023
534a59a
Fonts
OscarNieto113 Apr 20, 2023
530676d
Footer Component
AndresMaganaPerez Apr 20, 2023
0497a09
Header component complete
OscarNieto113 Apr 20, 2023
adf121a
JavaDoc in component Header
OscarNieto113 Apr 20, 2023
e4d5df5
Checkbox component
OscarNieto113 Apr 21, 2023
29b2196
Footer Component
AndresMaganaPerez Apr 21, 2023
889fae7
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
AndresMaganaPerez Apr 21, 2023
f43bcd6
Half component InfoProfileCard
OscarNieto113 Apr 21, 2023
e31c67a
Half component InfoProfileCard
OscarNieto113 Apr 21, 2023
dcb0561
A
OscarNieto113 Apr 21, 2023
96c1d98
update the page file
AndresMaganaPerez Apr 21, 2023
e762d40
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
AndresMaganaPerez Apr 21, 2023
f085987
correct className standard in components
AndresMaganaPerez Apr 21, 2023
6f4b09c
InfoProfileCard Component style
OscarNieto113 Apr 21, 2023
fc6541d
commit omiso
AndresMaganaPerez Apr 21, 2023
94dcf6d
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
AndresMaganaPerez Apr 21, 2023
2f95bcb
add custom colors to be used
AndresMaganaPerez Apr 21, 2023
9a9b1cd
Navbar bottom
OscarNieto113 Apr 21, 2023
f577f83
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
OscarNieto113 Apr 21, 2023
afba617
add style to checkbox and definition of custom colors in tailwind config
AndresMaganaPerez Apr 21, 2023
30118a6
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
AndresMaganaPerez Apr 21, 2023
509f8c8
Trying All components
OscarNieto113 Apr 21, 2023
21cc09e
new component spinner loader
AndresMaganaPerez Apr 22, 2023
1ae824e
New base images
OscarNieto113 Apr 23, 2023
7af44cd
SpinnerLoader component finished and commented
Apr 23, 2023
827ee4f
Merge branch '01-components' of https://github.com/Genesis-Solutions/…
Apr 23, 2023
aa7800a
Commented, variables in english, Add sippinerLoader if doesn't have i…
Apr 23, 2023
8289bfd
Minor changes on comments
Apr 23, 2023
6fc17a0
Minor comment changes, applied pritier formater to footer
Apr 23, 2023
90f21ac
Applied prettier format, Add new subLabel prop to component
Apr 23, 2023
003c665
Get rid of the trash on page
Apr 23, 2023
f646224
Deleting Fer and Cris Components from my branch
Apr 23, 2023
cb024a5
Add fix to: deletes: vite.config.js, folder img, inputForm.jsx, page.…
OscarNieto113 Apr 24, 2023
377f7ea
Fix all comments on components (infoProfileCard, ProfileCard, Spinner…
Apr 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,057 changes: 886 additions & 171 deletions GomezMorinFrontEnd/package-lock.json

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions GomezMorinFrontEnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@
"preview": "vite preview"
},
"dependencies": {
"@headlessui/react": "^1.7.14",
"@heroicons/react": "^2.0.17",
"@material-tailwind/react": "^1.4.2",
"@reduxjs/toolkit": "^1.9.3",
"axios": "^1.3.4",
"google-map-react": "^2.2.0",
"google-maps-react": "^2.0.6",
"flowbite": "^1.6.5",
"headlessui": "^0.0.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.8",
"react-redux": "^8.0.5"
"react-icons": "^4.8.0",
"react-loader-spinner": "^5.3.4",
"react-redux": "^8.0.5",
"react-router-dom": "^6.10.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GomezMorinFrontEnd/public/images/hexagono.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GomezMorinFrontEnd/public/images/logoMorin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 12 additions & 53 deletions GomezMorinFrontEnd/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,18 @@
import { useDispatch, useSelector } from "react-redux"
import { setUsers } from "./states/generalSlice"
import Card from "./components/Card"
import { useForm } from "react-hook-form"
import { createUser, readUsers } from "./queries/query"
import { useEffect } from "react"
import MapContainer from "./components/MapContainer"
import { BrowserRouter, Route, Routes } from "react-router-dom";
import Page from "./pages/page"
OscarNieto113 marked this conversation as resolved.
Show resolved Hide resolved

function App() {
const users = useSelector((state) => state.general.users)
const dispatch = useDispatch()

const { register, handleSubmit } = useForm()

const onSubmit = async (data) => {
const response = await createUser(data)

dispatch(setUsers(response))
}

useEffect(() => {
readUsers()
.then((response) => {

if (response) {
dispatch(setUsers(response))
}
})
}, [])

return (
<div className="w-full h-full ">
<form className="flex flex-col w-1/6" onSubmit={ handleSubmit(onSubmit) }>
<label htmlFor="username">Username: </label>
<input className="border-2 border-gray-400" type="text" id="username" placeholder="Username" {...register("username")} />
<label htmlFor="image">Image: </label>
<input type="file" id="image" {...register("urlImg")}/>
<button
className="p-1 border-2 border-black bg-slate-300 "
>
Enviar Usuario
</button>
</form>

<div>
<ul>
{ users.map((user, id) => (
<Card key={id} user={ user }/>
)) }
</ul>
</div>
<div>
<MapContainer />
</div>
<div className="App w-full h-full">
<BrowserRouter>
<Routes>
<Route element={ <Layout /> }>
<Route path="/" element={ <Page /> } />
</Route>
</Routes>
</BrowserRouter>
</div>
)
);
}

export default App
export default App
35 changes: 0 additions & 35 deletions GomezMorinFrontEnd/src/components/Card.jsx

This file was deleted.

25 changes: 25 additions & 0 deletions GomezMorinFrontEnd/src/components/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Checkbox } from "@material-tailwind/react";

/**
* A Material Tailwind checkbox component with a label and optional sub-label.
*
* @param label The text for the checkbox label.
* @param subLabel An optional sub-label to display below the checkbox label.
* @return {JSX.Element} The Checkbox1 component.
*/
const AltCheckbox = ({ label, subLabel }) => {
return (
<div>
<Checkbox
color="green"
ripple={true}
label={label}
defaultChecked
/>
<p className="text-sm italic font-thin mb-2">{subLabel}</p>
</div>

);
};

export default AltCheckbox;
39 changes: 39 additions & 0 deletions GomezMorinFrontEnd/src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";

/**
* A React component that displays the footer of a webpage. It includes the Gomez Morin logo,
* phone number, and address. The component is fixed at the bottom of the page.
*
* @return {JSX.Element} The JSX code that displays the footer.
*/
const Footer = () => {
return (
<div className="fixed bottom-0 w-full h-16 bg-gray-blue drop-shadow-lg">
<div className="flex justify-between items-center">
<div className="px-4 pt-2">
<img
className="object-scale-down h-12"
src="/img/gomez_morin_blanco.png"
/>
</div>
<div className="px-3 pt-2 text-white">
<p className="text-[#ffffff]">(442) 251 9600 Ext. 9613</p>
</div>
<div className="px-3 pt-2">
<p className="text-white">
Av. Constituyentes Esq. Luis Pasteur S/N Col. Villa del Sur,
C.P.76000. Santiago de Querétaro.
</p>
</div>
<div className="px-4 pt-2">
<img
className="object-scale-down h-12"
src="/img/gomez_morin_blanco.png"
/>
</div>
</div>
</div>
);
};

export default Footer;
17 changes: 17 additions & 0 deletions GomezMorinFrontEnd/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";

/**
* Componente para mostrar el encabezado de la página.
*
* @param {string} tittle - Título del encabezado.
* @returns {JSX.Element} Elemento JSX que representa el encabezado.
*/
const Header = ({ tittle }) => {
return (
<div className="text-center w-full">
<h1 className="Gobold text-black text-6xl ">{tittle}</h1>
</div>
);
};

export default Header;
131 changes: 131 additions & 0 deletions GomezMorinFrontEnd/src/components/InfoProfileCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import React, { useEffect, useState } from "react";
import { useForm, FormProvider } from "react-hook-form";
import InputForm from "./InputForm";
import Button from "./Button";
import Checkbox from "./Checkbox";
import SpinnerLoader from "./SpinnerLoader";

/**
* A component that displays user information and allows them to update their profile.
*
* @param {string} Cookie.session.id - The ID of the user's session cookie.
* @returns {JSX.Element} The JSX element displaying the user's profile and profile editing form.
*/
const InfoProfileCard = (/*Cookie.session.id*/) => {
const [user, setUser] = useState([]);
const [loading, setLoading] = useState(true);

/* To do:
//UseEfect
//query.findByID(cookie.session.id)
//setUser
//setLoading(false)
OscarNieto113 marked this conversation as resolved.
Show resolved Hide resolved
*/


const methods = useForm();
const reset = methods.reset;

/**
* Handles submission of updated user information.
* @param {Object} data - The updated user data to be submitted.
*/
const onSubmitUser = async (data) => {
const response = await updateUser(data); //Query importada
setUser(response);
reset();
};

return (
<div className="w-full rounded-lg bg-gray drop-shadow-md">
<div className="flex items-center">
<div className="w-1/2 mx-6 my-1 text-left">
{user.length === 1 ? (
user.map((tempUser) => (
<FormProvider {...methods}>
<form onSubmit={methods.handleSubmit(onSubmitUser)}>
<InputForm
label="Usuario"
name={tempUser.user} //To do: Posible cambio
type="text"
placeholder="Escribe tu nuevo nombre de Usuario"
defaultValue={tempUser.user} //To do: Posible cambio
/>
<InputForm
label="Correo"
name={tempUser.mail} //To do: Posible cambio
type="text"
placeholder="prueba"
defaultValue={tempUser.mail} //To do: Posible cambio
/>
<InputForm
label="Teléfono Celular"
name={tempUser.phone} //To do: Posible cambio
type="number"
placeholder="prueba"
defaultValue={tempUser.phone} //To do: Posible cambio
/>
<div className="flex justify-center items-center w-2/3 my-3">
<Button
text="Guardar Cambios"
type="submit"
colorBg="bg-teal-500"
colorHoverBg="bg-teal-500"
navigation=""
/>
</div>
</form>
</FormProvider>
))
) : loading ? (
<SpinnerLoader colorSpin="#AFD135" />
) : (
<h1 className="font-bold text-2xl">No existe el usuario</h1>
)}
</div>
<div className="w-1/2 mx-6 my-2 text-left">
{user.length === 1 ? (
user.map((tempUser) => (
<div>
<Checkbox
label={"Soy una persona moral"}
subLabel={"Este campo implica que eres una institución afiliada con Gómez Morín."}
/>
<div className="mt-3">
<label className="font-bold">Contraseña</label>
</div>
<div className="mt-3">
<Button
text="Cambiar Contraseña"
type="submit"
colorBg="bg-pink-red"
colorHoverBg="bg-rose-800"
navigation=""
/>
</div>
<div className="mt-3">
<label className="font-bold">Cuenta</label>
</div>
<div className="my-3">
<Button
text="Eliminar Cuenta"
type="submit"
colorBg="bg-pink-red"
colorHoverBg="bg-rose-500"
navigation=""
/>
</div>
</div>
))
) : loading ? (
<SpinnerLoader colorSpin="#AFD135" />
) : (
<h1 className="font-bold text-2xl">No existe el usuario</h1>
)}
</div>
</div>
</div>
);
};

export default InfoProfileCard;
21 changes: 21 additions & 0 deletions GomezMorinFrontEnd/src/components/Layout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { Outlet } from "react-router-dom";
import Navbar from "./Navbar";
import Footer from "./Footer";

/**
* This component is used for the single web application.
* In order to show all the components in the routes configured in App.jsx.
*/

const Layout = () => {
return (
<div className="w-full h-full flex flex-col">
<Navbar />
<Outlet />
<Footer/>
</div>
);
};

export default Layout;
Loading