Skip to content
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
Binary file added public/CCS_Bulb.ico
Binary file not shown.
Binary file added public/CCS_Bulb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="\CCS_Bulb.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="\CCS_Bulb.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
12 changes: 10 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ body::-webkit-scrollbar-thumb:hover {

/* UsernameEntry styles *****************************************/
body.username-entry-body {
background-color: #000000; /* Black background for the body */
background-color: black; /* Black background for the body */
color: var(--text-color); /* White text color */
display: flex;
justify-content: center;
Expand Down Expand Up @@ -722,9 +722,17 @@ body.username-entry-body {
flex: 1; /* Take up remaining space */

}

@media (max-width: 1024px) {
.outer-container{
width: 90%;
}
}
/* Adjustments for smaller screens */
@media (max-width: 768px) {
.outer-container{
width: 82%;
margin-top: 20rem;
}
.left {
flex-direction: column;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function App() {
handleLogin();
}, []);

console.log('Is Authenticated:', isAuthenticated);
// console.log('Is Authenticated:', isAuthenticated);

return (
<Router>
Expand Down
18 changes: 9 additions & 9 deletions src/Components/AuthVerify.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AuthVerify = ({ onVerify, setIsNewUser, setIsAuthenticated }) => {
const jwtToken = query.get('token');

if (jwtToken) {
console.log('JWT Token:', jwtToken);
// console.log('JWT Token:', jwtToken);

const requestBody = { token: jwtToken };

Expand All @@ -28,8 +28,8 @@ const AuthVerify = ({ onVerify, setIsNewUser, setIsAuthenticated }) => {
const data = await response.json();
const status = response.status;

console.log('Response Status:', status);
console.log('Response Data:', data);
/* console.log('Response Status:', status);
console.log('Response Data:', data); */

if (data.leetcode === false) {
setIsNewUser(true);
Expand All @@ -42,27 +42,27 @@ const AuthVerify = ({ onVerify, setIsNewUser, setIsAuthenticated }) => {
};
setIsAuthenticated(true); // Set isAuthenticated to true
navigate('/username', { state: { jwtToken, userData, token: data.token } });
console.log('Navigated to /username');
// console.log('Navigated to /username');
} else if (status === 200 && data.token) {
localStorage.setItem('token', data.token);
console.log('Token stored in localStorage:', localStorage.getItem('token'));
// console.log('Token stored in localStorage:', localStorage.getItem('token'));
onVerify();
setIsAuthenticated(true); // Set isAuthenticated to true
navigate('/profile');
console.log('Navigated to /profile');
// console.log('Navigated to /profile');
} else {
console.error(`Unexpected response: ${JSON.stringify(data)}`);
navigate('/login');
console.log('Navigated to /login1');
// console.log('Navigated to /login1');
}
} catch (error) {
console.error('Error checking user:', error);
navigate('/login');
console.log('Navigated to /login2');
// console.log('Navigated to /login2');
}
} else {
navigate('/login');
console.log('Navigated to /login3');
// console.log('Navigated to /login3');
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/Components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function Navbar() {
const token = localStorage.getItem('token');

try {
console.log('Stored Token:', token);
// console.log('Stored Token:', token);

const response = await fetch(API_URL + '/logout/', {
method: 'GET',
Expand All @@ -29,7 +29,7 @@ export default function Navbar() {
}

const data = await response.json();
console.log('Logout Response:', data);
// console.log('Logout Response:', data);

if (data.message.toLowerCase() === 'logged out successfully') {
localStorage.removeItem('token');
Expand Down
20 changes: 10 additions & 10 deletions src/Components/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const Profile = () => {

useEffect(() => {
const fetchProfile = async () => {
console.log('Fetching profile...');
// console.log('Fetching profile...');
const token = localStorage.getItem('token');
console.log('Token:', token);
// console.log('Token:', token);
if (!token) {
setError('Token is missing');
setLoading(false);
Expand All @@ -40,19 +40,19 @@ const Profile = () => {
}

const data = await response.json();
console.log('Profile response received:', data);
// console.log('Profile response received:', data);
setProfile(data);
} catch (err) {
console.error('Error occurred:', err);
setError(err.message);
} finally {
setLoading(false);
console.log('Loading state set to false');
// console.log('Loading state set to false');
}
};

const fetchQuestions = async () => {
console.log('Fetching questions...');
// console.log('Fetching questions...');
const token = localStorage.getItem('token');
if (!token) {
setError('Token is missing');
Expand All @@ -73,7 +73,7 @@ const Profile = () => {
}

const data = await response.json();
console.log('Questions response received:', data);
// console.log('Questions response received:', data);
setQuestions(data);
} catch (err) {
console.error('Error occurred:', err);
Expand All @@ -90,7 +90,7 @@ const Profile = () => {
};

if (loading) {
console.log('Loading...');
// console.log('Loading...');
return <div className="loading">Loading...</div>;
}

Expand All @@ -100,12 +100,12 @@ const Profile = () => {
}

if (!profile) {
console.log('No profile data available');
// console.log('No profile data available');
return <div className="no-data">No profile data available</div>;
}

console.log('Rendering profile:', profile);
console.log('Rendering questions:', questions);
/* console.log('Rendering profile:', profile);
console.log('Rendering questions:', questions); */

return (
<div className="profile-container">
Expand Down
4 changes: 2 additions & 2 deletions src/Components/UsernameEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ const UsernameEntry = ({ setIsAuthenticated }) => {
}

const registerData = await registerResponse.json();
console.log('Registration successful. Redirecting to profile...');
// console.log('Registration successful. Redirecting to profile...');

await localStorage.setItem('token', token);
const storedToken = localStorage.getItem('token');
console.log('Stored token:', storedToken);
// console.log('Stored token:', storedToken);

setIsAuthenticated(true);
navigate('/profile');
Expand Down