diff --git a/client/src/pages/Auth/auth.scss b/client/src/pages/Auth/auth.scss new file mode 100644 index 0000000..d5b6517 --- /dev/null +++ b/client/src/pages/Auth/auth.scss @@ -0,0 +1,61 @@ +@import "../../index.scss"; + +#Auth-Page { + @apply w-screen h-screen text-center p-5 + flex flex-col justify-between items-center; + + > main { + #Auth { + @apply w-screen; + .row { + @apply w-full flex justify-between p-10; + + .Local-Auths, + .Provided-Auths { + @apply flex flex-col w-[600px] gap-5 justify-center items-center p-10 + text-xl; + + button { + @apply w-full flex gap-5 justify-center; + } + } + } + } + + #Auth-Local { + #Local-Backward { + @apply absolute hover:scale-90; + } + + #Local { + @apply w-[400px] + flex flex-col justify-center items-center gap-5; + + > #Submit-Button { + @apply flex justify-between text-xl; + + > svg > path { + fill: black; + } + } + } + } + } +} + +@media screen and (max-width: 600px) { + #Login-Page { + > header > h3 { + @apply text-3xl; + } + + #Auth-Local { + @apply p-5 justify-center; + width: 100vw !important; + + #Local-Backward { + left: 5vw; + } + } + } +} \ No newline at end of file diff --git a/client/src/pages/Auth/index.jsx b/client/src/pages/Auth/index.jsx index 923e168..b8e28a1 100644 --- a/client/src/pages/Auth/index.jsx +++ b/client/src/pages/Auth/index.jsx @@ -1,4 +1,4 @@ -import "../pages-styles.scss"; +import "./auth.scss"; import Auth from "./Auth"; export default function AuthPage({ setAuthenticated }) { diff --git a/client/src/pages/Home/SearchComponents/search.scss b/client/src/pages/Home/SearchComponents/search.scss new file mode 100644 index 0000000..a881a6c --- /dev/null +++ b/client/src/pages/Home/SearchComponents/search.scss @@ -0,0 +1,35 @@ +.hide-modal { + @apply absolute z-40 w-screen h-screen top-0 left-0 opacity-25 + bg-slate-950; + } + + #user-profile { + @apply bg-[#d9d9d9] w-[30rem] h-[30rem] absolute ml-[17rem] + translate-y-[-8rem] px-[2rem] py-[1rem] z-50; + + .user-profile-upper { + @apply flex w-full; + + .user-profile-upper-left { + @apply w-[50%] flex justify-between; + } + + .user-profile-upper-right { + @apply w-[50%] flex justify-end items-center mr-[5%]; + } + + .user-profile-pic { + @apply h-[6rem] w-[6rem]; + border-radius: 3rem; + } + } + + .user-profile-description { + @apply bg-[#d28080] mt-[1rem] pl-[0.5rem] h-[60%]; + } + + .fat-btn { + @apply bg-[#d28080] flex justify-center items-center w-[120%] px-[0.2rem]; + border-radius: 1rem; + } + } \ No newline at end of file diff --git a/client/src/pages/Home/SearchComponents/searchedProfile.jsx b/client/src/pages/Home/SearchComponents/searchedProfile.jsx index 7ef8c9b..8aeb6dd 100644 --- a/client/src/pages/Home/SearchComponents/searchedProfile.jsx +++ b/client/src/pages/Home/SearchComponents/searchedProfile.jsx @@ -1,14 +1,15 @@ -import UserProfile from './userProfile'; -import { useState, useEffect } from 'react'; -import { useContext } from 'react'; -import UserContext from '../../../Contexts/userContext'; -import PropTypes from 'prop-types'; +import UserProfile from "./userProfile"; +import { useState, useEffect } from "react"; +import { useContext } from "react"; +import UserContext from "../../../Contexts/userContext"; +import PropTypes from "prop-types"; const SearchedProfile = (props) => { const [showConnectionProfile, setShowConnectionProfile] = useState(false); const [showStrangerProfile, setShowStrangerProfile] = useState(false); - const [SelectedUserProfileShowKey, setSelectedUserProfileShowKey] = useState(null); - const [connectionStatus, setConnectionStatus] = useState(''); // New state variable + const [SelectedUserProfileShowKey, setSelectedUserProfileShowKey] = + useState(null); + const [connectionStatus, setConnectionStatus] = useState(""); // New state variable const [dummyState, setDummyState] = useState(0); // Dummy state variable const user = useContext(UserContext); @@ -17,27 +18,29 @@ const SearchedProfile = (props) => { // Pass the chatKey to handleShowProfile setSelectedUserProfileShowKey(chatKey); - if (section === 'connection') { + if (section === "connection") { setShowConnectionProfile(!showConnectionProfile); setShowStrangerProfile(false); - } else if (section === 'stranger') { + } else if (section === "stranger") { setShowStrangerProfile(!showStrangerProfile); setShowConnectionProfile(false); } }; const [strangersSearchedResult, setStrangersSearchedResult] = useState([]); - const [connectionsSearchedResult, setConnectionsSearchedResult] = useState([]); + const [connectionsSearchedResult, setConnectionsSearchedResult] = useState( + [] + ); useEffect(() => { fetchData(); }, []); // Reload the component when connection status changes const fetchData = async () => { - const response = await fetch('http://localhost:3000/connection/search', { - method: 'POST', + const response = await fetch("http://localhost:3000/connection/search", { + method: "POST", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, body: JSON.stringify({ id: user._id, @@ -52,7 +55,7 @@ const SearchedProfile = (props) => { function truncateText(text, maxLength) { if (text.length > maxLength) { - return text.substring(0, maxLength) + '...'; + return text.substring(0, maxLength) + "..."; } return text; } @@ -62,14 +65,18 @@ const SearchedProfile = (props) => { for (let i = 0; i < strangersSearchedResult.length; i++) { const stranger = strangersSearchedResult[i]; - const truncatedDisplayName = truncateText(stranger.displayName, 18) || ''; - const pictureUrl = 'https://example.com/random-image.png'; + const truncatedDisplayName = truncateText(stranger.displayName, 18) || ""; + const pictureUrl = "https://example.com/random-image.png"; const chatKey = `stranger_${stranger._id}`; renderedChats.push(
-
handleShowProfile(chatKey, 'stranger')}> +
handleShowProfile(chatKey, "stranger")} + > Profile

{truncatedDisplayName}

@@ -88,6 +95,7 @@ const SearchedProfile = (props) => { description="Hardcoded description" setConnectionStatus={setConnectionStatus} setDummyState={setDummyState} + setShowProfile={setShowStrangerProfile} /> )}
@@ -105,34 +113,41 @@ const SearchedProfile = (props) => { const connection = connectionsSearchedResult[i].userData; if (!connection) continue; - const truncatedDisplayName = truncateText(connection.displayName, 18) || ''; - const pictureUrl = 'https://example.com/random-image.png'; + const truncatedDisplayName = + truncateText(connection.displayName, 18) || ""; + const pictureUrl = "https://example.com/random-image.png"; const chatKey = `connection_${connection._id}`; renderedChats.push(
-
handleShowProfile(chatKey, 'connection')}> +
handleShowProfile(chatKey, "connection")} + > Profile

{truncatedDisplayName}

@{connection.username}

- {showConnectionProfile && SelectedUserProfileShowKey === chatKey && ( - - )} + {showConnectionProfile && + SelectedUserProfileShowKey === chatKey && ( + + )}
); @@ -142,9 +157,9 @@ const SearchedProfile = (props) => { }; function removeHiddenChatMenu() { - const element = document.querySelector < HTMLElement > '.chat-menu'; + const element = document.querySelector < HTMLElement > ".chat-menu"; if (element) { - element.classList.remove('hidden'); + element.classList.remove("hidden"); } } diff --git a/client/src/pages/Home/SearchComponents/userProfile.jsx b/client/src/pages/Home/SearchComponents/userProfile.jsx index ec85e7c..65dbab6 100644 --- a/client/src/pages/Home/SearchComponents/userProfile.jsx +++ b/client/src/pages/Home/SearchComponents/userProfile.jsx @@ -1,5 +1,5 @@ -import FatButtons from '../../../SmallComponents/FatButtons'; -import PropTypes from 'prop-types'; +import FatButtons from "../../../SmallComponents/FatButtons"; +import PropTypes from "prop-types"; const UserProfile = (props) => { const connectButtonText = ( @@ -17,13 +17,27 @@ const UserProfile = (props) => { return ( <> -
+
- profile picture + profile picture
- +

{props.displayName}

@@ -33,6 +47,12 @@ const UserProfile = (props) => {

{props.description}

+
{ + props.setShowProfile(false); + }} + >
); }; @@ -45,6 +65,7 @@ UserProfile.propTypes = { displayName: PropTypes.string.isRequired, status: PropTypes.string.isRequired, description: PropTypes.string.isRequired, + setShowProfile: PropTypes.func.isRequired, }; export default UserProfile; diff --git a/client/src/pages/pages-styles.scss b/client/src/pages/Home/home.scss similarity index 59% rename from client/src/pages/pages-styles.scss rename to client/src/pages/Home/home.scss index 1e73f84..42ff5fb 100644 --- a/client/src/pages/pages-styles.scss +++ b/client/src/pages/Home/home.scss @@ -1,50 +1,5 @@ -@import '../index.scss'; - -#Auth-Page { - @apply w-screen h-screen text-center p-5 - flex flex-col justify-between items-center; - - > main { - #Auth { - @apply w-screen; - .row { - @apply w-full flex justify-between p-10; - - .Local-Auths, - .Provided-Auths { - @apply flex flex-col w-[600px] gap-5 justify-center items-center p-10 - text-xl; - - button { - @apply w-full flex gap-5 justify-center; - } - } - } - } - - #Auth-Local { - #Local-Backward { - @apply absolute hover:scale-90; - } - - #Local { - @apply w-[400px] - flex flex-col justify-center items-center gap-5; - - > #Submit-Button { - @apply flex justify-between text-xl; - - > svg > path { - fill: black; - } - } - } - } - } -} -.hidden { - display: none; -} +@import "../../index.scss"; +@import "./SearchComponents/search.scss"; #Home { @apply bg-white w-[100vw] h-[100vh] flex flex-row; @@ -178,76 +133,4 @@ } } } -} -#user-profile { - background-color: #d9d9d9; - width: 30rem; - height: 30rem; - position: absolute; - margin-left: 17rem; - transform: translateY(-8rem); - padding-left: 2rem; - padding-right: 2rem; - padding-top: 1rem; - padding-bottom: 1rem; -} - -.user-profile-upper { - display: flex; - flex-direction: row; - width: 100%; - - .user-profile-upper-left { - width: 50%; - display: flex; - justify-content: space-between; - } - .user-profile-upper-right { - width: 50%; - display: flex; - justify-content: flex-end; - align-items: center; - margin-right: 5%; - } - - .user-profile-pic { - height: 6rem; - width: 6rem; - border-radius: 3rem; - } -} - -.user-profile-description { - background-color: #d28080; - margin-top: 1rem; - padding-left: 0.5rem; - height: 60%; -} - -.fat-btn { - background-color: #d28080; - display: flex; - justify-content: center; - align-items: center; - width: 120%; - padding-left: 0.2rem; - padding-right: 0.2rem; - border-radius: 1rem; -} - -@media screen and (max-width: 600px) { - #Login-Page { - > header > h3 { - @apply text-3xl; - } - - #Auth-Local { - @apply p-5 justify-center; - width: 100vw !important; - - #Local-Backward { - left: 5vw; - } - } - } -} +} \ No newline at end of file diff --git a/client/src/pages/Home/index.jsx b/client/src/pages/Home/index.jsx index 3d50ea2..b327ada 100644 --- a/client/src/pages/Home/index.jsx +++ b/client/src/pages/Home/index.jsx @@ -1,7 +1,7 @@ -import LeftBar from './LeftBar'; -import '../pages-styles.scss'; -import MessageMenu from './MessageMenu'; -import { IsSearchingProvider } from '../../Contexts/IsSearchingContext'; +import LeftBar from "./LeftBar"; +import "./home.scss"; +import MessageMenu from "./MessageMenu"; +import { IsSearchingProvider } from "../../Contexts/IsSearchingContext"; const index = () => { return (