Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
26 changes: 6 additions & 20 deletions client/src/components/BuddyMatcher.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import { ThreeDots } from 'react-loading-icons';
import { PiPlugsLight } from 'react-icons/pi';
//import { PiPlugsLight } from 'react-icons/pi';
import { connectWithId, socket } from 'src/lib/socketConnection';

import Anonymous from 'components/Anonymous';
import ReconnectBanner from 'components/ReconnectBanner';
import { useAuth } from 'src/context/AuthContext';
import { useChat } from 'src/context/ChatContext';
import { useNavigate, Link } from 'react-router-dom';
//import { useNavigate, Link } from 'react-router-dom';
import { useNotification } from 'src/lib/notification';
import { useApp } from 'src/context/AppContext';
import { createBrowserNotification } from 'src/lib/browserNotification';
Expand All @@ -23,6 +24,7 @@ import {
NEW_EVENT_STOP_SEARCH,
NEW_EVENT_STOP_SEARCH_SUCCESS,
} from '../../../constants.json';
import { useNavigate } from 'react-router-dom';

const stoppingSearchLoadingText = <p>Stopping the search</p>;
const BuddyMatcher = () => {
Expand Down Expand Up @@ -258,28 +260,12 @@ const BuddyMatcher = () => {
)}
</div>
) : disconnected ? (
<div className="flex flex-col w-full justify-center items-center h-full bg-primary">
<PiPlugsLight className="text-secondary text-8xl" />
<p className="text-lg text-center text-white">Sorry, it seems you&apos;re not connected</p>
<div className="flex flex-col sm:flex-row gap-1 sm:gap-4 text-[1.5em] mt-4 font-medium items-center">
<button
onClick={handleReconnect}
className={
'hover:no-underline hover:text-black text-black w-[8em] h-[2.3em] rounded-[30px] bg-[#FF9F1C] flex flex-col items-center justify-center'
}
>
Try again
</button>
<Link to="/" className="underline text-white hover:text-white text-lg">
Return Home
</Link>
</div>
</div>
<ReconnectBanner handleReconnect={handleReconnect}/>
//Changes made here with moviing reconnector to another component.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment

) : (
<Anonymous
onChatClosed={startNewSearch}
/>
);
};

export default BuddyMatcher;
33 changes: 33 additions & 0 deletions client/src/components/ReconnectBanner.jsx
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think you ran prettier for this file, do you have prettier installed on your VSCode(it should automatically do this on each save)

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import PropTypes from 'prop-types'; // Import the PropTypes package
import { PiPlugsLight } from 'react-icons/pi';
import { Link } from 'react-router-dom';
const ReconnectBanner = ({ handleReconnect }) => {
return (
<div className="flex flex-col w-full justify-center items-center h-full bg-primary">
<PiPlugsLight className="text-secondary text-8xl" />
<p className="text-lg text-center text-white">Sorry, it seems you&apos;re not connected</p>
<div className="flex flex-col sm:flex-row gap-1 sm:gap-4 text-[1.5em] mt-4 font-medium items-center">
<button
onClick={handleReconnect}
className={
'hover:no-underline hover:text-black text-black w-[8em] h-[2.3em] rounded-[30px] bg-[#FF9F1C] flex flex-col items-center justify-center'
}
>
Try again
</button>
<Link
to="/"
className="underline text-white hover:text-white text-lg"
>
Return Home
</Link>
</div>
</div>
);
};
// Define the expected prop types
ReconnectBanner.propTypes = {
handleReconnect: PropTypes.func.isRequired,
};
export default ReconnectBanner;
6 changes: 6 additions & 0 deletions package-lock.json
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still need to remove this

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading