feat: restruction of admin sidebar, button slightly adjusted, member tiers header added, routing for sidbar adjusted
This commit is contained in:
25
src/App.js
25
src/App.js
@@ -62,19 +62,19 @@ import NotFound from './pages/NotFound';
|
||||
|
||||
const PrivateRoute = ({ children, adminOnly = false }) => {
|
||||
const { user, loading } = useAuth();
|
||||
|
||||
|
||||
if (loading) {
|
||||
return <div className="min-h-screen flex items-center justify-center">Loading...</div>;
|
||||
}
|
||||
|
||||
|
||||
if (!user) {
|
||||
return <Navigate to="/login" />;
|
||||
}
|
||||
|
||||
|
||||
if (adminOnly && !['admin', 'superadmin'].includes(user.role)) {
|
||||
return <Navigate to="/dashboard" />;
|
||||
}
|
||||
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
@@ -239,6 +239,20 @@ function App() {
|
||||
</AdminLayout>
|
||||
</PrivateRoute>
|
||||
} />
|
||||
<Route path="/admin/registration" element={
|
||||
<PrivateRoute adminOnly>
|
||||
<AdminLayout>
|
||||
<AdminRegistrationBuilder />
|
||||
</AdminLayout>
|
||||
</PrivateRoute>
|
||||
} />
|
||||
<Route path="/admin/member-tiers" element={
|
||||
<PrivateRoute adminOnly>
|
||||
<AdminLayout>
|
||||
<AdminMemberTiers />
|
||||
</AdminLayout>
|
||||
</PrivateRoute>
|
||||
} />
|
||||
<Route path="/admin/plans" element={
|
||||
<PrivateRoute adminOnly>
|
||||
<AdminLayout>
|
||||
@@ -293,6 +307,7 @@ function App() {
|
||||
<Navigate to="/admin/settings/permissions" replace />
|
||||
</PrivateRoute>
|
||||
} />
|
||||
|
||||
<Route path="/admin/settings" element={
|
||||
<PrivateRoute adminOnly>
|
||||
<AdminLayout>
|
||||
@@ -303,9 +318,7 @@ function App() {
|
||||
<Route index element={<Navigate to="stripe" replace />} />
|
||||
<Route path="stripe" element={<AdminSettings />} />
|
||||
<Route path="permissions" element={<AdminRoles />} />
|
||||
<Route path="member-tiers" element={<AdminMemberTiers />} />
|
||||
<Route path="theme" element={<AdminTheme />} />
|
||||
<Route path="registration" element={<AdminRegistrationBuilder />} />
|
||||
</Route>
|
||||
|
||||
{/* 404 - Catch all undefined routes */}
|
||||
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
Heart,
|
||||
Sun,
|
||||
Moon,
|
||||
Star,
|
||||
FileEdit
|
||||
} from 'lucide-react';
|
||||
|
||||
const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
|
||||
@@ -104,18 +106,31 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
|
||||
path: '/admin',
|
||||
disabled: false
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Staff',
|
||||
name: 'Staff & Admins',
|
||||
icon: UserCog,
|
||||
path: '/admin/staff',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: 'Members',
|
||||
name: 'Member Roster',
|
||||
icon: Users,
|
||||
path: '/admin/members',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: 'Member Tiers',
|
||||
icon: Star,
|
||||
path: '/admin/member-tiers',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: 'Registration',
|
||||
icon: FileEdit,
|
||||
path: '/admin/registration',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: 'Validations',
|
||||
icon: CheckCircle,
|
||||
@@ -316,6 +331,18 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
|
||||
{/* Dashboard - Standalone */}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Dashboard'))}
|
||||
|
||||
{/* Onboarding Section */}
|
||||
{isOpen && (
|
||||
<div className="px-4 py-2 mt-6">
|
||||
<h3 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
Onboarding
|
||||
</h3>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-1">
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Registration'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Validations'))}
|
||||
</div>
|
||||
{/* MEMBERSHIP Section */}
|
||||
{isOpen && (
|
||||
<div className="px-4 py-2 mt-6">
|
||||
@@ -325,9 +352,9 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-1">
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Staff'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Members'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Validations'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Member Roster'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Member Tiers'))}
|
||||
{renderNavItem(filteredNavItems.find(item => item.name === 'Staff & Admins'))}
|
||||
</div>
|
||||
|
||||
{/* FINANCIALS Section */}
|
||||
|
||||
@@ -5,9 +5,8 @@ import { CreditCard, Shield, Star, Palette, FileEdit } from 'lucide-react';
|
||||
const settingsItems = [
|
||||
{ label: 'Stripe', path: '/admin/settings/stripe', icon: CreditCard },
|
||||
{ label: 'Permissions', path: '/admin/settings/permissions', icon: Shield },
|
||||
{ label: 'Member Tiers', path: '/admin/settings/member-tiers', icon: Star },
|
||||
{ label: 'Theme', path: '/admin/settings/theme', icon: Palette },
|
||||
{ label: 'Registration Form', path: '/admin/settings/registration', icon: FileEdit },
|
||||
|
||||
];
|
||||
|
||||
const SettingsTabs = () => {
|
||||
|
||||
@@ -71,7 +71,7 @@ const AdminDashboard = () => {
|
||||
</div>
|
||||
<Link to={'/'} className=''>
|
||||
<Button
|
||||
className="btn-lavender mb-8 md:mb-0 "
|
||||
className="btn-lavender mb-8 md:mb-0 mr-4 "
|
||||
>
|
||||
<Globe />
|
||||
View Public Site
|
||||
|
||||
@@ -150,9 +150,15 @@ const AdminMemberTiers = () => {
|
||||
<div className="space-y-6">
|
||||
{/* Header and Actions */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||
<p className="text-muted-foreground">
|
||||
Configure tier names, time ranges, and badges displayed in the members directory.
|
||||
</p>
|
||||
<div>
|
||||
|
||||
<h1 className="text-4xl md:text-5xl font-semibold text-[var(--purple-ink)] mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
|
||||
Members Tiers
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure tier names, time ranges, and badges displayed in the members directory.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{hasChanges && (
|
||||
<Button variant="outline" onClick={handleDiscardChanges}>
|
||||
|
||||
Reference in New Issue
Block a user