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

chatResponsive #231

Merged
merged 4 commits into from
Nov 5, 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
21 changes: 17 additions & 4 deletions uniEmpleos/src/components/Chat/Chat.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
width: auto;
border-radius: 10px;
/* Sombras más pronunciadas */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-shadow: 0 4px 8px #94bd0f;
animation: chatAnimation 0.5s ease-in-out;
}

Expand All @@ -24,7 +24,7 @@
}

.button {
background-color: #e1dede;
background-color: #fff;
border: none;
border-radius: 5px;
padding: 5px;
Expand All @@ -39,11 +39,11 @@

.button:focus {
outline: none;
background-color: #d1cece;
background-color: #94bd0f75;
}

.button:hover {
background-color: #d1cece;
background-color: #94bd0f75;
}

.pfp {
Expand Down Expand Up @@ -83,4 +83,17 @@
color: #252525;
font-weight: normal;
text-align: start;
}


@media (max-width: 768px) {
.lastChat {
display: none;
}

.pfp {
width: 40%;
height: 60px;
}

}
1 change: 1 addition & 0 deletions uniEmpleos/src/components/Header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ button.buttonlogo:focus{

.nav-elements.active {
width: 100%;
z-index: 999;
}

.nav-elements ul {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@
.UploaderButton {
width: min(30%, 200px);
}

@media (max-width: 768px) {
.UploaderContainer {
width: 100%;
flex-direction: column;
padding: 0;
}

.UploaderForm {
width: 100%;
flex-direction: column;
align-items: center;
gap: 10px;
padding: 0;
}
}
3 changes: 2 additions & 1 deletion uniEmpleos/src/components/Input/Input.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
.inputContainer input {
width: 100%;
margin: 0;
padding-left: 0;
padding-left: 0 !important;
padding-right: 0 !important;
}

.inputContainer{
Expand Down
36 changes: 29 additions & 7 deletions uniEmpleos/src/pages/ChatPage/ChatPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable camelcase */
/* eslint-disable react/prop-types */
import React, { useEffect, useState, useRef } from "react"
import { FaUserFriends } from "react-icons/fa"
import { useStoreon } from "storeon/react"
import style from "./ChatPage.module.css"
import { Header } from "../../components/Header/Header"
Expand Down Expand Up @@ -79,11 +80,6 @@ const ChatPage = () => {
scrollDown()
obtainMessages()
}

const handleChat = (receptor, id) => {
setCurrentChat(receptor)
setIdCurrentChat(id)
}

const handleInputChange = (e) => {
setTextMessage(e.target.value)
Expand All @@ -105,6 +101,20 @@ const ChatPage = () => {
return () => clearInterval(intervalListadeChats)
}, [])

// Estado para controlar la visibilidad del contenedor de chats
const [showChats, setShowChats] = useState(false)

// Función para alternar la visibilidad del contenedor de chats
const toggleChats = () => {
setShowChats(!showChats)
}

const handleChat = (receptor, id) => {
setCurrentChat(receptor)
setIdCurrentChat(id)
setShowChats(false)
}

return (
<div className={style.container}>
<Header userperson="student" />
Expand All @@ -114,8 +124,15 @@ const ChatPage = () => {
style={typePopUp}
close={() => setWarning(false)}
/>
<button type="button" className={style.menuButton} onClick={toggleChats}>
<FaUserFriends size={30} color="#000" />
</button>
<div className={style.generalChatContainer}>
<div className={style.chatsContainer}>
<div
className={`${style.chatsContainer} ${
showChats ? style.showChat : style.hideChat
}`}
>
{apiLastChats.data && apiLastChats.data.messages.length > 0 ? (
apiLastChats.data.messages.map((chat) =>
chat.last_message.length === 0 ? null : (
Expand All @@ -139,7 +156,12 @@ const ChatPage = () => {
<div className={style.noUsersMessage}>No hay chats recientes.</div>
)}
</div>
<div className={style.currentChatContainer} ref={chatContainerRef}>
<div
className={`${style.currentChatContainer} ${
showChats ? style.hide : style.show
}`}
ref={chatContainerRef}
>
{apiMessages.data && apiMessages.data.messages.length > 0 ? (
apiMessages.data.messages.map((message, number) => {
const side = message.id_emisor === user.id_user ? "right" : "left"
Expand Down
56 changes: 54 additions & 2 deletions uniEmpleos/src/pages/ChatPage/ChatPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
.chatsContainer {
display: flex;
flex-direction: column;
background-color: #f5f5f5;
background-color: #fff;
color: #fff;
width: 30%;
padding: 10px;
overflow: hidden;
overflow-y: auto;
scrollbar-width: none;
Expand Down Expand Up @@ -140,4 +141,55 @@
color: #000;
width: 100%;
height: 100%;
}
}

.show {
display: block;
}

.hide {
display: none;
}

/* Estilos para el botón de menú, solo visible en móviles */
.menuButton {
display: none;
}

/* Usa media queries para hacer que el botón de menú solo se muestre en dispositivos móviles */
@media (max-width: 768px) {
.menuButton {
display: flex;
background-color: transparent;
border: none;
cursor: pointer;
}

.currentChatContainer {
width: calc(100% - 20px);
overflow: hidden;
padding: 10px;
box-shadow: none;
background-color: #fff;
}

.showChat {
display: flex;
gap: 20px;
}

.hideChat {
display: none;
}

.chatsContainer {
width: 100%;
padding: 10px;
}

.inputContainer {
width: 90%;
padding: 10px;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,46 @@
.inputTextArea {
width: 480px;
}

@media (max-width: 768px) {
.editProfileContainer{
padding: 0;
width: 90%;
}

.inputsContainer {
width: 100%;
padding: 0;
}

.editProfileContainer>div {
padding: 20px 0px;
margin: 20px 0;
}

.inputSubContainer {
width: 90%;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: center;
}

.inputSubContainerDataGroup1 {
width: 90%;
}

.grupoDatos1 {
flex-direction: column;
gap: 10px;
width: 100%;
flex-wrap: nowrap;
}

.inputTextArea {
width: 90%;
padding-left: 0 !important;
padding-right: 0 !important;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
justify-content: flex-start;
align-items: center;
background-color: #f1f1f1;
background-color: #fff;
flex-direction: column;
height: 100%;
width: 100%;
Expand Down Expand Up @@ -126,3 +126,33 @@
align-items: center;
padding: 0 10px 0 10px;
}

@media (max-width: 768px) {
.editProfileContainer{
padding: 0;
width: 90%;
}

.inputsContainer {
width: 100%;
padding: 0;
}

.editProfileContainer>div {
padding: 20px 0px;
margin: 20px 0;
}

.inputSubContainer {
width: 90%;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: center;
}

.inputSubContainerDataGroup1 {
width: 90%;
}

}
2 changes: 1 addition & 1 deletion uniEmpleos/src/pages/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const LogIn = () => {
if (role === "student") {
navigate("/profile")
} else if (role === "enterprise") {
navigate("/profilecompany")
navigate("/postulacionempresa")
} else if (role === "admin") {
navigate("/profileadmin")
}
Expand Down
Loading