added all pages placeholders

This commit is contained in:
2025-09-22 16:45:50 +03:00
parent 181fe61368
commit e566bd75b8
23 changed files with 251 additions and 61 deletions

View File

@ -1,4 +1,4 @@
import { BrowserRouter as Router, Routes, Route, Outlet, useLocation, useNavigate } from 'react-router-dom'; import { BrowserRouter as Router, Routes, Route, Outlet, useLocation, useNavigate } from "react-router-dom";
import {useEffect, useState } from "react"; import {useEffect, useState } from "react";
import { ToastContainer } from "react-toastify"; import { ToastContainer } from "react-toastify";
@ -10,14 +10,20 @@ import {
import { AuthProvider } from "./auth/auth-provider" import { AuthProvider } from "./auth/auth-provider"
import ping from "./auth/ping"; import ping from "./auth/ping";
import useAuth from "./auth/auth";
import Login from "./pages/login/login" import Login from "./pages/login/login"
import Register from "./pages/register/register" import Register from "./pages/register/register"
import Home from "./pages/home/home" import Home from "./pages/home/home"
import Dashboard from "./pages/dashboard/dashboard" import Dashboard from "./pages/dashboard/dashboard"
import Users from "./pages/users/users";
import Groups from "./pages/groups/groups";
import Feeds from "./pages/feeds/feeds";
import Pictures from "./pages/pictures/pictures";
import Account from "./pages/acccount/account";
import Settings from "./pages/settings/settings" import Settings from "./pages/settings/settings"
import useAuth from './auth/auth';
const PrivateRoute = () => { const PrivateRoute = () => {
@ -78,9 +84,15 @@ function App() {
<Route path="/register" element={<Register />} /> <Route path="/register" element={<Register />} />
<Route element={<PrivateRoute />}> <Route element={<PrivateRoute />}>
<Route path='/' element={<Home />} /> <Route path="/" element={<Home />} />
<Route path='/dashboard' element={<Dashboard />} /> <Route path="/dashboard" element={<Dashboard />} />
<Route path='/settings' element={<Settings />} /> <Route path="/users" element={<Users />} />
<Route path="/groups" element={<Groups />} />
<Route path="/feeds" element={<Feeds />} />
<Route path="/pictures" element={<Pictures />} />
<Route path="/account" element={<Account />} />
<Route path="/settings" element={<Settings />} />
</Route> </Route>
<Route path="*" element={<h1 className="not-found">404 [#]<br/>Not Found</h1>} /> <Route path="*" element={<h1 className="not-found">404 [#]<br/>Not Found</h1>} />

View File

@ -1,9 +1,9 @@
import React, { useState } from 'react'; import React, { useState } from "react";
import './FormField.css'; import "./FormField.css";
interface FormFieldProperties { interface FormFieldProperties {
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search'; type?: "text" | "email" | "password" | "number" | "tel" | "url" | "search";
placeholder?: string; placeholder?: string;
value: string; value: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
@ -22,24 +22,24 @@ interface FormFieldProperties {
const FormField: React.FC<FormFieldProperties> = ({ const FormField: React.FC<FormFieldProperties> = ({
type = 'text', type = "text",
placeholder, placeholder,
value, value,
onChange, onChange,
required = false, required = false,
errorMessage = 'Please fill out this field', errorMessage = "Please fill out this field",
showError = false, showError = false,
onBlur, onBlur,
onFocus, onFocus,
className = '', className = "",
disabled = false, disabled = false,
autoComplete = 'off', autoComplete = "off",
customValidator, customValidator,
showErrorInitially = false, showErrorInitially = false,
icon: Icon, icon: Icon,
}) => { }) => {
const [touched, setTouched] = useState<boolean>(showErrorInitially); const [touched, setTouched] = useState<boolean>(showErrorInitially);
const [customError, setCustomError] = useState<string>(''); const [customError, setCustomError] = useState<string>("");
const validateField = (value: string): string => { const validateField = (value: string): string => {
if (required && !value) { if (required && !value) {
@ -51,7 +51,7 @@ const FormField: React.FC<FormFieldProperties> = ({
return customValidation; return customValidation;
} }
} }
return ''; return "";
}; };
const shouldShowError = showError || (touched && validateField(value)); const shouldShowError = showError || (touched && validateField(value));
@ -64,7 +64,7 @@ const FormField: React.FC<FormFieldProperties> = ({
}; };
const handleFocus = (e: React.FocusEvent<HTMLInputElement>): void => { const handleFocus = (e: React.FocusEvent<HTMLInputElement>): void => {
setCustomError(''); setCustomError("");
onFocus?.(e); onFocus?.(e);
}; };
@ -85,7 +85,7 @@ const FormField: React.FC<FormFieldProperties> = ({
required={required} required={required}
disabled={disabled} disabled={disabled}
autoComplete={autoComplete} autoComplete={autoComplete}
className={shouldShowError ? 'error' : ''} className={shouldShowError ? "error" : ""}
/> />
{shouldShowError && ( {shouldShowError && (
<div className="error-message"> <div className="error-message">

View File

@ -2,7 +2,7 @@
display: flex; display: flex;
top: 0; top: 0;
left: 0; left: 0;
width: 240px; width: 280px;
height: 100%; height: 100%;
background-color: var(--background-dark); background-color: var(--background-dark);
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3); box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from "react";
import useLogout from "../auth/logout" import useLogout from "../auth/logout"
import './Sidebar.css'; import "./Sidebar.css";
const Sidebar: React.FC = () => { const Sidebar: React.FC = () => {
@ -14,7 +14,10 @@ const Sidebar: React.FC = () => {
<nav className="sidebar-nav"> <nav className="sidebar-nav">
<a href="/" className="sidebar-link">Home</a> <a href="/" className="sidebar-link">Home</a>
<a href="/dashboard" className="sidebar-link">Dashboard</a> <a href="/dashboard" className="sidebar-link">Dashboard</a>
<a href="/user" className="sidebar-link">User</a> <a href="/users" className="sidebar-link">Users</a>
<a href="/groups" className="sidebar-link">Groups</a>
<a href="/feeds" className="sidebar-link">Feeds</a>
<a href="/pictures" className="sidebar-link">Pictures</a>
</nav> </nav>
</div> </div>
@ -22,6 +25,7 @@ const Sidebar: React.FC = () => {
<button onClick={useLogout()} className="sidebar-link logout-button"> <button onClick={useLogout()} className="sidebar-link logout-button">
Logout Logout
</button> </button>
<a href="/account" className="sidebar-link">Account</a>
<a href="/settings" className="sidebar-link">Settings</a> <a href="/settings" className="sidebar-link">Settings</a>
</div> </div>
</div> </div>

View File

@ -1,9 +1,9 @@
import { StrictMode } from 'react' import { StrictMode } from "react"
import { createRoot } from 'react-dom/client' import { createRoot } from "react-dom/client"
import './index.css' import "./index.css"
import App from './App.tsx' import App from "./App.tsx"
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
<App /> <App />
</StrictMode>, </StrictMode>,

View File

@ -0,0 +1,14 @@
.account {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.account-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

View File

@ -0,0 +1,15 @@
import "./account.css"
import Sidebar from "../../components/Sidebar";
const Account = () => {
return (
<div className="account">
<Sidebar/>
<div className="account-content">
<h2>Account</h2>
</div>
</div>
)
}
export default Account;

View File

@ -5,10 +5,6 @@
max-width: 100%; max-width: 100%;
} }
.sidebar-container {
display: flex;
}
.dashboard-content { .dashboard-content {
display: flex; display: flex;
height: 100%; height: 100%;

View File

@ -4,9 +4,7 @@ import "./dashboard.css"
const Dashboard = () => { const Dashboard = () => {
return ( return (
<div className="dashboard"> <div className="dashboard">
<div>
<Sidebar/> <Sidebar/>
</div>
<div className="dashboard-content"> <div className="dashboard-content">
<div className="dashboard-text"> <div className="dashboard-text">
<h2>Dashboard Content<br/>WIP</h2> <h2>Dashboard Content<br/>WIP</h2>

14
src/pages/feeds/feeds.css Normal file
View File

@ -0,0 +1,14 @@
.feeds {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.feeds-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

15
src/pages/feeds/feeds.tsx Normal file
View File

@ -0,0 +1,15 @@
import "./feeds.css"
import Sidebar from "../../components/Sidebar";
const Feeds = () => {
return (
<div className="feeds">
<Sidebar/>
<div className="feeds-content">
<h2>Feeds</h2>
</div>
</div>
)
}
export default Feeds;

View File

@ -0,0 +1,14 @@
.groups {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.groups-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

View File

@ -0,0 +1,15 @@
import "./groups.css"
import Sidebar from "../../components/Sidebar";
const Groups = () => {
return (
<div className="groups">
<Sidebar/>
<div className="groups-content">
<h2>Groups</h2>
</div>
</div>
)
}
export default Groups;

14
src/pages/home/home.css Normal file
View File

@ -0,0 +1,14 @@
.home {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.home-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

View File

@ -1,14 +1,14 @@
import { Link } from 'react-router-dom'; import { Link } from "react-router-dom";
import useLogout from "../../auth/logout" import Sidebar from "../../components/Sidebar";
import "./home.css"
const Home = () => { const Home = () => {
return ( return (
<div> <div className="home">
<Sidebar/>
<div className="home-content">
<h2>Home</h2> <h2>Home</h2>
<button onClick={useLogout()}>
Logout
</button>
<nav> <nav>
<ul> <ul>
<li> <li>
@ -26,6 +26,7 @@ const Home = () => {
</ul> </ul>
</nav> </nav>
</div> </div>
</div>
) )
} }

View File

@ -17,7 +17,7 @@ const Login = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const searchPath = new URLSearchParams(location.search); const searchPath = new URLSearchParams(location.search);
const redirectPath = searchPath.get('to') || "/"; const redirectPath = searchPath.get("to") || "/";
const [usernameEmpty, setUsernameEmpty] = useState(false); const [usernameEmpty, setUsernameEmpty] = useState(false);
const [passwordEmpty, setPasswordEmpty] = useState(false); const [passwordEmpty, setPasswordEmpty] = useState(false);
@ -54,7 +54,7 @@ const Login = () => {
</div> </div>
<div className="login-left"> <div className="login-left">
<video className="login-video" autoPlay loop muted> <video className="login-video" autoPlay loop muted>
<source src={"./login-video.mp4"} type='video/mp4' /> <source src={"./login-video.mp4"} type="video/mp4" />
</video> </video>
</div> </div>
<div className="login-right"> <div className="login-right">

View File

@ -0,0 +1,14 @@
.pictures {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.pictures-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

View File

@ -0,0 +1,15 @@
import "./pictures.css"
import Sidebar from "../../components/Sidebar";
const Pictures = () => {
return (
<div className="pictures">
<Sidebar/>
<div className="pictures-content">
<h2>Pictures</h2>
</div>
</div>
)
}
export default Pictures;

View File

@ -17,7 +17,7 @@ const Register = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const searchPath = new URLSearchParams(location.search); const searchPath = new URLSearchParams(location.search);
const redirectPath = searchPath.get('to') || "/"; const redirectPath = searchPath.get("to") || "/";
const [usernameEmpty, setUsernameEmpty] = useState(false); const [usernameEmpty, setUsernameEmpty] = useState(false);
const [passwordEmpty, setPasswordEmpty] = useState(false); const [passwordEmpty, setPasswordEmpty] = useState(false);

View File

@ -0,0 +1,14 @@
.settings {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.settings-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

View File

@ -1,8 +1,14 @@
import "./settings.css"
import Sidebar from "../../components/Sidebar";
const Settings = () => { const Settings = () => {
return ( return (
<div> <div className="settings">
<Sidebar/>
<div className="settings-content">
<h2>Settings</h2> <h2>Settings</h2>
</div> </div>
</div>
) )
} }

14
src/pages/users/users.css Normal file
View File

@ -0,0 +1,14 @@
.users {
display: flex;
width: 100vw;
height: 100vh;
max-width: 100%;
}
.users-content {
display: flex;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
}

15
src/pages/users/users.tsx Normal file
View File

@ -0,0 +1,15 @@
import "./users.css"
import Sidebar from "../../components/Sidebar";
const Users = () => {
return (
<div className="users">
<Sidebar/>
<div className="users-content">
<h2>Users</h2>
</div>
</div>
)
}
export default Users;