mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 09:14:08 +00:00
feat(modules): dynamic sidebar group rendering active modules
The sidebar gains a new section that lists each currently-activated module as a direct shortcut to its settings page. This is the always-visible companion to the company-context Active Modules index — both surface the same set of modules, but the index is the catalog landing page and the sidebar group is the per-module quick access. - BootstrapController returns module_menu populated from \InvoiceShelf\Modules\Registry::allMenu(), but only on the company-context branch — not on the super-admin branch (lines 53-69), since super admins don't see the dynamic group. Because nwidart only boots service providers for currently-activated modules, the registry naturally contains only active modules at request time, no extra filtering needed. - bootstrap.service.ts BootstrapResponse type extended with module_menu?: ModuleMenuItem[]; new ModuleMenuItem interface (title/link/icon) — shaped distinctly from MenuItem because module entries use namespaced i18n keys and don't carry group/ability metadata. - global.store.ts exposes a moduleMenu ref + a hasActiveModules computed. - SiteSidebar.vue appends a new "Modules" section after the existing menuGroups output, in both the mobile (Dialog) and desktop branches. The section is hidden when hasActiveModules is false. Uses the modules.sidebar.section_title i18n key added in the previous commit.
This commit is contained in:
@@ -15,6 +15,20 @@ export interface MenuItem {
|
||||
ability?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Sidebar item registered by an active module via
|
||||
* \InvoiceShelf\Modules\Registry::registerMenu() in the module's ServiceProvider::boot().
|
||||
*
|
||||
* Distinct shape from MenuItem because module entries are namespaced (i18n
|
||||
* keys come from the module's lang files) and don't carry group/ability —
|
||||
* they always render under the dynamic "Modules" sidebar section.
|
||||
*/
|
||||
export interface ModuleMenuItem {
|
||||
title: string
|
||||
link: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
export interface BootstrapResponse {
|
||||
current_user: User
|
||||
current_user_settings: Record<string, string>
|
||||
@@ -28,6 +42,7 @@ export interface BootstrapResponse {
|
||||
config: Record<string, unknown>
|
||||
global_settings: Record<string, string>
|
||||
modules: string[]
|
||||
module_menu?: ModuleMenuItem[]
|
||||
admin_mode?: boolean
|
||||
pending_invitations?: Array<{
|
||||
token: string
|
||||
|
||||
Reference in New Issue
Block a user