MCP DuckDuckGo Search Server
by spences10
Verified
- frontend
- src
import { useState } from 'react'
import { Routes, Route, Link, useLocation } from 'react-router-dom'
import { styled } from '@mui/material/styles'
import Box from '@mui/material/Box'
import Drawer from '@mui/material/Drawer'
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import ListItemButton from '@mui/material/ListItemButton'
import ListItemIcon from '@mui/material/ListItemIcon'
import ListItemText from '@mui/material/ListItemText'
import DashboardIcon from '@mui/icons-material/Dashboard'
import PeopleIcon from '@mui/icons-material/People'
import SettingsIcon from '@mui/icons-material/Settings'
import ExtensionIcon from '@mui/icons-material/Extension'
import Typography from '@mui/material/Typography'
// Import pages (we'll create these next)
import Dashboard from './pages/Dashboard'
import Clients from './pages/Clients'
import Services from './pages/Services'
import Settings from './pages/Settings'
const drawerWidth = 240
const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })<{
open?: boolean
}>(({ theme, open }) => ({
flexGrow: 1,
padding: theme.spacing(3),
marginLeft: 0,
backgroundColor: theme.palette.background.default,
minHeight: '100vh',
}))
const DrawerHeader = styled('div')(({ theme }) => ({
display: 'flex',
alignItems: 'center',
padding: theme.spacing(2),
color: theme.palette.primary.main,
fontSize: '1.2rem',
fontWeight: 'bold',
borderBottom: `1px solid ${theme.palette.divider}`,
}))
const menuItems = [
{ text: 'Dashboard', icon: <DashboardIcon />, path: '/' },
{ text: 'Clients', icon: <PeopleIcon />, path: '/clients' },
{ text: 'Services', icon: <ExtensionIcon />, path: '/services' },
{ text: 'Settings', icon: <SettingsIcon />, path: '/settings' },
]
function App() {
const location = useLocation()
const [open] = useState(true)
return (
<Box sx={{ display: 'flex' }}>
<Drawer
sx={{
width: drawerWidth,
flexShrink: 0,
'& .MuiDrawer-paper': {
width: drawerWidth,
boxSizing: 'border-box',
backgroundColor: 'background.paper',
},
}}
variant="persistent"
anchor="left"
open={open}
>
<DrawerHeader>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Typography variant="h6" component="span">MCP</Typography>
<Typography variant="caption" sx={{ opacity: 0.7 }}>v1.0.0</Typography>
</Box>
</DrawerHeader>
<List>
{menuItems.map((item) => (
<ListItem key={item.text} disablePadding>
<ListItemButton
component={Link}
to={item.path}
selected={location.pathname === item.path}
>
<ListItemIcon sx={{ color: 'inherit' }}>
{item.icon}
</ListItemIcon>
<ListItemText primary={item.text} />
</ListItemButton>
</ListItem>
))}
</List>
</Drawer>
<Main open={open}>
<Box sx={{ p: 3 }}>
<Routes>
<Route path="/" element={<Dashboard />} />
<Route path="/clients" element={<Clients />} />
<Route path="/services" element={<Services />} />
<Route path="/settings" element={<Settings />} />
</Routes>
</Box>
</Main>
</Box>
)
}
export default App