@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Sidebar,
|
|
5
|
+
SidebarContent,
|
|
6
|
+
SidebarGroup,
|
|
7
|
+
SidebarGroupContent,
|
|
8
|
+
SidebarGroupLabel,
|
|
9
|
+
SidebarMenu,
|
|
10
|
+
SidebarMenuButton,
|
|
11
|
+
SidebarMenuItem,
|
|
12
|
+
SidebarMenuSub,
|
|
13
|
+
SidebarMenuSubButton,
|
|
14
|
+
SidebarMenuSubItem,
|
|
15
|
+
SidebarRail,
|
|
16
|
+
useSidebar,
|
|
17
|
+
} from "@/components/ui/sidebar.client";
|
|
18
|
+
import { Allowed } from "@/modules/auth/components/allowed.client";
|
|
19
|
+
import { Permission } from "@/modules/auth/entry";
|
|
20
|
+
import { Route } from "next";
|
|
21
|
+
import Link from "next/link";
|
|
22
|
+
import { useSelectedLayoutSegments } from "next/navigation";
|
|
23
|
+
import * as React from "react";
|
|
24
|
+
import { Suspense } from "react";
|
|
25
|
+
import { AdminSidebarHeader } from "./admin-sidebar-header.client";
|
|
26
|
+
import {
|
|
27
|
+
AdminSidebarHeaderLoading,
|
|
28
|
+
AdminSidebarMenuContentLoading,
|
|
29
|
+
} from "./admin-sidebar-skeleton";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Paths
|
|
33
|
+
*/
|
|
34
|
+
export function Paths({ children, ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
35
|
+
return (
|
|
36
|
+
<Sidebar {...props}>
|
|
37
|
+
<Suspense fallback={<AdminSidebarHeaderLoading />}>
|
|
38
|
+
<AdminSidebarHeader />
|
|
39
|
+
</Suspense>
|
|
40
|
+
|
|
41
|
+
<SidebarContent>
|
|
42
|
+
<Suspense fallback={<AdminSidebarMenuContentLoading />}>
|
|
43
|
+
<SidebarMenu>{children}</SidebarMenu>
|
|
44
|
+
</Suspense>
|
|
45
|
+
</SidebarContent>
|
|
46
|
+
<SidebarRail />
|
|
47
|
+
</Sidebar>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Path Group
|
|
53
|
+
*/
|
|
54
|
+
export function PathGroup(props: React.ComponentProps<"div">) {
|
|
55
|
+
return <SidebarGroup {...props} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Path Group Title
|
|
60
|
+
*/
|
|
61
|
+
export function PathGroupTitle(props: React.ComponentProps<"div">) {
|
|
62
|
+
return <SidebarGroupLabel {...props} />;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Path Group Items
|
|
67
|
+
*/
|
|
68
|
+
export function PathGroupItems(props: React.PropsWithChildren) {
|
|
69
|
+
return (
|
|
70
|
+
<SidebarGroupContent>
|
|
71
|
+
<SidebarMenu>{props.children}</SidebarMenu>
|
|
72
|
+
</SidebarGroupContent>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Path Context
|
|
78
|
+
*/
|
|
79
|
+
const PathContext = React.createContext({} as { isActive: boolean });
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Path
|
|
83
|
+
*/
|
|
84
|
+
type PathProps = React.ComponentProps<"li"> & {
|
|
85
|
+
permission?: Permission;
|
|
86
|
+
isActive?: boolean;
|
|
87
|
+
segment?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export function Path({ permission, children, isActive, segment, ...props }: PathProps) {
|
|
91
|
+
const currentSegments = useSelectedLayoutSegments();
|
|
92
|
+
|
|
93
|
+
if (!permission) {
|
|
94
|
+
return (
|
|
95
|
+
<PathContext value={{ isActive: isActive || segment === currentSegments?.[0] }}>
|
|
96
|
+
<SidebarMenuItem {...props}>{children}</SidebarMenuItem>
|
|
97
|
+
</PathContext>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Allowed permission={permission}>
|
|
103
|
+
<PathContext value={{ isActive: isActive || segment === currentSegments?.[0] }}>
|
|
104
|
+
<SidebarMenuItem {...props}>{children}</SidebarMenuItem>
|
|
105
|
+
</PathContext>
|
|
106
|
+
</Allowed>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Path Button
|
|
112
|
+
*/
|
|
113
|
+
export function PathLink({ href, children }: React.PropsWithChildren<{ href: Route }>) {
|
|
114
|
+
const { isMobile, toggleSidebar } = useSidebar();
|
|
115
|
+
const { isActive } = React.useContext(PathContext);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<SidebarMenuButton asChild isActive={isActive}>
|
|
119
|
+
<Link href={href} onClick={isMobile ? toggleSidebar : undefined}>
|
|
120
|
+
{children}
|
|
121
|
+
</Link>
|
|
122
|
+
</SidebarMenuButton>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Path Items
|
|
128
|
+
*/
|
|
129
|
+
export function PathItems(props: React.ComponentProps<"ul">) {
|
|
130
|
+
const { isActive } = React.useContext(PathContext);
|
|
131
|
+
if (!isActive) return null;
|
|
132
|
+
|
|
133
|
+
return <SidebarMenuSub {...props} />;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Path Sub Item Context
|
|
138
|
+
*/
|
|
139
|
+
const PathSubItemContext = React.createContext({} as { isActive: boolean });
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Path Sub Item
|
|
143
|
+
*/
|
|
144
|
+
type PathSubItemProps = React.ComponentProps<"li"> & {
|
|
145
|
+
permission?: Permission;
|
|
146
|
+
isActive?: boolean;
|
|
147
|
+
segment?: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export function PathSubItem({
|
|
151
|
+
permission,
|
|
152
|
+
isActive,
|
|
153
|
+
segment,
|
|
154
|
+
children,
|
|
155
|
+
...props
|
|
156
|
+
}: PathSubItemProps) {
|
|
157
|
+
const currentSegments = useSelectedLayoutSegments();
|
|
158
|
+
|
|
159
|
+
if (!permission) {
|
|
160
|
+
return (
|
|
161
|
+
<PathSubItemContext value={{ isActive: isActive || segment === currentSegments?.[1] }}>
|
|
162
|
+
<SidebarMenuSubItem {...props}>{children}</SidebarMenuSubItem>
|
|
163
|
+
</PathSubItemContext>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Allowed permission={permission}>
|
|
169
|
+
<PathSubItemContext value={{ isActive: isActive || segment === currentSegments?.[1] }}>
|
|
170
|
+
<SidebarMenuSubItem {...props}>{children}</SidebarMenuSubItem>
|
|
171
|
+
</PathSubItemContext>
|
|
172
|
+
</Allowed>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Path Button
|
|
178
|
+
*/
|
|
179
|
+
export function PathSubItemLink({ href, children }: React.PropsWithChildren<{ href: Route }>) {
|
|
180
|
+
const { isMobile, toggleSidebar } = useSidebar();
|
|
181
|
+
const { isActive } = React.useContext(PathSubItemContext);
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<SidebarMenuSubButton asChild isActive={isActive}>
|
|
185
|
+
<Link href={href} onClick={isMobile ? toggleSidebar : undefined}>
|
|
186
|
+
{children}
|
|
187
|
+
</Link>
|
|
188
|
+
</SidebarMenuSubButton>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { DropdownMenu, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
|
3
|
+
import {
|
|
4
|
+
SidebarHeader,
|
|
5
|
+
SidebarMenu,
|
|
6
|
+
SidebarMenuItem,
|
|
7
|
+
SidebarMenuSkeleton,
|
|
8
|
+
} from "@/components/ui/sidebar.client";
|
|
9
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
10
|
+
import { Suspense } from "react";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SidebarMenuContentLoading
|
|
14
|
+
*/
|
|
15
|
+
export function AdminSidebarMenuContentLoading() {
|
|
16
|
+
return (
|
|
17
|
+
<SidebarMenu>
|
|
18
|
+
{Array.from({ length: 20 }).map((_, index) => (
|
|
19
|
+
<SidebarMenuItem key={index}>
|
|
20
|
+
<Suspense>
|
|
21
|
+
<SidebarMenuSkeleton />
|
|
22
|
+
</Suspense>
|
|
23
|
+
</SidebarMenuItem>
|
|
24
|
+
))}
|
|
25
|
+
</SidebarMenu>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export function AdminSidebarHeaderLoading() {
|
|
33
|
+
return (
|
|
34
|
+
<SidebarHeader>
|
|
35
|
+
<DropdownMenu>
|
|
36
|
+
<DropdownMenuTrigger asChild>
|
|
37
|
+
<Button variant="outline" disabled>
|
|
38
|
+
<Skeleton className="h-5 w-full" />
|
|
39
|
+
</Button>
|
|
40
|
+
</DropdownMenuTrigger>
|
|
41
|
+
</DropdownMenu>
|
|
42
|
+
</SidebarHeader>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Sidebar,
|
|
5
|
+
SidebarContent,
|
|
6
|
+
SidebarGroup,
|
|
7
|
+
SidebarGroupContent,
|
|
8
|
+
SidebarGroupLabel,
|
|
9
|
+
SidebarMenu,
|
|
10
|
+
SidebarMenuButton,
|
|
11
|
+
SidebarMenuItem,
|
|
12
|
+
SidebarMenuSub,
|
|
13
|
+
SidebarMenuSubButton,
|
|
14
|
+
SidebarMenuSubItem,
|
|
15
|
+
SidebarRail,
|
|
16
|
+
useSidebar,
|
|
17
|
+
} from "@/components/ui/sidebar.client";
|
|
18
|
+
import { Allowed } from "@/modules/auth/entry.client";
|
|
19
|
+
import { Paths } from "@/modules/config/entry";
|
|
20
|
+
import Link from "next/link";
|
|
21
|
+
import { useSelectedLayoutSegments } from "next/navigation";
|
|
22
|
+
import { Suspense } from "react";
|
|
23
|
+
import { Fragment } from "react/jsx-runtime";
|
|
24
|
+
import { AdminSidebarHeader } from "./admin-sidebar-header.client";
|
|
25
|
+
import {
|
|
26
|
+
AdminSidebarHeaderLoading,
|
|
27
|
+
AdminSidebarMenuContentLoading,
|
|
28
|
+
} from "./admin-sidebar-skeleton";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* AdminSidebar
|
|
32
|
+
*/
|
|
33
|
+
export function AdminSidebar({
|
|
34
|
+
paths,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof Sidebar> & { paths: Paths }) {
|
|
37
|
+
const currentSegments = useSelectedLayoutSegments();
|
|
38
|
+
|
|
39
|
+
const { isMobile, toggleSidebar } = useSidebar();
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Sidebar {...props}>
|
|
43
|
+
<Suspense fallback={<AdminSidebarHeaderLoading />}>
|
|
44
|
+
<AdminSidebarHeader />
|
|
45
|
+
</Suspense>
|
|
46
|
+
|
|
47
|
+
<SidebarContent>
|
|
48
|
+
<Suspense fallback={<AdminSidebarMenuContentLoading />}>
|
|
49
|
+
<SidebarMenu>
|
|
50
|
+
{paths.map((group, index) => (
|
|
51
|
+
<SidebarGroup key={index}>
|
|
52
|
+
{group.name && <SidebarGroupLabel>{group.name}</SidebarGroupLabel>}
|
|
53
|
+
|
|
54
|
+
<SidebarGroupContent>
|
|
55
|
+
<SidebarMenu>
|
|
56
|
+
{group.items.map((item) => {
|
|
57
|
+
const isActive = item.isActive || item.segment === currentSegments?.[0];
|
|
58
|
+
const Icon = item.icon;
|
|
59
|
+
|
|
60
|
+
const children = (
|
|
61
|
+
<SidebarMenuItem>
|
|
62
|
+
<SidebarMenuButton asChild isActive={isActive}>
|
|
63
|
+
<Link href={item.href} onClick={isMobile ? toggleSidebar : undefined}>
|
|
64
|
+
{Icon && <Icon />}
|
|
65
|
+
{item.name}
|
|
66
|
+
</Link>
|
|
67
|
+
</SidebarMenuButton>
|
|
68
|
+
|
|
69
|
+
{isActive && !!item.items?.length && (
|
|
70
|
+
<SidebarMenuSub>
|
|
71
|
+
{item.items.map((subItem) => {
|
|
72
|
+
const subChildren = (
|
|
73
|
+
<SidebarMenuSubItem key={subItem.name}>
|
|
74
|
+
<SidebarMenuSubButton
|
|
75
|
+
asChild
|
|
76
|
+
isActive={subItem.segment === currentSegments?.[1]}
|
|
77
|
+
>
|
|
78
|
+
<Link
|
|
79
|
+
href={subItem.href}
|
|
80
|
+
onClick={isMobile ? toggleSidebar : undefined}
|
|
81
|
+
>
|
|
82
|
+
{subItem.name}
|
|
83
|
+
</Link>
|
|
84
|
+
</SidebarMenuSubButton>
|
|
85
|
+
</SidebarMenuSubItem>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (!subItem.permission) {
|
|
89
|
+
return <Fragment key={subItem.name}>{subChildren}</Fragment>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Allowed key={subItem.name} permission={subItem.permission}>
|
|
94
|
+
{subChildren}
|
|
95
|
+
</Allowed>
|
|
96
|
+
);
|
|
97
|
+
})}
|
|
98
|
+
</SidebarMenuSub>
|
|
99
|
+
)}
|
|
100
|
+
</SidebarMenuItem>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (!item.permission) {
|
|
104
|
+
return <Fragment key={item.name}>{children}</Fragment>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Allowed key={item.name} permission={item.permission}>
|
|
109
|
+
{children}
|
|
110
|
+
</Allowed>
|
|
111
|
+
);
|
|
112
|
+
})}
|
|
113
|
+
</SidebarMenu>
|
|
114
|
+
</SidebarGroupContent>
|
|
115
|
+
</SidebarGroup>
|
|
116
|
+
))}
|
|
117
|
+
</SidebarMenu>
|
|
118
|
+
</Suspense>
|
|
119
|
+
</SidebarContent>
|
|
120
|
+
<SidebarRail />
|
|
121
|
+
</Sidebar>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function Spinner() {
|
|
2
|
+
return (
|
|
3
|
+
<svg viewBox="0 0 120.09 141.73" className="w-16">
|
|
4
|
+
<title>Tulip Logo Icon</title>
|
|
5
|
+
<defs>
|
|
6
|
+
<linearGradient
|
|
7
|
+
id="tulip-logo-icon-gradient"
|
|
8
|
+
x1="60.5"
|
|
9
|
+
y1="0"
|
|
10
|
+
x2="60.5"
|
|
11
|
+
y2="141.73"
|
|
12
|
+
gradientUnits="userSpaceOnUse"
|
|
13
|
+
>
|
|
14
|
+
<stop offset="0" stopColor="#ffc754" />
|
|
15
|
+
<stop offset="1" stopColor="#ff1800" />
|
|
16
|
+
</linearGradient>
|
|
17
|
+
<linearGradient
|
|
18
|
+
id="tulip-logo-icon-gradient-2"
|
|
19
|
+
x1="72.4"
|
|
20
|
+
y1="5.81"
|
|
21
|
+
x2="72.4"
|
|
22
|
+
y2="141.73"
|
|
23
|
+
xlinkHref="#tulip-logo-icon-gradient"
|
|
24
|
+
/>
|
|
25
|
+
<linearGradient
|
|
26
|
+
id="tulip-logo-icon-gradient-3"
|
|
27
|
+
x1="47.69"
|
|
28
|
+
y1="5.81"
|
|
29
|
+
x2="47.69"
|
|
30
|
+
y2="141.73"
|
|
31
|
+
xlinkHref="#tulip-logo-icon-gradient"
|
|
32
|
+
/>
|
|
33
|
+
</defs>
|
|
34
|
+
|
|
35
|
+
<g>
|
|
36
|
+
<path
|
|
37
|
+
d="M107.88,93.09c0-35.95-47.38-93.09-47.38-93.09,0,0-47.39,57.14-47.38,93.09,0,26.17,21.21,48.64,47.38,48.64,26.17,0,47.39-22.47,47.38-48.64Z"
|
|
38
|
+
className="animate-pulse fill-[url(#tulip-logo-icon-gradient)] opacity-90"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
d="M116.68,109.5c12.3-33.78-12.69-103.68-12.69-103.68,0,0-64.07,37.49-76.37,71.27-8.95,24.59,3.3,52.97,27.89,61.92,24.59,8.95,52.21-4.91,61.16-29.5Z"
|
|
42
|
+
className="animate-pulse fill-[url(#tulip-logo-icon-gradient)] opacity-90"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
d="M92.46,77.09C80.16,43.3,16.09,5.81,16.09,5.81c0,0-24.98,69.9-12.69,103.68,8.95,24.59,36.57,38.45,61.16,29.5,24.59-8.95,36.84-37.32,27.89-61.92Z"
|
|
46
|
+
className="animate-pulse fill-[url(#tulip-logo-icon-gradient)] opacity-90"
|
|
47
|
+
/>
|
|
48
|
+
</g>
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import "server-cli-only";
|
|
2
|
-
|
|
3
|
-
import { TDatabaseSchema } from "@/modules/config/db/types";
|
|
4
|
-
import { getTulip, GetTulipParams } from "@/modules/config/lib/resolve.server";
|
|
5
1
|
import Image from "next/image";
|
|
6
2
|
import Link from "next/link";
|
|
7
3
|
import { PropsWithChildren } from "react";
|
|
8
4
|
|
|
9
|
-
export async function AuthLayout<
|
|
10
|
-
props: PropsWithChildren<GetTulipParams<TSchema>>,
|
|
11
|
-
) {
|
|
12
|
-
const { general } = await getTulip(props);
|
|
13
|
-
|
|
5
|
+
export async function AuthLayout(props: PropsWithChildren<{ name: string }>) {
|
|
14
6
|
return (
|
|
15
7
|
<div className="container relative mx-auto grid h-[100dvh] flex-col items-center justify-center lg:max-w-none lg:grid-cols-2 lg:px-0">
|
|
16
8
|
<div className="bg-muted relative hidden h-full flex-col p-10 text-white lg:flex dark:border-r">
|
|
17
9
|
<Image src="/images/auth-background.jpeg" alt="Background" className="object-cover" fill />
|
|
18
10
|
|
|
19
11
|
<Link href="/" className="relative z-20 flex items-center text-lg font-bold">
|
|
20
|
-
{
|
|
12
|
+
{props.name}
|
|
21
13
|
</Link>
|
|
22
14
|
|
|
23
15
|
<div className="relative z-20 mt-auto">
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
2
|
+
|
|
3
|
+
export function AuthLoading() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex flex-col gap-4">
|
|
6
|
+
<Skeleton className="h-7 w-full" />
|
|
7
|
+
<Skeleton className="h-48 w-full" />
|
|
8
|
+
<Skeleton className="h-12 w-full" />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { redirect } from "next/navigation";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
import { useSession } from "../hooks/use-session";
|
|
6
|
+
|
|
7
|
+
export function AuthGuard({ children }: PropsWithChildren) {
|
|
8
|
+
const session = useSession();
|
|
9
|
+
if (!session.data) redirect("/auth/login");
|
|
10
|
+
|
|
11
|
+
return <>{children}</>;
|
|
12
|
+
}
|
|
@@ -7,15 +7,16 @@ import { Input } from "@/components/ui/input";
|
|
|
7
7
|
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
8
8
|
import Link from "next/link";
|
|
9
9
|
import { useRouter } from "next/navigation";
|
|
10
|
-
import
|
|
10
|
+
import { parseAsString, useQueryState } from "nuqs";
|
|
11
|
+
import React from "react";
|
|
11
12
|
import { useForm } from "react-hook-form";
|
|
12
13
|
import { toast } from "sonner";
|
|
13
14
|
import * as z from "zod";
|
|
14
15
|
import { authClient } from "../handler/client.client";
|
|
15
16
|
import { loginSchema } from "../lib/validators";
|
|
16
17
|
|
|
17
|
-
export function LoginPage(
|
|
18
|
-
const
|
|
18
|
+
export function LoginPage() {
|
|
19
|
+
const [callbackURL] = useQueryState("callbackURL", parseAsString);
|
|
19
20
|
|
|
20
21
|
const router = useRouter();
|
|
21
22
|
|
|
@@ -4,3 +4,5 @@ export * from "./components/login-page.client";
|
|
|
4
4
|
export * from "./components/reset-password-page.client";
|
|
5
5
|
export * from "./components/update-password-command";
|
|
6
6
|
export * from "./handler/client.client";
|
|
7
|
+
export * from "./hooks/use-permission";
|
|
8
|
+
export * from "./hooks/use-session";
|
|
@@ -4,11 +4,14 @@ import { useSuspenseQueries } from "@tanstack/react-query";
|
|
|
4
4
|
import { LiteralString } from "better-auth";
|
|
5
5
|
import { authClient } from "../handler/client.client";
|
|
6
6
|
import { type Permission } from "../lib/permissions";
|
|
7
|
+
import { useSession } from "./use-session";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* UsePermission
|
|
10
11
|
*/
|
|
11
12
|
export function usePermission(permission?: Permission) {
|
|
13
|
+
const sessionQuery = useSession();
|
|
14
|
+
|
|
12
15
|
const keys = Object.entries(permission ?? {}).flatMap(([resource, permissions]) =>
|
|
13
16
|
permissions.map((permission) => [resource, permission] as const),
|
|
14
17
|
);
|
|
@@ -20,8 +23,7 @@ export function usePermission(permission?: Permission) {
|
|
|
20
23
|
const resource = key[0]?.toString() as string;
|
|
21
24
|
const permission: Permission = { [resource]: [key[1]] as LiteralString[] };
|
|
22
25
|
|
|
23
|
-
const
|
|
24
|
-
const userId = session.data?.user.id;
|
|
26
|
+
const userId = sessionQuery.data?.user.id;
|
|
25
27
|
|
|
26
28
|
const { data, error } = await authClient.admin.hasPermission({ permission, userId });
|
|
27
29
|
if (error) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
4
|
+
import { authClient } from "../entry.client";
|
|
5
|
+
|
|
6
|
+
export function useSession() {
|
|
7
|
+
const session = useSuspenseQuery({
|
|
8
|
+
queryKey: ["session"],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const session = await authClient.getSession();
|
|
11
|
+
if (session.error) throw session.error;
|
|
12
|
+
|
|
13
|
+
return session.data;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return session;
|
|
18
|
+
}
|
|
@@ -64,7 +64,7 @@ export const createUserSchema = userSchema.pick({ email: true, image: true }).ex
|
|
|
64
64
|
.min(2, { message: "Achternaam moet langer zijn dan 2 karakters" })
|
|
65
65
|
.max(50, { message: "Achternaam mag niet langer zijn dan 50 karakters" }),
|
|
66
66
|
password: z.string().min(6, { message: "Wachtwoord moet minimaal 6 karakters hebben" }),
|
|
67
|
-
role: z.string(),
|
|
67
|
+
role: z.string().default("user"),
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
export type CreateUserSchema = z.infer<typeof createUserSchema>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { Permission } from "@/modules/auth/entry";
|
|
4
|
-
import { usePermission } from "@/modules/auth/hooks/use-permission
|
|
4
|
+
import { usePermission } from "@/modules/auth/hooks/use-permission";
|
|
5
5
|
import { mergePermissions } from "@/modules/auth/lib/utils";
|
|
6
6
|
import {
|
|
7
7
|
type BulkCommandDefRenderParams,
|
|
@@ -119,12 +119,11 @@ export function useSingleCommandMenu<TData, TMeta>({
|
|
|
119
119
|
usePermission(mergePermissions(permissions));
|
|
120
120
|
|
|
121
121
|
// filter out commands that don't have valid conditions
|
|
122
|
-
const validCommands = commands
|
|
123
|
-
.
|
|
124
|
-
command
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
122
|
+
const validCommands = commands.filter((command) =>
|
|
123
|
+
command.mode === "single"
|
|
124
|
+
? validateSingleCommand({ data, command })
|
|
125
|
+
: validateBulkCommand({ data: [data], command }),
|
|
126
|
+
);
|
|
128
127
|
|
|
129
128
|
function renderCommand(command: (typeof validCommands)[number]) {
|
|
130
129
|
return command.mode === "single"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Skeleton } from "@/components/entry";
|
|
3
4
|
import { Button } from "@/components/ui/button";
|
|
4
5
|
import {
|
|
5
6
|
DropdownMenu,
|
|
@@ -8,10 +9,10 @@ import {
|
|
|
8
9
|
} from "@/components/ui/dropdown-menu";
|
|
9
10
|
import { cn } from "@/lib/utils/cn";
|
|
10
11
|
import { MoreHorizontal } from "lucide-react";
|
|
11
|
-
import React from "react";
|
|
12
|
+
import React, { ComponentProps } from "react";
|
|
13
|
+
import { RenderCommand } from "../components/render-command";
|
|
12
14
|
import { CommandContextProvider } from "../hooks/context.client";
|
|
13
15
|
import { SingleCommandMenuProps, useSingleCommandMenu } from "../hooks/use-command-menu.client";
|
|
14
|
-
import { RenderCommand } from "../components/render-command";
|
|
15
16
|
|
|
16
17
|
export function DropdownCommandMenu<TData, TMeta>({
|
|
17
18
|
data,
|
|
@@ -48,3 +49,11 @@ export function DropdownCommandMenu<TData, TMeta>({
|
|
|
48
49
|
</DropdownMenu>
|
|
49
50
|
);
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
export function DropdownCommandMenuLoading({ className, ...props }: ComponentProps<"div">) {
|
|
54
|
+
return (
|
|
55
|
+
<div {...props} className={cn("flex w-fit items-center", className)}>
|
|
56
|
+
<Skeleton className="h-8 w-8" />
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { Skeleton } from "@/components/entry";
|
|
3
4
|
import { cn } from "@/lib/utils/cn";
|
|
4
|
-
import React from "react";
|
|
5
|
+
import React, { ComponentProps } from "react";
|
|
5
6
|
import { RenderCommand } from "../components/render-command";
|
|
6
7
|
import { CommandContextProvider } from "../hooks/context.client";
|
|
7
8
|
import { SingleCommandMenuProps, useSingleCommandMenu } from "../hooks/use-command-menu.client";
|
|
@@ -32,3 +33,15 @@ export function InlineCommandMenu<TData, TMeta>({
|
|
|
32
33
|
</div>
|
|
33
34
|
);
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
export function InlineCommandMenuLoading({ className, ...props }: ComponentProps<"div">) {
|
|
38
|
+
return (
|
|
39
|
+
<div {...props} className={cn("flex w-fit items-center", className)}>
|
|
40
|
+
<div className="flex gap-2">
|
|
41
|
+
{Array.from({ length: 3 }).map((_, index) => (
|
|
42
|
+
<Skeleton key={index} className="h-8 w-8" />
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { SingleCommandMenuProps } from "../hooks/use-command-menu.client";
|
|
4
|
-
import { DropdownCommandMenu } from "./dropdown-menu.client";
|
|
5
|
-
import { InlineCommandMenu } from "./inline-menu.client";
|
|
4
|
+
import { DropdownCommandMenu, DropdownCommandMenuLoading } from "./dropdown-menu.client";
|
|
5
|
+
import { InlineCommandMenu, InlineCommandMenuLoading } from "./inline-menu.client";
|
|
6
6
|
|
|
7
7
|
type ResponsiveCommandMenuProps<TData, TMeta> = SingleCommandMenuProps<TData, TMeta>;
|
|
8
8
|
|
|
@@ -16,3 +16,12 @@ export function ResponsiveCommandMenu<TData, TMeta>(
|
|
|
16
16
|
</>
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
export function ResponsiveCommandMenuLoading() {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<InlineCommandMenuLoading className="hidden xl:flex" />
|
|
24
|
+
<DropdownCommandMenuLoading className="xl:hidden" />
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
}
|