(isVotePath ? updatePollColor() : clickHandle())}
+ >
{option.title}
diff --git a/prediction-polls/frontend/src/Components/Sidebar/Sidebar.module.css b/prediction-polls/frontend/src/Components/Sidebar/Sidebar.module.css
index 6885b0a8..f4875e15 100644
--- a/prediction-polls/frontend/src/Components/Sidebar/Sidebar.module.css
+++ b/prediction-polls/frontend/src/Components/Sidebar/Sidebar.module.css
@@ -58,7 +58,7 @@
border: none;
}
-@media (max-width: 640px) {
+@media (max-width: 768px) {
.sidebar {
display: none;
}
diff --git a/prediction-polls/frontend/src/Components/Sidebar/index.jsx b/prediction-polls/frontend/src/Components/Sidebar/index.jsx
index 1895c275..9579b2b8 100644
--- a/prediction-polls/frontend/src/Components/Sidebar/index.jsx
+++ b/prediction-polls/frontend/src/Components/Sidebar/index.jsx
@@ -14,14 +14,14 @@ import logout from "../../api/requests/logout.jsx";
const menuData = [
- { key: "Profile", Icon: ProfileIcon },
- { key: "Feed", Icon: FeedIcon },
- { key: "Vote", Icon: VoteIcon },
- { key: "Create", Icon: CreateIcon },
- { key: "Moderation", Icon: ModerationIcon },
- { key: "Leaderboard", Icon: LeaderboardIcon },
- { key: "Notifications", Icon: NotificationsIcon },
- { key: "Settings", Icon: SettingsIcon },
+ { key: "Profile", Icon: ProfileIcon, to:"profile/can.gezer" },
+ { key: "Feed", Icon: FeedIcon, to:"feed" },
+ { key: "Vote", Icon: VoteIcon, to:"vote" },
+ { key: "Create", Icon: CreateIcon , to:"create"},
+ { key: "Moderation", Icon: ModerationIcon , to:"moderation"},
+ { key: "Leaderboard", Icon: LeaderboardIcon, to:"leaderboard" },
+ { key: "Notifications", Icon: NotificationsIcon, to:"notifications" },
+ { key: "Settings", Icon: SettingsIcon, to:"settings" },
];
const SidebarMenuItem = ({
@@ -72,7 +72,7 @@ const Sidebar = ({ currentPage, handlePageChange }) => {
pageKey={item.key}
Icon={item.Icon}
navigate={navigate}
- to={`/${item.key.toLowerCase()}`}
+ to={`/${item.to}`}
/>
))}
diff --git a/prediction-polls/frontend/src/MockData/LeaderboardList.json b/prediction-polls/frontend/src/MockData/LeaderboardList.json
new file mode 100644
index 00000000..7b9979dd
--- /dev/null
+++ b/prediction-polls/frontend/src/MockData/LeaderboardList.json
@@ -0,0 +1,11 @@
+{
+ "e-sport": [
+ { "point": 420, "username": "sofistik" },
+ { "point": 385, "username": "artemis" },
+ { "point": 360, "username": "afrandes" },
+ { "point": 340, "username": "anakavun" },
+ { "point": 325, "username": "otaliptus" },
+ { "point": 290, "username": "marcholpin" },
+ { "point": 289, "username": "trella" }
+ ]
+}
diff --git a/prediction-polls/frontend/src/MockData/PollData.json b/prediction-polls/frontend/src/MockData/PollData.json
index 1c00355d..68175d0e 100644
--- a/prediction-polls/frontend/src/MockData/PollData.json
+++ b/prediction-polls/frontend/src/MockData/PollData.json
@@ -6,6 +6,7 @@
"tags": ["Color", "Favorite"],
"creatorName": "Zehra Kaya",
"creatorId": 6327697326,
+ "creatorUsername": "zehra.kaya",
"creatorImage": "https://www.w3schools.com/howto/img_lights_wide.jpg",
"isCustomPoll": false,
"options": [
@@ -53,6 +54,7 @@
"question": "When is your birthday?",
"tags": ["Birthday", "Personal"],
"creatorName": "Can Gezer",
+ "creatorUsername": "can.gezer",
"creatorId": 6578493045,
"creatorImage": "https://www.w3schools.com/howto/img_woods_wide.jpg",
"isCustomPoll": true,
@@ -76,6 +78,7 @@
"question": "How many books have you read this year?",
"tags": ["Reading", "Hobby"],
"creatorName": "Pelin Kaya",
+ "creatorUsername": "pelin.kaya",
"creatorId": 9472638473,
"creatorImage": "https://www.w3schools.com/howto/img_mountains_wide.jpg",
"isCustomPoll": true,
diff --git a/prediction-polls/frontend/src/MockData/Users.json b/prediction-polls/frontend/src/MockData/Users.json
new file mode 100644
index 00000000..94ceb833
--- /dev/null
+++ b/prediction-polls/frontend/src/MockData/Users.json
@@ -0,0 +1,29 @@
+
+{
+ "userList":[
+ {
+ "username":"can.gezer",
+ "name":"Can Gezer",
+ "about":"I am a software developer",
+ "image":"https://s3-alpha-sig.figma.com/img/fc6e/c509/c0b74981996d9829fa6111c5cbdc49af?Expires=1701043200&Signature=ZmoY99LI1VB2MqoReZhzDo479RnGlhHvGuFp4B46c0Tf4agDDcldUu2QVH2c4-n9zeCF53l4--4fscf1fsHuRe2qImIOSeA~e-KptBctEpDCevuW2ny148usMFDtMOBGt0vmCujJVcP0-zQMgfRqSil90q6nBF6mvpXae894TM6vV5yoYH4kc-fepYEcuf5aNVwwb6jU62OZYkI43nZtp4C77S~B3PWsumQcmQCOhu0cHvt9LMDSciH8u5NchF0Mm3GtLGFEuHGgAWWHi81lr82-gp7CPcKmxl1bUjtRtdveHQMOJLnoGZ12T4VhzLGdA8cGQWkgqA8XO0QGhxH5tw__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4",
+ "thumbnailImage":"https://s3-alpha-sig.figma.com/img/76d4/bfac/585eb54eac56f1d953fc74070b88ac83?Expires=1701043200&Signature=HW96gwr6cPNWu6v3OaSJRarXFJKlv7ULOYkoQrPJ~R55iPzYTtf-bM7yWnYcMqVmlSopJNqJKy4~a-NTnG4u7wPKnU2uNo159Ty4PUa-U0adzlY~ozwRBhuRlBgHyciIh2vxckf96kufvocheTBCvP7tMX39oQzd~z5Pv-zEWxc4h7L8e~d8eO9NUD3J9GXfrH2r82iav3HN8BdMgqE59Yh1W9qiaN~sk5T9SQAYxpNZWS4STckVx4~SLssxAtk2xCEsZlzXmsoVsTAM1hyXH63fLUMhKxR7~OZn4~yNBucY1Ih4Noblc8cED6SuBJbbn2ANb6a8Iuq3ILMi4j-e1Q__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4"
+ },
+ {
+ "username":"pelin.kaya",
+ "name":"Pelin Kaya",
+ "about":"Lorem ipsum",
+ "image":"https://www.w3schools.com/howto/img_mountains_wide.jpg",
+ "thumbnailImage":"https://s3-alpha-sig.figma.com/img/76d4/bfac/585eb54eac56f1d953fc74070b88ac83?Expires=1701043200&Signature=HW96gwr6cPNWu6v3OaSJRarXFJKlv7ULOYkoQrPJ~R55iPzYTtf-bM7yWnYcMqVmlSopJNqJKy4~a-NTnG4u7wPKnU2uNo159Ty4PUa-U0adzlY~ozwRBhuRlBgHyciIh2vxckf96kufvocheTBCvP7tMX39oQzd~z5Pv-zEWxc4h7L8e~d8eO9NUD3J9GXfrH2r82iav3HN8BdMgqE59Yh1W9qiaN~sk5T9SQAYxpNZWS4STckVx4~SLssxAtk2xCEsZlzXmsoVsTAM1hyXH63fLUMhKxR7~OZn4~yNBucY1Ih4Noblc8cED6SuBJbbn2ANb6a8Iuq3ILMi4j-e1Q__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4"
+ },
+ {
+ "username":"zehra.kaya",
+ "name":"Zehra Kaya",
+ "about":"Lorem Ipsum",
+ "image":"https://www.w3schools.com/howto/img_lights_wide.jpg",
+ "thumbnailImage":"https://s3-alpha-sig.figma.com/img/76d4/bfac/585eb54eac56f1d953fc74070b88ac83?Expires=1701043200&Signature=HW96gwr6cPNWu6v3OaSJRarXFJKlv7ULOYkoQrPJ~R55iPzYTtf-bM7yWnYcMqVmlSopJNqJKy4~a-NTnG4u7wPKnU2uNo159Ty4PUa-U0adzlY~ozwRBhuRlBgHyciIh2vxckf96kufvocheTBCvP7tMX39oQzd~z5Pv-zEWxc4h7L8e~d8eO9NUD3J9GXfrH2r82iav3HN8BdMgqE59Yh1W9qiaN~sk5T9SQAYxpNZWS4STckVx4~SLssxAtk2xCEsZlzXmsoVsTAM1hyXH63fLUMhKxR7~OZn4~yNBucY1Ih4Noblc8cED6SuBJbbn2ANb6a8Iuq3ILMi4j-e1Q__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4"
+ }
+
+
+
+ ]
+}
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Auth/Google/index.jsx b/prediction-polls/frontend/src/Pages/Auth/Google/index.jsx
new file mode 100644
index 00000000..d2b0f8a9
--- /dev/null
+++ b/prediction-polls/frontend/src/Pages/Auth/Google/index.jsx
@@ -0,0 +1,31 @@
+import React, { useEffect } from 'react';
+import { useNavigate, useLocation } from 'react-router-dom';
+import googleLogin from '../../../api/requests/googleLogin';
+
+function GoogleLogin() {
+ const navigate = useNavigate();
+ const location = useLocation();
+
+ useEffect(() => {
+ const code = new URLSearchParams(location.search).get('code');
+ if (code) {
+ googleLogin(code).then(success => {
+ if (success) {
+ // Redirect to profile if login was successful
+ navigate('/profile');
+ } else {
+ // Redirect to a login error page or back to login
+ navigate('/auth/sign-in');
+ }
+ });
+ }
+ }, [location.search, navigate]);
+
+ return (
+
+
Redirecting..
+
+ );
+}
+
+export default GoogleLogin;
diff --git a/prediction-polls/frontend/src/Pages/Auth/SignIn/SignIn.module.css b/prediction-polls/frontend/src/Pages/Auth/SignIn/SignIn.module.css
new file mode 100644
index 00000000..29ef13b4
--- /dev/null
+++ b/prediction-polls/frontend/src/Pages/Auth/SignIn/SignIn.module.css
@@ -0,0 +1,94 @@
+.splitContainerStyle {
+ display: flex;
+ width: 100%;
+ height: 100vh;
+ margin: 0 auto;
+}
+
+.formContainerStyle {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 20px;
+}
+
+.animationStyle {
+ max-width: 100%;
+ max-height: 100%;
+}
+
+.dividerStyle {
+ color: var(--primary-700);
+ border-color: var(--primary-700);
+}
+
+.imageStyle {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: linear-gradient(var(--primary-50), var(--primary-100));
+}
+
+.displayCenterStyle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.formButtonStyle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 22px 0px;
+ width: 100%;
+ background: var(--primary-500);
+ color: var(--neutral-white);
+}
+.formButtonStyle:hover {
+ background: var(--primary-600);
+}
+
+.logoStyle {
+ color: var(--neutral-100);
+ margin-bottom: 20px;
+ max-width: 80%;
+ max-height: 80%;
+}
+
+.googleLogoStyle {
+ margin-right: 20px;
+}
+
+.displayCenterStyle {
+ color: var(--neutral-100);
+}
+
+.signUpStyle {
+ color: var(--primary-500);
+}
+
+.passwordDivStyle {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+}
+
+;
+
+.labelStyle {
+ font-size: 12px;
+}
+
+.messageStyle {
+ color: var(--neutral-100);
+ color: var(--warning-600)
+}
+@media (max-width: 768px) {
+ .imageStyle{
+ display: none;
+ }
+
+}
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Auth/SignIn/index.jsx b/prediction-polls/frontend/src/Pages/Auth/SignIn/index.jsx
index 3defd3a1..6037b451 100644
--- a/prediction-polls/frontend/src/Pages/Auth/SignIn/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Auth/SignIn/index.jsx
@@ -1,4 +1,5 @@
import React from "react";
+import styles from "./SignIn.module.css";
import { Button, Input, Form, Divider, Typography } from "antd";
import { ReactComponent as Logo } from "../../../Assets/Logo.svg";
import { ReactComponent as SignPageAnimation } from "../../../Assets/SignPageAnimation.svg";
@@ -8,90 +9,15 @@ import { Link } from "react-router-dom";
import getGoogleOAuthURL from "../../../Config/googleOAuth"
const { Text } = Typography;
-const splitContainerStyle = {
- display: "flex",
- width: "100%",
- height: "100vh",
- margin: "0 auto",
-};
-
-const formContainerStyle = {
- flex: 1,
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- justifyContent: "center",
- padding: "20px",
-};
-const animationStyle = {
- maxWidth: "100%",
- maxHeight: "100%",
-};
-
-const dividerStyle = {
- color: "#9EC8EE",
- borderColor: "#9EC8EE",
-};
-
-const imageStyle = {
- flex: 1,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- background: "linear-gradient(#EAF3FB, #BEDAF4)",
-};
-
-const formItemLayout = {
- labelCol: { span: 24 },
- wrapperCol: { span: 24 },
-};
-const displayCenterStyle = {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
-};
-const formButtonStyle = {
- ...displayCenterStyle,
- padding: "22px 0px",
- width: "100%",
- background: "#2D87DA",
- color: "#FFFFFF",
-};
-const logoStyle = {
- ...displayCenterStyle,
- marginBottom: "20px",
- maxWidth: "80%",
- maxHeight: "80%",
-};
-const googleLogoStyle = {
- marginRight: "20px",
-};
-const forgotPasswordStyle = {
- color: "#363A3D",
-};
-const signUpStyle = {
- color: "#2D87DA",
-};
-const passwordDivStyle = {
- display: "flex",
- flexDirection: "column",
- alignItems: "flex-end",
-};
-const labelStyle = {
- fontSize: "12px",
-};
-
-const messageStyle = {
- ...displayCenterStyle,
- color: "#FC1612"
-}
-
function SignIn() {
const [passwordVisible, setPasswordVisible] = React.useState(false);
const [username, setUsername] = React.useState("");
const [password, setPassword] = React.useState("");
const [message, setMessage] = React.useState("");
const navigate = useNavigate();
+ const handleLogin = () => {
+ window.location.href = getGoogleOAuthURL();
+ };
const handleSignIn = async (e) => {
e.preventDefault();
@@ -104,7 +30,7 @@ function SignIn() {
password: password
})
};
- const response = await fetch(process.env.REACT_APP_BACKEND_LINK+'/login', requestOptions);
+ const response = await fetch(process.env.REACT_APP_BACKEND_LINK+'/auth/login', requestOptions);
const data = await response.json();
if (response.status === 201 && data.accessToken && data.refreshToken) {
@@ -120,28 +46,27 @@ function SignIn() {
};
return (
-
-
-
+
+
+
-
-
-
+
or
- USERNAME
+ USERNAME
- PASSWORD
-
+
PASSWORD
+
setPassword(e.target.value)}
/>
-
+
Forgot Password?
- LOG IN
+ LOG IN
-
+
Don't have an account?
- navigate("/auth/sign-up")}>
+ navigate("/auth/sign-up")}>
Sign Up
-
{message ?
{message}
: null}
+
{message ?
{message}
: null}
-
diff --git a/prediction-polls/frontend/src/Pages/Auth/SignUp/SignUp.module.css b/prediction-polls/frontend/src/Pages/Auth/SignUp/SignUp.module.css
new file mode 100644
index 00000000..3c4d04c7
--- /dev/null
+++ b/prediction-polls/frontend/src/Pages/Auth/SignUp/SignUp.module.css
@@ -0,0 +1,78 @@
+ .splitContainerStyle {
+ display: flex;
+ width: 100%;
+ margin: 0 auto;
+ height: 100vh;
+ }
+
+ .animationStyle {
+ max-width: 100%;
+ max-height: 100%;
+ }
+
+
+ .displayCenterStyle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .formInputStyle {
+ padding: 5px 5px;
+ width: 100%;
+ }
+
+ .formButtonStyle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 22px 0px;
+ width: 100%;
+ opacity: 0.85;
+ background: var(--primary-500);
+ }
+
+ .dividerStyle {
+ color: var(--primary-900);
+ border-color: var(--primary-900);
+ margin: 8px 0px 8px 0px;
+ }
+
+ .formDatePickerStyle {
+ padding: 5px 5px;
+ width: 100%;
+ width: 100%;
+ }
+
+ .imageContainerStyle {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: linear-gradient(var(--primary-50), var(--primary-100));
+ }
+
+ .formContainerStyle {
+ flex: 1;
+ padding-left: 20px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center
+ }
+
+ .logoStyle {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 20px;
+ max-width: 80%;
+ max-height: 80%;
+ }
+
+ @media (max-width: 768px) {
+ .imageContainerStyle{
+ display: none;
+ }
+
+ }
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Auth/SignUp/index.jsx b/prediction-polls/frontend/src/Pages/Auth/SignUp/index.jsx
index c3c31d73..b30765cd 100644
--- a/prediction-polls/frontend/src/Pages/Auth/SignUp/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Auth/SignUp/index.jsx
@@ -8,6 +8,7 @@ import {
Typography,
Divider,
} from "antd";
+import styles from "./SignUp.module.css";
import { Link, useNavigate } from "react-router-dom";
import { ReactComponent as Logo } from "../../../Assets/Logo.svg";
import { ReactComponent as SignPageAnimation } from "../../../Assets/SignPageAnimation.svg";
@@ -24,15 +25,15 @@ function SignUp() {
const handleSubmit = async (values) => {
try {
const formattedValues = { ...values };
- if (values.birthday) {
- if (typeof values.birthday.format === 'function') {
- formattedValues.birthday = formatDate(values.birthday.toDate());
- }
- } else {
- formattedValues.birthday = undefined;
- }
+ if (values.birthday) {
+ if (typeof values.birthday.format === 'function') {
+ formattedValues.birthday = formatDate(values.birthday.toDate());
+ }
+ } else {
+ formattedValues.birthday = undefined;
+ }
- const res = await fetch(process.env.REACT_APP_BACKEND_LINK+"/signup", {
+ const res = await fetch(process.env.REACT_APP_BACKEND_LINK + "/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -49,7 +50,7 @@ function SignUp() {
setUsernameHelp("Username should be unique");
}
} catch (err) {
-
+
}
};
@@ -71,102 +72,29 @@ function SignUp() {
}
};
- const splitContainerStyle = {
- display: "flex",
- width: "100%",
- margin: "0 auto",
- height: "100vh",
- };
-
- const animationStyle = {
- maxWidth: "100%",
- maxHeight: "100%",
- };
-
- const displayCenterStyle = {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- };
-
- const formInputStyle = {
- padding: "5px 5px",
- width: "100%",
- };
-
- const formButtonStyle = {
- ...displayCenterStyle,
- padding: "22px 0px",
- width: "100%",
- opacity: "0.85",
- };
-
- const dividerStyle = {
- color: "rgba(22, 119, 255, 0.4)",
- borderColor: "rgba(22, 119, 255, 0.2)",
- margin: "8px 0px 8px 0px",
- };
-
- const formDatePickerStyle = {
- ...formInputStyle,
- width: "100%",
- };
-
- const imageContainerStyle = {
- flex: 1,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- background: "linear-gradient(#EAF3FB, #BEDAF4)",
- };
-
- const formContainerStyle = {
- flex: 1,
- paddingLeft: "20px",
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- };
-
- const logoStyle = {
- ...displayCenterStyle,
- marginBottom: "20px",
- maxWidth: "80%",
- maxHeight: "80%",
- };
-
- const formItemLayout = {
- labelCol: {
- span: 24,
- },
- wrapperCol: {
- span: 24,
- },
- };
-
return (
-
-
-
+
+
+
-
+
{" "}
Sign Up with Google
-
+
or
@@ -187,7 +115,7 @@ function SignUp() {
@@ -206,7 +134,7 @@ function SignUp() {
@@ -232,15 +160,15 @@ function SignUp() {
>
@@ -269,7 +197,7 @@ function SignUp() {
Sign Up
@@ -277,20 +205,20 @@ function SignUp() {
-
- I Have an Account
-
+
+ I Have an Account
+
Login
-
+
{/* Our sign up image from mock-up */}
-
+
-
+
);
}
diff --git a/prediction-polls/frontend/src/Pages/Create/Create.module.css b/prediction-polls/frontend/src/Pages/Create/Create.module.css
index a8398eb3..6634eefb 100644
--- a/prediction-polls/frontend/src/Pages/Create/Create.module.css
+++ b/prediction-polls/frontend/src/Pages/Create/Create.module.css
@@ -1,10 +1,73 @@
-.page{
+.page {
display: flex;
background-color: var(--neutral-white);
width: 100%;
-}
-@media (max-width: 640px) {
- .page{
- flex-direction: column;
+ }
+
+ @media (max-width: 640px) {
+ .page {
+ flex-direction: column;
}
-}
\ No newline at end of file
+ }
+
+ .createContainer {
+ margin: 20px;
+ padding: 20px;
+ border: 1px solid #ccc;
+ border-radius: 8px;
+ background-color: #fff;
+ width: 60%;
+ }
+
+ .questionContainer {
+ margin-bottom: 16px;
+ }
+
+ .pollTypeContainer {
+ margin-bottom: 16px;
+ }
+
+ .submitContainer {
+ position: absolute;
+ bottom: 40px;
+ width: 40%;
+ }
+
+ .multipleChoiceInputs {
+ margin-bottom: 16px;
+ }
+
+ .choiceInput {
+ margin-bottom: 8px;
+ }
+
+ .datePickerContainer {
+ margin-top: 8px;
+ }
+
+ .numericInputContainer {
+ margin-top: 8px;
+ }
+
+ .dueDatePollInputContainer {
+ margin-top: 8px;
+ }
+
+ .setDueDateContainer {
+ margin-top: 8px;
+ }
+
+ .dateOptionsContainer {
+ margin-top: 8px;
+ }
+
+ .timeInput {
+ width: 60px;
+ margin-right: 8px;
+ }
+
+ .openVisibilityContainer {
+ position: absolute;
+ bottom: 100px;
+ }
+
diff --git a/prediction-polls/frontend/src/Pages/Create/index.jsx b/prediction-polls/frontend/src/Pages/Create/index.jsx
index a4a1b689..87ab1337 100644
--- a/prediction-polls/frontend/src/Pages/Create/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Create/index.jsx
@@ -1,14 +1,203 @@
import React from 'react'
import Menu from '../../Components/Menu'
import styles from './Create.module.css'
+import { useState } from 'react';
+import { Button, Input, DatePicker, Checkbox, Select } from 'antd';
+const { TextArea } = Input;
+const { Option } = Select;
function Create() {
+ const [question, setQuestion] = useState('');
+ const [pollType, setPollType] = useState('');
+ const [showMultipleChoiceInputs, setShowMultipleChoiceInputs] = useState(false);
+ const [additionalChoices, setAdditionalChoices] = useState(['']);
+ const [customizedType, setCustomizedType] = useState('text');
+ const [customizedOptions, setCustomizedOptions] = useState(['']);
+ const [selectedDate, setSelectedDate] = useState(null);
+ const [setDueDate, setSetDueDate] = useState(false);
+ const [dueDatePoll, setDueDatePoll] = useState(null);
+ const [numericFieldValue, setNumericFieldValue] = useState('');
+ const [selectedTimeUnit, setSelectedTimeUnit] = useState('min');
+ const [openVisibility, setOpenVisibility] = useState(false);
+
+ const handleOpenVisibilityChange = (e) => {
+ setOpenVisibility(e.target.checked);
+ };
+
+ const handleDueDatePollChange = (date) => {
+ setDueDatePoll(date);
+ };
+
+ const handleSetDueDateChange = (e) => {
+ setSetDueDate(e.target.checked);
+ };
+
+ const handleQuestionChange = (e) => {
+ setQuestion(e.target.value);
+ };
+
+ const handlePollTypeChange = (type) => {
+ setPollType(type);
+ setShowMultipleChoiceInputs(type === 'multipleChoice');
+ setSelectedDate(null);
+ };
+
+ const handleAddChoice = () => {
+ setAdditionalChoices([...additionalChoices, '']);
+ };
+
+ const handleDeleteChoice = (index) => {
+ const updatedChoices = [...additionalChoices];
+ updatedChoices.splice(index, 1);
+ setAdditionalChoices(updatedChoices);
+ };
+
+ const handleChoiceChange = (index, value) => {
+ const updatedChoices = [...additionalChoices];
+ updatedChoices[index] = value;
+ setAdditionalChoices(updatedChoices);
+ };
+
+ const handleCustomizedTypeChange = (type) => {
+ setCustomizedType(type);
+ };
+
+ const handleDateChange = (date) => {
+ setSelectedDate(date);
+ };
+
+ const handleSubmit = () => {
+ // Additional logic will be added
+ };
+
return (
-
-
Create Page
+
+
+
Create Poll
+
+
+
+
+
+
+
Select the type of the poll:
+
handlePollTypeChange('multipleChoice')}
+ style={{ marginRight: '8px' }}
+ >
+ Multiple Choice
+
+
handlePollTypeChange('customized')}
+ >
+ Customized
+
+
+ {showMultipleChoiceInputs && (
+
+ {additionalChoices.map((choice, index) => (
+
+ handleChoiceChange(index, e.target.value)}
+ />
+ handleDeleteChoice(index)}>
+ Delete
+
+
+ ))}
+
Add Choice
+
+ )}
+ {pollType === 'customized' && (
+
+
handleCustomizedTypeChange('date')}
+ style={{ marginRight: '8px' }}
+ >
+ Date
+
+
handleCustomizedTypeChange('numeric')}
+ >
+ Numeric
+
+ {customizedType === 'date' && (
+
+
+
+ )}
+ {customizedType === 'numeric' && (
+
+
+
+ )}
+
+ )}
+
+
Set Due Date
+ {setDueDate && (
+ <>
+
+
+
+
+
Do not accept any votes in last:
+
setNumericFieldValue(e.target.value)}
+ />
+
+
+ >
+ )}
+
+
+ Open Distribution Visibility
+
+
+
+ Create Poll
+
+
+
- )
+ );
}
-
-export default Create;
\ No newline at end of file
+export default Create;
diff --git a/prediction-polls/frontend/src/Pages/EditProfile/EditProfile.module.css b/prediction-polls/frontend/src/Pages/EditProfile/EditProfile.module.css
new file mode 100644
index 00000000..a8398eb3
--- /dev/null
+++ b/prediction-polls/frontend/src/Pages/EditProfile/EditProfile.module.css
@@ -0,0 +1,10 @@
+.page{
+ display: flex;
+ background-color: var(--neutral-white);
+ width: 100%;
+}
+@media (max-width: 640px) {
+ .page{
+ flex-direction: column;
+ }
+}
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/EditProfile/index.jsx b/prediction-polls/frontend/src/Pages/EditProfile/index.jsx
new file mode 100644
index 00000000..da18c2b0
--- /dev/null
+++ b/prediction-polls/frontend/src/Pages/EditProfile/index.jsx
@@ -0,0 +1,14 @@
+import React from 'react'
+import Menu from '../../Components/Menu'
+import styles from './EditProfile.module.css'
+
+function EditProfile() {
+ return (
+
+
+ Edit Profile Page
+
+ )
+}
+
+export default EditProfile;
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Feed/Feed.module.css b/prediction-polls/frontend/src/Pages/Feed/Feed.module.css
index ba3df987..d8e406b8 100644
--- a/prediction-polls/frontend/src/Pages/Feed/Feed.module.css
+++ b/prediction-polls/frontend/src/Pages/Feed/Feed.module.css
@@ -2,16 +2,31 @@
display: flex;
background-color: var(--neutral-white);
width: 100%;
+ box-sizing: border-box;
}
-@media (max-width: 640px) {
+@media (max-width: 768px) {
.page{
flex-direction: column;
}
+ .pointsButton{
+ display:none;
+ }
+ .pollList{
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ padding: 20px;
+ justify-content: center;
+ align-items: center;
+ }
}
+
+@media (min-width: 769px) {
.pollList{
display: flex;
flex-direction: column;
padding-left: 20px;
width: 60%;
- margin-top: 30px;
+ padding-top: 100px;
+}
}
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Feed/index.jsx b/prediction-polls/frontend/src/Pages/Feed/index.jsx
index 5996afc1..97144f71 100644
--- a/prediction-polls/frontend/src/Pages/Feed/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Feed/index.jsx
@@ -16,7 +16,8 @@ function Feed() {
))
}
-
+
);
}
diff --git a/prediction-polls/frontend/src/Pages/Leaderboard/Leaderboard.module.css b/prediction-polls/frontend/src/Pages/Leaderboard/Leaderboard.module.css
index a8398eb3..40227b55 100644
--- a/prediction-polls/frontend/src/Pages/Leaderboard/Leaderboard.module.css
+++ b/prediction-polls/frontend/src/Pages/Leaderboard/Leaderboard.module.css
@@ -7,4 +7,72 @@
.page{
flex-direction: column;
}
-}
\ No newline at end of file
+}
+
+.listContainer {
+ margin-left: 5em;
+ box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
+ height: 70%;
+ border: 1px solid #e8e8e8;
+ margin-top: 10em ;
+}
+
+.listHeader {
+ display: flex;
+ padding: 10px;
+ color: white;
+ background-color: #156cd6;
+ border-bottom: 1px solid #e8e8e8;
+}
+
+.rankHeader,
+.usernameHeader,
+.pointsHeader {
+ font-weight: normal;
+ font-size: 15px;
+}
+
+.rankHeader {
+ width: 50px;
+ text-align: center;
+}
+
+.usernameHeader {
+ flex: 1;
+ padding-left: 50px;
+}
+
+.avatar{
+ background-color: '#000';
+ color: '#fff';
+}
+
+.pointsHeader {
+ width: 100px;
+ text-align: right;
+ padding-right: 20px;
+}
+
+.listItem {
+ display: flex;
+ align-items: center;
+ border-bottom: 1px solid #e8e8e8;
+ background-color: #eaf3fb;
+}
+
+.rank {
+ width: 50px;
+ text-align: center;
+}
+
+.username {
+ flex: 1;
+ margin-left: 2.1em;
+ width: 250px;
+}
+
+.points {
+ width: 50px;
+ margin-right: 1em;
+}
+
diff --git a/prediction-polls/frontend/src/Pages/Leaderboard/index.jsx b/prediction-polls/frontend/src/Pages/Leaderboard/index.jsx
index 9187e01c..fc5bad0a 100644
--- a/prediction-polls/frontend/src/Pages/Leaderboard/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Leaderboard/index.jsx
@@ -1,14 +1,83 @@
-import React from 'react'
-import Menu from '../../Components/Menu'
-import styles from './Leaderboard.module.css'
+import React from 'react';
+import { List, Avatar } from 'antd';
+import Menu from '../../Components/Menu';
+import styles from './Leaderboard.module.css';
+import PointsButton from "../../Components/PointsButton";
+import pointData from "../../MockData/PointList.json";
+import leaderboardData from "../../MockData/LeaderboardList.json";
+import { Select } from 'antd';
function Leaderboard() {
+ const listData = Object.values(leaderboardData).flat();
+
return (
-
- Leaderboard Page
-
- )
+
+
+ );
}
-export default Leaderboard;
\ No newline at end of file
+export default Leaderboard;
diff --git a/prediction-polls/frontend/src/Pages/Profile/Profile.module.css b/prediction-polls/frontend/src/Pages/Profile/Profile.module.css
index a8398eb3..e195a3a8 100644
--- a/prediction-polls/frontend/src/Pages/Profile/Profile.module.css
+++ b/prediction-polls/frontend/src/Pages/Profile/Profile.module.css
@@ -1,10 +1,175 @@
-.page{
+.page {
+ display: flex;
+ background-color: var(--neutral-white);
+ width: 100%;
+}
+@media (max-width: 640px) {
+ .page {
+ flex-direction: column;
+ }
+}
+
+.card {
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ width: 95%;
+ box-shadow: 2px 4px 8px var(--neutral-shadow);
+ border-radius: 8px;
+ background-color: var(--neutral-pollCard);
+ margin-bottom: 20px;
+}
+.profileInfo {
+ display: flex;
+ flex-direction: column;
+ padding-left: 20px;
+ width: 60%;
+ margin-top: 30px;
+}
+.thumbnailImage {
+ display: flex;
+ width: 100%;
+ height: 200px;
+ position: relative;
+}
+
+.thumbnail {
+ width: 100%;
+ height: 100%;
+ border-radius: 8px 8px 0px 0px;
+ object-fit: cover;
+}
+.profileImage {
+ width: 150px;
+ height: 150px;
+ object-fit: cover;
+ border-radius: 100px;
+ position: absolute;
+ left: 50px;
+ bottom: -75px;
+}
+.info {
+ display: flex;
+ width: 100%;
+ flex-direction: column;
+ background-color: var(--primary-50);
+ border-radius: 0px 0px 8px 8px;
+}
+.nameAndButton {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+
+}
+.name {
+ display: flex;
+ flex-direction: column;
+ justify-content: start;
+ align-items: start;
+ margin-left: 230px;
+ gap:10px;
+ padding-top: 20px;
+
+}
+.button {
+ background-color: var(--primary-500);
+ color: var(--neutral-white);
+ border: none;
+ padding: 10px 20px;
+ border-radius: 12px;
+ gap: 8px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ font-size: 20px;
+}
+.buttonText{
+ margin: 0px;
+}
+.buttonContainer {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding-right: 10px;
+}
+.aboutContainer{
display: flex;
+ flex-direction: column;
+ padding: 0px 10px;
+ padding-left: 50px;
+ padding-top: 10px;
+ gap:10
+}
+.aboutTitle{
+ font-weight: 700;
+ color: var(--neutral-black);
+ line-height: 24px;
+ font-size: 24px;
+ margin: 0px 0px;
+}
+.aboutText{
+ color:var(--neutral-black);
+ margin: 0px;
+ font-size: 20px;
+}
+
+.nameUsernameText{
+ font-weight: 700;
+ color: var(--neutral-black);
+ line-height: 24px;
+ font-size: 24px;
+ margin: 0px 0px;
+
+}
+.badgesContainer{
+ display: flex;
+ flex-direction: row;
+ justify-content: start;
+ align-items: center;
+ gap: 10px;
+ padding-left: 50px;
+ padding-top: 10px;
+ padding-bottom: 10px;
+}
+
+.badge{
+ width: 85px;
+ height: 85px;
+ border-radius: 100%;
+ background-color: gold;
+ justify-content: center;
+ align-items: center;
+ display: flex;
+ flex-direction: column;
+ gap:5px;
+ box-sizing: border-box;
+ overflow-wrap:anywhere;
+ padding: 4px;
+ text-align: center;
+ vertical-align: middle;
+ position: relative;
+
+}
+.badge::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 85px;
+ height: 85px;
background-color: var(--neutral-white);
- width: 100%;
+ opacity: 0.2; /* Adjust this value for desired opacity */
+ border-radius: 100%; /* To maintain the circular shape of the badge */
+ pointer-events: none; /* So that the overlay does not interfere with interaction */
}
-@media (max-width: 640px) {
- .page{
- flex-direction: column;
- }
+.badgeText{
+ font-weight: 700;
+ color: var(--neutral-black);
+ line-height: 14px;
+ font-size: 14px;
+ margin: 0px 0px;
+ z-index: 1;
+
}
\ No newline at end of file
diff --git a/prediction-polls/frontend/src/Pages/Profile/index.jsx b/prediction-polls/frontend/src/Pages/Profile/index.jsx
index b8b7dda1..7f3f2192 100644
--- a/prediction-polls/frontend/src/Pages/Profile/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Profile/index.jsx
@@ -1,14 +1,82 @@
-import React from 'react'
-import Menu from '../../Components/Menu'
-import styles from './Profile.module.css'
+import React from "react";
+import Menu from "../../Components/Menu";
+import styles from "./Profile.module.css";
+import Users from "../../MockData/Users.json";
+import EditIcon from "../../Assets/icons/EditIcon.jsx";
+import pollData from "../../MockData/PollData.json";
+import PollCard from "../../Components/PollCard";
+import { useNavigate } from "react-router-dom";
+import PointsButton from "../../Components/PointsButton";
+import pointData from "../../MockData/PointList.json"
+import { useParams } from "react-router-dom";
function Profile() {
+ const { username } = useParams();
+
+ const userData = Users.userList.filter((user) => user.username === username)[0];
+ const navigate = useNavigate();
return (
-
- Profile Page
-
- )
+
+
+
+
+
+
+
+
+
+
+
+ {userData.username}
+
+
+ {userData.name}
+
+
+
+
navigate("/editProfile")}>
+ {userData.username === "can.gezer" ? <>
+ Edit Profile
> : Follow
}
+
+
+
+
+
+
About
+
{userData.about}
+
+
+
+
+ {pollData.pollList.map((poll, index) => (
+
+ ))}
+
+
+
+ );
}
-export default Profile;
\ No newline at end of file
+export default Profile;
diff --git a/prediction-polls/frontend/src/Pages/Vote/Vote.module.css b/prediction-polls/frontend/src/Pages/Vote/Vote.module.css
index a8398eb3..644411ac 100644
--- a/prediction-polls/frontend/src/Pages/Vote/Vote.module.css
+++ b/prediction-polls/frontend/src/Pages/Vote/Vote.module.css
@@ -3,6 +3,73 @@
background-color: var(--neutral-white);
width: 100%;
}
+.poll{
+ display: flex;
+ flex-direction: column;
+ padding-left: 20px;
+ width: 100%;
+ margin-top: 100px;
+}
+.page_row{
+ display: flex;
+ flex-direction: row;
+ width: 100%;
+ height: 100%;
+}
+.choice_column{
+ display: flex;
+ flex-direction: column;
+ margin-top: 150px;
+ width: 100%;
+ height: 100%;
+ text-align: center;
+}
+.infoText{
+ font-family: sans-serif ;
+ font-size: 18px;
+ font-weight: 700;
+ color: var(--neutral-100);
+}
+.chooseText{
+ font-family: sans-serif ;
+ margin-top: 80px;
+ font-size: 18px;
+ font-weight: 700;
+ color: var(--neutral-100);
+}
+.buttonDivStyle{
+ margin-top: 40px;
+ justify-content: center;
+}
+.inputStyle{
+ margin-top: 40px;
+ justify-content: center;
+ width: 60%;
+ font-size: 28px;
+ font-weight: 700;
+ color: var(--neutral-100);
+ border-color: var(--secondary-500);
+ border-width: 3px;
+ padding-left: 10px;
+
+}
+.bottonStyle{
+ width: 50%;
+ height: 100%;
+ margin-top: 40px;
+ justify-content: center;
+ background-color: var(--secondary-500);
+ color: var(--neutral-white);
+ font-size: 32px;
+ font-weight: 700;
+}
+.messageStyle{
+ margin-top: 20px;
+ justify-content: center;
+ color: var(--warning-600);
+ font-weight: 700;
+ font-size: 16px;
+}
@media (max-width: 640px) {
.page{
flex-direction: column;
diff --git a/prediction-polls/frontend/src/Pages/Vote/index.jsx b/prediction-polls/frontend/src/Pages/Vote/index.jsx
index 5c7cbe08..ef4b6d66 100644
--- a/prediction-polls/frontend/src/Pages/Vote/index.jsx
+++ b/prediction-polls/frontend/src/Pages/Vote/index.jsx
@@ -1,12 +1,69 @@
import React from "react";
import Menu from "../../Components/Menu";
+import PollCard from "../../Components/PollCard";
import styles from "./Vote.module.css";
+import pollData from "../../MockData/PollData.json"
+import PointsButton from "../../Components/PointsButton";
+import pointData from "../../MockData/PointList.json"
+import { Button, InputNumber} from 'antd';
+import {useParams} from 'react-router-dom';
+
function Vote() {
+ let {id} = useParams();
+ let parsedID = parseInt(id);
+ const [polldata, setPolldata] = React.useState(pollData.pollList[parsedID-1]);
+ const [sentence, setSentence] = React.useState((polldata.isCustomPoll == true) ? "Please enter a suitable answer to the poll" : "Choose the option you want to vote for ");
+ const [betPoint, setBetPoint] = React.useState(0);
+ const [message, setMessage] = React.useState("");
+ const [selectedOption, setSelectedOption] = React.useState();
+
+ const handleVoting = () =>{
+
+ };
+ const retrievePoll = async () => {
+ try {
+ const requestOptions = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ id: parsedID,
+ })
+ };
+ const response = await fetch(process.env.REACT_APP_BACKEND_LINK+'/vote', requestOptions);
+ const data = await response.json();
+
+ if (response.status === 200 && data.poll ) {
+ }
+ }
+ catch (error) {
+ }
+ };
+
return (
-
Vote Page
+
+
+
+
+
{sentence}
+
How many points do you want to place?
+
setBetPoint(e.target.value)}
+ />
+
Vote
+
{message}
+
+
);
}
diff --git a/prediction-polls/frontend/src/Routes/Router.jsx b/prediction-polls/frontend/src/Routes/Router.jsx
index 787f1b67..2ba783af 100644
--- a/prediction-polls/frontend/src/Routes/Router.jsx
+++ b/prediction-polls/frontend/src/Routes/Router.jsx
@@ -12,6 +12,8 @@ import Profile from '../Pages/Profile';
import Settings from '../Pages/Settings';
import Vote from '../Pages/Vote';
import PrivateRoute from '../Components/PrivateRoute';
+import GoogleLogin from '../Pages/Auth/Google'
+import EditProfile from '../Pages/EditProfile';
function AppRouter() {
return (
@@ -21,12 +23,15 @@ function AppRouter() {
} />
+
} />
} />
} />
+
+ } />
+
} />
@@ -40,14 +45,19 @@ function AppRouter() {
} />
-
+
} />
} />
-
+
+
+ } />
+
+
} />
diff --git a/prediction-polls/frontend/src/api/requests/googleLogin.jsx b/prediction-polls/frontend/src/api/requests/googleLogin.jsx
new file mode 100644
index 00000000..a6cf6e3f
--- /dev/null
+++ b/prediction-polls/frontend/src/api/requests/googleLogin.jsx
@@ -0,0 +1,22 @@
+const baseUrl = process.env.REACT_APP_BACKEND_LINK;
+async function googleLogin(code) {
+ try {
+ const response = await fetch(`${baseUrl}/auth/google`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ 'code': code })
+ });
+ const data = await response.json();
+ if (response.status === 200 && data.accessToken && data.refreshToken) {
+ localStorage.setItem('accessToken', data.accessToken);
+ localStorage.setItem('refreshToken', data.refreshToken);
+ return { success: true };
+ } else {
+ return { success: false };
+ }
+ } catch (error) {
+ return false;
+ }
+}
+
+export default googleLogin;
\ No newline at end of file