Section 6 COmpleted
This commit is contained in:
@@ -52,7 +52,13 @@ const AppSidebar: React.FC = () => {
|
||||
const subMenuRefs = useRef<Record<string, HTMLDivElement | null>>({});
|
||||
|
||||
const isActive = useCallback(
|
||||
(path: string) => location.pathname === path,
|
||||
(path: string) => {
|
||||
// Exact match
|
||||
if (location.pathname === path) return true;
|
||||
// For sub-pages, match if pathname starts with the path (except for root)
|
||||
if (path !== '/' && location.pathname.startsWith(path + '/')) return true;
|
||||
return false;
|
||||
},
|
||||
[location.pathname]
|
||||
);
|
||||
|
||||
@@ -60,35 +66,45 @@ const AppSidebar: React.FC = () => {
|
||||
// New structure: Dashboard (standalone) → SETUP → WORKFLOW → SETTINGS
|
||||
// Module visibility is controlled by GlobalModuleSettings (Django Admin only)
|
||||
const menuSections: MenuSection[] = useMemo(() => {
|
||||
// SETUP section items (single items, no dropdowns - submenus shown as in-page navigation)
|
||||
const setupItems: NavItem[] = [
|
||||
{
|
||||
icon: <DocsIcon />,
|
||||
name: "Add Keywords",
|
||||
path: "/setup/add-keywords",
|
||||
},
|
||||
{
|
||||
icon: <PageIcon />,
|
||||
name: "Content Settings",
|
||||
path: "/account/content-settings",
|
||||
},
|
||||
];
|
||||
// SETUP section items - Ordered: Sites → Add Keywords → Content Settings → Thinker
|
||||
const setupItems: NavItem[] = [];
|
||||
|
||||
// Add Sites (Site Builder) if enabled
|
||||
// Add Sites first (if enabled)
|
||||
if (isModuleEnabled('site_builder')) {
|
||||
setupItems.push({
|
||||
icon: <GridIcon />,
|
||||
name: "Sites",
|
||||
path: "/sites", // Submenus shown as in-page navigation
|
||||
path: "/sites",
|
||||
});
|
||||
}
|
||||
|
||||
// Add Thinker if enabled (admin only - prompts and AI settings)
|
||||
// Add Keywords second
|
||||
setupItems.push({
|
||||
icon: <DocsIcon />,
|
||||
name: "Add Keywords",
|
||||
path: "/setup/add-keywords",
|
||||
});
|
||||
|
||||
// Content Settings third - with dropdown
|
||||
setupItems.push({
|
||||
icon: <PageIcon />,
|
||||
name: "Content Settings",
|
||||
subItems: [
|
||||
{ name: "Content Generation", path: "/account/content-settings" },
|
||||
{ name: "Publishing", path: "/account/content-settings/publishing" },
|
||||
{ name: "Image Settings", path: "/account/content-settings/images" },
|
||||
],
|
||||
});
|
||||
|
||||
// Add Thinker last (admin only - prompts and AI settings)
|
||||
if (isModuleEnabled('thinker')) {
|
||||
setupItems.push({
|
||||
icon: <BoltIcon />,
|
||||
name: "Thinker",
|
||||
path: "/thinker/prompts", // Default to prompts, submenus shown as in-page navigation
|
||||
subItems: [
|
||||
{ name: "Prompts", path: "/thinker/prompts" },
|
||||
{ name: "Author Profiles", path: "/thinker/author-profiles" },
|
||||
],
|
||||
adminOnly: true, // Only visible to admin/staff users
|
||||
});
|
||||
}
|
||||
@@ -96,25 +112,35 @@ const AppSidebar: React.FC = () => {
|
||||
// WORKFLOW section items (conditionally shown based on global settings)
|
||||
const workflowItems: NavItem[] = [];
|
||||
|
||||
// Add Planner if enabled
|
||||
// Add Planner with dropdown if enabled
|
||||
if (isModuleEnabled('planner')) {
|
||||
workflowItems.push({
|
||||
icon: <ListIcon />,
|
||||
name: "Planner",
|
||||
path: "/planner/keywords", // Default to keywords, submenus shown as in-page navigation
|
||||
subItems: [
|
||||
{ name: "Keywords", path: "/planner/keywords" },
|
||||
{ name: "Clusters", path: "/planner/clusters" },
|
||||
{ name: "Ideas", path: "/planner/ideas" },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// Add Writer if enabled
|
||||
// Add Writer with dropdown if enabled
|
||||
if (isModuleEnabled('writer')) {
|
||||
workflowItems.push({
|
||||
icon: <TaskIcon />,
|
||||
name: "Writer",
|
||||
path: "/writer/tasks", // Default to tasks, submenus shown as in-page navigation
|
||||
subItems: [
|
||||
{ name: "Queue", path: "/writer/tasks" },
|
||||
{ name: "Drafts", path: "/writer/content" },
|
||||
{ name: "Images", path: "/writer/images" },
|
||||
{ name: "Review", path: "/writer/review" },
|
||||
{ name: "Published", path: "/writer/published" },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// Add Automation if enabled
|
||||
// Add Automation if enabled (no dropdown - single page)
|
||||
if (isModuleEnabled('automation')) {
|
||||
workflowItems.push({
|
||||
icon: <BoltIcon />,
|
||||
@@ -123,23 +149,7 @@ const AppSidebar: React.FC = () => {
|
||||
});
|
||||
}
|
||||
|
||||
// Add Linker if enabled
|
||||
if (isModuleEnabled('linker')) {
|
||||
workflowItems.push({
|
||||
icon: <PlugInIcon />,
|
||||
name: "Linker",
|
||||
path: "/linker/content",
|
||||
});
|
||||
}
|
||||
|
||||
// Add Optimizer if enabled
|
||||
if (isModuleEnabled('optimizer')) {
|
||||
workflowItems.push({
|
||||
icon: <BoltIcon />,
|
||||
name: "Optimizer",
|
||||
path: "/optimizer/content",
|
||||
});
|
||||
}
|
||||
// Linker and Optimizer removed - not active modules
|
||||
|
||||
return [
|
||||
// Dashboard is standalone (no section header)
|
||||
@@ -167,17 +177,29 @@ const AppSidebar: React.FC = () => {
|
||||
{
|
||||
icon: <UserCircleIcon />,
|
||||
name: "Account Settings",
|
||||
path: "/account/settings",
|
||||
subItems: [
|
||||
{ name: "Account", path: "/account/settings" },
|
||||
{ name: "Profile", path: "/account/settings/profile" },
|
||||
{ name: "Team", path: "/account/settings/team" },
|
||||
],
|
||||
},
|
||||
{
|
||||
icon: <DollarLineIcon />,
|
||||
name: "Plans & Billing",
|
||||
path: "/account/plans",
|
||||
subItems: [
|
||||
{ name: "Current Plan", path: "/account/plans" },
|
||||
{ name: "Upgrade Plan", path: "/account/plans/upgrade" },
|
||||
{ name: "History", path: "/account/plans/history" },
|
||||
],
|
||||
},
|
||||
{
|
||||
icon: <PieChartIcon />,
|
||||
name: "Usage",
|
||||
path: "/account/usage",
|
||||
subItems: [
|
||||
{ name: "Limits & Usage", path: "/account/usage" },
|
||||
{ name: "Credit History", path: "/account/usage/credits" },
|
||||
{ name: "Activity", path: "/account/usage/activity" },
|
||||
],
|
||||
},
|
||||
{
|
||||
icon: <PlugInIcon />,
|
||||
|
||||
Reference in New Issue
Block a user