From 2d0a3f7a05b98b380f29a2c622a27490f7f9b1d7 Mon Sep 17 00:00:00 2001 From: Shubham-Lal Date: Mon, 5 Aug 2024 12:37:04 +0530 Subject: [PATCH] modify fonts --- client/src/App.tsx | 38 ++++++++-------- client/src/ProtectedRoute.tsx | 6 +-- client/src/components/button/toggle-theme.tsx | 6 +-- client/src/components/card/claim-username.tsx | 18 ++++---- .../components/card/closed-debate-card.css | 13 +----- .../components/card/closed-debate-card.tsx | 14 +++--- client/src/components/card/debate-bar.css | 7 +-- client/src/components/card/debate-bar.tsx | 13 +++--- .../src/components/card/open-debate-card.css | 2 +- .../src/components/card/open-debate-card.tsx | 14 +++--- client/src/components/loading/skeleton.tsx | 2 +- client/src/components/loading/svg.tsx | 2 +- .../components/modal/auth/forgot-password.tsx | 18 ++++---- client/src/components/modal/auth/index.css | 3 +- client/src/components/modal/auth/index.tsx | 32 +++++++------- .../src/components/modal/auth/login-tab.tsx | 16 +++---- .../components/modal/auth/set-password.tsx | 16 +++---- .../src/components/modal/auth/signup-tab.tsx | 20 ++++----- client/src/components/sidebar/explore.css | 10 ++++- client/src/components/sidebar/explore.tsx | 12 ++--- .../src/components/sidebar/left-sidebar.tsx | 24 +++++----- client/src/components/sidebar/profile.css | 4 +- client/src/components/sidebar/profile.tsx | 40 ++++++++--------- .../src/components/sidebar/right-sidebar.tsx | 12 ++--- client/src/data/categories-data.ts | 44 +++++++++---------- client/src/data/left-sidebar-links.ts | 34 +++++++------- client/src/main.tsx | 10 ++--- client/src/pages/auth/index.tsx | 18 ++++---- client/src/pages/create-debate/editor.tsx | 4 +- client/src/pages/create-debate/index.tsx | 20 ++++----- client/src/pages/create-debate/preview.tsx | 4 +- client/src/pages/home/index.tsx | 14 ++---- client/src/pages/hot-topics/index.tsx | 6 +-- client/src/pages/notifications/index.tsx | 2 +- client/src/pages/open-topics/index.tsx | 6 +-- client/src/pages/search/index.tsx | 18 ++++---- client/src/store/useAuthStore.ts | 28 ++++++------ client/src/store/useNavStore.ts | 2 +- client/src/utils/handleAutoLogin.ts | 2 +- client/vite.config.ts | 4 +- server/controllers/auth.js | 6 +-- 41 files changed, 275 insertions(+), 289 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index fcc6ecd..848fac7 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,22 +1,22 @@ -import "./App.css" -import { useRef, useState, useEffect } from "react" -import { Routes, Route, Navigate } from "react-router-dom" -import { Toaster } from "sonner" -import { ProtectedRoute } from "./ProtectedRoute" -import { Theme, useNavStore } from "./store/useNavStore" -import { AuthTab, useAuthStore } from "./store/useAuthStore" -import handleAutoLogin from "./utils/handleAutoLogin" -import LeftSidebar from "./components/sidebar/left-sidebar" -import RightSidebar from "./components/sidebar/right-sidebar" -import AuthModal from "./components/modal/auth" -import HomePage from "./pages/home" -import AuthPage from "./pages/auth" -import SearchPage from "./pages/search" -import CreateDebatePage from "./pages/create-debate" -import HotTopicsPage from "./pages/hot-topics" -import OpenTopicsPage from "./pages/open-topics" -import NotificationPage from "./pages/notifications" -import { FaChevronLeft, FaChevronRight } from "react-icons/fa" +import './App.css' +import { useRef, useState, useEffect } from 'react' +import { Routes, Route, Navigate } from 'react-router-dom' +import { Toaster } from 'sonner' +import { ProtectedRoute } from './ProtectedRoute' +import { Theme, useNavStore } from './store/useNavStore' +import { AuthTab, useAuthStore } from './store/useAuthStore' +import handleAutoLogin from './utils/handleAutoLogin' +import LeftSidebar from './components/sidebar/left-sidebar' +import RightSidebar from './components/sidebar/right-sidebar' +import AuthModal from './components/modal/auth' +import HomePage from './pages/home' +import AuthPage from './pages/auth' +import SearchPage from './pages/search' +import CreateDebatePage from './pages/create-debate' +import HotTopicsPage from './pages/hot-topics' +import OpenTopicsPage from './pages/open-topics' +import NotificationPage from './pages/notifications' +import { FaChevronLeft, FaChevronRight } from 'react-icons/fa' export default function App() { const { setRoute, setUser, setIsAuthenticated, authTab, setAuthTab } = useAuthStore() diff --git a/client/src/ProtectedRoute.tsx b/client/src/ProtectedRoute.tsx index e1a0694..4bfc9be 100644 --- a/client/src/ProtectedRoute.tsx +++ b/client/src/ProtectedRoute.tsx @@ -1,6 +1,6 @@ -import { Navigate } from "react-router-dom" -import { AuthStatus, useAuthStore } from "./store/useAuthStore" -import { LoadingComponent } from "./components/loading/svg" +import { Navigate } from 'react-router-dom' +import { AuthStatus, useAuthStore } from './store/useAuthStore' +import { LoadingComponent } from './components/loading/svg' interface ProtectedRouteProps { children: React.ReactNode diff --git a/client/src/components/button/toggle-theme.tsx b/client/src/components/button/toggle-theme.tsx index c42a498..9851ee1 100644 --- a/client/src/components/button/toggle-theme.tsx +++ b/client/src/components/button/toggle-theme.tsx @@ -1,12 +1,12 @@ -import "./toggle-theme.css" -import { Theme, useNavStore } from "../../store/useNavStore" +import './toggle-theme.css' +import { Theme, useNavStore } from '../../store/useNavStore' const ToggleTheme = () => { const { theme, setTheme } = useNavStore() const handleToggleTheme = () => { const newTheme = theme === Theme.Light ? Theme.Dark : Theme.Light - document.querySelector("body")?.setAttribute('data-theme', newTheme) + document.querySelector('body')?.setAttribute('data-theme', newTheme) setTheme(newTheme) } diff --git a/client/src/components/card/claim-username.tsx b/client/src/components/card/claim-username.tsx index 198021e..8272184 100644 --- a/client/src/components/card/claim-username.tsx +++ b/client/src/components/card/claim-username.tsx @@ -1,18 +1,18 @@ -import "./claim-username.css" -import { useCallback, useState } from "react" -import { AuthTab, useAuthStore } from "../../store/useAuthStore" -import { toast } from "sonner" -import { PiArrowUpRightBold } from "react-icons/pi" -import { LoadingSVG } from "../loading/svg" -import { useNavStore } from "../../store/useNavStore" -import { usernameRegex } from "../../data/regex" +import './claim-username.css' +import { useCallback, useState } from 'react' +import { AuthTab, useAuthStore } from '../../store/useAuthStore' +import { toast } from 'sonner' +import { PiArrowUpRightBold } from 'react-icons/pi' +import { LoadingSVG } from '../loading/svg' +import { useNavStore } from '../../store/useNavStore' +import { usernameRegex } from '../../data/regex' const ClaimUsername = () => { const { setAuthTab } = useAuthStore() const { sidebar } = useNavStore() const [isSubmitted, setIsSubmitted] = useState(false) - const [username, setUsername] = useState(localStorage.getItem("username") || "") + const [username, setUsername] = useState(localStorage.getItem('username') || '') const [loading, setLoading] = useState(false) const [message, setMessage] = useState({ type: '', content: '' }) diff --git a/client/src/components/card/closed-debate-card.css b/client/src/components/card/closed-debate-card.css index e1955ff..351bf85 100644 --- a/client/src/components/card/closed-debate-card.css +++ b/client/src/components/card/closed-debate-card.css @@ -70,20 +70,10 @@ line-clamp: 5; -webkit-box-orient: vertical; padding-top: 10px; - font-size: 17px; + font-size: 18px; color: var(--card_color_secondary); } -#closed-card .left a { - padding-top: 10px; - width: fit-content; - color: var(--card_color_secondary); - text-decoration: underline; - font-size: 15px; - font-weight: 700; - cursor: pointer; -} - #closed-card-loading .left .view .loading-skeleton { margin-top: 10px; width: 35px; @@ -185,7 +175,6 @@ #closed-card-loading .right .debate-bar { margin-top: 10px; - gap: 2.5px; } #closed-card-loading .right .debate-bar .loading-skeleton { diff --git a/client/src/components/card/closed-debate-card.tsx b/client/src/components/card/closed-debate-card.tsx index 7315771..63d550c 100644 --- a/client/src/components/card/closed-debate-card.tsx +++ b/client/src/components/card/closed-debate-card.tsx @@ -1,10 +1,10 @@ -import "./closed-debate-card.css" -import { useNavigate } from "react-router-dom" -import { useNavStore } from "../../store/useNavStore" -import DebateBar from "./debate-bar" -import { MdModeComment } from "react-icons/md" -import useFormatNumber from "../../hooks/useFormatNumber" -import LoadingSkeleton from "../loading/skeleton" +import './closed-debate-card.css' +import { useNavigate } from 'react-router-dom' +import { useNavStore } from '../../store/useNavStore' +import DebateBar from './debate-bar' +import { MdModeComment } from 'react-icons/md' +import useFormatNumber from '../../hooks/useFormatNumber' +import LoadingSkeleton from '../loading/skeleton' const ClosedDebateCard = () => { const navigate = useNavigate() diff --git a/client/src/components/card/debate-bar.css b/client/src/components/card/debate-bar.css index 21bc0e1..6371d7c 100644 --- a/client/src/components/card/debate-bar.css +++ b/client/src/components/card/debate-bar.css @@ -1,10 +1,11 @@ .debate-bar { + position: relative; + width: 100%; + height: 30px; display: flex; align-items: center; justify-content: space-between; - width: 100%; - height: 30px; - position: relative; + gap: 2.5px; border-radius: 15px; overflow: hidden; } diff --git a/client/src/components/card/debate-bar.tsx b/client/src/components/card/debate-bar.tsx index 9f8ab01..1ee80a1 100644 --- a/client/src/components/card/debate-bar.tsx +++ b/client/src/components/card/debate-bar.tsx @@ -1,7 +1,7 @@ -import "./debate-bar.css" -import React from "react" -import { IoCaretUpSharp } from "react-icons/io5" -import useFormatNumber from "../../hooks/useFormatNumber" +import './debate-bar.css' +import React from 'react' +import { IoCaretUpSharp } from 'react-icons/io5' +import useFormatNumber from '../../hooks/useFormatNumber' interface BarProps { debateFrom: number @@ -18,10 +18,7 @@ const DebateBar: React.FC = ({ debateFrom, debateBy }) => { <>
diff --git a/client/src/components/card/open-debate-card.css b/client/src/components/card/open-debate-card.css index 30898a0..0a9ae79 100644 --- a/client/src/components/card/open-debate-card.css +++ b/client/src/components/card/open-debate-card.css @@ -37,7 +37,7 @@ line-clamp: 5; -webkit-box-orient: vertical; padding-top: 10px; - font-size: 17px; + font-size: 18px; color: var(--card_color_secondary); } diff --git a/client/src/components/card/open-debate-card.tsx b/client/src/components/card/open-debate-card.tsx index 680b23d..332df33 100644 --- a/client/src/components/card/open-debate-card.tsx +++ b/client/src/components/card/open-debate-card.tsx @@ -1,10 +1,10 @@ -import "./open-debate-card.css" -import { useNavigate } from "react-router-dom" -import { useNavStore } from "../../store/useNavStore" -import { MdModeComment } from "react-icons/md" -import { IoCaretUpSharp } from "react-icons/io5" -import useFormatNumber from "../../hooks/useFormatNumber" -import LoadingSkeleton from "../loading/skeleton" +import './open-debate-card.css' +import { useNavigate } from 'react-router-dom' +import { useNavStore } from '../../store/useNavStore' +import { MdModeComment } from 'react-icons/md' +import { IoCaretUpSharp } from 'react-icons/io5' +import useFormatNumber from '../../hooks/useFormatNumber' +import LoadingSkeleton from '../loading/skeleton' const OpenDebateCard = () => { const navigate = useNavigate() diff --git a/client/src/components/loading/skeleton.tsx b/client/src/components/loading/skeleton.tsx index d44c9d5..db4c636 100644 --- a/client/src/components/loading/skeleton.tsx +++ b/client/src/components/loading/skeleton.tsx @@ -1,4 +1,4 @@ -import "./style.css" +import './style.css' interface SkeletonProps { style?: React.CSSProperties diff --git a/client/src/components/loading/svg.tsx b/client/src/components/loading/svg.tsx index 81fb030..c571230 100644 --- a/client/src/components/loading/svg.tsx +++ b/client/src/components/loading/svg.tsx @@ -1,4 +1,4 @@ -import "./style.css" +import './style.css' interface Props { size: number diff --git a/client/src/components/modal/auth/forgot-password.tsx b/client/src/components/modal/auth/forgot-password.tsx index 0f2101b..a452c85 100644 --- a/client/src/components/modal/auth/forgot-password.tsx +++ b/client/src/components/modal/auth/forgot-password.tsx @@ -1,15 +1,15 @@ -import { useState, useCallback } from "react" -import { useNavigate } from "react-router-dom" -import { toast } from "sonner" -import { emailRegex } from "../../../data/regex" -import { LoadingSVG } from "../../loading/svg" +import { useState, useCallback } from 'react' +import { useNavigate } from 'react-router-dom' +import { toast } from 'sonner' +import { emailRegex } from '../../../data/regex' +import { LoadingSVG } from '../../loading/svg' const ForgotPassword = () => { const navigate = useNavigate() const [forgotData, setForgotData] = useState({ - email: "", - username: "" + email: '', + username: '' }) const [isSubmitted, setIsSubmitted] = useState(false) const [validationState, setValidationState] = useState(true) @@ -18,8 +18,8 @@ const ForgotPassword = () => { const { name, value } = e.target setForgotData(() => ({ - email: name === "email" ? value : "", - username: name === "username" ? value : "" + email: name === 'email' ? value : '', + username: name === 'username' ? value : '' })) setValidationState(!!value) diff --git a/client/src/components/modal/auth/index.css b/client/src/components/modal/auth/index.css index 66042b2..608955c 100644 --- a/client/src/components/modal/auth/index.css +++ b/client/src/components/modal/auth/index.css @@ -196,7 +196,8 @@ #auth-modal .form__container p { width: fit-content; - font-size: 17px; + font-size: 18px; + text-align: center; } #auth-modal .form__container p span { diff --git a/client/src/components/modal/auth/index.tsx b/client/src/components/modal/auth/index.tsx index 29198ab..f135ae8 100644 --- a/client/src/components/modal/auth/index.tsx +++ b/client/src/components/modal/auth/index.tsx @@ -1,14 +1,14 @@ -import "./index.css" -import { useState } from "react" -import { useLocation, useNavigate } from "react-router-dom" -import Lottie from "lottie-react" -import { useAuthStore, AuthTab, useTempStore } from "../../../store/useAuthStore" -import WavingHand from "../../../lottie/WavingHand.json" -import LoginTab from "./login-tab" -import SignupTab from "./signup-tab" -import ForgotPassword from "./forgot-password" -import ResetPassword from "./set-password" -import { IoCloseOutline } from "react-icons/io5" +import './index.css' +import { useState } from 'react' +import { useLocation, useNavigate } from 'react-router-dom' +import Lottie from 'lottie-react' +import { useAuthStore, AuthTab, useTempStore } from '../../../store/useAuthStore' +import WavingHand from '../../../lottie/WavingHand.json' +import LoginTab from './login-tab' +import SignupTab from './signup-tab' +import ForgotPassword from './forgot-password' +import ResetPassword from './set-password' +import { IoCloseOutline } from 'react-icons/io5' type RegisterData = { avatar: string | File @@ -26,11 +26,11 @@ const AuthModal = () => { const { tempUser } = useTempStore() const [registerData, setRegisterData] = useState(() => ({ - avatar: tempUser.avatar || "", - username: localStorage.getItem("username") || tempUser.username || "", - first_name: tempUser.first_name || "", - last_name: tempUser.last_name || "", - email: tempUser.email || "" + avatar: tempUser.avatar || '', + username: localStorage.getItem('username') || tempUser.username || '', + first_name: tempUser.first_name || '', + last_name: tempUser.last_name || '', + email: tempUser.email || '' })) const handleCloseModal = () => { diff --git a/client/src/components/modal/auth/login-tab.tsx b/client/src/components/modal/auth/login-tab.tsx index 116db07..48dfdcb 100644 --- a/client/src/components/modal/auth/login-tab.tsx +++ b/client/src/components/modal/auth/login-tab.tsx @@ -1,9 +1,9 @@ -import React, { useState, useCallback } from "react" -import { useNavigate } from "react-router-dom" -import { toast } from "sonner" -import { AuthStatus, AuthTab, useAuthStore } from "../../../store/useAuthStore" -import { FcGoogle } from "react-icons/fc" -import { LoadingSVG } from "../../loading/svg" +import React, { useState, useCallback } from 'react' +import { useNavigate } from 'react-router-dom' +import { toast } from 'sonner' +import { AuthStatus, AuthTab, useAuthStore } from '../../../store/useAuthStore' +import { FcGoogle } from 'react-icons/fc' +import { LoadingSVG } from '../../loading/svg' const LoginTab = () => { const navigate = useNavigate() @@ -11,8 +11,8 @@ const LoginTab = () => { const { route, setAuthTab, isAuthenticated, setIsAuthenticated, setUser } = useAuthStore() const [loginData, setLoginData] = useState({ - id: "", - password: "" + id: '', + password: '' }) const [isSubmitted, setIsSubmitted] = useState(false) diff --git a/client/src/components/modal/auth/set-password.tsx b/client/src/components/modal/auth/set-password.tsx index 8402d4d..f086e79 100644 --- a/client/src/components/modal/auth/set-password.tsx +++ b/client/src/components/modal/auth/set-password.tsx @@ -1,8 +1,8 @@ -import { useCallback, useState } from "react" -import { useNavigate } from "react-router-dom" -import { toast } from "sonner" -import { AuthStatus, AuthTab, useAuthStore } from "../../../store/useAuthStore" -import { LoadingSVG } from "../../loading/svg" +import { useCallback, useState } from 'react' +import { useNavigate } from 'react-router-dom' +import { toast } from 'sonner' +import { AuthStatus, AuthTab, useAuthStore } from '../../../store/useAuthStore' +import { LoadingSVG } from '../../loading/svg' const SetPassword = () => { const navigate = useNavigate() @@ -10,8 +10,8 @@ const SetPassword = () => { const { setUser, setIsAuthenticated, setAuthTab } = useAuthStore() const [resetData, setResetData] = useState({ - new: "", - confirm: "" + new: '', + confirm: '' }) const [isSubmitted, setIsSubmitted] = useState(false) @@ -53,7 +53,7 @@ const SetPassword = () => { if (trimmedNew !== trimmedConfirm) { setTimeout(() => setIsSubmitted(false), 500) - return toast.error("Password doesn't match") + return toast.error('Password does not match') } else { if (trimmedNew.length < 6) { diff --git a/client/src/components/modal/auth/signup-tab.tsx b/client/src/components/modal/auth/signup-tab.tsx index e778ea7..ec323d7 100644 --- a/client/src/components/modal/auth/signup-tab.tsx +++ b/client/src/components/modal/auth/signup-tab.tsx @@ -1,13 +1,13 @@ -import React, { useState, useCallback } from "react" -import { useNavigate } from "react-router-dom" -import { RegisterDataProps } from "../../../types" -import { toast } from "sonner" -import { AuthTab, useAuthStore, useTempStore } from "../../../store/useAuthStore" -import { LoadingSVG } from "../../loading/svg" -import { specialCharRegex, usernameRegex, emailRegex } from "../../../data/regex" -import { MdModeEdit } from "react-icons/md" -import { GrCloudUpload } from "react-icons/gr" -import { IoPersonCircleOutline } from "react-icons/io5" +import React, { useState, useCallback } from 'react' +import { useNavigate } from 'react-router-dom' +import { RegisterDataProps } from '../../../types' +import { toast } from 'sonner' +import { AuthTab, useAuthStore, useTempStore } from '../../../store/useAuthStore' +import { LoadingSVG } from '../../loading/svg' +import { specialCharRegex, usernameRegex, emailRegex } from '../../../data/regex' +import { MdModeEdit } from 'react-icons/md' +import { GrCloudUpload } from 'react-icons/gr' +import { IoPersonCircleOutline } from 'react-icons/io5' const SignupTab: React.FC = ({ registerData, setRegisterData }) => { const navigate = useNavigate() diff --git a/client/src/components/sidebar/explore.css b/client/src/components/sidebar/explore.css index 1283e0d..05b249c 100644 --- a/client/src/components/sidebar/explore.css +++ b/client/src/components/sidebar/explore.css @@ -15,7 +15,7 @@ height: 40px; background-color: var(--explore_input_bg); border-radius: 20px; - font-size: 16px; + font-size: 18px; text-align: center; color: var(--body_color); border: 2px solid transparent; @@ -59,10 +59,16 @@ } #explore .explore-btns a { - border-radius: 20px; + font-size: 18px; text-transform: lowercase; } #explore .explore-btns a:hover { text-decoration: underline; +} + +@media screen and (max-width: 480px) { + #explore .explore-input input { + text-align: left; + } } \ No newline at end of file diff --git a/client/src/components/sidebar/explore.tsx b/client/src/components/sidebar/explore.tsx index 8fe8f04..44aa8e1 100644 --- a/client/src/components/sidebar/explore.tsx +++ b/client/src/components/sidebar/explore.tsx @@ -1,8 +1,8 @@ -import "./explore.css" -import { useRef, useState } from "react" -import { useNavigate, Link } from "react-router-dom" -import { IoSearch } from "react-icons/io5" -import { categoriesData } from "../../data/categories-data" +import './explore.css' +import { useRef, useState } from 'react' +import { useNavigate, Link } from 'react-router-dom' +import { IoSearch } from 'react-icons/io5' +import { categoriesData } from '../../data/categories-data' interface ExploreProps { term?: string @@ -12,7 +12,7 @@ const Explore: React.FC = ({ term }) => { const navigate = useNavigate() const inputRef = useRef(null) - const [searchTerm, setSearchTerm] = useState("") + const [searchTerm, setSearchTerm] = useState('') const [formSubmitted, setFormSubmitted] = useState(false) const handleSearch = (e: React.FormEvent) => { diff --git a/client/src/components/sidebar/left-sidebar.tsx b/client/src/components/sidebar/left-sidebar.tsx index 0d838ca..8d2b2af 100644 --- a/client/src/components/sidebar/left-sidebar.tsx +++ b/client/src/components/sidebar/left-sidebar.tsx @@ -1,12 +1,12 @@ -import "./left-sidebar.css" -import { useLocation, Link, useNavigate } from "react-router-dom" -import { toast } from "sonner" -import { AuthStatus, AuthTab, useAuthStore } from "../../store/useAuthStore" -import { useNavStore } from "../../store/useNavStore" -import { leftSidebarLinks } from "../../data/left-sidebar-links" -import Profile from "./profile" -import { GoPerson } from "react-icons/go" -import LoadingSkeleton from "../loading/skeleton" +import './left-sidebar.css' +import { useLocation, Link, useNavigate } from 'react-router-dom' +import { toast } from 'sonner' +import { AuthStatus, AuthTab, useAuthStore } from '../../store/useAuthStore' +import { useNavStore } from '../../store/useNavStore' +import { leftSidebarLinks } from '../../data/left-sidebar-links' +import Profile from './profile' +import { GoPerson } from 'react-icons/go' +import LoadingSkeleton from '../loading/skeleton' interface SidebarProps { isVisible: boolean @@ -20,7 +20,7 @@ const LeftSidebar: React.FC = ({ isVisible }) => { const { sidebar } = useNavStore() const handleLinkClick = (href: string, name: string) => { - if (name === "Create Debate") { + if (name === 'Create Debate') { if (isAuthenticated === AuthStatus.Failed) { setRoute(href) setAuthTab(AuthTab.Login) @@ -41,9 +41,9 @@ const LeftSidebar: React.FC = ({ isVisible }) => {
  • handleLinkClick(item.href, item.name)} className='links__wrapper'> -

    {item.name}

    +

    {item.name}

    -
    +
  • ))} diff --git a/client/src/components/sidebar/profile.css b/client/src/components/sidebar/profile.css index 2e7be3b..629a8f4 100644 --- a/client/src/components/sidebar/profile.css +++ b/client/src/components/sidebar/profile.css @@ -22,14 +22,12 @@ display: flex; align-items: center; justify-content: center; - background-size: 200% 100%; background: linear-gradient(to right, var(--shine_text_primary) 0, var(--shine_text_secondary) 10%, var(--shine_text_tertiary) 20%); - -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: shine-join_community 7.5s infinite linear; font-weight: 600; - font-size: 20px; + font-size: 22px; } @keyframes shine-join_community { diff --git a/client/src/components/sidebar/profile.tsx b/client/src/components/sidebar/profile.tsx index 1e63165..6d2e3be 100644 --- a/client/src/components/sidebar/profile.tsx +++ b/client/src/components/sidebar/profile.tsx @@ -1,14 +1,14 @@ -import "./profile.css" -import React, { useCallback, useEffect } from "react" -import { Link, useNavigate } from "react-router-dom" -import { useNavStore } from "../../store/useNavStore" -import { AuthStatus, AuthTab, useAuthStore } from "../../store/useAuthStore" -import ToggleTheme from "../button/toggle-theme" -import LoadingSkeleton from "../loading/skeleton" -import { IoMdPerson } from "react-icons/io" -import { PiBellSimpleFill, PiSignOutBold } from "react-icons/pi" -import { GoPerson } from "react-icons/go" -import { FaRegUser } from "react-icons/fa" +import './profile.css' +import React, { useCallback, useEffect } from 'react' +import { Link, useNavigate } from 'react-router-dom' +import { useNavStore } from '../../store/useNavStore' +import { AuthStatus, AuthTab, useAuthStore } from '../../store/useAuthStore' +import ToggleTheme from '../button/toggle-theme' +import LoadingSkeleton from '../loading/skeleton' +import { IoMdPerson } from 'react-icons/io' +import { PiBellSimpleFill, PiSignOutBold } from 'react-icons/pi' +import { GoPerson } from 'react-icons/go' +import { FaRegUser } from 'react-icons/fa' interface ProfileProps { isVisible?: boolean @@ -23,7 +23,7 @@ const Profile: React.FC = ({ isVisible }) => { setExpand(!expand) const mainElement = document.querySelector('#main') as HTMLElement if (mainElement) { - if (window.matchMedia("(max-width: 480px)").matches) { + if (window.matchMedia('(max-width: 480px)').matches) { if (expand) mainElement.style.overflow = '' else mainElement.style.overflow = 'hidden' } @@ -36,11 +36,11 @@ const Profile: React.FC = ({ isVisible }) => { navigate('/') setIsAuthenticated(AuthStatus.Failed) setUser({ - username: "", - email: "", - first_name: "", - last_name: "", - avatar: "" + username: '', + email: '', + first_name: '', + last_name: '', + avatar: '' }) localStorage.removeItem('token') } @@ -48,13 +48,13 @@ const Profile: React.FC = ({ isVisible }) => { useEffect(() => { const handleClickOutside = (event: MouseEvent) => { const target = event.target as HTMLElement - if (expand && !target.closest(".profile__modal") && !target.closest(".profile__image")) { + if (expand && !target.closest('.profile__modal') && !target.closest('.profile__image')) { handleToggleMenu() } } - document.addEventListener("mousedown", handleClickOutside) - return () => document.removeEventListener("mousedown", handleClickOutside) + document.addEventListener('mousedown', handleClickOutside) + return () => document.removeEventListener('mousedown', handleClickOutside) }, [expand, handleToggleMenu]) return ( diff --git a/client/src/components/sidebar/right-sidebar.tsx b/client/src/components/sidebar/right-sidebar.tsx index ef4dc2a..6e15e7a 100644 --- a/client/src/components/sidebar/right-sidebar.tsx +++ b/client/src/components/sidebar/right-sidebar.tsx @@ -1,9 +1,9 @@ -import "./right-sidebar.css" -import { Link } from "react-router-dom" -import { useNavStore } from "../../store/useNavStore" -import ToggleTheme from "../button/toggle-theme" -import Profile from "./profile" -import Explore from "./explore" +import './right-sidebar.css' +import { Link } from 'react-router-dom' +import { useNavStore } from '../../store/useNavStore' +import ToggleTheme from '../button/toggle-theme' +import Profile from './profile' +import Explore from './explore' interface SidebarProps { isVisible: boolean diff --git a/client/src/data/categories-data.ts b/client/src/data/categories-data.ts index 7a4ebe3..d7f986e 100644 --- a/client/src/data/categories-data.ts +++ b/client/src/data/categories-data.ts @@ -1,24 +1,24 @@ export const categoriesData = [ - "Arts", - "Agriculture", - "Business", - "Education", - "Entertainment", - "Environment", - "Fashion", - "Finance", - "Games", - "Health", - "Law", - "Lifestyle", - "Marketing", - "Music", - "News", - "Parenting", - "Politics", - "Science", - "Sports", - "Technology", - "Travel", - "Writing" + 'Arts', + 'Agriculture', + 'Business', + 'Education', + 'Entertainment', + 'Environment', + 'Fashion', + 'Finance', + 'Games', + 'Health', + 'Law', + 'Lifestyle', + 'Marketing', + 'Music', + 'News', + 'Parenting', + 'Politics', + 'Science', + 'Sports', + 'Technology', + 'Travel', + 'Writing' ] \ No newline at end of file diff --git a/client/src/data/left-sidebar-links.ts b/client/src/data/left-sidebar-links.ts index d4f4dd9..7fb0e2e 100644 --- a/client/src/data/left-sidebar-links.ts +++ b/client/src/data/left-sidebar-links.ts @@ -1,44 +1,44 @@ -import { RiHome2Fill, RiFireFill } from "react-icons/ri" -import { FaFeather } from "react-icons/fa6" -import { IoSearch } from "react-icons/io5" -import { PiBellSimpleFill } from "react-icons/pi" -import { IoMdCreate } from "react-icons/io" +import { RiHome2Fill, RiFireFill } from 'react-icons/ri' +import { FaFeather } from 'react-icons/fa6' +import { IoSearch } from 'react-icons/io5' +import { PiBellSimpleFill } from 'react-icons/pi' +import { IoMdCreate } from 'react-icons/io' export const leftSidebarLinks = [ { id: 1, - name: "Home", - href: "/", + name: 'Home', + href: '/', icon: RiHome2Fill }, { id: 2, - name: "Search", - href: "/search", + name: 'Search', + href: '/search', icon: IoSearch }, { id: 3, - name: "Create Debate", - href: "/create", + name: 'Create Debate', + href: '/create', icon: IoMdCreate }, { id: 4, - name: "Hot Topics", - href: "/hot-topics", + name: 'Hot Topics', + href: '/hot-topics', icon: RiFireFill }, { id: 5, - name: "Open Topics", - href: "/open-topics", + name: 'Open Topics', + href: '/open-topics', icon: FaFeather }, { id: 6, - name: "Notifications", - href: "/notifications", + name: 'Notifications', + href: '/notifications', icon: PiBellSimpleFill } ] \ No newline at end of file diff --git a/client/src/main.tsx b/client/src/main.tsx index 41c0265..c2c140f 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -1,8 +1,8 @@ -import "./globals.css" -import ReactDOM from "react-dom/client" -import { BrowserRouter } from "react-router-dom" -import { registerLicense } from "@syncfusion/ej2-base" -import App from "./App.tsx" +import './globals.css' +import ReactDOM from 'react-dom/client' +import { BrowserRouter } from 'react-router-dom' +import { registerLicense } from '@syncfusion/ej2-base' +import App from './App.tsx' registerLicense(import.meta.env.VITE_SYNCFUSION_KEY) diff --git a/client/src/pages/auth/index.tsx b/client/src/pages/auth/index.tsx index 90f9350..917687d 100644 --- a/client/src/pages/auth/index.tsx +++ b/client/src/pages/auth/index.tsx @@ -1,7 +1,7 @@ -import { useEffect } from "react" -import { useLocation, useNavigate } from "react-router-dom" -import { AuthStatus, AuthTab, useAuthStore, useTempStore } from "../../store/useAuthStore" -import { toast } from "sonner" +import { useEffect } from 'react' +import { useLocation, useNavigate } from 'react-router-dom' +import { AuthStatus, AuthTab, useAuthStore, useTempStore } from '../../store/useAuthStore' +import { toast } from 'sonner' export default function AuthPage() { const location = useLocation() @@ -42,11 +42,11 @@ export default function AuthPage() { } else if (type === 'signup' && user) { setTempUser({ - username: "", - email: user.email || "", - first_name: user.given_name || "", - last_name: user.family_name || "", - avatar: user.picture || "" + username: '', + email: user.email || '', + first_name: user.given_name || '', + last_name: user.family_name || '', + avatar: user.picture || '' }) setAuthTab(AuthTab.Signup) navigate('/auth?type=signup', { replace: true }) diff --git a/client/src/pages/create-debate/editor.tsx b/client/src/pages/create-debate/editor.tsx index aeaa24d..dae68cc 100644 --- a/client/src/pages/create-debate/editor.tsx +++ b/client/src/pages/create-debate/editor.tsx @@ -1,4 +1,4 @@ -import "./editor.css" +import './editor.css' import { RichTextEditorComponent, Toolbar, @@ -15,7 +15,7 @@ import { FormatPainter, PasteCleanup, Resize -} from "@syncfusion/ej2-react-richtexteditor" +} from '@syncfusion/ej2-react-richtexteditor' interface EditorProps { editorRef: React.RefObject diff --git a/client/src/pages/create-debate/index.tsx b/client/src/pages/create-debate/index.tsx index ec2eda7..2821882 100644 --- a/client/src/pages/create-debate/index.tsx +++ b/client/src/pages/create-debate/index.tsx @@ -1,9 +1,9 @@ -import "./style.css" -import { useRef, useState } from "react" -import { RichTextEditorComponent } from "@syncfusion/ej2-react-richtexteditor" -import { toast } from "sonner" -import Editor from "./editor" -import Preview from "./preview" +import './style.css' +import { useRef, useState } from 'react' +import { RichTextEditorComponent } from '@syncfusion/ej2-react-richtexteditor' +import { toast } from 'sonner' +import Editor from './editor' +import Preview from './preview' interface CreateProps { isVisible: boolean @@ -23,14 +23,14 @@ const CreateDebatePage: React.FC = ({ isVisible, isFullscreen }) => } } - if (!debateData.title.trim()) return toast.warning("Enter debate title") + if (!debateData.title.trim()) return toast.warning('Enter debate title') - const tempDiv = document.createElement("div") + const tempDiv = document.createElement('div') tempDiv.innerHTML = editorRef.current?.value || '' const bodyText = tempDiv.textContent?.replace(/\u200B/g, '').trim() if (!bodyText || bodyText === '
    ' || bodyText === '

    ' || bodyText === '


    ') { - return toast.warning("Enter debate body") + return toast.warning('Enter debate body') } setIsPreview(!isPreview) @@ -68,7 +68,7 @@ const CreateDebatePage: React.FC = ({ isVisible, isFullscreen }) => > {isPreview ? 'BACK' : 'PREVIEW'} -
    diff --git a/client/src/pages/create-debate/preview.tsx b/client/src/pages/create-debate/preview.tsx index 6eb55a9..4357f4a 100644 --- a/client/src/pages/create-debate/preview.tsx +++ b/client/src/pages/create-debate/preview.tsx @@ -1,5 +1,5 @@ -import { RichTextEditorComponent } from "@syncfusion/ej2-react-richtexteditor" -import Editor from "./editor" +import { RichTextEditorComponent } from '@syncfusion/ej2-react-richtexteditor' +import Editor from './editor' interface PreviewProps { isPreview: boolean diff --git a/client/src/pages/home/index.tsx b/client/src/pages/home/index.tsx index ef7a8cb..6b1ff66 100644 --- a/client/src/pages/home/index.tsx +++ b/client/src/pages/home/index.tsx @@ -1,19 +1,13 @@ -import "./style.css" -import { AuthStatus, useAuthStore } from "../../store/useAuthStore" -import { useNavStore } from "../../store/useNavStore" -import ClaimUsername from "../../components/card/claim-username" -import { ClosedDebateCard } from "../../components/card/closed-debate-card" -import { OpenDebateCard } from "../../components/card/open-debate-card" +import './style.css' +import { useNavStore } from '../../store/useNavStore' +import { ClosedDebateCard } from '../../components/card/closed-debate-card' +import { OpenDebateCard } from '../../components/card/open-debate-card' export default function HomePage() { - const { isAuthenticated } = useAuthStore() const { sidebar } = useNavStore() return (
    - {isAuthenticated === AuthStatus.Authenticating || isAuthenticated === AuthStatus.Failed && ( - - )} diff --git a/client/src/pages/hot-topics/index.tsx b/client/src/pages/hot-topics/index.tsx index ba72364..b6a0141 100644 --- a/client/src/pages/hot-topics/index.tsx +++ b/client/src/pages/hot-topics/index.tsx @@ -1,6 +1,6 @@ -import "./style.css" -import { useNavStore } from "../../store/useNavStore" -import { ClosedDebateCard, ClosedDebateLoadingCard } from "../../components/card/closed-debate-card" +import './style.css' +import { useNavStore } from '../../store/useNavStore' +import { ClosedDebateCard, ClosedDebateLoadingCard } from '../../components/card/closed-debate-card' export default function HotTopicsPage() { const { sidebar } = useNavStore() diff --git a/client/src/pages/notifications/index.tsx b/client/src/pages/notifications/index.tsx index 89b0d9f..84872b7 100644 --- a/client/src/pages/notifications/index.tsx +++ b/client/src/pages/notifications/index.tsx @@ -1,4 +1,4 @@ -import "./style.css" +import './style.css' export default function NotificationPage() { return ( diff --git a/client/src/pages/open-topics/index.tsx b/client/src/pages/open-topics/index.tsx index 5030b83..23f2d28 100644 --- a/client/src/pages/open-topics/index.tsx +++ b/client/src/pages/open-topics/index.tsx @@ -1,6 +1,6 @@ -import "./style.css" -import { useNavStore } from "../../store/useNavStore" -import { OpenDebateCard, OpenDebateLoadingCard } from "../../components/card/open-debate-card" +import './style.css' +import { useNavStore } from '../../store/useNavStore' +import { OpenDebateCard, OpenDebateLoadingCard } from '../../components/card/open-debate-card' export default function OpenTopicsPage() { const { sidebar } = useNavStore() diff --git a/client/src/pages/search/index.tsx b/client/src/pages/search/index.tsx index 3c64033..8913c95 100644 --- a/client/src/pages/search/index.tsx +++ b/client/src/pages/search/index.tsx @@ -1,22 +1,22 @@ -import "./style.css" -import { useState, useEffect } from "react" -import { useLocation, useNavigate } from "react-router-dom" -import Explore from "../../components/sidebar/explore" -import { IoMdClose } from "react-icons/io" -import { PiArrowBendUpRightBold } from "react-icons/pi" +import './style.css' +import { useState, useEffect } from 'react' +import { useLocation, useNavigate } from 'react-router-dom' +import Explore from '../../components/sidebar/explore' +import { IoMdClose } from 'react-icons/io' +import { PiArrowBendUpRightBold } from 'react-icons/pi' export default function SearchPage() { const location = useLocation() const navigate = useNavigate() - const [searchTerm, setSearchTerm] = useState("") + const [searchTerm, setSearchTerm] = useState('') useEffect(() => { const urlParams = new URLSearchParams(location.search) const termValue = urlParams.get('term') const categoryValue = urlParams.get('category') - if (termValue === "" || categoryValue === "") navigate("/") + if (termValue === '' || categoryValue === '') navigate('/') else { const searchValue = termValue ?? categoryValue ?? '' setSearchTerm(searchValue) @@ -33,7 +33,7 @@ export default function SearchPage() {

    Showing results for {searchTerm}

    -
    diff --git a/client/src/store/useAuthStore.ts b/client/src/store/useAuthStore.ts index dafe0b2..9b33fd8 100644 --- a/client/src/store/useAuthStore.ts +++ b/client/src/store/useAuthStore.ts @@ -1,4 +1,4 @@ -import { create } from "zustand" +import { create } from 'zustand' export enum AuthTab { Closed = 'closed', @@ -34,17 +34,17 @@ interface AuthStore { } export const useAuthStore = create((set) => ({ - route: "", + route: '', setRoute: (navigate: string) => set({ route: navigate }), authTab: AuthTab.Closed, setAuthTab: (tab: AuthTab) => set({ authTab: tab }), isAuthenticated: AuthStatus.Authenticating, setIsAuthenticated: (authenticated: AuthStatus) => set({ isAuthenticated: authenticated }), user: { - username: "", - email: "", - first_name: "", - last_name: "", + username: '', + email: '', + first_name: '', + last_name: '', avatar: null }, setUser: (data: User) => set({ user: data }) @@ -58,19 +58,19 @@ interface TempStore { export const useTempStore = create((set) => ({ tempUser: { - username: "", - email: "", - first_name: "", - last_name: "", + username: '', + email: '', + first_name: '', + last_name: '', avatar: null }, setTempUser: (data: User) => set({ tempUser: data }), clearTempUser: () => set({ tempUser: { - username: "", - email: "", - first_name: "", - last_name: "", + username: '', + email: '', + first_name: '', + last_name: '', avatar: null } }) diff --git a/client/src/store/useNavStore.ts b/client/src/store/useNavStore.ts index fec2780..be740bc 100644 --- a/client/src/store/useNavStore.ts +++ b/client/src/store/useNavStore.ts @@ -1,4 +1,4 @@ -import { create } from "zustand" +import { create } from 'zustand' export enum Theme { Light = 'light', diff --git a/client/src/utils/handleAutoLogin.ts b/client/src/utils/handleAutoLogin.ts index 88ea90f..8c63c05 100644 --- a/client/src/utils/handleAutoLogin.ts +++ b/client/src/utils/handleAutoLogin.ts @@ -1,4 +1,4 @@ -import { User, AuthStatus, AuthTab } from "../store/useAuthStore" +import { User, AuthStatus, AuthTab } from '../store/useAuthStore' type SetRoute = (navigate: string) => void type SetUser = (user: User) => void diff --git a/client/vite.config.ts b/client/vite.config.ts index 714d296..7e1155e 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from "vite" -import react from "@vitejs/plugin-react-swc" +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react-swc' export default defineConfig({ plugins: [react()], diff --git a/server/controllers/auth.js b/server/controllers/auth.js index 43d7c37..783bcef 100644 --- a/server/controllers/auth.js +++ b/server/controllers/auth.js @@ -110,7 +110,7 @@ exports.login = async function (fastify, request, reply) { if (cachedUser) user = cachedUser.item else { const [db_user] = await fastify.mysql.query(`SELECT * FROM users WHERE ${id.includes('@') ? 'email=?' : 'username=?'}`, [id, id]) - if (!db_user.length) throw new ErrorHandler(400, false, "Account doesn't exist") + if (!db_user.length) throw new ErrorHandler(400, false, 'Account does not exist') await fastify.cache.set(cacheKey, db_user[0], 432000, (err) => { if (err) throw new ErrorHandler(400, false, 'Failed to set data in cache') @@ -197,7 +197,7 @@ exports.recoverAccount = async function (fastify, request, reply) { const { email, username } = request.body const [user] = await fastify.mysql.query('SELECT * FROM users WHERE email=? OR username=?', [email, username]) - if (!user.length) throw new ErrorHandler(400, false, "Account doesn't exist") + if (!user.length) throw new ErrorHandler(400, false, 'Account does not exist') const token = randomBytes(32).toString('hex') const tokenExpiry = new Date(Date.now() + 3600000) @@ -240,7 +240,7 @@ exports.resetPassword = async (fastify, request, reply) => { await fastify.mysql.query('DELETE FROM reset WHERE username=?', [reset[0].username]) const [updatedUser] = await fastify.mysql.query('SELECT * FROM users WHERE username=?', [reset[0].username]) - if (!updatedUser.length) throw new ErrorHandler(400, false, "Account doesn't exists") + if (!updatedUser.length) throw new ErrorHandler(400, false, 'Account does not exists') const cacheKeys = [`user:${updatedUser[0].username}`, `user:${updatedUser[0].email}`] await Promise.all(cacheKeys.map(cacheKey =>