Skip to content

Commit

Permalink
Chats Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sonuku092 committed Feb 22, 2024
1 parent bd8c48e commit d88b844
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 86 deletions.
38 changes: 0 additions & 38 deletions frontend/src/App.css

This file was deleted.

3 changes: 1 addition & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './App.css';
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

Expand All @@ -11,7 +10,7 @@ import Protected from './components/Protected';
function App() {

return (
<div className="App">
<div>
<Router>
<Routes>
<Route path="/login" element={<Login/>} />
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/App.test.js

This file was deleted.

74 changes: 55 additions & 19 deletions frontend/src/components/Chats/Chats.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import React from 'react'
import { useState, useEffect } from 'react';
import { signOut } from 'firebase/auth';
import { auth } from '../../firebase';

import React, { useState, useEffect } from "react";
import { signOut } from "firebase/auth";
import { auth } from "../../firebase";

function Chats(props) {

const [userName, setUserName] = useState("");
const [showList, setShowList] = useState(true);
const [showVoice, setShowVoice] = useState(false);

useEffect(()=>{
setUserName(localStorage.getItem("userName"));
},[userName]);

const handleSignout = () => {
useEffect(() => {
setUserName(localStorage.getItem("userName"));
}, []);

const handleSignout = () => {
localStorage.removeItem("token");
localStorage.removeItem("userName");
window.location.reload();

signOut(auth)
.then(() => {
console.log("Signout successful");
Expand All @@ -27,14 +25,52 @@ function Chats(props) {
});
};

const toggleList = () => {
setShowList(!showList);
};

const toggleVoice = () => {
setShowVoice(!showVoice);
};

return (
<div>
<h2>
{userName ? `Welcome - ${userName}` : "Please Login"}
</h2>
<button onClick={handleSignout}>Logout</button>
<div className="h-screen">
<div className="w-full px-14 py-1 bg-slate-400">
<div className="flex gap-1">
<div className="flex-none px-10 max-h-max bg-slate-50 rounded-sm py-2 items-center">
<h1>Chatbot</h1>
</div>
<div className="flex-grow max-h-max bg-slate-50 rounded-sm py-2">
<button onClick={handleSignout}>Logout</button>
</div>
<div className="flex w-auto pl-8 py-1 max-h-max bg-slate-50 rounded-sm items-center">
<h2>{userName ? `Welcome - ${userName}` : "Please Login"}</h2>
<div className="w-6 h-6 rounded-[50%] border-[1px] mx-2 border-black"></div>
</div>
</div>
</div>

<div className="w-full h-[93vh] bg-green-400 flex">
<div className={`w-${showList ? '1/5' : '0'} border-2 transition-all duration-500 overflow-hidden`}>
<div className="border-b-2 pb-2">
{showList && <button onClick={toggleList}>Toggle List</button>}
List
</div>
</div>

<div className="w-full border-2">
<h1>Main Content</h1>
<button onClick={toggleList}>Toggle List</button>
<button onClick={toggleVoice}>Toggle Voice</button>
</div>

<div className={`w-${showVoice ? '1/5' : '0'} md:block border-2 transition-all duration-500 overflow-hidden`}>
{showVoice && <button onClick={toggleVoice}>Toggle Voice</button>}
Voice
</div>
</div>
)
</div>
);
}

export default Chats
export default Chats;
Empty file.
2 changes: 1 addition & 1 deletion frontend/src/components/Signup/Signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Signup() {
if (token) {
navigate("/");
}
}, []);
});

const [errorMsg, setErrorMsg] = useState("");
const [submitButtonDisabled, setSubmitButtonDisabled] = useState(false);
Expand Down
59 changes: 45 additions & 14 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--color-primary: #ff0000;
--color-secondary: #00ff00;
--color-tertiary: #0000ff;
--color-text: #000000;
--color-background: #ffffff;
--color-border: #000000;
--color-link: #0000ff;
--color-link-hover: #ff0000;
--color-link-visited: #800080;
--color-link-active: #00ff00;
--color-link-focus: #ffff00;
--color-link-disabled: #808080;
--color-link-text: #ffffff;
--color-link-text-hover: #ffffff;
--color-link-text-visited: #ffffff;
--color-link-text-active: #ffffff;

/* code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
} */
--blue-gradient: linear-gradient(
144.39deg,
#def9fa 0.89%,
#bef3f5 17.23%,
#9dedf0 42.04%,
#7de7eb 55.12%,
#5ce1e6 71.54%,
#33bbcf 100%
);

--red-gradient: linear-gradient(
144.39deg,
#f9d3d3 0.89%,
#f5b7b7 17.23%,
#f09b9b 42.04%,
#eb7f7f 55.12%,
#e66363 71.54%,
#cf3333 100%
);
--card-shadow: 0px 20px 100px -10px rgba(225, 229, 248, 0.1);
--card-shadow1: 0px 0px 10px 2px rgba(0, 229, 255, 0.129);


}
3 changes: 0 additions & 3 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ root.render(
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
2 changes: 1 addition & 1 deletion frontend/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [],
content: ["./src/**/*.{js,jsx,ts,tsx}",],
theme: {
extend: {},
},
Expand Down

0 comments on commit d88b844

Please sign in to comment.