Skip to content
Open

Bar2 #10

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b7b3a69
First frank commit
Frank-cntrl Jul 11, 2025
1e01aab
Franks first commit
Frank-cntrl Jul 11, 2025
9edeae2
initial commit
baryaakov555 Jul 11, 2025
499c5ab
Initial commit
AlexNurci Jul 11, 2025
3094294
Made profile/me view
Frank-cntrl Jul 14, 2025
a56cbc4
Added friends page with placeholder photos and css
AlexNurci Jul 14, 2025
d0f19b3
Merge pull request #3 from TabulaRasae/frank
AlexNurci Jul 14, 2025
1ff1273
Merge branch 'main' into alex
AlexNurci Jul 14, 2025
fd94651
Merge pull request #4 from TabulaRasae/alex
Frank-cntrl Jul 14, 2025
2431ada
Solved URL error
AlexNurci Jul 14, 2025
715f518
Merge pull request #5 from TabulaRasae/alex2
Frank-cntrl Jul 14, 2025
f27d16d
Added Poll list and New Poll components, waiting for backend to test …
AlexNurci Jul 14, 2025
df664a4
Merge pull request #6 from TabulaRasae/alex
Frank-cntrl Jul 14, 2025
2124f83
profile/me page calls for data from back end
Frank-cntrl Jul 15, 2025
a021ea5
Made frontend work with backend
AlexNurci Jul 15, 2025
1e4c696
Merge pull request #9 from TabulaRasae/alex
Frank-cntrl Jul 15, 2025
f94d3fd
Merge branch 'main' into frank
Frank-cntrl Jul 15, 2025
190f0ce
Merge pull request #10 from TabulaRasae/frank
AlexNurci Jul 15, 2025
ddb8cce
Connected Poll Creation with Poll List, not fully connected with back…
AlexNurci Jul 15, 2025
d1fe3b1
test
baryaakov555 Jul 15, 2025
07948ae
All polls and poll card
Frank-cntrl Jul 15, 2025
ad0bea6
added an all users page
baryaakov555 Jul 15, 2025
28460cd
added a way to go to a specific user's page when clicking the user ca…
baryaakov555 Jul 15, 2025
4c52371
added the user card component
baryaakov555 Jul 15, 2025
238ec7b
Merge pull request #15 from TabulaRasae/frank
baryaakov555 Jul 15, 2025
c21a112
Merge branch 'main' into bar
baryaakov555 Jul 15, 2025
fe4d826
Merge pull request #17 from TabulaRasae/bar
TabulaRasae Jul 15, 2025
90e6e80
resolved conflict
baryaakov555 Jul 15, 2025
0ae440b
Added Dropdown Menu to the Navbar and added CSS to it
AlexNurci Jul 15, 2025
e82ef6b
Merge branch 'main' into alex
TabulaRasae Jul 15, 2025
8ff8c10
Merge pull request #18 from TabulaRasae/alex
TabulaRasae Jul 15, 2025
5f439f4
Franks work 07/15
Frank-cntrl Jul 15, 2025
debe439
Connected Poll Creation with Poll List, not fully connected with back…
AlexNurci Jul 15, 2025
ec57723
Added Dropdown Menu to the Navbar and added CSS to it
AlexNurci Jul 15, 2025
d5d49bd
test
baryaakov555 Jul 15, 2025
d159812
added a way to go to a specific user's page when clicking the user ca…
baryaakov555 Jul 15, 2025
5c52043
added the user card component
baryaakov555 Jul 15, 2025
8169ab8
New poll form, and poll list, and poll cards
Frank-cntrl Jul 15, 2025
5fd1b8a
Added space
Frank-cntrl Jul 15, 2025
723a061
Merge branch 'main' into frank
Frank-cntrl Jul 15, 2025
e530b8f
Merge pull request #20 from TabulaRasae/frank
TabulaRasae Jul 15, 2025
6a441d1
Minor bug fix
Frank-cntrl Jul 15, 2025
54aee49
Single poll view
Frank-cntrl Jul 16, 2025
1bb6fb8
Merge branch 'main' into frank
Frank-cntrl Jul 16, 2025
53e01dc
Merge pull request #25 from TabulaRasae/frank
Frank-cntrl Jul 16, 2025
07483b6
DO NOT MERGE, added search options to users and friends page, also ad…
baryaakov555 Jul 16, 2025
5ed66b4
pulled from main
baryaakov555 Jul 16, 2025
4daed26
added polls created by the user to the user card
baryaakov555 Jul 16, 2025
227fc68
Merge pull request #27 from TabulaRasae/bar
Frank-cntrl Jul 16, 2025
315e223
Frank
Frank-cntrl Jul 16, 2025
390e5ba
Merge pull request #28 from TabulaRasae/frank
Frank-cntrl Jul 16, 2025
3fcacc3
Minor bug fixes
Frank-cntrl Jul 17, 2025
a5213f9
Created voting form
Frank-cntrl Jul 17, 2025
32eb449
Merge pull request #29 from TabulaRasae/frank
TabulaRasae Jul 17, 2025
5facbd0
Published Polls have a chart with current results
TabulaRasae Jul 18, 2025
c40be6e
Styled the current winner component
TabulaRasae Jul 18, 2025
f920465
Merge pull request #30 from TabulaRasae/IRVResults
Frank-cntrl Jul 18, 2025
1bb088f
Draft poll progress
AlexNurci Jul 18, 2025
35012d5
Fixed refresh issue
Frank-cntrl Jul 18, 2025
f6ee911
Merge pull request #32 from TabulaRasae/frank
baryaakov555 Jul 18, 2025
703ea44
Added anonymous voting option functionality
Frank-cntrl Jul 18, 2025
0f61868
Merge pull request #33 from TabulaRasae/frank
Frank-cntrl Jul 18, 2025
b5e63b5
Logged out users have a poll list butotn on their nav bar
Frank-cntrl Jul 18, 2025
9239603
Merge pull request #34 from TabulaRasae/frank
Frank-cntrl Jul 18, 2025
adf486e
Draft Poll
AlexNurci Jul 21, 2025
94179aa
Added Draft Poll and Duplicate Poll
AlexNurci Jul 21, 2025
b081653
Merge branch 'main' into alex
Frank-cntrl Jul 21, 2025
c2e337b
Merge pull request #35 from TabulaRasae/alex
Frank-cntrl Jul 21, 2025
11f15b4
.
baryaakov555 Jul 21, 2025
3b31d9e
Merge branch 'main' into bar
Frank-cntrl Jul 21, 2025
e7ba326
Merge pull request #36 from TabulaRasae/bar
Frank-cntrl Jul 21, 2025
916e85a
Latest changes added, everything is working
AlexNurci Jul 21, 2025
cac5c2e
Merge pull request #37 from TabulaRasae/alex
Frank-cntrl Jul 21, 2025
20e221f
.
baryaakov555 Jul 21, 2025
4cc32be
Added home and landing pages
baryaakov555 Jul 21, 2025
6d79400
Added home and landing pages
baryaakov555 Jul 21, 2025
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
1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="favicon.ico" />
<base href="/" />
<title>Capstone 1</title>
<script defer src="main.js"></script>
</head>
Expand Down
34 changes: 32 additions & 2 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
"@babel/preset-react": "^7.27.1",
"axios": "^1.10.0",
"babel-loader": "^10.0.0",
"chart.js": "^4.5.0",
"dotenv": "^17.1.0",
"react": "^19.1.0",
"react-chartjs-2": "^5.3.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.6.3",
"webpack": "^5.99.9",
Expand Down
60 changes: 53 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,66 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, use } from "react";
import { createRoot } from "react-dom/client";
import axios from "axios";
import "./AppStyles.css";
import NavBar from "./components/NavBar";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { API_URL } from "./shared";
import { useNavigate } from "react-router-dom";

import Login from "./components/Login";
import Signup from "./components/Signup";
import Home from "./components/Home";
import NotFound from "./components/NotFound";
import { API_URL } from "./shared";
import FriendsPage from "./components/FriendsPage";
import Friends from "./components/Friends";
import Profile from "./components/Profile";
import NewPoll from "./components/NewPoll";
import PollList from "./components/PollList";
import UsersPage from "./components/UsersPage";
import UserCard from "./components/UserCard";
import DraftPoll from "./components/DraftPoll";
import PollDetails from "./components/PollDetails";
import AboutUs from "./components/AboutUs";

//Alex branch
const App = () => {
const [user, setUser] = useState(null);
const [polls, setPolls] = useState(null);
const [loading, setLoading] = useState(true);

const fetchPolls = async () => {
try {
const response = await axios.get(`${API_URL}/api/polls`);
setPolls(response.data);
} catch {
console.log("failed to get polls");
setPolls([]);
}
};

const checkAuth = async () => {
try {
const response = await axios.get(`${API_URL}/auth/me`, {
withCredentials: true,
});
setUser(response.data.user);
} catch {
console.log("Not authenticated");
setUser(response.data);
} catch (error) {
console.error("Auth check failed:", error);
setUser(null);
} finally {
setLoading(false);
}
};

// Check authentication status on app load
useEffect(() => {
checkAuth();
fetchPolls();
}, []);

const navigate = useNavigate();

const handleLogout = async () => {
try {
// Logout from our backend
await axios.post(
`${API_URL}/auth/logout`,
{},
Expand All @@ -46,14 +74,32 @@ const App = () => {
}
};

console.log(user);

return (
<div>
<NavBar user={user} onLogout={handleLogout} />
<div className="app">
<Routes>
<Route path="/login" element={<Login setUser={setUser} />} />
<Route path="/signup" element={<Signup setUser={setUser} />} />
<Route path="/friends-page" element={<FriendsPage />} />
<Route exact path="/" element={<Home />} />
<Route exact path="/friends" element={<Friends />} />
<Route exact path="new-poll" element={<NewPoll user={user} />} />
<Route exact path="/users" element={<UsersPage />} />
<Route path="/users/:id" element={<UserCard />} />
<Route path="/edit-draft" element={<DraftPoll user={user} />} />
<Route path="/edit-draft/:id" element={<DraftPoll user={user} />} />
<Route path="/AboutUs" element={<AboutUs />} />

<Route
exact
path="/me"
element={<Profile user={user} authLoading={loading} />}
/>
<Route exact path="poll-list" element={<PollList polls={polls} />} />
<Route path="/polls/:id" element={<PollDetails user={user} />} />
<Route path="*" element={<NotFound />} />
</Routes>
</div>
Expand Down
37 changes: 37 additions & 0 deletions src/components/AboutUs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import "./CSS/AboutUs.css";

const AboutUs = () => {
return (
<div className="about-container">
<section>
<h1>About Us</h1>
<p className="styled-paragraph">
This platform was built with a simple goal: to make decision-making
fair, fast, and accessible to everyone.
</p>
<p className="styled-paragraph">
Whether you're planning a night out, organizing an event, or just
settling a debate, our ranked-choice poll system ensures the results
reflect the group's true consensus.
</p>
</section>

<section>
<h2>Why Ranked-Choice?</h2>
<p className="styled-paragraph">
Traditional polls can be skewed by vote splitting or tactical voting.
With ranked-choice, every vote counts more fairly. Voters rank the
options in order of preference, and a winner is chosen through a
series of instant-runoff rounds.
</p>
<p className="styled-paragraph">
This method leads to more satisfying outcomes because it rewards broad
support, not just a passionate minority.
</p>
</section>
</div>
);
};

export default AboutUs;
44 changes: 44 additions & 0 deletions src/components/CSS/AboutUs.CSS
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* AboutUs.css */

.about-container {
padding: 60px 20px;
max-width: 1000px;
margin: 0 auto;
color: #e2e8f0;
background-color: #0f111a;
font-family: "Segoe UI", Roboto, sans-serif;
}

.about-container h1,
.about-container h2 {
color: #ffffff;
margin-bottom: 20px;
}

.about-container p {
color: #cbd5e1;
font-size: 17px;
line-height: 1.7;
margin-bottom: 24px;
max-width: 800px;
}

.about-container ul {
list-style-type: disc;
padding-left: 20px;
margin-bottom: 40px;
}

.about-container li {
font-size: 16px;
margin-bottom: 12px;
}

.about-container a {
color: #818cf8;
text-decoration: underline;
}

.about-container a:hover {
color: #6366f1;
}
File renamed without changes.
37 changes: 37 additions & 0 deletions src/components/CSS/Dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.dropdown {
position: relative;
display: inline-block;
}

.dropdown-toggle {
padding: 8px 14px;
font-size: 12px;
cursor: pointer;
border: 1px solid #cccccc;
border-radius: 4px;
width: 100%;
white-space: nowrap;
}

.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
border: 1px solid #cccccc;
border-radius: 4px;
list-style: none;
padding: 0;
margin: 4px 0 0 0;
min-width: 100%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
}

.dropdown:hover .dropdown-menu {
display: block;
}

.dropdown-item {
white-space: nowrap;
}
Loading