Skip to content

Commit

Permalink
Merge pull request #17 from atlp-rwanda/187783612-create-admin-landin…
Browse files Browse the repository at this point in the history
…g-page

[#finishes 187783612] Implementing admin dashboard UI
  • Loading branch information
niyontwali authored Jun 22, 2024
2 parents 54ea615 + 4260e59 commit 1ab014e
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 62 deletions.
10 changes: 2 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@
"prettier",
"plugin:storybook/recommended"
],
"ignorePatterns": [
"dist",
".eslintrc.cjs"
],
"ignorePatterns": ["dist", ".eslintrc.cjs"],
"parser": "@typescript-eslint/parser",
"plugins": [
"react-refresh",
"prettier"
],
"plugins": ["react-refresh", "prettier"],
"rules": {
"react-refresh/only-export-components": [
"warn",
Expand Down
18 changes: 12 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
import eslintConfigPrettier from 'eslint-config-prettier';

export default [
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReactConfig,
eslintConfigPrettier
eslintConfigPrettier,
{
rules: {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
},
},
];
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
"@hookform/resolvers": "^3.6.0",
"@reduxjs/toolkit": "^2.2.5",
"@types/react-redux": "^7.1.33",
"apexcharts": "^3.49.1",
"axios": "^1.7.2",
"clsx": "^2.1.1",
"jwt-decode": "^4.0.0",
"react": "^18.2.0",
"react-apexcharts": "^1.4.1",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.5",
"react-icons": "^5.2.1",
Expand Down
16 changes: 16 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Login from './pages/Login';
import LandingPage from './pages/LandingPage';
import GoogleAuthSuccess from './components/authentication/GoogleAuthSucces';
import { ToastContainer } from 'react-toastify';
import AdminPage from './pages/Admin';
import Category from './pages/Admin/Category';

const App = () => {
const router = createBrowserRouter([
Expand Down Expand Up @@ -37,6 +39,20 @@ const App = () => {
{ path: 'success', element: <Success /> },
],
},
{
path: 'admin',
element: <AdminPage />,
children: [
{
index: true,
element: <AdminPage />,
},
{
path: 'categories',
element: <Category />,
},
],
},
]);
return (
<>
Expand Down
Binary file added src/assets/Rectangle 2487.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/profile-picture-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import React from 'react';
import { FaRegListAlt, FaUserFriends, FaUserTie, FaRegEnvelope, FaCog } from 'react-icons/fa';
import { FiLogOut } from 'react-icons/fi';
import { RxDashboard } from 'react-icons/rx';
import logo from '../assets/Rectangle 2487.png';
import { Link } from 'react-router-dom';

export default function Sidebar({ isOpen, toggleSidebar }: { isOpen: boolean; toggleSidebar: () => void }) {
const [activeLink, setActiveLink] = React.useState('Dashboard');

const handleLinkClick = (link: string) => {
setActiveLink(link);
};

const linkClasses = (link: string) =>
`flex items-center py-2.5 px-4 rounded transition duration-200 hover:bg-[#E5E7EB] text-[#8F8183] ${
activeLink === link ? 'bg-skyBlue text-skyBlueText hover:bg-skyBlue' : ''
}`;

return (
<>
<div
className={`fixed inset-0 bg-blackColor opacity-50 z-40 ${isOpen ? 'block' : 'hidden'} md:hidden`}
onClick={toggleSidebar}
></div>
<div
className={`w-64 h-screen bg-whiteColor shadow-md flex flex-col justify-between fixed z-50 transition-transform transform ${isOpen ? 'translate-x-0' : '-translate-x-full'} md:translate-x-0`}
>
<div className='p-6'>
<div className='text-center font-semibold text-2xl mb-6 static'>
<a href='#'>
MAVERICKS <img src={logo} alt='' className='absolute top-5 right-5' width={40} height={40} />
</a>
</div>
<nav>
<ul className='space-y-2'>
<li>
<Link to={'/admin'} className={linkClasses('Dashboard')} onClick={() => handleLinkClick('Dashboard')}>
<RxDashboard className='mr-3' />
Dashboard
</Link>
</li>
<li>
<Link to={'categories'} className={linkClasses('Category')} onClick={() => handleLinkClick('Category')}>
<FaRegListAlt className='mr-3' />
Category
</Link>
</li>
<li>
<Link to={''} className={linkClasses('Sellers')} onClick={() => handleLinkClick('Sellers')}>
<FaUserTie className='mr-3' />
Sellers
</Link>
</li>
<li>
<Link to={''} className={linkClasses('Buyers')} onClick={() => handleLinkClick('Buyers')}>
<FaUserFriends className='mr-3' />
Buyers
</Link>
</li>
<li>
<Link to={''} className={linkClasses('Messages')} onClick={() => handleLinkClick('Messages')}>
<FaRegEnvelope className='mr-3' />
Messages
</Link>
</li>
<li>
<Link to={''} className={linkClasses('Settings')} onClick={() => handleLinkClick('Settings')}>
<FaCog className='mr-3' />
Settings
</Link>
</li>
</ul>
</nav>
</div>
<div className='p-6'>
<a href='#' className='flex items-center py-2.5 px-4 rounded transition duration-200 hover:bg-[#E5E7EB]'>
<FiLogOut className='mr-3' />
Logout
</a>
</div>
</div>
</>
);
}
102 changes: 54 additions & 48 deletions src/containers/nav/NavbarComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,62 @@
import clothes from '../../assets/clothes.png'
import watches from '../../assets/watches.png'
import education from '../../assets/education.png'
import suppliment from '../../assets/supplement.png'
import shoes from '../../assets/shoes.png'
import electronics from '../../assets/electronics.png'
import { Link, NavLink } from 'react-router-dom'
import clothes from '../../assets/clothes.png';
import watches from '../../assets/watches.png';
import education from '../../assets/education.png';
import suppliment from '../../assets/supplement.png';
import shoes from '../../assets/shoes.png';
import electronics from '../../assets/electronics.png';
import { Link, NavLink } from 'react-router-dom';

export function PopularCategory({ title }: { title: string }) {
return (
<>
<div className='p-3'>
<h2 className="capitalize font-bold text-2xl">{title}</h2>
</div>
<SidebarLink icon={clothes} to='/' name='women clothes' />
<SidebarLink icon={watches} to='/' name='watches' />
<SidebarLink icon={education} to='/' name='education' />
<SidebarLink icon={suppliment} to='/' name='suppliment' />
<SidebarLink icon={shoes} to='/' name='shoes' />
<SidebarLink icon={electronics} to='/' name='electronics' />
</>
)
return (
<>
<div className='p-3'>
<h2 className='capitalize font-bold text-2xl'>{title}</h2>
</div>
<SidebarLink icon={clothes} to='/' name='women clothes' />
<SidebarLink icon={watches} to='/' name='watches' />
<SidebarLink icon={education} to='/' name='education' />
<SidebarLink icon={suppliment} to='/' name='suppliment' />
<SidebarLink icon={shoes} to='/' name='shoes' />
<SidebarLink icon={electronics} to='/' name='electronics' />
</>
);
}
export function SidebarLink({ icon, name, to }: { icon: string, name: string, to: string }) {
return (
<NavLink to={to} className="flex items-center justify-start gap-3 px-3 cursor-pointer active:bg-grayColor transition-all ease-in py-1 hover:bg-grayColor">
<div className="rounded-md h-[50px] w-[50px] flex justify-center items-center">
<img src={icon} alt="" className="w-full rounded-md" />
</div>
<p className="leading-none font-medium text-base capitalize">{name}</p>
</NavLink>
)
export function SidebarLink({ icon, name, to }: { icon: string; name: string; to: string }) {
return (
<NavLink
to={to}
className='flex items-center justify-start gap-3 px-3 cursor-pointer active:bg-grayColor transition-all ease-in py-1 hover:bg-grayColor'
>
<div className='rounded-md h-[50px] w-[50px] flex justify-center items-center'>
<img src={icon} alt='' className='w-full rounded-md' />
</div>
<p className='leading-none font-medium text-base capitalize'>{name}</p>
</NavLink>
);
}
export function DesktopNav() {
return (
<div className="bg-blackColor text-whiteColor hidden md:block w-full">
<div className="flex justify-center items-center border-whiteColor">
<DeskNavLink to="/" name='Plus' />
<DeskNavLink to="/" name='Flash Sales' />
<DeskNavLink to="/" name='Babies' />
<DeskNavLink to="/" name='Fathers' />
<DeskNavLink to="/" name='Electronics' />
<DeskNavLink to="/" name='Beauty' />
<DeskNavLink to="/" name='Sports' />
</div>
</div>
)
return (
<div className='bg-blackColor text-whiteColor hidden md:block w-full'>
<div className='flex justify-center items-center border-whiteColor'>
<DeskNavLink to='/' name='Plus' />
<DeskNavLink to='/' name='Flash Sales' />
<DeskNavLink to='/' name='Babies' />
<DeskNavLink to='/' name='Fathers' />
<DeskNavLink to='/' name='Electronics' />
<DeskNavLink to='/' name='Beauty' />
<DeskNavLink to='/' name='Sports' />
</div>
</div>
);
}

function DeskNavLink({ to, name }: { to: string, name: string }) {
return (
<Link to={to} className={`px-5 py-2 cursor-pointer hover:bg-whiteColor hover:text-blackColor transition-all delay-100 ease-linear`}>
{name}
</Link>
);
function DeskNavLink({ to, name }: { to: string; name: string }) {
return (
<Link
to={to}
className={`px-5 py-2 cursor-pointer hover:bg-whiteColor hover:text-blackColor transition-all delay-100 ease-linear`}
>
{name}
</Link>
);
}
3 changes: 3 additions & 0 deletions src/pages/Admin/Category.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Category() {
return <div>This is a Category</div>;
}
Loading

0 comments on commit 1ab014e

Please sign in to comment.