feat: Add Plugins dropdown menu to Business sidebar
- Added Plugins collapsible menu with 3 items: - Plugin Marketplace (/plugins/marketplace) - My Plugins (/plugins/my-plugins) - Plugin Docs (/help/plugins) - Moved Plugin Docs from Help dropdown to Plugins dropdown - Added Plug, ShoppingBag, Package icons from lucide-react - Added translations for plugin navigation items - Auto-opens dropdown when on /plugins/* routes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,10 @@ import {
|
|||||||
BookOpen,
|
BookOpen,
|
||||||
FileQuestion,
|
FileQuestion,
|
||||||
LifeBuoy,
|
LifeBuoy,
|
||||||
Zap
|
Zap,
|
||||||
|
Plug,
|
||||||
|
ShoppingBag,
|
||||||
|
Package
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { Business, User } from '../types';
|
import { Business, User } from '../types';
|
||||||
import { useLogout } from '../hooks/useAuth';
|
import { useLogout } from '../hooks/useAuth';
|
||||||
@@ -37,6 +40,7 @@ const Sidebar: React.FC<SidebarProps> = ({ business, user, isCollapsed, toggleCo
|
|||||||
const { role } = user;
|
const { role } = user;
|
||||||
const logoutMutation = useLogout();
|
const logoutMutation = useLogout();
|
||||||
const [isHelpOpen, setIsHelpOpen] = useState(location.pathname.startsWith('/help') || location.pathname === '/support');
|
const [isHelpOpen, setIsHelpOpen] = useState(location.pathname.startsWith('/help') || location.pathname === '/support');
|
||||||
|
const [isPluginsOpen, setIsPluginsOpen] = useState(location.pathname.startsWith('/plugins'));
|
||||||
|
|
||||||
const getNavClass = (path: string, exact: boolean = false, disabled: boolean = false) => {
|
const getNavClass = (path: string, exact: boolean = false, disabled: boolean = false) => {
|
||||||
const isActive = exact
|
const isActive = exact
|
||||||
@@ -182,6 +186,52 @@ const Sidebar: React.FC<SidebarProps> = ({ business, user, isCollapsed, toggleCo
|
|||||||
<Users size={20} className="shrink-0" />
|
<Users size={20} className="shrink-0" />
|
||||||
{!isCollapsed && <span>{t('nav.staff')}</span>}
|
{!isCollapsed && <span>{t('nav.staff')}</span>}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
{/* Plugins Dropdown */}
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
onClick={() => setIsPluginsOpen(!isPluginsOpen)}
|
||||||
|
className={`flex items-center gap-3 py-3 text-base font-medium rounded-lg transition-colors w-full ${isCollapsed ? 'px-3 justify-center' : 'px-4'} ${location.pathname.startsWith('/plugins') ? 'bg-white/10 text-white' : 'text-white/70 hover:text-white hover:bg-white/5'}`}
|
||||||
|
title={t('nav.plugins', 'Plugins')}
|
||||||
|
>
|
||||||
|
<Plug size={20} className="shrink-0" />
|
||||||
|
{!isCollapsed && (
|
||||||
|
<>
|
||||||
|
<span className="flex-1 text-left">{t('nav.plugins', 'Plugins')}</span>
|
||||||
|
<ChevronDown size={16} className={`shrink-0 transition-transform ${isPluginsOpen ? 'rotate-180' : ''}`} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
{isPluginsOpen && !isCollapsed && (
|
||||||
|
<div className="ml-4 mt-1 space-y-1 border-l border-white/20 pl-4">
|
||||||
|
<Link
|
||||||
|
to="/plugins/marketplace"
|
||||||
|
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/plugins/marketplace' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
||||||
|
title={t('nav.pluginMarketplace', 'Marketplace')}
|
||||||
|
>
|
||||||
|
<ShoppingBag size={16} className="shrink-0" />
|
||||||
|
<span>{t('nav.pluginMarketplace', 'Marketplace')}</span>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
to="/plugins/my-plugins"
|
||||||
|
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/plugins/my-plugins' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
||||||
|
title={t('nav.myPlugins', 'My Plugins')}
|
||||||
|
>
|
||||||
|
<Package size={16} className="shrink-0" />
|
||||||
|
<span>{t('nav.myPlugins', 'My Plugins')}</span>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
to="/help/plugins"
|
||||||
|
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/help/plugins' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
||||||
|
title={t('nav.pluginDocs', 'Plugin Documentation')}
|
||||||
|
>
|
||||||
|
<Zap size={16} className="shrink-0" />
|
||||||
|
<span>{t('nav.pluginDocs', 'Plugin Docs')}</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Help Dropdown */}
|
{/* Help Dropdown */}
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -216,7 +266,6 @@ const Sidebar: React.FC<SidebarProps> = ({ business, user, isCollapsed, toggleCo
|
|||||||
<span>{t('nav.ticketingHelp', 'Ticketing System')}</span>
|
<span>{t('nav.ticketingHelp', 'Ticketing System')}</span>
|
||||||
</Link>
|
</Link>
|
||||||
{role === 'owner' && (
|
{role === 'owner' && (
|
||||||
<>
|
|
||||||
<Link
|
<Link
|
||||||
to="/help/api"
|
to="/help/api"
|
||||||
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/help/api' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/help/api' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
||||||
@@ -225,15 +274,6 @@ const Sidebar: React.FC<SidebarProps> = ({ business, user, isCollapsed, toggleCo
|
|||||||
<Code size={16} className="shrink-0" />
|
<Code size={16} className="shrink-0" />
|
||||||
<span>{t('nav.apiDocs', 'API Docs')}</span>
|
<span>{t('nav.apiDocs', 'API Docs')}</span>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
|
||||||
to="/help/plugins"
|
|
||||||
className={`flex items-center gap-3 py-2 text-sm font-medium rounded-lg transition-colors px-3 ${location.pathname === '/help/plugins' ? 'bg-white/10 text-white' : 'text-white/60 hover:text-white hover:bg-white/5'}`}
|
|
||||||
title={t('nav.pluginDocs', 'Automation Plugins')}
|
|
||||||
>
|
|
||||||
<Zap size={16} className="shrink-0" />
|
|
||||||
<span>{t('nav.pluginDocs', 'Plugin Docs')}</span>
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<div className="pt-2 mt-2 border-t border-white/10">
|
<div className="pt-2 mt-2 border-t border-white/10">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -94,7 +94,10 @@
|
|||||||
"ticketingHelp": "Ticketing System",
|
"ticketingHelp": "Ticketing System",
|
||||||
"apiDocs": "API Docs",
|
"apiDocs": "API Docs",
|
||||||
"pluginDocs": "Plugin Docs",
|
"pluginDocs": "Plugin Docs",
|
||||||
"contactSupport": "Contact Support"
|
"contactSupport": "Contact Support",
|
||||||
|
"plugins": "Plugins",
|
||||||
|
"pluginMarketplace": "Marketplace",
|
||||||
|
"myPlugins": "My Plugins"
|
||||||
},
|
},
|
||||||
"help": {
|
"help": {
|
||||||
"guide": {
|
"guide": {
|
||||||
|
|||||||
Reference in New Issue
Block a user