@tulip-systems/core 0.5.8 → 0.5.10
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/components/client.mjs +7 -7
- package/dist/components/common/icons.d.mts +2 -2
- package/dist/components/common/status.d.mts +3 -3
- package/dist/components/editor/components/content.client.d.mts +2 -2
- package/dist/components/editor/components/editor.client.d.mts +5 -5
- package/dist/components/editor/components/editor.client.d.mts.map +1 -1
- package/dist/components/editor/components/menu.client.d.mts +3 -3
- package/dist/components/editor/components/menu.client.mjs +1 -1
- package/dist/components/editor/lib/constants.d.mts +27 -27
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/bottom-bar.client.mjs +1 -1
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/breadcrumbs.client.mjs +1 -1
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/header/top-bar.client.mjs +1 -1
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- package/dist/components/layouts/admin-error-pages.d.mts +23 -0
- package/dist/components/layouts/admin-error-pages.d.mts.map +1 -0
- package/dist/components/layouts/admin-error-pages.mjs +60 -0
- package/dist/components/layouts/admin-error-pages.mjs.map +1 -0
- package/dist/components/layouts/admin-layout.d.mts +2 -2
- package/dist/components/layouts/admin-layout.d.mts.map +1 -1
- package/dist/components/layouts/admin-loading.d.mts +2 -2
- package/dist/components/layouts/empty-page.d.mts +4 -4
- package/dist/components/layouts/empty-page.mjs.map +1 -1
- package/dist/components/layouts/error-page.d.mts +35 -10
- package/dist/components/layouts/error-page.d.mts.map +1 -1
- package/dist/components/layouts/error-page.mjs +36 -40
- package/dist/components/layouts/error-page.mjs.map +1 -1
- package/dist/components/layouts/error-sections.d.mts +29 -0
- package/dist/components/layouts/error-sections.d.mts.map +1 -0
- package/dist/components/layouts/error-sections.mjs +47 -0
- package/dist/components/layouts/error-sections.mjs.map +1 -0
- package/dist/components/layouts/list-layout.d.mts +2 -2
- package/dist/components/layouts/providers.client.d.mts +2 -2
- package/dist/components/layouts/root-error-pages.d.mts +10 -0
- package/dist/components/layouts/root-error-pages.d.mts.map +1 -0
- package/dist/components/layouts/root-error-pages.mjs +17 -0
- package/dist/components/layouts/root-error-pages.mjs.map +1 -0
- package/dist/components/layouts/root-layout.server.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
- package/dist/components/layouts/root-loading.d.mts +2 -2
- package/dist/components/layouts/tab-layout.d.mts +2 -2
- package/dist/components/layouts/tab-layout.mjs +1 -1
- package/dist/components/lists/data-list.d.mts +5 -5
- package/dist/components/lists/data-stack.d.mts +8 -8
- package/dist/components/navigation/admin-sidebar-header.client.mjs +2 -2
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts.map +1 -1
- package/dist/components/navigation/admin-sidebar-paths.client.mjs +1 -1
- package/dist/components/navigation/admin-sidebar-skeleton.mjs +1 -1
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert.d.mts +4 -4
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/avatar.client.d.mts.map +1 -1
- package/dist/components/ui/badge.d.mts +2 -2
- package/dist/components/ui/breadcrumb.d.mts +8 -8
- package/dist/components/ui/button.d.mts +3 -3
- package/dist/components/ui/calendar.d.mts +3 -3
- package/dist/components/ui/card.d.mts +7 -7
- package/dist/components/ui/carousel.d.mts +6 -6
- package/dist/components/ui/chart.client.d.mts +5 -5
- package/dist/components/ui/chart.client.d.mts.map +1 -1
- package/dist/components/ui/checkbox.d.mts +2 -2
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/collapsible.client.d.mts.map +1 -1
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/color-picker.client.d.mts.map +1 -1
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/components/ui/combobox-dropdown.client.mjs +1 -1
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts.map +1 -1
- package/dist/components/ui/combobox.client.mjs +1 -1
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/date-picker.client.d.mts.map +1 -1
- package/dist/components/ui/date-picker.client.mjs +1 -1
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/dialog.client.d.mts.map +1 -1
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- package/dist/components/ui/input-recipient.d.mts +2 -2
- package/dist/components/ui/input.d.mts +2 -2
- package/dist/components/ui/label.d.mts +2 -2
- package/dist/components/ui/navigation-menu.d.mts +9 -9
- package/dist/components/ui/pagination.d.mts +8 -8
- package/dist/components/ui/popover.d.mts +5 -5
- package/dist/components/ui/progress.client.d.mts +2 -2
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sidebar.client.d.mts +24 -24
- package/dist/components/ui/sidebar.client.mjs +2 -2
- package/dist/components/ui/skeleton.d.mts +2 -2
- package/dist/components/ui/slider.d.mts +2 -2
- package/dist/components/ui/sonner.client.d.mts +2 -2
- package/dist/components/ui/switch.d.mts +2 -2
- package/dist/components/ui/tabs.d.mts +5 -5
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/time-input.client.d.mts +2 -2
- package/dist/components/ui/toggle-group.client.d.mts +3 -3
- package/dist/components/ui/toggle.d.mts +2 -2
- package/dist/components/ui/tooltip.client.d.mts +5 -5
- package/dist/components/ui/tooltip.client.d.mts.map +1 -1
- package/dist/components.d.mts +5 -4
- package/dist/components.mjs +18 -17
- package/dist/lib/hooks/use-action.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts +2 -2
- package/dist/lib.mjs +1 -1
- package/dist/modules/auth/components/allowed.client.d.mts +2 -2
- package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
- package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-loading.d.mts +2 -2
- package/dist/modules/auth/components/auth-loading.d.mts.map +1 -1
- package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/create-first-user-page.client.mjs +1 -1
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
- package/dist/modules/auth/components/guard.server.d.mts +2 -2
- package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
- package/dist/modules/auth/components/login-page.client.d.mts +2 -2
- package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/login-page.client.mjs +1 -1
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.mjs +1 -1
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
- package/dist/modules/auth/db/schema.d.mts +73 -73
- package/dist/modules/auth/db/schema.d.mts.map +1 -1
- package/dist/modules/auth/handler/client.client.d.mts +137 -137
- package/dist/modules/auth/handler/client.client.d.mts.map +1 -1
- package/dist/modules/auth/handler/init.d.mts +131 -131
- package/dist/modules/auth/handler/init.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-permission.d.mts +3 -3
- package/dist/modules/auth/hooks/use-session.d.mts +4 -4
- package/dist/modules/auth/lib/helpers.server.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts.map +1 -1
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/command-trigger.client.d.mts +4 -4
- package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.mjs +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dialog-command.client.mjs +1 -1
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/components/form-dialog-command.client.mjs +1 -1
- package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +1 -1
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/dropdown-menu.client.mjs +1 -1
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
- package/dist/modules/data-tables/components/column-header.d.mts +2 -2
- package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.mjs +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.mjs +1 -1
- package/dist/modules/data-tables/components/header.d.mts +4 -4
- package/dist/modules/data-tables/components/header.d.mts.map +1 -1
- package/dist/modules/data-tables/components/layout.d.mts +2 -2
- package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
- package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
- package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
- package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
- package/dist/modules/data-tables/components/table.d.mts +7 -7
- package/dist/modules/data-tables/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
- package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/lib/converters/search.mjs +2 -2
- package/dist/modules/data-tables/lib/converters/search.mjs.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/read-only.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.mjs +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.mjs +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-picker.client.mjs +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
- package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
- package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/lib/variants.d.mts +2 -2
- package/dist/modules/router/lib/query-client.server.d.mts +2 -2
- package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/image-grid.client.d.mts +10 -3
- package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
- package/dist/modules/storage/components/image-grid.client.mjs +10 -11
- package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.d.mts +7 -2
- package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +6 -7
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +17 -28
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +2321 -2321
- package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/schema.d.mts +92 -92
- package/dist/modules/storage/lib/schema.d.mts.map +1 -1
- package/dist/modules/storage/lib/schema.mjs +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +21 -21
- package/dist/modules/storage/lib/service.server.mjs +1 -1
- package/dist/modules/storage/lib/validators.d.mts +90 -90
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/components/entry.ts +3 -2
- package/src/components/layouts/admin-error-pages.tsx +109 -0
- package/src/components/layouts/empty-page.tsx +0 -17
- package/src/components/layouts/error-page.tsx +58 -44
- package/src/components/layouts/error-sections.tsx +52 -0
- package/src/components/layouts/root-error-pages.tsx +12 -0
- package/src/modules/data-tables/lib/converters/search.ts +2 -2
- package/src/modules/storage/components/image-grid.client.tsx +10 -8
- package/src/modules/storage/components/upload-zone-context.client.tsx +9 -2
- package/src/modules/storage/components/upload-zone.client.tsx +26 -44
- package/dist/components/layouts/not-allowed-page.d.mts +0 -22
- package/dist/components/layouts/not-allowed-page.d.mts.map +0 -1
- package/dist/components/layouts/not-allowed-page.mjs +0 -25
- package/dist/components/layouts/not-allowed-page.mjs.map +0 -1
- package/dist/components/layouts/not-found-page.d.mts +0 -8
- package/dist/components/layouts/not-found-page.d.mts.map +0 -1
- package/dist/components/layouts/not-found-page.mjs +0 -20
- package/dist/components/layouts/not-found-page.mjs.map +0 -1
- package/dist/components/layouts/not-found-section.mjs +0 -30
- package/dist/components/layouts/not-found-section.mjs.map +0 -1
- package/src/components/layouts/not-allowed-page.tsx +0 -44
- package/src/components/layouts/not-found-page.tsx +0 -17
- package/src/components/layouts/not-found-section.tsx +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAYY,IAAA,UAAc,KAAA,CAAM;AAApB,KACA,QAAA,GADI,OACc,KAAA,CAAM,YADQ,GAAA;EAChC,IAAA,EAAA,MAAQ;AACpB,CAAA;AAKa,KALD,UAAA,GAKiD,OAL7B,KAAA,CAAM,YAKX,GAAA;EACf,IAAA,EAAA,QAAQ;AAKpB,CAAA;;;;cANa,gBAAc,GAAA,CAAA;;;;KACf,QAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAI7B,gBAAA,GAAmB,GAAA,CAAE,aAAa;KAClC,4BAAA,GAA+B,GAAA,CAAE,aAAa;;;;cAK7C,yBAAuB,GAAA,CAAA,QAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaxB,iBAAA,GAAoB,GAAA,CAAE,aAAa;;;;cAKlC,wBAAsB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;KAOvB,sBAAA,GAAyB,GAAA,CAAE,aAAa;;;;cAKvC,kBAAgB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEjB,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,mBAAiB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAElB,iBAAA,GAAoB,GAAA,CAAE,aAAa;;;;cAKlC;;;;cAEA,kBAAgB,GAAA,CAAA;;;;;;;;;;KAKjB,eAAA,GAAkB,GAAA,CAAE,aAAa;KACjC,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,0BAAwB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,uBAAA,GAA0B,GAAA,CAAE,aAAa;;;;cAKxC,iBAAe,GAAA,CAAA;;;;;;;;KAMhB,cAAA,GAAiB,GAAA,CAAE,aAAa;KAChC,eAAA,GAAkB,GAAA,CAAE,aAAa;;;;cAKhC,iBAAe,GAAA,CAAA;;;;;;;;;;;KAShB,cAAA,GAAiB,GAAA,CAAE,aAAa;SACnC;;KAGG,eAAA,GAAkB,GAAA,CAAE,aAAa"}
|
package/package.json
CHANGED
package/src/components/entry.ts
CHANGED
|
@@ -10,12 +10,13 @@ export * from "./editor/lib/types";
|
|
|
10
10
|
/**
|
|
11
11
|
* Components Layouts
|
|
12
12
|
*/
|
|
13
|
+
export * from "./layouts/admin-error-pages";
|
|
13
14
|
export * from "./layouts/admin-loading";
|
|
14
15
|
export * from "./layouts/empty-page";
|
|
15
16
|
export * from "./layouts/error-page";
|
|
17
|
+
export * from "./layouts/error-sections";
|
|
16
18
|
export * from "./layouts/list-layout";
|
|
17
|
-
export * from "./layouts/
|
|
18
|
-
export * from "./layouts/not-found-page";
|
|
19
|
+
export * from "./layouts/root-error-pages";
|
|
19
20
|
export * from "./layouts/root-loading";
|
|
20
21
|
export * from "./layouts/tab-layout";
|
|
21
22
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ServerError } from "@/modules/router/lib/error.server";
|
|
2
|
+
import { CommonORPCErrorCode } from "@orpc/client";
|
|
3
|
+
import { Header } from "../header/header.client";
|
|
4
|
+
import { Topbar, TopbarTitle } from "../header/top-bar.client";
|
|
5
|
+
import {
|
|
6
|
+
DefaultErrorSection,
|
|
7
|
+
NotAllowedSection,
|
|
8
|
+
NotFoundSection,
|
|
9
|
+
ServerErrorSection,
|
|
10
|
+
} from "./error-sections";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Admin Not Found Page
|
|
14
|
+
*/
|
|
15
|
+
export function AdminNotFoundPage() {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<Header>
|
|
19
|
+
<Topbar>
|
|
20
|
+
<TopbarTitle breadcrumbs={[{ label: "404" }]} />
|
|
21
|
+
</Topbar>
|
|
22
|
+
</Header>
|
|
23
|
+
|
|
24
|
+
<div className="p-content">
|
|
25
|
+
<NotFoundSection className="min-h-[calc(100dvh-var(--header-top-bar-height)-var(--content)-var(--content))]" />
|
|
26
|
+
</div>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Admin Not Allowed Page
|
|
33
|
+
*/
|
|
34
|
+
export function AdminNotAllowedPage() {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<Header>
|
|
38
|
+
<Topbar>
|
|
39
|
+
<TopbarTitle breadcrumbs={[{ label: "Unauthorized" }]} />
|
|
40
|
+
</Topbar>
|
|
41
|
+
</Header>
|
|
42
|
+
|
|
43
|
+
<div className="p-content">
|
|
44
|
+
<NotAllowedSection className="min-h-[calc(100dvh-var(--header-top-bar-height)-var(--content)-var(--content))]" />
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* ErrorPage
|
|
52
|
+
* - If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
53
|
+
* - If the error is a ServerError and the code is "NOT_FOUND", show the NotFoundSection
|
|
54
|
+
* - Else show the ErrorPage
|
|
55
|
+
*/
|
|
56
|
+
export function AdminErrorPage(props: { error: Error }) {
|
|
57
|
+
const serverErrorCode: CommonORPCErrorCode =
|
|
58
|
+
props.error instanceof ServerError ? props.error.code : undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
62
|
+
*/
|
|
63
|
+
if (serverErrorCode === "UNAUTHORIZED") {
|
|
64
|
+
return <AdminNotAllowedPage />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
69
|
+
*/
|
|
70
|
+
if (serverErrorCode === "NOT_FOUND") {
|
|
71
|
+
return <AdminNotFoundPage />;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
76
|
+
*/
|
|
77
|
+
if (serverErrorCode === "INTERNAL_SERVER_ERROR") {
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<Header>
|
|
81
|
+
<Topbar>
|
|
82
|
+
<TopbarTitle breadcrumbs={[{ label: "Server Error" }]} />
|
|
83
|
+
</Topbar>
|
|
84
|
+
</Header>
|
|
85
|
+
|
|
86
|
+
<div className="p-content">
|
|
87
|
+
<ServerErrorSection className="min-h-[calc(100dvh-var(--header-top-bar-height)-var(--content)-var(--content))]" />
|
|
88
|
+
</div>
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Else show the ErrorPage
|
|
95
|
+
*/
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<Header>
|
|
99
|
+
<Topbar>
|
|
100
|
+
<TopbarTitle breadcrumbs={[{ label: "Error" }]} />
|
|
101
|
+
</Topbar>
|
|
102
|
+
</Header>
|
|
103
|
+
|
|
104
|
+
<div className="p-content">
|
|
105
|
+
<DefaultErrorSection className="min-h-[calc(100dvh-var(--header-top-bar-height)-var(--content)-var(--content))]" />
|
|
106
|
+
</div>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -40,20 +40,3 @@ export function EmptyPageDescription({ className, children, ...props }: Componen
|
|
|
40
40
|
</p>
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
/* <div className="flex h-full flex-col place-items-center justify-center space-y-6 border border-dashed">
|
|
46
|
-
<span className="space-y-2 text-center">
|
|
47
|
-
<h2 className="text-2xl font-bold tracking-tight">{title}</h2>
|
|
48
|
-
{description && (
|
|
49
|
-
<p className="text-muted-foreground max-w-[40ch] text-sm">{description}</p>
|
|
50
|
-
)}
|
|
51
|
-
</span>
|
|
52
|
-
|
|
53
|
-
{callToAction && (
|
|
54
|
-
<Link href={callToAction.href} className={cn(buttonVariants({ variant: "default" }))}>
|
|
55
|
-
{callToAction.title}
|
|
56
|
-
</Link>
|
|
57
|
-
)}
|
|
58
|
-
</div> */
|
|
59
|
-
}
|
|
@@ -1,61 +1,75 @@
|
|
|
1
1
|
import { cn } from "@/lib/utils/cn";
|
|
2
|
-
import {
|
|
3
|
-
import { CommonORPCErrorCode } from "@orpc/client";
|
|
4
|
-
import { BugIcon } from "lucide-react";
|
|
2
|
+
import { BugIcon, ServerCrashIcon, ShieldBanIcon } from "lucide-react";
|
|
5
3
|
import { ComponentProps } from "react";
|
|
6
|
-
import { NotAllowedPage } from "./not-allowed-page";
|
|
7
|
-
import { NotFoundSection } from "./not-found-section";
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* ErrorPage
|
|
11
7
|
*/
|
|
12
|
-
export function ErrorPage({ className, ...props }: ComponentProps<"div">) {
|
|
8
|
+
export function ErrorPage({ className, children, ...props }: ComponentProps<"div">) {
|
|
13
9
|
return (
|
|
14
|
-
<div
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
<div
|
|
11
|
+
{...props}
|
|
12
|
+
className={cn(
|
|
13
|
+
"min-h-120 flex h-full w-full flex-col items-center justify-center gap-y-3 border border-dashed text-center",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
21
18
|
</div>
|
|
22
19
|
);
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
* - If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
28
|
-
* - If the error is a ServerError and the code is "NOT_FOUND", show the NotFoundSection
|
|
29
|
-
* - Else show the ErrorPage
|
|
23
|
+
* ErrorPageCode
|
|
30
24
|
*/
|
|
31
|
-
export function
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
export function ErrorPageCode({ className, children, ...props }: ComponentProps<"h2">) {
|
|
26
|
+
return (
|
|
27
|
+
<h2 className={cn("text-9xl font-bold leading-none", className)} {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</h2>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
33
|
+
/**
|
|
34
|
+
* ErrorPageIcon
|
|
35
|
+
*/
|
|
36
|
+
const errorPageIcons = {
|
|
37
|
+
serverError: ServerCrashIcon,
|
|
38
|
+
notAllowed: ShieldBanIcon,
|
|
39
|
+
default: BugIcon,
|
|
40
|
+
// 404: BombIcon,
|
|
41
|
+
};
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<NotFoundSection href="/admin" />
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
43
|
+
export function ErrorPageIcon({
|
|
44
|
+
variant = "default",
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
}: ComponentProps<"svg"> & { variant?: keyof typeof errorPageIcons }) {
|
|
48
|
+
const Icon = errorPageIcons[variant];
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
* Else show the ErrorPage
|
|
59
|
-
*/
|
|
60
|
-
return <ErrorPage />;
|
|
50
|
+
return <Icon className={cn("size-16 xl:size-24", className)} {...props} />;
|
|
61
51
|
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* ErrorPageDescription
|
|
55
|
+
*/
|
|
56
|
+
export function ErrorPageDescription({ className, children, ...props }: ComponentProps<"p">) {
|
|
57
|
+
return (
|
|
58
|
+
<p className={cn("text-2xl font-bold lg:text-3xl", className)} {...props}>
|
|
59
|
+
{children}
|
|
60
|
+
</p>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// export function ErrorPage({ className, ...props }: ComponentProps<"div">) {
|
|
65
|
+
// return (
|
|
66
|
+
// <div {...props} className={cn("relative z-0 grid w-full place-items-center", className)}>
|
|
67
|
+
// <div className="flex flex-col items-center gap-12 text-center">
|
|
68
|
+
// <span className="text-destructive flex flex-col items-center gap-2">
|
|
69
|
+
// <BugIcon className="size-20 xl:size-32" />
|
|
70
|
+
// <h1 className="text-2xl font-bold lg:text-3xl">Oeps, er is iets fout gegaan.</h1>
|
|
71
|
+
// </span>
|
|
72
|
+
// </div>
|
|
73
|
+
// </div>
|
|
74
|
+
// );
|
|
75
|
+
// }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils/cn";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import { ErrorPage, ErrorPageCode, ErrorPageDescription, ErrorPageIcon } from "./error-page";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* DefaultErrorSection
|
|
7
|
+
*/
|
|
8
|
+
export function DefaultErrorSection({ className, ...props }: ComponentProps<"div">) {
|
|
9
|
+
return (
|
|
10
|
+
<ErrorPage {...props} className={cn("text-destructive", className)}>
|
|
11
|
+
{/* <BugIcon className="size-16 xl:size-24" /> */}
|
|
12
|
+
<ErrorPageIcon variant="default" />
|
|
13
|
+
<ErrorPageDescription>Oeps, er is iets fout gegaan</ErrorPageDescription>
|
|
14
|
+
</ErrorPage>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ServerErrorSection
|
|
20
|
+
*/
|
|
21
|
+
export function ServerErrorSection({ className, ...props }: ComponentProps<"div">) {
|
|
22
|
+
return (
|
|
23
|
+
<ErrorPage {...props} className={cn("text-destructive", className)}>
|
|
24
|
+
<ErrorPageIcon variant="serverError" />
|
|
25
|
+
<ErrorPageDescription>Oeps, er is iets fout gegaan met de server</ErrorPageDescription>
|
|
26
|
+
</ErrorPage>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* NotFoundSection
|
|
32
|
+
*/
|
|
33
|
+
export function NotFoundSection(props: ComponentProps<"div">) {
|
|
34
|
+
return (
|
|
35
|
+
<ErrorPage {...props}>
|
|
36
|
+
<ErrorPageCode>404</ErrorPageCode>
|
|
37
|
+
<ErrorPageDescription>Oeps, deze pagina is niet gevonden.</ErrorPageDescription>
|
|
38
|
+
</ErrorPage>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Not Allowed Section
|
|
44
|
+
*/
|
|
45
|
+
export function NotAllowedSection(props: ComponentProps<"div">) {
|
|
46
|
+
return (
|
|
47
|
+
<ErrorPage {...props}>
|
|
48
|
+
<ErrorPageIcon variant="notAllowed" />
|
|
49
|
+
<ErrorPageDescription>Je hebt geen toegang tot deze pagina.</ErrorPageDescription>
|
|
50
|
+
</ErrorPage>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NotFoundSection } from "./error-sections";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Admin Not Found Page
|
|
5
|
+
*/
|
|
6
|
+
export function RootNotFoundPage() {
|
|
7
|
+
return (
|
|
8
|
+
<div className="relative z-0 grid h-dvh w-full place-items-center">
|
|
9
|
+
<NotFoundSection className="h-full" />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SQL, ilike, or } from "drizzle-orm";
|
|
1
|
+
import { type SQL, ilike, or, sql } from "drizzle-orm";
|
|
2
2
|
import type { PgColumn } from "drizzle-orm/pg-core";
|
|
3
3
|
import { TableQuerySchema } from "../validators";
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export function convertSearchToQueryParams(
|
|
|
16
16
|
if (!search) return undefined;
|
|
17
17
|
|
|
18
18
|
// create an array of search fields with the search query applied
|
|
19
|
-
const searchFields = fields.map((field) => ilike(field
|
|
19
|
+
const searchFields = fields.map((field) => ilike(sql`${field}::text`, `%${search}%`));
|
|
20
20
|
|
|
21
21
|
// return the query with the search fields
|
|
22
22
|
return or(...searchFields);
|
|
@@ -14,7 +14,6 @@ import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog.cli
|
|
|
14
14
|
import { Input } from "@/components/ui/input";
|
|
15
15
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
16
16
|
import { useAction } from "@/lib/entry.client";
|
|
17
|
-
import { arrayMove } from "@/lib/utils/array-move";
|
|
18
17
|
import { cn } from "@/lib/utils/cn";
|
|
19
18
|
import {
|
|
20
19
|
closestCenter,
|
|
@@ -47,10 +46,13 @@ type ImageGridProps = ComponentProps<"div"> & {
|
|
|
47
46
|
nodes: FileNode[];
|
|
48
47
|
disabled?: boolean;
|
|
49
48
|
moveAction: (params: { fromIndex: number; toIndex: number }) => Promise<void>;
|
|
49
|
+
optimistic?: {
|
|
50
|
+
move?: (params: { fromIndex: number; toIndex: number }) => Promise<void> | void;
|
|
51
|
+
};
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
export function ImageGrid({ nodes, moveAction, disabled, ...props }: ImageGridProps) {
|
|
53
|
-
const
|
|
54
|
+
export function ImageGrid({ nodes, moveAction, optimistic, disabled, ...props }: ImageGridProps) {
|
|
55
|
+
const uploadZone = useUploadZone();
|
|
54
56
|
|
|
55
57
|
const images = nodes.flatMap((node) => ({ ...node, url: getFileUrl(node.id) }));
|
|
56
58
|
|
|
@@ -75,12 +77,12 @@ export function ImageGrid({ nodes, moveAction, disabled, ...props }: ImageGridPr
|
|
|
75
77
|
const fromIndex = images.findIndex((image) => image.id === activeId);
|
|
76
78
|
const toIndex = images.findIndex((image) => image.id === overId);
|
|
77
79
|
|
|
78
|
-
await
|
|
80
|
+
await optimistic?.move?.({ fromIndex, toIndex });
|
|
79
81
|
await moveAction({ fromIndex, toIndex });
|
|
80
82
|
},
|
|
81
83
|
onSuccess: async () => {
|
|
82
84
|
setCurrent(0);
|
|
83
|
-
await
|
|
85
|
+
await uploadZone.optimistic?.invalidate?.();
|
|
84
86
|
},
|
|
85
87
|
onError: (error) => {
|
|
86
88
|
console.error("Error moving image:", error);
|
|
@@ -113,7 +115,7 @@ export function ImageGrid({ nodes, moveAction, disabled, ...props }: ImageGridPr
|
|
|
113
115
|
multiple
|
|
114
116
|
onChange={(e) => {
|
|
115
117
|
if (!e.target.files) return;
|
|
116
|
-
return Array.from(e.target.files).map(onUpload);
|
|
118
|
+
return Array.from(e.target.files).map(uploadZone.onUpload);
|
|
117
119
|
}}
|
|
118
120
|
/>
|
|
119
121
|
</label>
|
|
@@ -156,7 +158,7 @@ type ImageGridItemProps = {
|
|
|
156
158
|
};
|
|
157
159
|
|
|
158
160
|
function ImageGridItem({ node, index, setCurrent }: ImageGridItemProps) {
|
|
159
|
-
const
|
|
161
|
+
const uploadZone = useUploadZone();
|
|
160
162
|
|
|
161
163
|
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: node.id });
|
|
162
164
|
|
|
@@ -198,7 +200,7 @@ function ImageGridItem({ node, index, setCurrent }: ImageGridItemProps) {
|
|
|
198
200
|
type="button"
|
|
199
201
|
variant="destructive"
|
|
200
202
|
size="icon"
|
|
201
|
-
onClick={() =>
|
|
203
|
+
onClick={() => uploadZone.onRemove([node.id])}
|
|
202
204
|
className="absolute left-2 top-2 hidden p-1 group-hover:flex"
|
|
203
205
|
>
|
|
204
206
|
<Icons.trash className="size-4" />
|
|
@@ -9,9 +9,16 @@ import { FileNode, Node } from "../lib/validators";
|
|
|
9
9
|
*/
|
|
10
10
|
export type UploadZoneContextValue = {
|
|
11
11
|
uploadClient: UploadClient;
|
|
12
|
-
updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;
|
|
13
|
-
invalidateQuery: () => Promise<void> | void;
|
|
14
12
|
onUpload: (file: File) => Promise<Node>;
|
|
13
|
+
onRemove: (ids: string[]) => Promise<void>;
|
|
14
|
+
optimistic?: {
|
|
15
|
+
add?: (newValue: FileNode) => Promise<void> | void;
|
|
16
|
+
remove?: (ids: string[]) => Promise<void> | void;
|
|
17
|
+
invalidate?: () => Promise<void> | void;
|
|
18
|
+
cancel?: () => Promise<void> | void;
|
|
19
|
+
};
|
|
20
|
+
// updateData: (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => Promise<void>;
|
|
21
|
+
// invalidateQuery: () => Promise<void> | void;
|
|
15
22
|
};
|
|
16
23
|
|
|
17
24
|
/**
|
|
@@ -4,26 +4,23 @@ import { Input } from "@/components/ui/input";
|
|
|
4
4
|
import { toast } from "@/components/ui/sonner.client";
|
|
5
5
|
import { cn } from "@/lib/entry";
|
|
6
6
|
import { useAction } from "@/lib/hooks/use-action";
|
|
7
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
8
7
|
import { ComponentProps, useCallback, useState } from "react";
|
|
9
|
-
import {
|
|
8
|
+
import { UploadFileRequest, UploadHooks } from "../lib/create-upload.client";
|
|
10
9
|
import { FileNode, Node, UploadFileSchema } from "../lib/validators";
|
|
11
|
-
import { UploadZoneContext } from "./upload-zone-context.client";
|
|
10
|
+
import { UploadZoneContext, UploadZoneContextValue } from "./upload-zone-context.client";
|
|
12
11
|
|
|
13
|
-
export type UploadZoneProps = ComponentProps<"div"> &
|
|
14
|
-
|
|
12
|
+
export type UploadZoneProps = ComponentProps<"div"> &
|
|
13
|
+
Pick<UploadZoneContextValue, "optimistic" | "uploadClient"> & {
|
|
14
|
+
variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
|
|
15
|
+
uploadHooks?: UploadHooks;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onUploadCompleted?: (node: Node) => Promise<void> | void;
|
|
21
|
-
onUploadFailed?: (error: unknown) => Promise<void> | void;
|
|
22
|
-
};
|
|
17
|
+
onUploadCompleted?: (node: Node) => Promise<void> | void;
|
|
18
|
+
onUploadFailed?: (error: unknown) => Promise<void> | void;
|
|
19
|
+
};
|
|
23
20
|
|
|
24
21
|
export function UploadZone({
|
|
25
22
|
variables,
|
|
26
|
-
|
|
23
|
+
optimistic,
|
|
27
24
|
uploadClient,
|
|
28
25
|
uploadHooks,
|
|
29
26
|
onUploadCompleted,
|
|
@@ -34,41 +31,23 @@ export function UploadZone({
|
|
|
34
31
|
onDragLeave,
|
|
35
32
|
...props
|
|
36
33
|
}: UploadZoneProps) {
|
|
37
|
-
const queryClient = useQueryClient();
|
|
38
34
|
const [isDragging, setIsDragging] = useState(false);
|
|
39
35
|
|
|
40
|
-
/**
|
|
41
|
-
* Optimisticly update the data
|
|
42
|
-
*/
|
|
43
|
-
const updateData = useCallback(
|
|
44
|
-
async (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => {
|
|
45
|
-
await queryClient.cancelQueries({ queryKey });
|
|
46
|
-
await queryClient.setQueryData(queryKey, newValue);
|
|
47
|
-
},
|
|
48
|
-
[queryClient, queryKey],
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Invalidate the query
|
|
53
|
-
*/
|
|
54
|
-
const invalidateQuery = useCallback(async () => {
|
|
55
|
-
await queryClient.invalidateQueries({ queryKey });
|
|
56
|
-
}, [queryClient, queryKey]);
|
|
57
|
-
|
|
58
36
|
/**
|
|
59
37
|
* Delete mutation
|
|
60
38
|
*/
|
|
61
39
|
const deleteMutation = useAction({
|
|
62
|
-
mutationFn: async (
|
|
63
|
-
onMutate: async (
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
onSuccess: async () => {
|
|
67
|
-
await invalidateQuery();
|
|
40
|
+
mutationFn: async (ids: string[]) => uploadClient.deleteFiles(ids),
|
|
41
|
+
onMutate: async (ids) => {
|
|
42
|
+
await optimistic?.cancel?.();
|
|
43
|
+
await optimistic?.remove?.(ids);
|
|
68
44
|
},
|
|
69
45
|
onError: async (error) => {
|
|
70
|
-
await onUploadFailed?.(error);
|
|
71
46
|
console.error("Delete failed upload error: ", error);
|
|
47
|
+
await onUploadFailed?.(error);
|
|
48
|
+
},
|
|
49
|
+
onSettled: () => {
|
|
50
|
+
optimistic?.invalidate?.();
|
|
72
51
|
},
|
|
73
52
|
});
|
|
74
53
|
|
|
@@ -85,7 +64,8 @@ export function UploadZone({
|
|
|
85
64
|
isPending: true,
|
|
86
65
|
} as FileNode;
|
|
87
66
|
|
|
88
|
-
await
|
|
67
|
+
await optimistic?.cancel?.();
|
|
68
|
+
await optimistic?.add?.(newNode);
|
|
89
69
|
},
|
|
90
70
|
onSuccess: async (data) => {
|
|
91
71
|
await onUploadCompleted?.(data);
|
|
@@ -100,10 +80,10 @@ export function UploadZone({
|
|
|
100
80
|
});
|
|
101
81
|
|
|
102
82
|
console.info("Deleting failed upload");
|
|
103
|
-
await deleteMutation.mutateAsync(
|
|
83
|
+
await deleteMutation.mutateAsync([variables.id]);
|
|
104
84
|
},
|
|
105
85
|
onSettled: () => {
|
|
106
|
-
|
|
86
|
+
optimistic?.invalidate?.();
|
|
107
87
|
},
|
|
108
88
|
});
|
|
109
89
|
|
|
@@ -112,6 +92,7 @@ export function UploadZone({
|
|
|
112
92
|
*/
|
|
113
93
|
const onUpload = useCallback(
|
|
114
94
|
async (file: File) => {
|
|
95
|
+
console.info("Uploading file", file);
|
|
115
96
|
const req = uploadClient.prepareUpload({ ...variables, file });
|
|
116
97
|
return await uploadMutation.mutateAsync(req);
|
|
117
98
|
},
|
|
@@ -121,6 +102,7 @@ export function UploadZone({
|
|
|
121
102
|
return (
|
|
122
103
|
<div
|
|
123
104
|
{...props}
|
|
105
|
+
role="region"
|
|
124
106
|
className={cn("relative z-0 flex-1 space-y-6", className)}
|
|
125
107
|
onDragOver={(...args) => {
|
|
126
108
|
setIsDragging(true);
|
|
@@ -151,8 +133,8 @@ export function UploadZone({
|
|
|
151
133
|
value={{
|
|
152
134
|
uploadClient,
|
|
153
135
|
onUpload,
|
|
154
|
-
|
|
155
|
-
|
|
136
|
+
onRemove: deleteMutation.mutateAsync,
|
|
137
|
+
optimistic,
|
|
156
138
|
}}
|
|
157
139
|
>
|
|
158
140
|
{children}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime247 from "react/jsx-runtime";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
3
|
-
import { Route } from "next";
|
|
4
|
-
|
|
5
|
-
//#region src/components/layouts/not-allowed-page.d.ts
|
|
6
|
-
type NotAllowedPageProps = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
-
title?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
callToAction?: {
|
|
10
|
-
href: Route;
|
|
11
|
-
title: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
declare function NotAllowedPage({
|
|
15
|
-
title,
|
|
16
|
-
description,
|
|
17
|
-
callToAction,
|
|
18
|
-
...props
|
|
19
|
-
}: NotAllowedPageProps): react_jsx_runtime247.JSX.Element;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { NotAllowedPage, NotAllowedPageProps };
|
|
22
|
-
//# sourceMappingURL=not-allowed-page.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"not-allowed-page.d.mts","names":[],"sources":["../../../src/components/layouts/not-allowed-page.tsx"],"sourcesContent":[],"mappings":";;;;;KAOY,mBAAA,GAAsB,eAAe;;;EAArC,YAAA,CAAA,EAAA;IAAqC,IAAA,EAIvC,KAJuC;IAAf,KAAA,EAAA,MAAA;EAIxB,CAAA;CAAK;AAKC,iBAAA,cAAA,CAAc;EAAA,KAAA;EAAA,WAAA;EAAA,YAAA;EAAA,GAAA;AAAA,CAAA,EAK3B,mBAL2B,CAAA,EAKR,oBAAA,CAAA,GAAA,CAAA,OALQ"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../lib/utils/cn.mjs";
|
|
2
|
-
import { EmptyPage, EmptyPageDescription, EmptyPageTitle } from "./empty-page.mjs";
|
|
3
|
-
import { buttonVariants } from "../ui/button.mjs";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import Link from "next/link";
|
|
6
|
-
|
|
7
|
-
//#region src/components/layouts/not-allowed-page.tsx
|
|
8
|
-
function NotAllowedPage({ title, description, callToAction, ...props }) {
|
|
9
|
-
return /* @__PURE__ */ jsxs(EmptyPage, {
|
|
10
|
-
...props,
|
|
11
|
-
children: [
|
|
12
|
-
/* @__PURE__ */ jsx(EmptyPageTitle, { children: title ?? "Geen toegang" }),
|
|
13
|
-
/* @__PURE__ */ jsx(EmptyPageDescription, { children: description ?? "Je hebt geen toegang tot deze pagina." }),
|
|
14
|
-
callToAction && /* @__PURE__ */ jsx(Link, {
|
|
15
|
-
href: callToAction.href,
|
|
16
|
-
className: cn(buttonVariants({ variant: "default" })),
|
|
17
|
-
children: callToAction.title
|
|
18
|
-
})
|
|
19
|
-
]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { NotAllowedPage };
|
|
25
|
-
//# sourceMappingURL=not-allowed-page.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"not-allowed-page.mjs","names":[],"sources":["../../../src/components/layouts/not-allowed-page.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils/cn\";\nimport type { Route } from \"next\";\nimport Link from \"next/link\";\nimport type { HTMLAttributes } from \"react\";\nimport { buttonVariants } from \"../ui/button\";\nimport { EmptyPage, EmptyPageDescription, EmptyPageTitle } from \"./empty-page\";\n\nexport type NotAllowedPageProps = HTMLAttributes<HTMLDivElement> & {\n title?: string;\n description?: string;\n callToAction?: {\n href: Route;\n title: string;\n };\n};\n\nexport function NotAllowedPage({\n title,\n description,\n callToAction,\n ...props\n}: NotAllowedPageProps) {\n return (\n <EmptyPage {...props}>\n <EmptyPageTitle>{title ?? \"Geen toegang\"}</EmptyPageTitle>\n <EmptyPageDescription>\n {description ?? \"Je hebt geen toegang tot deze pagina.\"}\n </EmptyPageDescription>\n\n {callToAction && (\n <Link href={callToAction.href} className={cn(buttonVariants({ variant: \"default\" }))}>\n {callToAction.title}\n </Link>\n )}\n </EmptyPage>\n );\n}\n\n// <EmptyPage\n// {...props}\n// title={title ?? \"Geen toegang\"}\n// description={description ?? \"Je hebt geen toegang tot deze pagina.\"}\n// callToAction={callToAction ?? { href: \"/admin\", title: \"Terug naar dashboard\" }}\n// />\n"],"mappings":";;;;;;;AAgBA,SAAgB,eAAe,EAC7B,OACA,aACA,cACA,GAAG,SACmB;AACtB,QACE,qBAAC;EAAU,GAAI;;GACb,oBAAC,4BAAgB,SAAS,iBAAgC;GAC1D,oBAAC,kCACE,eAAe,0CACK;GAEtB,gBACC,oBAAC;IAAK,MAAM,aAAa;IAAM,WAAW,GAAG,eAAe,EAAE,SAAS,WAAW,CAAC,CAAC;cACjF,aAAa;KACT;;GAEC"}
|