Skip to content

Commit

Permalink
Changed route to /conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
JackWaz28 committed Feb 14, 2022
1 parent b63df51 commit 0d12213
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 61 deletions.
6 changes: 1 addition & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import AllProjects from './components/Dashboard/AllProjects';
import SingleProject from './components/Dashboard/SingleProject';
import EditProfile from './components/Users/EditProfile';
import FetchProfiles from './components/Home/FetchProfiles';
import MessagingPage from './components/Messaging/MessagingPage'
import SingleConversation from './components/Messaging/SingleConversation'
import AdminPanel from './components/admin/adminPanel';
import GoogleCalendar from './components/Calendar/GoogleCalendar';
Expand Down Expand Up @@ -93,14 +92,11 @@ function App() {
<Route path="/transaction">
<Transactions />
</Route>
<Route path="/messages">
<MessagingPage />
</Route>
<Route path="/conversations/:id">
{!user && <Redirect to="/login" />}
{user && <SingleConversation />}
</Route>
<Route path="/allconversations">
<Route exact path="/conversations">
{!user && <Redirect to="/login" />}
{user && <AllConversations />}
</Route>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dashboard/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export default function Sidebar() {
<span className="px-2 py-0.5 ml-auto text-xs font-medium tracking-wide text-indigo-500 bg-indigo-50 rounded-full">New</span>
</p>
</Link>
<Link to="/allconversations">
<Link to="/conversations">
<p href="#" className="relative flex flex-row items-center h-11 focus:outline-none hover:bg-gray-50 text-gray-600 hover:text-gray-800 border-l-4 border-transparent hover:border-indigo-500 pr-6">
<span className="inline-flex justify-center items-center ml-4">
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"></path></svg>
</span>
<span className="ml-2 text-sm tracking-wide truncate">Start Conversations</span>
<span className="ml-2 text-sm tracking-wide truncate">Conversations</span>
</p>
</Link>
<Link to="/calendar">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Messaging/AllMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function AllMessages({ conversation }) {
<div className="bg-blue-100 h-5/6 w-3/4 shadow-xl rounded-xl flex-col overflow overflow-auto">
<div className="flex flex-row justify-between p-6">
<h4 className="text-3xl font-bold ml-12 mt-4 "> {conversation.title} with: {conversation.userNames.find(elem => elem !== user.displayName)}</h4>
<Link to="/allconversations">
<Link to="/conversations">
<button type="submit" className=" border border-blue-600 rounded-full font-bold text-blue-600 px-4 py-3 transition duration-300 ease-in-out hover:bg-blue-600 m-3">
All Conversations
<svg xmlns="http://www.w3.org/2000/svg" class="inline ml-2 w-6 stroke-current text-white stroke-2" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12" /><polyline points="12 5 19 12 12 19" /></svg>
Expand Down
48 changes: 0 additions & 48 deletions src/components/Messaging/MessagingPage.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/Users/PublicProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const PublicProfile = () => {
history.push("/signin")
}else if (finalCheck === true){
alert("You already have a conversation with this user")
history.push("/allconversations")
history.push("/conversations")
}
};

const handleSubmit = async (e) => {
e.preventDefault();
if(finalCheck === true){
alert("You already have a conversation with this user")
history.push("/allconversations")
history.push("/conversations")
}
else{
const firstMessage = {
Expand All @@ -59,7 +59,7 @@ const PublicProfile = () => {
title: newTitle,
};
await conversationsRef.add(conversationToCreate);
history.push("/allconversations")
history.push("/conversations")
}

};
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/useSendMessage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {firebase, projectFirestore, projectAuth} from '../firebase/fbConfig';
import { useState, useEffect } from 'react'
import { useAuthContext } from './useAuthContext'

// const auth = firebase.auth();
// const firestore = firebase.firestore();
Expand Down

0 comments on commit 0d12213

Please sign in to comment.