Skip to content
Open
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
32 changes: 16 additions & 16 deletions src/pages/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ const TopRightIcon = styled(FaUser)`
`;

const Dashboard = ({ user }) => {
const navigate = useNavigate();
const navigate = useNavigate();

return (
<Container>
<Sidebar>
<SidebarItem onClick={() => navigate("/profile")}>User Profile</SidebarItem>
<SidebarItem onClick={() => navigate("/profile#scores")}>Scores</SidebarItem>
<SidebarItem onClick={() => navigate("/upload")}>Upload Resume</SidebarItem>
<SidebarItem>Coordinator Dashboard</SidebarItem>
</Sidebar>
<MainContent>
<h2>Welcome, {user?.email.toUpperCase()}</h2>
<p>Select an option from the sidebar.</p>
</MainContent>
<TopRightIcon onClick={() => navigate("/profile")} />
</Container>
);
return (
<Container>
<Sidebar>
<SidebarItem onClick={() => navigate("/profile")}>User Profile</SidebarItem>
<SidebarItem onClick={() => navigate("/profile#scores")}>Scores</SidebarItem>
<SidebarItem onClick={() => navigate("/upload")}>Upload Resume</SidebarItem>
<SidebarItem>Coordinator Dashboard</SidebarItem>
</Sidebar>
<MainContent>
<h2>Welcome, {user?.email.toUpperCase()}</h2>
<p>Select an option from the sidebar.</p>
</MainContent>
<TopRightIcon onClick={() => navigate("/profile")} />
</Container>
);
};

export default Dashboard;
72 changes: 36 additions & 36 deletions src/pages/SignUp.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from "react";
import { auth, sendSignInLinkToEmail } from "../firebase";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { theme } from "../styles/theme";


const Container = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -49,45 +49,45 @@ const Button = styled.button`
`;

const SignUp = () => {
const [rollNumber, setRollNumber] = useState("");
const [name, setName] = useState("");
const [loading, setLoading] = useState(false);
//const navigate = useNavigate();

const handleSignUp = async () => {
if (!rollNumber || !name) {
alert("Please enter your Roll Number and Name");
return;
}
const [rollNumber, setRollNumber] = useState("");
const [name, setName] = useState("");
const [loading, setLoading] = useState(false);
//const navigate = useNavigate();

const email = `${rollNumber}@nitrkl.ac.in`;
const actionCodeSettings = {
url: "http://localhost:5173/login",
handleCodeInApp: true,
};
const handleSignUp = async () => {
if (!rollNumber || !name) {
alert("Please enter your Roll Number and Name");
return;
}

setLoading(true);
try {
await sendSignInLinkToEmail(auth, email, actionCodeSettings);
window.localStorage.setItem("emailForSignIn", email);
alert(`Verification link sent to ${email}. Check your email.`);
} catch (error) {
console.error("Error sending email:", error);
alert("Failed to send verification link.");
}
setLoading(false);
const email = `${rollNumber}@nitrkl.ac.in`;
const actionCodeSettings = {
url: "http://localhost:5173/login",
handleCodeInApp: true,
};

return (
<Container>
<Card>
<h2>Sign Up</h2>
<Input type="text" placeholder="Roll Number" value={rollNumber} onChange={(e) => setRollNumber(e.target.value)} />
<Input type="text" placeholder="Name" value={name} onChange={(e) => setName(e.target.value)} />
<Button onClick={handleSignUp} disabled={loading}>{loading ? "Sending..." : "Sign Up"}</Button>
</Card>
</Container>
);
setLoading(true);
try {
await sendSignInLinkToEmail(auth, email, actionCodeSettings);
window.localStorage.setItem("emailForSignIn", email);
alert(`Verification link sent to ${email}. Check your email.`);
} catch (error) {
console.error("Error sending email:", error);
alert("Failed to send verification link.");
}
setLoading(false);
};

return (
<Container>
<Card>
<h2>Sign Up</h2>
<Input type="text" placeholder="Roll Number" value={rollNumber} onChange={(e) => setRollNumber(e.target.value)} />
<Input type="text" placeholder="Name" value={name} onChange={(e) => setName(e.target.value)} />
<Button onClick={handleSignUp} disabled={loading}>{loading ? "Sending..." : "Sign Up"}</Button>
</Card>
</Container>
);
};

export default SignUp;