Added Navigate To DropDown

This commit is contained in:
Mitchell Magro 2025-06-25 15:35:28 +02:00
parent 11fca28199
commit 69fbd6d5e1
6 changed files with 79 additions and 84 deletions

View File

@ -1,2 +1,27 @@
# paymentIQ # 🛠️ Backoffice Admin Panel
Payment IQ Back Office
A modern backoffice admin panel built with [Next.js](https://nextjs.org/) and [React](https://react.dev), providing a scalable and maintainable foundation for managing internal tools, content, and operations.
---
## 🚀 Tech Stack
- [Next.js](https://nextjs.org/) App Router with SSR support
- [React](https://reactjs.org/)
- [TypeScript](https://www.typescriptlang.org/)
- [Material UI](https://mui.com/) UI component library
- [Axios](https://axios-http.com/) API client
- [Jest](https://jestjs.io/) / [React Testing Library](https://testing-library.com/) Unit & integration testing
- [ESLint](https://eslint.org/) / [Prettier](https://prettier.io/) Code quality & formatting
- [dotenv](https://github.com/motdotla/dotenv) Environment variable management
---
## 📦 Getting Started
```bash
git clone https://git.luckyigaming.com/Mitchell/payment-backoffice.git
cd backoffice
yarn run dev

View File

@ -0,0 +1,42 @@
import React from 'react';
import {
FormControl,
InputLabel,
Select,
MenuItem,
SelectChangeEvent,
ListItemIcon,
ListItemText,
} from '@mui/material';
import { SIDEBAR_LINKS } from '@/constants/SidebarLink.constants';
interface Props {
onChange?: (event: SelectChangeEvent<string>) => void;
}
export default function SidebarDropdown({ onChange }: Props) {
const [value, setValue] = React.useState('');
const handleChange = (event: SelectChangeEvent<string>) => {
setValue(event.target.value);
onChange?.(event);
};
return (
<FormControl fullWidth variant="outlined" sx={{ maxWidth: 200 }}>
<InputLabel id="sidebar-dropdown-label">Navigate To</InputLabel>
<Select
labelId="sidebar-dropdown-label"
value={value}
onChange={handleChange}
label="Navigate To"
>
{SIDEBAR_LINKS.map((link:any) => (
<MenuItem key={link.path} value={link.path}>
<ListItemText primary={link.title} />
</MenuItem>
))}
</Select>
</FormControl>
);
}

View File

@ -1,6 +1,7 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { AppBar, Toolbar, IconButton, Menu, MenuItem, Button } from '@mui/material'; import { AppBar, Toolbar, IconButton, Menu, MenuItem, Button } from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu'; import MenuIcon from '@mui/icons-material/Menu';
import Dropdown from './DropDown';
const Header = () => { const Header = () => {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
@ -15,6 +16,9 @@ const Header = () => {
setAnchorEl(null); setAnchorEl(null);
}; };
const handleChange = (e:any) => {
};
return ( return (
<AppBar position="sticky" color="transparent" elevation={0} sx={{ borderBottom: '1px solid #22242626' }}> <AppBar position="sticky" color="transparent" elevation={0} sx={{ borderBottom: '1px solid #22242626' }}>
<Toolbar> <Toolbar>
@ -24,9 +28,7 @@ const Header = () => {
</IconButton> </IconButton>
{/* Dropdown Button */} {/* Dropdown Button */}
<Button color="inherit" onClick={handleMenuClick}> <Dropdown onChange={handleChange}/>
Options
</Button>
{/* Dropdown Menu */} {/* Dropdown Menu */}
<Menu <Menu

View File

@ -38,7 +38,7 @@ const SideBar = () => {
return ( return (
<SideBarContainer> <SideBarContainer>
<SidebarHeader> <SidebarHeader>
PaymentIQ <IconSpacing fontSize="small" /> <span style={{color: '#fff'}}>Betrise cashir <IconSpacing fontSize="small" /></span>
</SidebarHeader> </SidebarHeader>
{SIDEBAR_LINKS.map((link) => ( {SIDEBAR_LINKS.map((link) => (
<SidebarLink <SidebarLink

View File

@ -1,73 +0,0 @@
'use client';
import React from 'react';
import { styled } from '@mui/system';
import DashboardIcon from '@mui/icons-material/Dashboard';
import { SIDEBAR_LINKS } from '@/constants/SidebarLink.constants';
import SideBarLink from './SideBarLink';
// SideBar Container (styled using MUI System)
export const SideBar = styled('div')(({ theme }) => ({
width: '240px',
backgroundColor: theme.palette.background.primary,
color: 'white',
padding: theme.spacing(2),
height: '100vh',
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between',
transition: 'width 0.3s ease', // Transition for resizing
}));
// Main Content Area
export const MainContent = styled('div')(({ theme }) => ({
flexGrow: 1,
padding: theme.spacing(4),
backgroundColor: theme.palette.background.default,
minHeight: '100vh',
overflowY: 'auto',
}));
// SideBar Header
export const SideBarHeader = styled('div')(({ theme }) => ({
marginBottom: theme.spacing(2),
fontSize: '20px',
fontWeight: 600,
display: 'flex',
alignItems: 'center',
}));
// Page Wrapper that holds SideBar and Content
export const LayoutWrapper = styled('div')({
display: 'flex',
flexDirection: 'row',
height: '100vh',
});
interface SideBarLayoutProps {
children: React.ReactNode; // Add children to accept passed content
}
const SideBarLayout: React.FC<SideBarLayoutProps> = ({ children }) => {
return (
<LayoutWrapper>
<SideBar>
<SideBarHeader>
PaymentIQ
<DashboardIcon sx={{ marginLeft: 0.5 }} />
</SideBarHeader>
{SIDEBAR_LINKS.map((link) => (
<SideBarLink
key={link.path}
title={link.title}
path={link.path}
icon={link.icon}
/>
))}
</SideBar>
<MainContent>{children}</MainContent> {/* Render children here */}
</LayoutWrapper>
);
};
export default SideBarLayout;

View File

@ -1,11 +1,10 @@
'use client'; 'use client';
import React from 'react'; import React from 'react';
import { MainContent } from '../components/Dashboard/Layout/mainContent'; import { LayoutWrapper } from '../components/dashboard/layout/layoutWrapper';
import Header from '../components/Dashboard/Header/Header'; import { MainContent } from '../components/dashboard/layout/mainContent';
import { LayoutWrapper } from '../components/Dashboard/Layout/layoutWrapper'; import SideBar from '../components/dashboard/sidebar/Sidebar';
import SideBar from '../components/Dashboard/SideBar/Sidebar'; import Header from '../components/dashboard/header/Header';
const DashboardLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => { const DashboardLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return ( return (