@tulip-systems/core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/client.d.ts +3 -1
- package/dist/auth/client.js +4 -2
- package/dist/auth.d.ts +2 -1
- package/dist/auth.js +3 -2
- package/dist/commands/client.d.ts +4 -4
- package/dist/commands/client.js +4 -4
- package/dist/components/client.d.ts +5 -3
- package/dist/components/client.js +6 -4
- package/dist/components/common/icons.d.ts +51 -48
- package/dist/components/common/icons.d.ts.map +1 -1
- package/dist/components/common/icons.js +4 -1
- package/dist/components/common/icons.js.map +1 -1
- package/dist/components/common/status.d.ts +3 -3
- package/dist/components/common/status.d.ts.map +1 -1
- package/dist/components/editor/components/content.client.d.ts +2 -2
- package/dist/components/editor/components/fixed-menu.client.d.ts +2 -2
- package/dist/components/editor/context.client.d.ts +4 -4
- package/dist/components/editor/context.client.d.ts.map +1 -1
- package/dist/components/editor/index.client.d.ts +2 -2
- package/dist/components/editor/preview.client.d.ts +2 -2
- package/dist/components/header/back-button.client.d.ts +2 -2
- package/dist/components/header/bottom-bar.client.d.ts +5 -5
- package/dist/components/header/bottom-bar.client.d.ts.map +1 -1
- package/dist/components/header/bottom-bar.client.js.map +1 -1
- package/dist/components/header/breadcrumbs.client.d.ts +7 -7
- package/dist/components/header/breadcrumbs.client.js +1 -1
- package/dist/components/header/header.client.d.ts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.ts +2 -2
- package/dist/components/header/top-bar.client.d.ts +4 -4
- package/dist/components/layouts/admin-content.client.d.ts +13 -0
- package/dist/components/layouts/admin-content.client.d.ts.map +1 -0
- package/dist/components/layouts/admin-layout.d.ts +8 -0
- package/dist/components/layouts/admin-layout.d.ts.map +1 -0
- package/dist/components/layouts/admin-layout.js +15 -0
- package/dist/components/layouts/admin-layout.js.map +1 -0
- package/dist/components/layouts/admin-loading.d.ts +3 -3
- package/dist/components/layouts/admin-loading.d.ts.map +1 -1
- package/dist/components/layouts/admin-loading.js +2 -2
- package/dist/components/layouts/admin-loading.js.map +1 -1
- package/dist/components/layouts/empty-page.d.ts +4 -4
- package/dist/components/layouts/empty-page.d.ts.map +1 -1
- package/dist/components/layouts/list-layout.d.ts +2 -2
- package/dist/components/layouts/list-layout.d.ts.map +1 -1
- package/dist/components/layouts/not-found-page.d.ts +2 -2
- package/dist/components/layouts/not-found-page.d.ts.map +1 -1
- package/dist/components/layouts/providers.client.d.ts +2 -2
- package/dist/components/layouts/root-layout.server.d.ts +2 -2
- package/dist/components/layouts/root-layout.server.d.ts.map +1 -1
- package/dist/components/layouts/root-loading.d.ts +7 -0
- package/dist/components/layouts/root-loading.d.ts.map +1 -0
- package/dist/components/layouts/root-loading.js +14 -0
- package/dist/components/layouts/root-loading.js.map +1 -0
- package/dist/components/layouts/tab-layout.d.ts +2 -2
- package/dist/components/layouts/tab-layout.d.ts.map +1 -1
- package/dist/components/lists/data-list.d.ts +5 -5
- package/dist/components/lists/data-list.d.ts.map +1 -1
- package/dist/components/lists/data-stack.d.ts +8 -8
- package/dist/components/lists/data-stack.d.ts.map +1 -1
- package/dist/components/{layouts → navigation}/admin-sidebar-header.client.js +8 -9
- package/dist/components/navigation/admin-sidebar-header.client.js.map +1 -0
- package/dist/components/navigation/admin-sidebar-paths.client.d.ts +81 -0
- package/dist/components/navigation/admin-sidebar-paths.client.d.ts.map +1 -0
- package/dist/components/navigation/admin-sidebar-paths.client.js +143 -0
- package/dist/components/navigation/admin-sidebar-paths.client.js.map +1 -0
- package/dist/components/navigation/admin-sidebar-skeleton.js +31 -0
- package/dist/components/navigation/admin-sidebar-skeleton.js.map +1 -0
- package/dist/components/server.d.ts +1 -1
- package/dist/components/server.js +1 -1
- package/dist/components/ui/accordion.d.ts +5 -5
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +12 -12
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +6 -6
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +2 -2
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.client.d.ts +4 -4
- package/dist/components/ui/badge.d.ts +4 -4
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +8 -8
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +5 -5
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +2 -2
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -7
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +6 -6
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.client.d.ts +5 -5
- package/dist/components/ui/checkbox.d.ts +2 -2
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.client.d.ts +4 -4
- package/dist/components/ui/color-picker.client.d.ts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.ts +2 -2
- package/dist/components/ui/combobox.client.d.ts +2 -2
- package/dist/components/ui/command.d.ts +10 -10
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +16 -16
- package/dist/components/ui/dialog.client.d.ts +11 -11
- package/dist/components/ui/drawer.client.d.ts +11 -11
- package/dist/components/ui/dropdown-menu.d.ts +16 -16
- package/dist/components/ui/form.client.d.ts +8 -8
- package/dist/components/ui/hover-card.client.d.ts +4 -4
- package/dist/components/ui/input.d.ts +2 -2
- package/dist/components/ui/label.d.ts +2 -2
- package/dist/components/ui/navigation-menu.d.ts +11 -11
- package/dist/components/ui/pagination.d.ts +8 -8
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +5 -5
- package/dist/components/ui/progress.client.d.ts +2 -2
- package/dist/components/ui/radio-group.d.ts +3 -3
- package/dist/components/ui/resizable.client.d.ts +4 -4
- package/dist/components/ui/scroll-area.d.ts +3 -3
- package/dist/components/ui/select.client.d.ts +11 -11
- package/dist/components/ui/separator.d.ts +2 -2
- package/dist/components/ui/sheet.client.d.ts +9 -9
- package/dist/components/ui/sidebar.client.d.ts +26 -26
- package/dist/components/ui/sidebar.client.js +1 -1
- package/dist/components/ui/skeleton.d.ts +2 -2
- package/dist/components/ui/slider.d.ts +2 -2
- package/dist/components/ui/sonner.client.d.ts +2 -2
- package/dist/components/ui/sonner.client.js +1 -1
- package/dist/components/ui/spinner.js +63 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/components/ui/tabs.d.ts +5 -5
- package/dist/components/ui/textarea.d.ts +2 -2
- package/dist/components/ui/time-input.client.d.ts +2 -2
- package/dist/components/ui/toggle-group.client.d.ts +3 -3
- package/dist/components/ui/toggle.d.ts +2 -2
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.client.d.ts +5 -5
- package/dist/components/ui/tree.client.d.ts +5 -5
- package/dist/components.d.ts +5 -4
- package/dist/components.js +7 -6
- package/dist/config/server.d.ts +2 -3
- package/dist/config/server.js +3 -4
- package/dist/config.d.ts +3 -2
- package/dist/config.js +2 -1
- package/dist/lib/client.js +1 -1
- package/dist/lib/hooks/use-action.d.ts +2 -2
- package/dist/lib/hooks/use-indicator.d.ts +2 -2
- package/dist/modules/auth/components/allowed.client.d.ts +2 -2
- package/dist/modules/auth/components/allowed.client.js +1 -1
- package/dist/modules/auth/components/allowed.client.js.map +1 -1
- package/dist/modules/auth/components/allowed.server.d.ts +2 -2
- package/dist/modules/auth/components/allowed.server.d.ts.map +1 -1
- package/dist/modules/auth/components/allowed.server.js +1 -1
- package/dist/modules/auth/components/auth-layout.server.d.ts +4 -5
- package/dist/modules/auth/components/auth-layout.server.d.ts.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.js +1 -4
- package/dist/modules/auth/components/auth-layout.server.js.map +1 -1
- package/dist/modules/auth/components/auth-loading.d.ts +7 -0
- package/dist/modules/auth/components/auth-loading.d.ts.map +1 -0
- package/dist/modules/auth/components/auth-loading.js +18 -0
- package/dist/modules/auth/components/auth-loading.js.map +1 -0
- package/dist/modules/auth/components/forget-password-page.client.d.ts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.js +2 -2
- package/dist/modules/auth/components/guard.js +16 -0
- package/dist/modules/auth/components/guard.js.map +1 -0
- package/dist/modules/auth/components/login-page.client.d.ts +2 -6
- package/dist/modules/auth/components/login-page.client.d.ts.map +1 -1
- package/dist/modules/auth/components/login-page.client.js +7 -6
- package/dist/modules/auth/components/login-page.client.js.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.d.ts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.js +3 -3
- package/dist/modules/auth/components/update-password-command.d.ts +3 -3
- package/dist/modules/auth/components/update-password-command.js +1 -1
- package/dist/modules/auth/handler/client.client.d.ts +48 -48
- package/dist/modules/auth/handler/client.client.d.ts.map +1 -1
- package/dist/modules/auth/hooks/use-permission.d.ts +26 -0
- package/dist/modules/auth/hooks/use-permission.d.ts.map +1 -0
- package/dist/modules/auth/hooks/{use-permission.client.js → use-permission.js} +5 -3
- package/dist/modules/auth/hooks/use-permission.js.map +1 -0
- package/dist/modules/auth/hooks/use-session.d.ts +34 -0
- package/dist/modules/auth/hooks/use-session.d.ts.map +1 -0
- package/dist/modules/auth/hooks/use-session.js +21 -0
- package/dist/modules/auth/hooks/use-session.js.map +1 -0
- package/dist/modules/auth/lib/helpers.server.d.ts +1 -1
- package/dist/modules/auth/lib/helpers.server.js +2 -2
- package/dist/modules/auth/lib/validators.d.ts +1 -1
- package/dist/modules/auth/lib/validators.d.ts.map +1 -1
- package/dist/modules/auth/lib/validators.js +1 -1
- package/dist/modules/auth/lib/validators.js.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.ts +11 -11
- package/dist/modules/commands/components/alert-dialog-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.js +1 -1
- package/dist/modules/commands/components/click-command.client.d.ts +2 -2
- package/dist/modules/commands/components/click-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.d.ts +6 -6
- package/dist/modules/commands/components/command-trigger.client.d.ts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.js +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.ts +8 -8
- package/dist/modules/commands/components/dialog-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.js +1 -1
- package/dist/modules/commands/components/dropdown-command.client.d.ts +5 -5
- package/dist/modules/commands/components/dropdown-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/empty-command.client.d.ts +2 -2
- package/dist/modules/commands/components/empty-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.d.ts +12 -12
- package/dist/modules/commands/components/form-dialog-command.client.d.ts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.js +1 -1
- package/dist/modules/commands/hooks/use-command-action.client.js +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.js +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.js.map +1 -1
- package/dist/modules/commands/menus/context-menu.client.d.ts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.ts.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.d.ts +8 -4
- package/dist/modules/commands/menus/dropdown-menu.client.d.ts.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.js +9 -1
- package/dist/modules/commands/menus/dropdown-menu.client.js.map +1 -1
- package/dist/modules/commands/menus/inline-menu.client.d.ts +8 -4
- package/dist/modules/commands/menus/inline-menu.client.d.ts.map +1 -1
- package/dist/modules/commands/menus/inline-menu.client.js +12 -1
- package/dist/modules/commands/menus/inline-menu.client.js.map +1 -1
- package/dist/modules/commands/menus/responsive-menu.client.d.ts +4 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.ts.map +1 -1
- package/dist/modules/commands/menus/responsive-menu.client.js +6 -3
- package/dist/modules/commands/menus/responsive-menu.client.js.map +1 -1
- package/dist/modules/commands/utils/archive-command.client.d.ts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.ts.map +1 -1
- package/dist/modules/commands/utils/delete-command.client.d.ts +2 -2
- package/dist/modules/commands/utils/delete-command.client.d.ts.map +1 -1
- package/dist/modules/commands/utils/send-mail-command.client.d.ts +2 -2
- package/dist/modules/commands/utils/send-mail-command.client.d.ts.map +1 -1
- package/dist/modules/commands/utils/send-mail-command.client.js +3 -3
- package/dist/modules/config/db/helpers.d.ts +5 -5
- package/dist/modules/config/db/helpers.d.ts.map +1 -1
- package/dist/modules/config/lib/config.server.d.ts +0 -2
- package/dist/modules/config/lib/config.server.d.ts.map +1 -1
- package/dist/modules/config/lib/config.server.js.map +1 -1
- package/dist/modules/config/lib/resolve.server.d.ts +189 -190
- package/dist/modules/config/lib/resolve.server.d.ts.map +1 -1
- package/dist/modules/config/paths/helpers.d.ts +11 -0
- package/dist/modules/config/paths/helpers.d.ts.map +1 -0
- package/dist/modules/config/paths/helpers.js +9 -0
- package/dist/modules/config/paths/helpers.js.map +1 -0
- package/dist/modules/config/paths/types.d.ts +8 -37
- package/dist/modules/config/paths/types.d.ts.map +1 -1
- package/dist/modules/config/router/client.server.d.ts +4 -4
- package/dist/modules/config/router/client.server.d.ts.map +1 -1
- package/dist/modules/config/router/context.server.d.ts +191 -192
- package/dist/modules/config/router/context.server.d.ts.map +1 -1
- package/dist/modules/config/router/init.server.d.ts +196 -197
- package/dist/modules/config/router/init.server.d.ts.map +1 -1
- package/dist/modules/data-tables/components/cell/common.client.d.ts +5 -5
- package/dist/modules/data-tables/components/cell/common.client.d.ts.map +1 -1
- package/dist/modules/data-tables/components/column-header.d.ts +2 -2
- package/dist/modules/data-tables/components/column-header.d.ts.map +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.d.ts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.d.ts.map +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.js +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.js.map +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.d.ts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.ts.map +1 -1
- package/dist/modules/data-tables/components/header.d.ts +4 -4
- package/dist/modules/data-tables/components/header.d.ts.map +1 -1
- package/dist/modules/data-tables/components/layout.d.ts +2 -2
- package/dist/modules/data-tables/components/layout.d.ts.map +1 -1
- package/dist/modules/data-tables/components/search-input.client.d.ts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.ts.map +1 -1
- package/dist/modules/data-tables/components/skeleton.d.ts +2 -2
- package/dist/modules/data-tables/components/skeleton.d.ts.map +1 -1
- package/dist/modules/data-tables/components/table.d.ts +7 -7
- package/dist/modules/data-tables/components/table.d.ts.map +1 -1
- package/dist/modules/data-tables/components/toolbar.d.ts +3 -3
- package/dist/modules/data-tables/components/toolbar.d.ts.map +1 -1
- package/dist/modules/data-tables/hooks/use-context.client.d.ts +2 -2
- package/dist/modules/data-tables/hooks/use-context.client.d.ts.map +1 -1
- package/dist/modules/data-tables/lib/filters/resolvers.d.ts +1 -1
- package/dist/modules/data-tables/lib/filters/resolvers.d.ts.map +1 -1
- package/dist/modules/data-tables/lib/search-params.d.ts +5 -5
- package/dist/modules/data-tables/lib/search-params.d.ts.map +1 -1
- package/dist/modules/data-tables/lib/types.d.ts +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.ts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.ts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.ts +3 -3
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.ts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.js +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/use-input.client.js +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/use-input.client.js.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/combobox.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.js +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/date-picker.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/editor.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/input-toggle.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.ts +3 -3
- package/dist/modules/inline-edit/components/input.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/richtext.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/richtext.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.ts +6 -6
- package/dist/modules/inline-edit/components/select.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/switch.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.d.ts +2 -2
- package/dist/modules/inline-edit/components/toggle.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/hooks/context.client.d.ts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.ts.map +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.js +1 -1
- package/dist/modules/inline-edit/hooks/use-inline.client.js.map +1 -1
- package/dist/modules/uploads/components/button.client.d.ts +2 -2
- package/dist/modules/uploads/components/button.client.d.ts.map +1 -1
- package/dist/modules/uploads/components/images/grid.client.d.ts +2 -2
- package/dist/modules/uploads/components/images/grid.client.d.ts.map +1 -1
- package/dist/modules/uploads/components/images/grid.client.js +1 -1
- package/dist/modules/uploads/components/images/input.client.d.ts +2 -2
- package/dist/modules/uploads/components/images/input.client.d.ts.map +1 -1
- package/dist/modules/uploads/components/preview-dialog.client.d.ts +2 -2
- package/dist/modules/uploads/components/preview-dialog.client.d.ts.map +1 -1
- package/dist/modules/uploads/components/zone.client.d.ts +2 -2
- package/dist/modules/uploads/components/zone.client.d.ts.map +1 -1
- package/dist/modules/uploads/hooks/use-upload-image.client.js +1 -1
- package/dist/modules/uploads/lib/proxy.server.d.ts +1 -1
- package/dist/modules/uploads/lib/proxy.server.js +3 -3
- package/dist/modules/uploads/lib/route.server.d.ts +1 -1
- package/dist/modules/uploads/lib/route.server.js +1 -1
- package/dist/modules/uploads/lib/router.server.d.ts +938 -938
- package/dist/modules/uploads/lib/router.server.d.ts.map +1 -1
- package/dist/modules/uploads/lib/router.server.js +1 -1
- package/dist/modules/uploads/lib/schema.d.ts +61 -61
- package/dist/modules/uploads/lib/validators.d.ts +56 -56
- package/dist/modules/uploads/lib/validators.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/common/icons.tsx +6 -0
- package/src/components/entry.client.ts +6 -0
- package/src/components/entry.server.ts +1 -1
- package/src/components/entry.ts +1 -0
- package/src/components/header/bottom-bar.client.tsx +2 -2
- package/src/components/layouts/admin-layout.tsx +13 -0
- package/src/components/layouts/admin-loading.tsx +1 -1
- package/src/components/layouts/root-loading.tsx +9 -0
- package/src/components/{layouts → navigation}/admin-sidebar-header.client.tsx +11 -6
- package/src/components/navigation/admin-sidebar-paths.client.tsx +190 -0
- package/src/components/navigation/admin-sidebar-skeleton.tsx +44 -0
- package/src/components/navigation/admin-sidebar.client.tsx +123 -0
- package/src/components/ui/spinner.tsx +51 -0
- package/src/modules/auth/components/allowed.client.tsx +1 -1
- package/src/modules/auth/components/auth-layout.server.tsx +2 -10
- package/src/modules/auth/components/auth-loading.tsx +11 -0
- package/src/modules/auth/components/guard.tsx +12 -0
- package/src/modules/auth/components/login-page.client.tsx +4 -3
- package/src/modules/auth/entry.client.ts +2 -0
- package/src/modules/auth/entry.ts +1 -0
- package/src/modules/auth/hooks/{use-permission.client.ts → use-permission.ts} +4 -2
- package/src/modules/auth/hooks/use-session.ts +18 -0
- package/src/modules/auth/lib/validators.ts +1 -1
- package/src/modules/commands/hooks/use-command-menu.client.tsx +6 -7
- package/src/modules/commands/menus/dropdown-menu.client.tsx +11 -2
- package/src/modules/commands/menus/inline-menu.client.tsx +14 -1
- package/src/modules/commands/menus/responsive-menu.client.tsx +11 -2
- package/src/modules/config/entry.server.ts +1 -2
- package/src/modules/config/entry.ts +3 -0
- package/src/modules/config/lib/config.server.ts +1 -2
- package/src/modules/config/lib/router.server.ts +64 -0
- package/src/modules/config/paths/helpers.ts +6 -0
- package/src/modules/config/paths/types.ts +26 -38
- package/src/modules/data-tables/components/filters/combobox.client.tsx +1 -1
- package/src/modules/data-tables/tables/inline-table/hooks/use-input.client.ts +1 -1
- package/src/modules/inline-edit/hooks/use-inline.client.tsx +1 -1
- package/dist/components/layouts/admin-layout.server.d.ts +0 -14
- package/dist/components/layouts/admin-layout.server.d.ts.map +0 -1
- package/dist/components/layouts/admin-layout.server.js +0 -26
- package/dist/components/layouts/admin-layout.server.js.map +0 -1
- package/dist/components/layouts/admin-sidebar-context.client.js +0 -28
- package/dist/components/layouts/admin-sidebar-context.client.js.map +0 -1
- package/dist/components/layouts/admin-sidebar-header.client.js.map +0 -1
- package/dist/components/layouts/admin-sidebar.client.js +0 -51
- package/dist/components/layouts/admin-sidebar.client.js.map +0 -1
- package/dist/modules/auth/hooks/use-permission.client.js.map +0 -1
- package/dist/modules/config/paths/create.server.d.ts +0 -14
- package/dist/modules/config/paths/create.server.d.ts.map +0 -1
- package/dist/modules/config/paths/create.server.js +0 -12
- package/dist/modules/config/paths/create.server.js.map +0 -1
- package/dist/modules/config/paths/get.server.js +0 -47
- package/dist/modules/config/paths/get.server.js.map +0 -1
- package/src/components/layouts/admin-layout.server.tsx +0 -31
- package/src/components/layouts/admin-sidebar-context.client.tsx +0 -34
- package/src/components/layouts/admin-sidebar.client.tsx +0 -88
- package/src/modules/config/paths/create.server.ts +0 -10
- package/src/modules/config/paths/get.server.ts +0 -69
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from "./lib/config.server";
|
|
5
5
|
export * from "./lib/resolve.server";
|
|
6
|
-
export * from "./paths/create.server";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Router
|
|
10
9
|
*/
|
|
10
|
+
export * from "./router/client.server";
|
|
11
11
|
export * from "./router/context.server";
|
|
12
12
|
export * from "./router/error.server";
|
|
13
13
|
export * from "./router/init.server";
|
|
14
|
-
export * from "./router/client.server";
|
|
@@ -3,14 +3,13 @@ import "server-cli-only";
|
|
|
3
3
|
import { createAccessControl, Role } from "@/modules/auth/lib/permissions";
|
|
4
4
|
import { TDatabaseSchema } from "@/modules/config/db/types";
|
|
5
5
|
import { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
6
|
-
import { PathConfig } from "../paths/types";
|
|
7
6
|
|
|
8
7
|
export type TulipConfig<TSchema extends TDatabaseSchema> = {
|
|
9
8
|
general: {
|
|
10
9
|
name: string;
|
|
11
10
|
shortName: string;
|
|
12
11
|
};
|
|
13
|
-
paths: PathConfig
|
|
12
|
+
// paths: PathConfig;
|
|
14
13
|
database: {
|
|
15
14
|
schema: TSchema;
|
|
16
15
|
pool: {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// import { initRPC } from "../entry.server";
|
|
2
|
+
|
|
3
|
+
// export function createBaseRouter() {
|
|
4
|
+
// const { protectedProcedure } = initRPC();
|
|
5
|
+
|
|
6
|
+
// return {
|
|
7
|
+
// /**
|
|
8
|
+
// * Get paths
|
|
9
|
+
// */
|
|
10
|
+
// getPaths: protectedProcedure.handler(async ({ context }) => {
|
|
11
|
+
// /**
|
|
12
|
+
// * Initialise the paths by executing the path functions
|
|
13
|
+
// */
|
|
14
|
+
// const resolvedPaths = await Promise.all(
|
|
15
|
+
// context.paths.map(async (group) => {
|
|
16
|
+
// /**
|
|
17
|
+
// * Initialise the path by executing the path function
|
|
18
|
+
// */
|
|
19
|
+
// const initialisedPaths = await Promise.all(group.items.map((path) => path()));
|
|
20
|
+
|
|
21
|
+
// /**
|
|
22
|
+
// * Filter out paths that the user doesn't have permission for
|
|
23
|
+
// */
|
|
24
|
+
// const validatedPaths = await Promise.all(
|
|
25
|
+
// initialisedPaths.map(async (path) => {
|
|
26
|
+
// if (!path.permission) return path;
|
|
27
|
+
|
|
28
|
+
// const hasPermission = await context.auth.api.userHasPermission({
|
|
29
|
+
// body: {
|
|
30
|
+
// permission: path.permission,
|
|
31
|
+
// userId: context.session.user?.id,
|
|
32
|
+
// },
|
|
33
|
+
// });
|
|
34
|
+
// if (!hasPermission.success) return null;
|
|
35
|
+
|
|
36
|
+
// return path;
|
|
37
|
+
// }),
|
|
38
|
+
// );
|
|
39
|
+
|
|
40
|
+
// // /**
|
|
41
|
+
// // * Resolve the icon component
|
|
42
|
+
// // */
|
|
43
|
+
// // const resolvedPaths = validatedPaths
|
|
44
|
+
// // .filter((path) => !!path)
|
|
45
|
+
// // .map((path) => {
|
|
46
|
+
// // return {
|
|
47
|
+
// // ...path,
|
|
48
|
+
// // icon: path.icon ? createElement(path.icon) : undefined,
|
|
49
|
+
// // };
|
|
50
|
+
// // });
|
|
51
|
+
|
|
52
|
+
// const items = validatedPaths.filter((path) => !!path);
|
|
53
|
+
|
|
54
|
+
// return { ...group, items };
|
|
55
|
+
// }),
|
|
56
|
+
// );
|
|
57
|
+
|
|
58
|
+
// /**
|
|
59
|
+
// * Filter out empty groups
|
|
60
|
+
// */
|
|
61
|
+
// return resolvedPaths.filter((group) => group.items.length > 0);
|
|
62
|
+
// }),
|
|
63
|
+
// };
|
|
64
|
+
// }
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { type Permission } from "@/modules/auth/lib/permissions";
|
|
2
|
-
import {
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
3
|
import { type Route } from "next";
|
|
4
|
-
import { type TDatabaseSchema } from "../db/types";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* Path
|
|
6
|
+
* Path types
|
|
8
7
|
*/
|
|
9
|
-
export type
|
|
8
|
+
export type PathGroup = {
|
|
10
9
|
name?: string;
|
|
11
|
-
items:
|
|
10
|
+
items: Path[];
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
export type
|
|
13
|
+
export type Path = {
|
|
15
14
|
name: string;
|
|
16
15
|
href: Route;
|
|
17
16
|
icon?: LucideIcon;
|
|
18
17
|
segment?: string;
|
|
19
18
|
permission?: Permission;
|
|
20
19
|
isActive?: boolean;
|
|
21
|
-
items?:
|
|
20
|
+
items?: PathSubItem[];
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
export type
|
|
23
|
+
export type PathSubItem = {
|
|
25
24
|
name: string;
|
|
26
25
|
href: Route;
|
|
27
26
|
segment?: string;
|
|
@@ -29,36 +28,25 @@ export type PathSubItemInput = {
|
|
|
29
28
|
isActive?: boolean;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
* Path output type
|
|
34
|
-
*/
|
|
35
|
-
export type PathGroupOutput = {
|
|
36
|
-
name?: string;
|
|
37
|
-
items: PathOutput[];
|
|
38
|
-
};
|
|
31
|
+
export type Paths = PathGroup[];
|
|
39
32
|
|
|
40
|
-
export type PathOutput = {
|
|
41
|
-
name: string;
|
|
42
|
-
href: Route;
|
|
43
|
-
icon?: React.JSX.Element;
|
|
44
|
-
segment?: string;
|
|
45
|
-
isActive?: boolean;
|
|
46
|
-
items?: PathSubItemOutput[];
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type PathSubItemOutput = {
|
|
50
|
-
name: string;
|
|
51
|
-
href: Route;
|
|
52
|
-
segment?: string;
|
|
53
|
-
isActive?: boolean;
|
|
54
|
-
};
|
|
55
33
|
|
|
56
34
|
/**
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
35
|
+
* <PathGroup>
|
|
36
|
+
* <PathGroupTitle>{name}</PathGroupTitle>
|
|
37
|
+
*
|
|
38
|
+
* <PathGroupItems>
|
|
39
|
+
<Path href="/" segment="admin" permission="admin" isActive>
|
|
40
|
+
<PathIcon><Icon /></PathIcon>
|
|
41
|
+
<PathTitle>{name}</PathTitle>
|
|
42
|
+
|
|
43
|
+
<PathItems>
|
|
44
|
+
<PathSubItem href="/" segment="admin" permission="admin" isActive>
|
|
45
|
+
<PathSubItemIcon><Icon /></PathSubItemIcon>
|
|
46
|
+
<PathSubItemTitle>{name}</PathSubItemTitle>
|
|
47
|
+
</PathSubItem>
|
|
48
|
+
</PathItems>
|
|
49
|
+
</Path>
|
|
50
|
+
* </PathGroupItems>
|
|
51
|
+
* </PathGroup>
|
|
52
|
+
*/
|
|
@@ -119,7 +119,7 @@ export function TableFilterCombobox<TValue extends string>({
|
|
|
119
119
|
<span>{option.label}</span>
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
|
-
{option.total
|
|
122
|
+
{option.total !== undefined && (
|
|
123
123
|
<span className="text-muted-foreground/50 size-4 justify-self-end font-mono text-xs">
|
|
124
124
|
{option.total}
|
|
125
125
|
</span>
|
|
@@ -2,7 +2,7 @@ import "client-only";
|
|
|
2
2
|
|
|
3
3
|
import { useAction } from "@/lib/hooks/use-action";
|
|
4
4
|
import { Permission } from "@/modules/auth/entry";
|
|
5
|
-
import { usePermission } from "@/modules/auth/hooks/use-permission
|
|
5
|
+
import { usePermission } from "@/modules/auth/hooks/use-permission";
|
|
6
6
|
import { InlineEditSchema } from "@/modules/inline-edit/entry";
|
|
7
7
|
import { type CellContext } from "@tanstack/react-table";
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useAction } from "@/lib/hooks/use-action";
|
|
4
|
-
import { usePermission } from "@/modules/auth/hooks/use-permission
|
|
4
|
+
import { usePermission } from "@/modules/auth/hooks/use-permission";
|
|
5
5
|
import { Permission } from "@/modules/auth/lib/permissions";
|
|
6
6
|
import { JSONContent } from "@tiptap/react";
|
|
7
7
|
import { useState } from "react";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TDatabaseSchema } from "../../modules/config/db/types.js";
|
|
2
|
-
import { GetTulipParams } from "../../modules/config/lib/resolve.server.js";
|
|
3
|
-
import * as react_jsx_runtime106 from "react/jsx-runtime";
|
|
4
|
-
import { PropsWithChildren } from "react";
|
|
5
|
-
import "server-cli-only";
|
|
6
|
-
|
|
7
|
-
//#region src/components/layouts/admin-layout.server.d.ts
|
|
8
|
-
declare function AdminLayout<TSchema extends TDatabaseSchema>({
|
|
9
|
-
config,
|
|
10
|
-
children
|
|
11
|
-
}: PropsWithChildren<GetTulipParams<TSchema>>): Promise<react_jsx_runtime106.JSX.Element>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { AdminLayout };
|
|
14
|
-
//# sourceMappingURL=admin-layout.server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-layout.server.d.ts","names":[],"sources":["../../../src/components/layouts/admin-layout.server.tsx"],"sourcesContent":[],"mappings":";;;;;;;iBAWsB,4BAA4B;;;GAG/C,kBAAkB,eAAe,YAAS,QAAA,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getSession } from "../../modules/auth/lib/helpers.server.js";
|
|
2
|
-
import { getTulip } from "../../modules/config/lib/resolve.server.js";
|
|
3
|
-
import { getPaths } from "../../modules/config/paths/get.server.js";
|
|
4
|
-
import { AdminContent } from "./admin-content.client.js";
|
|
5
|
-
import { AdminSidebarProvider } from "./admin-sidebar-context.client.js";
|
|
6
|
-
import { AdminSidebar } from "./admin-sidebar.client.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import "server-cli-only";
|
|
9
|
-
|
|
10
|
-
//#region src/components/layouts/admin-layout.server.tsx
|
|
11
|
-
async function AdminLayout({ config, children }) {
|
|
12
|
-
const tulip = await getTulip({ config });
|
|
13
|
-
const session = await getSession(tulip);
|
|
14
|
-
return /* @__PURE__ */ jsxs(AdminSidebarProvider, {
|
|
15
|
-
value: {
|
|
16
|
-
paths: await getPaths(tulip),
|
|
17
|
-
session
|
|
18
|
-
},
|
|
19
|
-
className: "max-h-[100dvh] overflow-hidden border",
|
|
20
|
-
children: [/* @__PURE__ */ jsx(AdminSidebar, {}), /* @__PURE__ */ jsx(AdminContent, { children })]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { AdminLayout };
|
|
26
|
-
//# sourceMappingURL=admin-layout.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-layout.server.js","names":[],"sources":["../../../src/components/layouts/admin-layout.server.tsx"],"sourcesContent":["import \"server-cli-only\";\n\nimport { getSession } from \"@/modules/auth/lib/helpers.server\";\nimport { TDatabaseSchema } from \"@/modules/config/db/types\";\nimport { getTulip, GetTulipParams } from \"@/modules/config/lib/resolve.server\";\nimport { getPaths } from \"@/modules/config/paths/get.server\";\nimport { PropsWithChildren } from \"react\";\nimport { AdminContent } from \"./admin-content.client\";\nimport { AdminSidebarProvider } from \"./admin-sidebar-context.client\";\nimport { AdminSidebar } from \"./admin-sidebar.client\";\n\nexport async function AdminLayout<TSchema extends TDatabaseSchema>({\n config,\n children,\n}: PropsWithChildren<GetTulipParams<TSchema>>) {\n const tulip = await getTulip({ config });\n const session = await getSession(tulip);\n\n const paths = await getPaths(tulip);\n\n return (\n <AdminSidebarProvider\n value={{ paths, session }}\n className=\"max-h-[100dvh] overflow-hidden border\"\n >\n <AdminSidebar />\n\n <AdminContent>{children}</AdminContent>\n </AdminSidebarProvider>\n );\n}\n"],"mappings":";;;;;;;;;;AAWA,eAAsB,YAA6C,EACjE,QACA,YAC6C;CAC7C,MAAM,QAAQ,MAAM,SAAS,EAAE,QAAQ,CAAC;CACxC,MAAM,UAAU,MAAM,WAAW,MAAM;AAIvC,QACE,qBAAC;EACC,OAAO;GAAE,OAJC,MAAM,SAAS,MAAM;GAIf;GAAS;EACzB,WAAU;aAEV,oBAAC,iBAAe,EAEhB,oBAAC,gBAAc,WAAwB;GAClB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { SidebarProvider } from "../ui/sidebar.client.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import React from "react";
|
|
7
|
-
|
|
8
|
-
//#region src/components/layouts/admin-sidebar-context.client.tsx
|
|
9
|
-
/**
|
|
10
|
-
* AdminSidebarContext
|
|
11
|
-
*/
|
|
12
|
-
const AdminSidebarContext = React.createContext({});
|
|
13
|
-
/**
|
|
14
|
-
* AdminSidebarProvider
|
|
15
|
-
*/
|
|
16
|
-
function AdminSidebarProvider({ value, children,...props }) {
|
|
17
|
-
return /* @__PURE__ */ jsx(SidebarProvider, {
|
|
18
|
-
...props,
|
|
19
|
-
children: /* @__PURE__ */ jsx(AdminSidebarContext.Provider, {
|
|
20
|
-
value,
|
|
21
|
-
children
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { AdminSidebarContext, AdminSidebarProvider };
|
|
28
|
-
//# sourceMappingURL=admin-sidebar-context.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-sidebar-context.client.js","names":[],"sources":["../../../src/components/layouts/admin-sidebar-context.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { ClientSession } from \"@/modules/auth/handler/client.client\";\nimport { PathResult } from \"@/modules/config/paths/types\";\nimport React from \"react\";\nimport { SidebarProvider } from \"../entry.client\";\n\n/**\n * AdminSidebarContextValue\n */\ntype AdminSidebarContextValue = {\n paths: PathResult;\n session: ClientSession;\n};\n\n/**\n * AdminSidebarContext\n */\nexport const AdminSidebarContext = React.createContext({} as AdminSidebarContextValue);\n\n/**\n * AdminSidebarProvider\n */\nexport function AdminSidebarProvider({\n value,\n children,\n ...props\n}: React.ComponentProps<typeof SidebarProvider> & { value: AdminSidebarContextValue }) {\n return (\n <SidebarProvider {...props}>\n <AdminSidebarContext.Provider value={value}>{children}</AdminSidebarContext.Provider>\n </SidebarProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkBA,MAAa,sBAAsB,MAAM,cAAc,EAAE,CAA6B;;;;AAKtF,SAAgB,qBAAqB,EACnC,OACA,SACA,GAAG,SACkF;AACrF,QACE,oBAAC;EAAgB,GAAI;YACnB,oBAAC,oBAAoB;GAAgB;GAAQ;IAAwC;GACrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-sidebar-header.client.js","names":[],"sources":["../../../src/components/layouts/admin-sidebar-header.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar.client\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { cn } from \"@/lib/utils/cn\";\nimport { authClient } from \"@/modules/auth/handler/client.client\";\nimport { ChevronsUpDownIcon, LaptopIcon, LogOutIcon, MoonIcon, SunIcon } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { useRouter } from \"next/navigation\";\nimport { useContext } from \"react\";\nimport { SidebarHeader, useSidebar } from \"../entry.client\";\nimport { AdminSidebarContext } from \"./admin-sidebar-context.client\";\n\nexport function AdminSidebarHeader() {\n const router = useRouter();\n const { theme, setTheme } = useTheme();\n\n const { setOpenMobile } = useSidebar();\n const { session } = useContext(AdminSidebarContext);\n\n return (\n <SidebarHeader>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"items-center justify-between py-3.5\">\n <div className=\"flex items-center gap-4\">\n <Avatar className=\"h-6 w-6 text-sm\">\n <AvatarImage src={session.user.image ?? undefined} alt={session.user.name} />\n <AvatarFallback>{session.user.name?.[0] ?? \"\"}</AvatarFallback>\n </Avatar>\n <span className=\"text-md text-muted-foreground font-bold\">{session.user.name}</span>\n </div>\n\n <ChevronsUpDownIcon className=\"text-muted-foreground h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n\n <DropdownMenuContent className=\"w-44\">\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <span>Thema</span>\n </DropdownMenuSubTrigger>\n\n <DropdownMenuSubContent>\n <DropdownMenuItem\n className={cn(theme === \"light\" && \"bg-secondary font-bold\")}\n onClick={() => setTheme(\"light\")}\n >\n <SunIcon className=\"mr-2 h-4 w-4\" />\n <span>Light</span>\n </DropdownMenuItem>\n\n <DropdownMenuItem\n className={cn(theme === \"dark\" && \"bg-secondary font-bold\")}\n onClick={() => setTheme(\"dark\")}\n >\n <MoonIcon className=\"mr-2 h-4 w-4\" />\n <span>Dark</span>\n </DropdownMenuItem>\n\n <DropdownMenuItem\n className={cn(theme === \"system\" && \"bg-secondary font-bold\")}\n onClick={() => setTheme(\"system\")}\n >\n <LaptopIcon className=\"mr-2 h-4 w-4\" />\n <span>System</span>\n </DropdownMenuItem>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n\n <DropdownMenuSeparator />\n\n <DropdownMenuItem\n onClick={() => {\n setOpenMobile(false);\n authClient.signOut({\n fetchOptions: { onSuccess: () => router.replace(\"/auth/login\") },\n });\n }}\n >\n <LogOutIcon className=\"mr-2 h-4 w-4\" />\n <span>Log out</span>\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarHeader>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,SAAgB,qBAAqB;CACnC,MAAM,SAAS,WAAW;CAC1B,MAAM,EAAE,OAAO,aAAa,UAAU;CAEtC,MAAM,EAAE,kBAAkB,YAAY;CACtC,MAAM,EAAE,YAAY,WAAW,oBAAoB;AAEnD,QACE,oBAAC,2BACC,qBAAC,2BACC,oBAAC;EAAoB;YACnB,qBAAC;GAAO,SAAQ;GAAU,WAAU;cAClC,qBAAC;IAAI,WAAU;eACb,qBAAC;KAAO,WAAU;gBAChB,oBAAC;MAAY,KAAK,QAAQ,KAAK,SAAS;MAAW,KAAK,QAAQ,KAAK;OAAQ,EAC7E,oBAAC,4BAAgB,QAAQ,KAAK,OAAO,MAAM,KAAoB;MACxD,EACT,oBAAC;KAAK,WAAU;eAA2C,QAAQ,KAAK;MAAY;KAChF,EAEN,oBAAC,sBAAmB,WAAU,kCAAkC;IACzD;GACW,EAEtB,qBAAC;EAAoB,WAAU;;GAC7B,qBAAC,8BACC,oBAAC,oCACC,oBAAC,oBAAK,UAAY,GACK,EAEzB,qBAAC;IACC,qBAAC;KACC,WAAW,GAAG,UAAU,WAAW,yBAAyB;KAC5D,eAAe,SAAS,QAAQ;gBAEhC,oBAAC,WAAQ,WAAU,iBAAiB,EACpC,oBAAC,oBAAK,UAAY;MACD;IAEnB,qBAAC;KACC,WAAW,GAAG,UAAU,UAAU,yBAAyB;KAC3D,eAAe,SAAS,OAAO;gBAE/B,oBAAC,YAAS,WAAU,iBAAiB,EACrC,oBAAC,oBAAK,SAAW;MACA;IAEnB,qBAAC;KACC,WAAW,GAAG,UAAU,YAAY,yBAAyB;KAC7D,eAAe,SAAS,SAAS;gBAEjC,oBAAC,cAAW,WAAU,iBAAiB,EACvC,oBAAC,oBAAK,WAAa;MACF;OACI,IACT;GAElB,oBAAC,0BAAwB;GAEzB,qBAAC;IACC,eAAe;AACb,mBAAc,MAAM;AACpB,gBAAW,QAAQ,EACjB,cAAc,EAAE,iBAAiB,OAAO,QAAQ,cAAc,EAAE,EACjE,CAAC;;eAGJ,oBAAC,cAAW,WAAU,iBAAiB,EACvC,oBAAC,oBAAK,YAAc;KACH;;GACC,IACT,GACD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarRail, useSidebar } from "../ui/sidebar.client.js";
|
|
5
|
-
import { AdminSidebarContext } from "./admin-sidebar-context.client.js";
|
|
6
|
-
import { AdminSidebarHeader } from "./admin-sidebar-header.client.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import * as React$1 from "react";
|
|
9
|
-
import Link from "next/link";
|
|
10
|
-
import { useSelectedLayoutSegments } from "next/navigation";
|
|
11
|
-
|
|
12
|
-
//#region src/components/layouts/admin-sidebar.client.tsx
|
|
13
|
-
/**
|
|
14
|
-
* AdminSidebar
|
|
15
|
-
*/
|
|
16
|
-
function AdminSidebar({ ...props }) {
|
|
17
|
-
const currentSegments = useSelectedLayoutSegments();
|
|
18
|
-
const { paths } = React$1.useContext(AdminSidebarContext);
|
|
19
|
-
const { isMobile, toggleSidebar } = useSidebar();
|
|
20
|
-
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
21
|
-
...props,
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsx(AdminSidebarHeader, {}),
|
|
24
|
-
/* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: paths.map((group, index) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [group.name && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.name }), /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item) => {
|
|
25
|
-
const isActive = item.isActive || item.segment === currentSegments?.[0];
|
|
26
|
-
return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
27
|
-
asChild: true,
|
|
28
|
-
isActive,
|
|
29
|
-
children: /* @__PURE__ */ jsxs(Link, {
|
|
30
|
-
href: item.href,
|
|
31
|
-
onClick: isMobile ? toggleSidebar : void 0,
|
|
32
|
-
children: [item.icon, item.name]
|
|
33
|
-
})
|
|
34
|
-
}), isActive && !!item.items?.length && /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items.map((subItem) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
35
|
-
asChild: true,
|
|
36
|
-
isActive: subItem.segment === currentSegments?.[1],
|
|
37
|
-
children: /* @__PURE__ */ jsx(Link, {
|
|
38
|
-
href: subItem.href,
|
|
39
|
-
onClick: isMobile ? toggleSidebar : void 0,
|
|
40
|
-
children: subItem.name
|
|
41
|
-
})
|
|
42
|
-
}) }, subItem.name)) })] }, item.name);
|
|
43
|
-
}) }) })] }, index)) }) }),
|
|
44
|
-
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
45
|
-
]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
export { AdminSidebar };
|
|
51
|
-
//# sourceMappingURL=admin-sidebar.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-sidebar.client.js","names":["React"],"sources":["../../../src/components/layouts/admin-sidebar.client.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Sidebar,\n SidebarContent,\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarRail,\n useSidebar,\n} from \"@/components/ui/sidebar.client\";\nimport Link from \"next/link\";\nimport { useSelectedLayoutSegments } from \"next/navigation\";\nimport * as React from \"react\";\nimport { AdminSidebarContext } from \"./admin-sidebar-context.client\";\nimport { AdminSidebarHeader } from \"./admin-sidebar-header.client\";\n\n/**\n * AdminSidebar\n */\nexport function AdminSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {\n const currentSegments = useSelectedLayoutSegments();\n\n const { paths } = React.useContext(AdminSidebarContext);\n const { isMobile, toggleSidebar } = useSidebar();\n\n return (\n <Sidebar {...props}>\n <AdminSidebarHeader />\n\n <SidebarContent>\n <SidebarMenu>\n {paths.map((group, index) => (\n <SidebarGroup key={index}>\n {group.name && <SidebarGroupLabel>{group.name}</SidebarGroupLabel>}\n\n <SidebarGroupContent>\n <SidebarMenu>\n {group.items.map((item) => {\n const isActive = item.isActive || item.segment === currentSegments?.[0];\n\n return (\n <SidebarMenuItem key={item.name}>\n <SidebarMenuButton asChild isActive={isActive}>\n <Link href={item.href} onClick={isMobile ? toggleSidebar : undefined}>\n {item.icon}\n {item.name}\n </Link>\n </SidebarMenuButton>\n\n {isActive && !!item.items?.length && (\n <SidebarMenuSub>\n {item.items.map((subItem) => (\n <SidebarMenuSubItem key={subItem.name}>\n <SidebarMenuSubButton\n asChild\n isActive={subItem.segment === currentSegments?.[1]}\n >\n <Link\n href={subItem.href}\n onClick={isMobile ? toggleSidebar : undefined}\n >\n {subItem.name}\n </Link>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n )}\n </SidebarMenuItem>\n );\n })}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n ))}\n </SidebarMenu>\n </SidebarContent>\n <SidebarRail />\n </Sidebar>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,SAAgB,aAAa,EAAE,GAAG,SAA+C;CAC/E,MAAM,kBAAkB,2BAA2B;CAEnD,MAAM,EAAE,UAAUA,QAAM,WAAW,oBAAoB;CACvD,MAAM,EAAE,UAAU,kBAAkB,YAAY;AAEhD,QACE,qBAAC;EAAQ,GAAI;;GACX,oBAAC,uBAAqB;GAEtB,oBAAC,4BACC,oBAAC,yBACE,MAAM,KAAK,OAAO,UACjB,qBAAC,2BACE,MAAM,QAAQ,oBAAC,+BAAmB,MAAM,OAAyB,EAElE,oBAAC,iCACC,oBAAC,yBACE,MAAM,MAAM,KAAK,SAAS;IACzB,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,kBAAkB;AAErE,WACE,qBAAC,8BACC,oBAAC;KAAkB;KAAkB;eACnC,qBAAC;MAAK,MAAM,KAAK;MAAM,SAAS,WAAW,gBAAgB;iBACxD,KAAK,MACL,KAAK;OACD;MACW,EAEnB,YAAY,CAAC,CAAC,KAAK,OAAO,UACzB,oBAAC,4BACE,KAAK,MAAM,KAAK,YACf,oBAAC,gCACC,oBAAC;KACC;KACA,UAAU,QAAQ,YAAY,kBAAkB;eAEhD,oBAAC;MACC,MAAM,QAAQ;MACd,SAAS,WAAW,gBAAgB;gBAEnC,QAAQ;OACJ;MACc,IAXA,QAAQ,KAYZ,CACrB,GACa,KAzBC,KAAK,KA2BT;KAEpB,GACU,GACM,KAxCL,MAyCJ,CACf,GACU,GACC;GACjB,oBAAC,gBAAc;;GACP"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-permission.client.js","names":["permission","permission: Permission"],"sources":["../../../../src/modules/auth/hooks/use-permission.client.ts"],"sourcesContent":["\"use client\";\n\nimport { useSuspenseQueries } from \"@tanstack/react-query\";\nimport { LiteralString } from \"better-auth\";\nimport { authClient } from \"../handler/client.client\";\nimport { type Permission } from \"../lib/permissions\";\n\n/**\n * UsePermission\n */\nexport function usePermission(permission?: Permission) {\n const keys = Object.entries(permission ?? {}).flatMap(([resource, permissions]) =>\n permissions.map((permission) => [resource, permission] as const),\n );\n\n return useSuspenseQueries({\n queries: keys.map((key) => ({\n queryKey: [\"permission\", ...key],\n queryFn: async () => {\n const resource = key[0]?.toString() as string;\n const permission: Permission = { [resource]: [key[1]] as LiteralString[] };\n\n const session = await authClient.getSession();\n const userId = session.data?.user.id;\n\n const { data, error } = await authClient.admin.hasPermission({ permission, userId });\n if (error) {\n console.error(error);\n throw error;\n }\n\n return {\n permission,\n success: data.success,\n };\n },\n })),\n combine: (results) => {\n const errors = results.filter(({ error }) => error);\n if (errors.length) return { data: null, errors };\n\n const values = results.map(({ data }) => data);\n const success = results.every(({ data }) => data.success);\n\n return { data: { success, values }, errors: null };\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,cAAc,YAAyB;AAKrD,QAAO,mBAAmB;EACxB,SALW,OAAO,QAAQ,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,iBAChE,YAAY,KAAK,iBAAe,CAAC,UAAUA,aAAW,CAAU,CACjE,CAGe,KAAK,SAAS;GAC1B,UAAU,CAAC,cAAc,GAAG,IAAI;GAChC,SAAS,YAAY;IAEnB,MAAMC,eAAyB,GADd,IAAI,IAAI,UAAU,GACU,CAAC,IAAI,GAAG,EAAqB;IAG1E,MAAM,UADU,MAAM,WAAW,YAAY,EACtB,MAAM,KAAK;IAElC,MAAM,EAAE,MAAM,UAAU,MAAM,WAAW,MAAM,cAAc;KAAE;KAAY;KAAQ,CAAC;AACpF,QAAI,OAAO;AACT,aAAQ,MAAM,MAAM;AACpB,WAAM;;AAGR,WAAO;KACL;KACA,SAAS,KAAK;KACf;;GAEJ,EAAE;EACH,UAAU,YAAY;GACpB,MAAM,SAAS,QAAQ,QAAQ,EAAE,YAAY,MAAM;AACnD,OAAI,OAAO,OAAQ,QAAO;IAAE,MAAM;IAAM;IAAQ;GAEhD,MAAM,SAAS,QAAQ,KAAK,EAAE,WAAW,KAAK;AAG9C,UAAO;IAAE,MAAM;KAAE,SAFD,QAAQ,OAAO,EAAE,WAAW,KAAK,QAAQ;KAE/B;KAAQ;IAAE,QAAQ;IAAM;;EAErD,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TDatabaseSchema } from "../db/types.js";
|
|
2
|
-
import { PathConfig } from "./types.js";
|
|
3
|
-
import "server-cli-only";
|
|
4
|
-
|
|
5
|
-
//#region src/modules/config/paths/create.server.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Create the paths object
|
|
9
|
-
* @param {(() => Promise<PathOutput>)[]} config
|
|
10
|
-
*/
|
|
11
|
-
declare const createPaths: <TSchema extends TDatabaseSchema>(paths: PathConfig<TSchema>) => PathConfig<TSchema>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { createPaths };
|
|
14
|
-
//# sourceMappingURL=create.server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.server.d.ts","names":[],"sources":["../../../../src/modules/config/paths/create.server.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASA;;AAA4C,cAA/B,WAA+B,EAAA,CAAA,gBAAA,eAAA,CAAA,CAAA,KAAA,EAAwB,UAAxB,CAAmC,OAAnC,CAAA,EAAA,GAA2C,UAA3C,CAA2C,OAA3C,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "server-cli-only";
|
|
2
|
-
|
|
3
|
-
//#region src/modules/config/paths/create.server.ts
|
|
4
|
-
/**
|
|
5
|
-
* Create the paths object
|
|
6
|
-
* @param {(() => Promise<PathOutput>)[]} config
|
|
7
|
-
*/
|
|
8
|
-
const createPaths = (paths) => paths;
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { createPaths };
|
|
12
|
-
//# sourceMappingURL=create.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.server.js","names":[],"sources":["../../../../src/modules/config/paths/create.server.ts"],"sourcesContent":["import \"server-cli-only\";\n\nimport { TDatabaseSchema } from \"../db/types\";\nimport { PathConfig } from \"./types\";\n\n/**\n * Create the paths object\n * @param {(() => Promise<PathOutput>)[]} config\n */\nexport const createPaths = <TSchema extends TDatabaseSchema>(paths: PathConfig<TSchema>) => paths;\n"],"mappings":";;;;;;;AASA,MAAa,eAAgD,UAA+B"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getSession } from "../../auth/lib/helpers.server.js";
|
|
2
|
-
import { cache, createElement } from "react";
|
|
3
|
-
import "server-cli-only";
|
|
4
|
-
|
|
5
|
-
//#region src/modules/config/paths/get.server.ts
|
|
6
|
-
/**
|
|
7
|
-
* Get the paths that the user has access to
|
|
8
|
-
* @param {(() => Promise<PathOutput>)[][]} paths
|
|
9
|
-
* @param {User} user
|
|
10
|
-
* @returns {Promise<PathInput[][]>}
|
|
11
|
-
*/
|
|
12
|
-
const getPaths = cache(async (config) => {
|
|
13
|
-
const session = await getSession(config);
|
|
14
|
-
/**
|
|
15
|
-
* Filter out empty groups
|
|
16
|
-
*/
|
|
17
|
-
return (await Promise.all(config.paths.map(async (group) => {
|
|
18
|
-
/**
|
|
19
|
-
* Initialise the path by executing the path function
|
|
20
|
-
*/
|
|
21
|
-
const initialisedPaths = await Promise.all(group.items.map((path) => path(config)));
|
|
22
|
-
/**
|
|
23
|
-
* Resolve the icon component
|
|
24
|
-
*/
|
|
25
|
-
const resolvedPaths = (await Promise.all(initialisedPaths.map(async (path) => {
|
|
26
|
-
if (!path.permission) return path;
|
|
27
|
-
if (!(await config.auth.api.userHasPermission({ body: {
|
|
28
|
-
permission: path.permission,
|
|
29
|
-
userId: session.user?.id
|
|
30
|
-
} })).success) return null;
|
|
31
|
-
return path;
|
|
32
|
-
}))).filter((path) => !!path).map((path) => {
|
|
33
|
-
return {
|
|
34
|
-
...path,
|
|
35
|
-
icon: path.icon ? createElement(path.icon) : void 0
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
return {
|
|
39
|
-
...group,
|
|
40
|
-
items: resolvedPaths
|
|
41
|
-
};
|
|
42
|
-
}))).filter((group) => group.items.length > 0);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { getPaths };
|
|
47
|
-
//# sourceMappingURL=get.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get.server.js","names":[],"sources":["../../../../src/modules/config/paths/get.server.ts"],"sourcesContent":["import \"server-cli-only\";\n\nimport { getSession } from \"@/modules/auth/lib/helpers.server\";\nimport { cache, createElement } from \"react\";\nimport { TDatabaseSchema } from \"../db/types\";\nimport { GetTulipReturn } from \"../lib/resolve.server\";\nimport { PathResult } from \"./types\";\n\n/**\n * Get the paths that the user has access to\n * @param {(() => Promise<PathOutput>)[][]} paths\n * @param {User} user\n * @returns {Promise<PathInput[][]>}\n */\nexport const getPaths = cache(\n async <TSchema extends TDatabaseSchema>(config: GetTulipReturn<TSchema>): Promise<PathResult> => {\n const session = await getSession(config);\n\n /**\n * Initialise the paths by executing the path functions\n */\n const resolvedPaths = await Promise.all(\n config.paths.map(async (group) => {\n /**\n * Initialise the path by executing the path function\n */\n const initialisedPaths = await Promise.all(group.items.map((path) => path(config)));\n\n /**\n * Filter out paths that the user doesn't have permission for\n */\n const validatedPaths = await Promise.all(\n initialisedPaths.map(async (path) => {\n if (!path.permission) return path;\n\n const hasPermission = await config.auth.api.userHasPermission({\n body: {\n permission: path.permission,\n userId: session.user?.id,\n },\n });\n if (!hasPermission.success) return null;\n\n return path;\n }),\n );\n\n /**\n * Resolve the icon component\n */\n const resolvedPaths = validatedPaths\n .filter((path) => !!path)\n .map((path) => {\n return {\n ...path,\n icon: path.icon ? createElement(path.icon) : undefined,\n };\n });\n\n return { ...group, items: resolvedPaths };\n }),\n );\n\n /**\n * Filter out empty groups\n */\n return resolvedPaths.filter((group) => group.items.length > 0);\n },\n);\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,WAAW,MACtB,OAAwC,WAAyD;CAC/F,MAAM,UAAU,MAAM,WAAW,OAAO;;;;AAkDxC,SA7CsB,MAAM,QAAQ,IAClC,OAAO,MAAM,IAAI,OAAO,UAAU;;;;EAIhC,MAAM,mBAAmB,MAAM,QAAQ,IAAI,MAAM,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC,CAAC;;;;EAwBnF,MAAM,iBAnBiB,MAAM,QAAQ,IACnC,iBAAiB,IAAI,OAAO,SAAS;AACnC,OAAI,CAAC,KAAK,WAAY,QAAO;AAQ7B,OAAI,EANkB,MAAM,OAAO,KAAK,IAAI,kBAAkB,EAC5D,MAAM;IACJ,YAAY,KAAK;IACjB,QAAQ,QAAQ,MAAM;IACvB,EACF,CAAC,EACiB,QAAS,QAAO;AAEnC,UAAO;IACP,CACH,EAME,QAAQ,SAAS,CAAC,CAAC,KAAK,CACxB,KAAK,SAAS;AACb,UAAO;IACL,GAAG;IACH,MAAM,KAAK,OAAO,cAAc,KAAK,KAAK,GAAG;IAC9C;IACD;AAEJ,SAAO;GAAE,GAAG;GAAO,OAAO;GAAe;GACzC,CACH,EAKoB,QAAQ,UAAU,MAAM,MAAM,SAAS,EAAE;EAEjE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import "server-cli-only";
|
|
2
|
-
|
|
3
|
-
import { getSession } from "@/modules/auth/lib/helpers.server";
|
|
4
|
-
import { TDatabaseSchema } from "@/modules/config/db/types";
|
|
5
|
-
import { getTulip, GetTulipParams } from "@/modules/config/lib/resolve.server";
|
|
6
|
-
import { getPaths } from "@/modules/config/paths/get.server";
|
|
7
|
-
import { PropsWithChildren } from "react";
|
|
8
|
-
import { AdminContent } from "./admin-content.client";
|
|
9
|
-
import { AdminSidebarProvider } from "./admin-sidebar-context.client";
|
|
10
|
-
import { AdminSidebar } from "./admin-sidebar.client";
|
|
11
|
-
|
|
12
|
-
export async function AdminLayout<TSchema extends TDatabaseSchema>({
|
|
13
|
-
config,
|
|
14
|
-
children,
|
|
15
|
-
}: PropsWithChildren<GetTulipParams<TSchema>>) {
|
|
16
|
-
const tulip = await getTulip({ config });
|
|
17
|
-
const session = await getSession(tulip);
|
|
18
|
-
|
|
19
|
-
const paths = await getPaths(tulip);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<AdminSidebarProvider
|
|
23
|
-
value={{ paths, session }}
|
|
24
|
-
className="max-h-[100dvh] overflow-hidden border"
|
|
25
|
-
>
|
|
26
|
-
<AdminSidebar />
|
|
27
|
-
|
|
28
|
-
<AdminContent>{children}</AdminContent>
|
|
29
|
-
</AdminSidebarProvider>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ClientSession } from "@/modules/auth/handler/client.client";
|
|
4
|
-
import { PathResult } from "@/modules/config/paths/types";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { SidebarProvider } from "../entry.client";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* AdminSidebarContextValue
|
|
10
|
-
*/
|
|
11
|
-
type AdminSidebarContextValue = {
|
|
12
|
-
paths: PathResult;
|
|
13
|
-
session: ClientSession;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* AdminSidebarContext
|
|
18
|
-
*/
|
|
19
|
-
export const AdminSidebarContext = React.createContext({} as AdminSidebarContextValue);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* AdminSidebarProvider
|
|
23
|
-
*/
|
|
24
|
-
export function AdminSidebarProvider({
|
|
25
|
-
value,
|
|
26
|
-
children,
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<typeof SidebarProvider> & { value: AdminSidebarContextValue }) {
|
|
29
|
-
return (
|
|
30
|
-
<SidebarProvider {...props}>
|
|
31
|
-
<AdminSidebarContext.Provider value={value}>{children}</AdminSidebarContext.Provider>
|
|
32
|
-
</SidebarProvider>
|
|
33
|
-
);
|
|
34
|
-
}
|