Add business Finance hub with invoices and templates.
Ship invoice issue/list/templates under Finance, fix tenant theme reset and owner role badge, and show customers-joined charts by Persian months. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
722933dda9
commit
917b840ee5
@@ -15,6 +15,7 @@ import {
|
||||
Building2,
|
||||
Pencil,
|
||||
Package,
|
||||
Wallet,
|
||||
} from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import { useLocale } from '@meshkee/dashboard-ui'
|
||||
@@ -61,8 +62,13 @@ interface NavLinkItem {
|
||||
|
||||
type NavItem = NavLinkItem | NavGroup
|
||||
|
||||
function isGroupActive(basePath: string, pathname: string) {
|
||||
return pathname === basePath || pathname.startsWith(`${basePath}/`)
|
||||
function isGroupActive(group: NavGroup, pathname: string) {
|
||||
if (pathname === group.basePath || pathname.startsWith(`${group.basePath}/`)) {
|
||||
return true
|
||||
}
|
||||
return group.children.some(
|
||||
(child) => pathname === child.to || pathname.startsWith(`${child.to}/`),
|
||||
)
|
||||
}
|
||||
|
||||
export function Sidebar() {
|
||||
@@ -130,6 +136,18 @@ export function Sidebar() {
|
||||
],
|
||||
},
|
||||
{ type: 'link', id: 'customers', icon: Users, labelKey: 'nav.customers', to: '/customers' },
|
||||
{
|
||||
type: 'group',
|
||||
id: 'finance',
|
||||
icon: Wallet,
|
||||
labelKey: 'nav.finance',
|
||||
basePath: '/finance',
|
||||
children: [
|
||||
{ labelKey: 'nav.finance.overview', to: '/finance' },
|
||||
{ labelKey: 'nav.finance.invoices', to: '/invoices' },
|
||||
{ labelKey: 'nav.finance.transactions', to: '/transactions' },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
id: 'customer-products',
|
||||
@@ -227,7 +245,7 @@ export function Sidebar() {
|
||||
|
||||
useEffect(() => {
|
||||
const activeGroup = navItems.find(
|
||||
(item) => item.type === 'group' && isGroupActive(item.basePath, pathname),
|
||||
(item) => item.type === 'group' && isGroupActive(item, pathname),
|
||||
)
|
||||
if (!activeGroup || activeGroup.type !== 'group') return
|
||||
setOpenGroups({ [activeGroup.id]: true })
|
||||
@@ -285,7 +303,7 @@ export function Sidebar() {
|
||||
}
|
||||
|
||||
const isOpen = openGroups[item.id] ?? false
|
||||
const groupActive = isGroupActive(item.basePath, pathname)
|
||||
const groupActive = isGroupActive(item, pathname)
|
||||
|
||||
return (
|
||||
<div key={item.id} className={styles.navGroup}>
|
||||
|
||||
Reference in New Issue
Block a user