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

Front searchbar #252

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions uniEmpleos/src/components/HeaderHome/HeaderHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { FaBars, FaTimes } from "react-icons/fa"
import { LuLogOut } from "react-icons/lu"
import styles from "./HeaderHome.module.css"
import { navigate } from "../../store"
import { useTranslation } from "react-i18next"

const HeaderHome = () => {
const { t } = useTranslation()
const [showNavbar, setShowNavbar] = useState(false)

const handleShowNavbar = () => {
Expand All @@ -16,9 +18,9 @@ const HeaderHome = () => {
<div className="actions">
<div className={styles.actionlinks}>
<a href="/login" className={styles.buttonlogin}>
Iniciar Sesión
{t("headerHome.login")}
</a>
<a href="/signup">Registrarse</a>
<a href="/signup">{t("headerHome.register")}</a>
</div>
</div>
)
Expand Down
38 changes: 27 additions & 11 deletions uniEmpleos/src/components/InfoTab/InfoTab.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { format } from "date-fns"
import { useTranslation } from "react-i18next"
import styles from "./InfoTab.module.css"
import Button from "../Button/Button"

Expand All @@ -16,18 +17,20 @@ const InfoTab = ({
horariofin,
jornada,
}) => {
const { t } = useTranslation()
const parseTime = (isoString) => {
const date = isoString.split("T")[1].split("Z")[0].slice(0, -3)
const hours = parseInt(date.split(":")[0])
const hours = parseInt(date.split(":")[0], 10)
if (hours > 12) {
return `${hours - 12}:${date.split(":")[1]} p.m.`
} else if (hours === 12) {
}
if (hours === 12) {
return `12:${date.split(":")[1]} p.m.`
} else if (hours === 0) {
}
if (hours === 0) {
return `12:${date.split(":")[1]} a.m.`
} else {
return `${hours}:${date.split(":")[1]} a.m.`
}
return `${hours}:${date.split(":")[1]} a.m.`
}

return (
Expand All @@ -38,13 +41,26 @@ const InfoTab = ({
</div>
)}
<div className={styles.containerinfosecond}>
{company && <p>{`Empresa: ${company}`}</p>}
{salary && <p>{`Salario: ${salary}`}</p>}
{jornada && <p>{`Jornada: ${jornada}`}</p>}
{company && (
<p>
{t("previewOffer.enterprise")}: {company}
</p>
)}
{salary && (
<p>
{t("previewOffer.salary")}: {salary}
</p>
)}
{jornada && (
<p>
{t("previewOffer.type")}: {jornada}
</p>
)}
{horarioinicio && horariofin && (
<p>{`Horario: ${`${parseTime(horarioinicio)} - ${parseTime(
horariofin
)}`}`}</p>
<p>
{t("previewOffer.schedule")}: {parseTime(horarioinicio)} -{" "}
{parseTime(horariofin)}
</p>
)}
</div>
<div className={styles.button}>
Expand Down
24 changes: 24 additions & 0 deletions uniEmpleos/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,29 @@
"enterprises": "Enterprises",
"students": "Students"
}
},
"headerHome": {
"login": "Login",
"register": "Register"
},
"previewOffer": {
"enterprise": "Enterprise",
"salary": "Salary",
"type": "Type",
"schedule": "Schedule",
"apply": "Apply"
},
"profileStudent":{
"name": "Name",
"lastName": "Last Name",
"dateBirth": "Date of Birth",
"phone": "Phone",
"nameUniversity": "University",
"career": "Career",
"semester": "Semester",
"save": "Save"
},
"previewPostulations":{
"delete": "Delete Postulation"
}
}
25 changes: 25 additions & 0 deletions uniEmpleos/src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,30 @@
"enterprises": "Empresas",
"students": "Estudiantes"
}
},
"headerHome": {
"login": "Iniciar Sesión",
"register": "Registrarse"
},
"previewOffer": {
"enterprise": "Empresa",
"salary": "Salario",
"type": "Jornada",
"schedule": "Horario",
"apply": "Postularme"
},
"profileStudent":{
"name": "Nombres",
"lastName": "Apellidos",
"dateBirth": "Fecha de Nacimiento",
"phone": "Teléfono",
"nameUniversity": "Universidad",
"career": "Carrera",
"semester": "Semestre",
"save": "Guardar"
},
"previewPostulations":{
"delete": "Eliminar Postulación"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { useStoreon } from "storeon/react"
import Select from "react-select"
import makeAnimated, { Input } from "react-select/animated"
import ImageDirectUploader from "@components/ImageDirectUploader/ImageDirectUploader.jsx"
import { AiOutlineCloudDownload } from "react-icons/ai"
import { TbEdit } from "react-icons/tb"
import { useTranslation } from "react-i18next"
import style from "./EditProfileEstudiante.module.css"
import ComponentInput from "../../components/Input/Input"
import Button from "../../components/Button/Button"
Expand All @@ -12,12 +15,11 @@ import useApi from "../../Hooks/useApi"
import Popup from "../../components/Popup/Popup"
import API_URL from "@/api.js"
import InputFile from "../../components/InputFile/InputFile"
import { AiOutlineCloudDownload } from "react-icons/ai"
import { TbEdit } from "react-icons/tb"

const animatedComponents = makeAnimated()

const EditProfileEstudiante = () => {
const { t } = useTranslation()
const { user } = useStoreon("user")
const api = useApi()
const apiCareers = useApi()
Expand Down Expand Up @@ -72,7 +74,7 @@ const EditProfileEstudiante = () => {
const fotoUrl =
api.data.usuario.foto === ""
? "/images/pfp.svg"
: API_URL + "/api/uploads/" + api.data.usuario.foto
: `${API_URL}/api/uploads/${api.data.usuario.foto}`
setNombre(usuario.nombre)
setApellido(usuario.apellido)
const date = new Date(usuario.nacimiento)
Expand Down Expand Up @@ -114,8 +116,6 @@ const EditProfileEstudiante = () => {
apiCareers.handleRequest("GET", "/careers")
}, [])

//console.log("CV" , apiCV.data)

const handleInputsValue = (e) => {
switch (e.target.name) {
case "nombres":
Expand Down Expand Up @@ -244,14 +244,12 @@ const EditProfileEstudiante = () => {
const handleShowCV = () => {
if (newCV !== "") {
window.open(newCV)
} else if (oldCV === "") {
setTypePopUp(2)
setError("No tienes un CV")
setWarning(true)
} else {
if (oldCV === "") {
setTypePopUp(2)
setError("No tienes un CV")
setWarning(true)
} else {
window.open(`${API_URL}/api/cv/${oldCV}`)
}
window.open(`${API_URL}/api/cv/${oldCV}`)
}
}

Expand Down Expand Up @@ -284,7 +282,7 @@ const EditProfileEstudiante = () => {
<div className={style.editProfileContainer}>
<div className={style.inputsContainer}>
<div className={style.inputSubContainer}>
<span>Nombres</span>
<span>{t("profileStudent.name")}</span>
<ComponentInput
value={nombre}
name="nombres"
Expand All @@ -294,7 +292,7 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.inputSubContainer}>
<span>Apellidos</span>
<span>{t("profileStudent.lastName")}</span>
<ComponentInput
value={apellido}
name="apellidos"
Expand All @@ -304,7 +302,7 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.inputSubContainer}>
<span>Fecha de nacimiento</span>
<span>{t("profileStudent.dateBirth")}</span>
<ComponentInput
value={edad}
name="fechaNacimiento"
Expand All @@ -317,7 +315,7 @@ const EditProfileEstudiante = () => {
</div>
<div className={style.grupoDatos1}>
<div className={style.inputSubContainerDataGroup1}>
<span>Telefono</span>
<span>{t("profileStudent.phone")}</span>
<ComponentInput
value={telefono}
name="telefono"
Expand All @@ -327,7 +325,7 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.inputSubContainerDataGroup1}>
<span>Carrera</span>
<span>{t("profileStudent.career")}</span>
<Select
styles={{
control: (baseStyles, state) => ({
Expand Down Expand Up @@ -358,7 +356,7 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.inputSubContainerDataGroup1}>
<span>Universidad</span>
<span>{t("profileStudent.nameUniversity")}</span>
<ComponentInput
value={universidad}
name="universidad"
Expand All @@ -368,7 +366,7 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.inputSubContainerDataGroup1}>
<span>Semestre</span>
<span>{t("profileStudent.semester")}</span>
<Select
styles={{
control: (baseStyles, state) => ({
Expand Down Expand Up @@ -402,7 +400,7 @@ const EditProfileEstudiante = () => {
<span className={style.titleCV}>CV</span>
<InputFile
file={cvText}
placeHolder={"Subir CV"}
placeHolder="Subir CV"
onFileSelect={handleCVSelect}
type="pdf"
/>
Expand All @@ -414,7 +412,10 @@ const EditProfileEstudiante = () => {
/>
</div>
<div className={style.buttonContainer}>
<Button label="Guardar" onClick={handleButton} />
<Button
label={t("editProfileStudent.save")}
onClick={handleButton}
/>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import styles from "./PostulationsEstudent.module.css"
import Popup from "../../components/Popup/Popup"
import upload from "./upload.json"
import Loader from "../../components/Loader/Loader"
import { useTranslation } from "react-i18next"

const PostulationsEstudent = () => {
const { t } = useTranslation()
const api = useApi()
const deletePostulation = useApi()
const { user } = useStoreon("user")
Expand Down Expand Up @@ -71,7 +73,7 @@ const PostulationsEstudent = () => {
key={postulation.id_oferta}
title={postulation.puesto}
salary={`Q.${postulation.salario}.00`}
labelbutton="Eliminar Postulación"
labelbutton={t("previewPostulations.delete")}
onClick={() => eliminarPostulacion(postulation.id_postulacion)}
/>
))}
Expand Down
4 changes: 3 additions & 1 deletion uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useConfig from "../../Hooks/Useconfig"
import API_URL from "../../api"
import useApi from "../../Hooks/useApi"
import Loader from "../../components/Loader/Loader"
import { useTranslation } from "react-i18next"

const schema = Joi.object({
token: Joi.string().required(),
Expand All @@ -23,6 +24,7 @@ const PrincipalStudent = () => {
const [postulaciones, setPostulaciones] = useState([])
const [ofertasAMostrar, setOfertasAMostrar] = useState([])
const [loading, setLoading] = useState(false)
const { t } = useTranslation()

const form = useConfig(schema, {
token: "a",
Expand Down Expand Up @@ -121,7 +123,7 @@ const PrincipalStudent = () => {
jornada={postulation.jornada}
horarioinicio={postulation.hora_inicio}
horariofin={postulation.hora_fin}
labelbutton="Postularme"
labelbutton={t("previewOffer.apply")}
onClick={() => saveidlocalstorage(postulation.id_oferta)}
/>
))}
Expand Down
Loading