@tulip-systems/drive 0.8.1 → 0.8.3
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/client.d.mts +5 -0
- package/dist/client.mjs +6 -0
- package/dist/components/content.d.mts +13 -0
- package/dist/components/content.mjs +17 -0
- package/dist/components/context.client.d.mts +13 -0
- package/dist/components/dnd.client.d.mts +16 -0
- package/dist/components/dnd.client.mjs +29 -0
- package/dist/components/grid-card.client.d.mts +46 -0
- package/dist/components/grid-card.client.mjs +173 -0
- package/dist/components/grid.client.d.mts +53 -0
- package/dist/components/grid.client.mjs +53 -0
- package/dist/components/navigation/breadcrumbs.client.d.mts +25 -0
- package/dist/components/navigation/breadcrumbs.client.mjs +51 -0
- package/dist/components/navigation/header.client.d.mts +27 -0
- package/dist/components/navigation/header.client.mjs +40 -0
- package/dist/components/navigation/toolbar.client.d.mts +23 -0
- package/dist/components/navigation/toolbar.client.mjs +34 -0
- package/dist/components/navigation/view-switcher.client.d.mts +9 -0
- package/dist/components/navigation/view-switcher.client.mjs +35 -0
- package/dist/components/selection.client.d.mts +27 -0
- package/dist/components/selection.client.mjs +36 -0
- package/dist/components/view.client.d.mts +25 -0
- package/dist/components/view.client.mjs +43 -0
- package/dist/config/filters.mjs +14 -0
- package/dist/config/types.mjs +60 -0
- package/dist/google/client.d.mts +8 -0
- package/dist/google/client.mjs +9 -0
- package/dist/google/server.d.mts +3 -0
- package/dist/google/server.mjs +4 -0
- package/dist/google.d.mts +6 -0
- package/dist/google.mjs +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +7 -0
- package/dist/lib/constants.d.mts +11 -0
- package/dist/lib/constants.mjs +20 -0
- package/dist/lib/contracts.d.mts +100 -0
- package/dist/lib/dto.d.mts +117 -0
- package/dist/lib/dto.mjs +57 -0
- package/dist/lib/helpers.d.mts +17 -0
- package/dist/lib/helpers.mjs +36 -0
- package/dist/lib/helpers.server.d.mts +13 -0
- package/dist/lib/helpers.server.mjs +15 -0
- package/dist/lib/search-params.d.mts +8 -0
- package/dist/lib/search-params.mjs +7 -0
- package/dist/lib/validators.d.mts +157 -0
- package/dist/lib/validators.mjs +65 -0
- package/dist/local/client.d.mts +13 -0
- package/dist/local/client.mjs +13 -0
- package/dist/local/server.d.mts +4 -0
- package/dist/local/server.mjs +5 -0
- package/dist/local.d.mts +8 -0
- package/dist/local.mjs +9 -0
- package/dist/providers/google/components/command-file-update.d.mts +21 -0
- package/dist/providers/google/components/command-file-update.mjs +51 -0
- package/dist/providers/google/components/command-folder-create.d.mts +21 -0
- package/dist/providers/google/components/command-folder-create.mjs +58 -0
- package/dist/providers/google/components/command-folder-update.d.mts +21 -0
- package/dist/providers/google/components/command-folder-update.mjs +51 -0
- package/dist/providers/google/components/content.client.d.mts +9 -0
- package/dist/providers/google/components/content.client.mjs +10 -0
- package/dist/providers/google/components/navigation.client.d.mts +15 -0
- package/dist/providers/google/components/navigation.client.mjs +17 -0
- package/dist/providers/google/components/provider.client.d.mts +32 -0
- package/dist/providers/google/components/provider.client.mjs +42 -0
- package/dist/providers/google/components/view.client.d.mts +40 -0
- package/dist/providers/google/components/view.client.mjs +96 -0
- package/dist/providers/google/config/columns-data.d.mts +7 -0
- package/dist/providers/google/config/columns-data.mjs +69 -0
- package/dist/providers/google/config/filters.d.mts +15 -0
- package/dist/providers/google/config/filters.mjs +7 -0
- package/dist/providers/google/lib/constants.mjs +12 -0
- package/dist/providers/google/lib/dto.d.mts +38 -0
- package/dist/providers/google/lib/dto.mjs +65 -0
- package/dist/providers/google/lib/helpers.mjs +38 -0
- package/dist/providers/google/lib/router.server.d.mts +611 -0
- package/dist/providers/google/lib/router.server.mjs +39 -0
- package/dist/providers/google/lib/search-params.d.mts +14 -0
- package/dist/providers/google/lib/search-params.mjs +11 -0
- package/dist/providers/google/lib/service.server.d.mts +185 -0
- package/dist/providers/google/lib/service.server.mjs +610 -0
- package/dist/providers/google/lib/validators.d.mts +302 -0
- package/dist/providers/google/lib/validators.mjs +58 -0
- package/dist/providers/local/components/command-file-update.d.mts +17 -0
- package/dist/providers/local/components/command-file-update.mjs +47 -0
- package/dist/providers/local/components/command-file-upload.d.mts +10 -0
- package/dist/providers/local/components/command-file-upload.mjs +34 -0
- package/dist/providers/local/components/command-folder-create.d.mts +17 -0
- package/dist/providers/local/components/command-folder-create.mjs +54 -0
- package/dist/providers/local/components/command-folder-update.d.mts +17 -0
- package/dist/providers/local/components/command-folder-update.mjs +47 -0
- package/dist/providers/local/components/content.client.d.mts +6 -0
- package/dist/providers/local/components/content.client.mjs +7 -0
- package/dist/providers/local/components/navigation.client.d.mts +15 -0
- package/dist/providers/local/components/navigation.client.mjs +17 -0
- package/dist/providers/local/components/provider.client.d.mts +39 -0
- package/dist/providers/local/components/provider.client.mjs +60 -0
- package/dist/providers/local/components/upload-zone-context.client.d.mts +37 -0
- package/dist/providers/local/components/upload-zone-context.client.mjs +22 -0
- package/dist/providers/local/components/upload-zone.client.d.mts +29 -0
- package/dist/providers/local/components/upload-zone.client.mjs +146 -0
- package/dist/providers/local/components/view.client.d.mts +31 -0
- package/dist/providers/local/components/view.client.mjs +90 -0
- package/dist/providers/local/config/columns-data.d.mts +7 -0
- package/dist/providers/local/config/columns-data.mjs +69 -0
- package/dist/providers/local/config/filters.d.mts +25 -0
- package/dist/providers/local/config/filters.mjs +14 -0
- package/dist/providers/local/lib/constants.d.mts +11 -0
- package/dist/providers/local/lib/constants.mjs +28 -0
- package/dist/providers/local/lib/helpers.d.mts +44 -0
- package/dist/providers/local/lib/helpers.mjs +109 -0
- package/dist/providers/local/lib/route-handler.server.d.mts +33 -0
- package/dist/providers/local/lib/route-handler.server.mjs +113 -0
- package/dist/providers/local/lib/router.server.d.mts +41647 -0
- package/dist/providers/local/lib/router.server.mjs +51 -0
- package/dist/providers/local/lib/schema.d.mts +1112 -0
- package/dist/providers/local/lib/schema.mjs +70 -0
- package/dist/providers/local/lib/search-params.d.mts +13 -0
- package/dist/providers/local/lib/search-params.mjs +8 -0
- package/dist/providers/local/lib/service.server.d.mts +488 -0
- package/dist/providers/local/lib/service.server.mjs +667 -0
- package/dist/providers/local/lib/upload.client.d.mts +61 -0
- package/dist/providers/local/lib/upload.client.mjs +99 -0
- package/dist/providers/local/lib/validators.d.mts +453 -0
- package/dist/providers/local/lib/validators.mjs +95 -0
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +3 -0
- package/package.json +45 -46
- package/src/components/grid-card.client.tsx +17 -12
- package/src/components/selection.client.tsx +1 -2
- package/src/config/types.tsx +1 -1
- package/src/providers/google/components/command-file-update.tsx +2 -2
- package/src/providers/google/components/command-folder-create.tsx +2 -2
- package/src/providers/google/components/command-folder-update.tsx +2 -2
- package/src/providers/google/components/view.client.tsx +1 -7
- package/src/providers/google/lib/helpers.ts +0 -9
- package/src/providers/google/lib/service.server.ts +1 -3
- package/src/providers/local/components/command-file-update.tsx +2 -2
- package/src/providers/local/components/command-folder-create.tsx +2 -2
- package/src/providers/local/components/command-folder-update.tsx +2 -2
- package/src/providers/local/components/upload-zone.client.tsx +1 -1
- package/src/providers/local/lib/helpers.ts +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { driveNodeSchema } from "../../../lib/dto.mjs";
|
|
2
|
+
import { createDriveFolderInputSchema, presignDriveFileInputSchema, updateDriveNodeInputSchema, uploadDriveFileInputSchema } from "../../../lib/validators.mjs";
|
|
3
|
+
import { imageVariants } from "./constants.mjs";
|
|
4
|
+
import { localDriveFilters } from "../config/filters.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { resolveFiltersSchema, tableQuerySchema } from "@tulip-systems/core/data-tables";
|
|
7
|
+
import { getAssetURLSchema, storageAssetVisibilitySchema } from "@tulip-systems/core/storage";
|
|
8
|
+
|
|
9
|
+
//#region src/providers/local/lib/validators.ts
|
|
10
|
+
const localDriveNodeSchema = driveNodeSchema.extend({
|
|
11
|
+
provider: z.literal("local"),
|
|
12
|
+
assetId: z.string().nullable()
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Node with children
|
|
16
|
+
*/
|
|
17
|
+
const localDriveNodeWithChildrenSchema = localDriveNodeSchema.extend({ children: z.array(localDriveNodeSchema) });
|
|
18
|
+
/**
|
|
19
|
+
* Create folder
|
|
20
|
+
*/
|
|
21
|
+
const createLocalDriveFolderInputSchema = createDriveFolderInputSchema.extend({
|
|
22
|
+
hidden: z.boolean().optional(),
|
|
23
|
+
readonly: z.boolean().optional()
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Update node
|
|
27
|
+
*/
|
|
28
|
+
const updateLocalDriveNodeInputSchema = updateDriveNodeInputSchema.extend({
|
|
29
|
+
parentId: z.string().nullable().optional(),
|
|
30
|
+
hidden: z.boolean().optional(),
|
|
31
|
+
readonly: z.boolean().optional(),
|
|
32
|
+
archivedAt: z.date().nullable().optional()
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Upload file
|
|
36
|
+
*/
|
|
37
|
+
const uploadLocalDriveFileInputSchema = uploadDriveFileInputSchema.extend({
|
|
38
|
+
hidden: z.boolean().optional(),
|
|
39
|
+
readonly: z.boolean().optional()
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Presign file
|
|
43
|
+
*/
|
|
44
|
+
const presignLocalDriveFileInputSchema = presignDriveFileInputSchema.extend({
|
|
45
|
+
hidden: z.boolean().optional(),
|
|
46
|
+
readonly: z.boolean().optional(),
|
|
47
|
+
uploadId: z.uuid().optional(),
|
|
48
|
+
visibility: storageAssetVisibilitySchema.optional().default("private")
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Get file url schema
|
|
52
|
+
*/
|
|
53
|
+
const getLocalFileURLSchemaDefaults = {
|
|
54
|
+
variant: "main",
|
|
55
|
+
disposition: "inline"
|
|
56
|
+
};
|
|
57
|
+
const getLocalFileURLSchema = getAssetURLSchema.extend({ variant: z.enum(imageVariants).optional().default(getLocalFileURLSchemaDefaults.variant) });
|
|
58
|
+
/**
|
|
59
|
+
* Tree filters
|
|
60
|
+
*/
|
|
61
|
+
const localDriveTreeFiltersSchema = resolveFiltersSchema(localDriveFilters).partial().extend({
|
|
62
|
+
namespace: z.string(),
|
|
63
|
+
parentId: z.string().nullable()
|
|
64
|
+
}).transform((input) => ({
|
|
65
|
+
...input,
|
|
66
|
+
hidden: input?.hidden ?? false,
|
|
67
|
+
isArchived: input?.isArchived ?? false
|
|
68
|
+
}));
|
|
69
|
+
/**
|
|
70
|
+
* Flat filters
|
|
71
|
+
*/
|
|
72
|
+
const localDriveFlatFiltersSchema = resolveFiltersSchema(localDriveFilters).partial().extend({ namespace: z.string().optional() }).transform((input) => ({
|
|
73
|
+
...input,
|
|
74
|
+
hidden: input?.hidden ?? false,
|
|
75
|
+
isArchived: input?.isArchived ?? false
|
|
76
|
+
}));
|
|
77
|
+
/**
|
|
78
|
+
* List tree input schema
|
|
79
|
+
*/
|
|
80
|
+
const listLocalDriveTreeInputSchema = tableQuerySchema.extend({ filters: localDriveTreeFiltersSchema });
|
|
81
|
+
/**
|
|
82
|
+
* List flat input schema
|
|
83
|
+
*/
|
|
84
|
+
const listLocalDriveFlatInputSchema = tableQuerySchema.extend({ filters: localDriveFlatFiltersSchema });
|
|
85
|
+
/**
|
|
86
|
+
* Get by parent id input
|
|
87
|
+
*/
|
|
88
|
+
const getLocalDriveNodesByParentIdInputSchema = tableQuerySchema.pick({
|
|
89
|
+
order: true,
|
|
90
|
+
sort: true,
|
|
91
|
+
search: true
|
|
92
|
+
}).extend({ filters: localDriveTreeFiltersSchema });
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { createLocalDriveFolderInputSchema, getLocalDriveNodesByParentIdInputSchema, getLocalFileURLSchema, getLocalFileURLSchemaDefaults, listLocalDriveFlatInputSchema, listLocalDriveTreeInputSchema, localDriveFlatFiltersSchema, localDriveNodeSchema, localDriveNodeWithChildrenSchema, localDriveTreeFiltersSchema, presignLocalDriveFileInputSchema, updateLocalDriveNodeInputSchema, uploadLocalDriveFileInputSchema };
|
package/dist/server.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,82 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tulip-systems/drive",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@
|
|
8
|
+
"@arethetypeswrong/core": "^0.18.2",
|
|
9
|
+
"@types/pg": "^8.20.0",
|
|
9
10
|
"@types/react": "19.2.14",
|
|
10
11
|
"@types/react-dom": "19.2.3",
|
|
11
12
|
"aws-sdk-client-mock": "^4.1.0",
|
|
12
13
|
"aws-sdk-client-mock-vitest": "^7.0.1",
|
|
13
|
-
"
|
|
14
|
+
"publint": "^0.3.20",
|
|
15
|
+
"tailwindcss": "^4.3.0",
|
|
14
16
|
"tsdown": "^0.20.3",
|
|
15
17
|
"typescript": "5.9.3",
|
|
16
|
-
"
|
|
17
|
-
"vitest": "^4.1.
|
|
18
|
+
"unrun": "^0.3.0",
|
|
19
|
+
"vitest": "^4.1.5",
|
|
18
20
|
"@tulip-systems/typescript-config": "0.0.0"
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
|
-
"@dnd-kit/collision": "^0.
|
|
22
|
-
"@dnd-kit/dom": "^0.
|
|
23
|
-
"@dnd-kit/helpers": "^0.
|
|
24
|
-
"@dnd-kit/react": "^0.
|
|
23
|
+
"@dnd-kit/collision": "^0.4.0",
|
|
24
|
+
"@dnd-kit/dom": "^0.4.0",
|
|
25
|
+
"@dnd-kit/helpers": "^0.4.0",
|
|
26
|
+
"@dnd-kit/react": "^0.4.0",
|
|
25
27
|
"@dnd-kit/sortable": "^10.0.0",
|
|
26
28
|
"@dnd-kit/utilities": "^3.2.2",
|
|
27
|
-
"@google-cloud/local-auth": "2.1.0",
|
|
28
29
|
"@hookform/resolvers": "^5.2.2",
|
|
29
|
-
"@orpc/client": "^1.
|
|
30
|
-
"@orpc/contract": "^1.
|
|
31
|
-
"@orpc/server": "^1.
|
|
32
|
-
"@orpc/tanstack-query": "^1.
|
|
33
|
-
"@react-
|
|
34
|
-
"@tanstack/react-query": "^5.
|
|
35
|
-
"@tanstack/react-query-devtools": "^5.91.3",
|
|
30
|
+
"@orpc/client": "^1.14.2",
|
|
31
|
+
"@orpc/contract": "^1.14.2",
|
|
32
|
+
"@orpc/server": "^1.14.2",
|
|
33
|
+
"@orpc/tanstack-query": "^1.14.2",
|
|
34
|
+
"@tanstack/react-query": "^5.100.9",
|
|
35
|
+
"@tanstack/react-query-devtools": "^5.100.9",
|
|
36
36
|
"@tanstack/react-table": "^8.21.3",
|
|
37
|
-
"@tanstack/react-virtual": "^3.13.
|
|
37
|
+
"@tanstack/react-virtual": "^3.13.24",
|
|
38
38
|
"class-variance-authority": "^0.7.1",
|
|
39
39
|
"client-only": "^0.0.1",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
41
|
"cmdk": "1.1.1",
|
|
42
42
|
"date-fns": "^4.1.0",
|
|
43
43
|
"deepmerge": "^4.3.1",
|
|
44
|
-
"drizzle-orm": "^0.45.
|
|
44
|
+
"drizzle-orm": "^0.45.2",
|
|
45
45
|
"drizzle-zod": "^0.8.3",
|
|
46
46
|
"embla-carousel-react": "^8.6.0",
|
|
47
|
-
"googleapis": "
|
|
48
|
-
"lucide-react": "^
|
|
49
|
-
"motion": "^12.
|
|
47
|
+
"googleapis": "^171.4.0",
|
|
48
|
+
"lucide-react": "^1.14.0",
|
|
49
|
+
"motion": "^12.38.0",
|
|
50
50
|
"next-themes": "^0.4.6",
|
|
51
51
|
"radix-ui": "^1.4.3",
|
|
52
|
-
"react-colorful": "^5.
|
|
53
|
-
"react-day-picker": "
|
|
52
|
+
"react-colorful": "^5.7.0",
|
|
53
|
+
"react-day-picker": "10.0.0",
|
|
54
54
|
"react-dropzone": "^15.0.0",
|
|
55
|
-
"react-email": "^
|
|
56
|
-
"react-hook-form": "^7.
|
|
57
|
-
"react-hotkeys-hook": "^5.2
|
|
58
|
-
"react-resizable-panels": "^4.
|
|
59
|
-
"resend": "^6.
|
|
55
|
+
"react-email": "^6.1.1",
|
|
56
|
+
"react-hook-form": "^7.75.0",
|
|
57
|
+
"react-hotkeys-hook": "^5.3.2",
|
|
58
|
+
"react-resizable-panels": "^4.11.0",
|
|
59
|
+
"resend": "^6.12.3",
|
|
60
60
|
"server-cli-only": "^0.3.2",
|
|
61
61
|
"server-only": "^0.0.1",
|
|
62
62
|
"sonner": "^2.0.7",
|
|
63
|
-
"tailwind-merge": "^3.
|
|
64
|
-
"use-debounce": "^10.1.
|
|
65
|
-
"uuid": "^
|
|
63
|
+
"tailwind-merge": "^3.6.0",
|
|
64
|
+
"use-debounce": "^10.1.1",
|
|
65
|
+
"uuid": "^14.0.0",
|
|
66
66
|
"vaul": "^1.1.2",
|
|
67
|
-
"zod": "^4.3
|
|
68
|
-
"@tulip-systems/core": "0.8.
|
|
67
|
+
"zod": "^4.4.3",
|
|
68
|
+
"@tulip-systems/core": "0.8.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@better-auth/passkey": "^1.5.5",
|
|
72
71
|
"@tailwindcss/typography": "^0.5.19",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"react": "19.2.
|
|
78
|
-
"react-dom": "19.2.4",
|
|
79
|
-
"recharts": "2.15.4",
|
|
72
|
+
"next": "16.2.6",
|
|
73
|
+
"nuqs": "2.8.9",
|
|
74
|
+
"pg": "8.20.0",
|
|
75
|
+
"react": "19.2.6",
|
|
76
|
+
"react-dom": "19.2.6",
|
|
80
77
|
"sharp": "^0.34.5"
|
|
81
78
|
},
|
|
82
79
|
"publishConfig": {
|
|
@@ -103,11 +100,13 @@
|
|
|
103
100
|
"./styles.css": "./src/styles.css"
|
|
104
101
|
},
|
|
105
102
|
"scripts": {
|
|
106
|
-
"dev": "tsdown --config
|
|
107
|
-
"build": "tsdown --config
|
|
103
|
+
"dev": "tsdown --config tsdown.config.ts --config-loader unrun --watch",
|
|
104
|
+
"build": "tsdown --config tsdown.config.ts --config-loader unrun",
|
|
105
|
+
"release:build": "pnpm run build",
|
|
108
106
|
"lint": "biome check",
|
|
109
107
|
"format": "biome format --write",
|
|
110
|
-
"
|
|
111
|
-
"test": "vitest"
|
|
108
|
+
"typecheck": "tsc --noEmit",
|
|
109
|
+
"test": "vitest",
|
|
110
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
112
111
|
}
|
|
113
112
|
}
|
|
@@ -31,6 +31,7 @@ type DriveGridCardProps<TData extends DriveNode> = ComponentProps<"div"> & {
|
|
|
31
31
|
node: TData;
|
|
32
32
|
commands?: CommandDef<TData>[];
|
|
33
33
|
imageLoader?: (props: ImageLoaderProps) => string;
|
|
34
|
+
unoptimized?: boolean;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
export function DriveGridCard<TData extends DriveNode>(props: DriveGridCardProps<TData>) {
|
|
@@ -56,6 +57,8 @@ export function DriveGridFolderCard<TData extends DriveNode>({
|
|
|
56
57
|
node,
|
|
57
58
|
commands,
|
|
58
59
|
onDoubleClick,
|
|
60
|
+
imageLoader,
|
|
61
|
+
unoptimized,
|
|
59
62
|
className,
|
|
60
63
|
...props
|
|
61
64
|
}: DriveGridCardProps<TData>) {
|
|
@@ -63,7 +66,7 @@ export function DriveGridFolderCard<TData extends DriveNode>({
|
|
|
63
66
|
|
|
64
67
|
const router = useRouter();
|
|
65
68
|
|
|
66
|
-
const
|
|
69
|
+
const selectionContext = useDriveSelectionContext();
|
|
67
70
|
|
|
68
71
|
const droppable = useDroppable({ id: node.id });
|
|
69
72
|
const draggable = useDraggable({ id: node.id });
|
|
@@ -77,11 +80,11 @@ export function DriveGridFolderCard<TData extends DriveNode>({
|
|
|
77
80
|
{...props}
|
|
78
81
|
key={id}
|
|
79
82
|
ref={draggable.ref}
|
|
80
|
-
data-selected={selection?.rowSelection?.[id]}
|
|
83
|
+
data-selected={selectionContext?.selection?.rowSelection?.[id]}
|
|
81
84
|
data-dragging={draggable.isDragging}
|
|
82
85
|
className="group @container relative flex max-h-48 max-w-full cursor-pointer flex-col items-center gap-2 overflow-hidden bg-transparent p-2 hover:bg-muted/70 active:bg-muted data-[selected=true]:bg-primary/30 data-[dragging=true]:opacity-50"
|
|
83
86
|
onClick={() => {
|
|
84
|
-
const conditions = selectionConditions?.(node);
|
|
87
|
+
const conditions = selectionContext?.selectionConditions?.(node);
|
|
85
88
|
|
|
86
89
|
if (conditions !== undefined) {
|
|
87
90
|
const canSelect = Array.isArray(conditions)
|
|
@@ -91,12 +94,12 @@ export function DriveGridFolderCard<TData extends DriveNode>({
|
|
|
91
94
|
if (!canSelect) return;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
const isSelected = selection?.rowSelection?.[id];
|
|
97
|
+
const isSelected = selectionContext?.selection?.rowSelection?.[id];
|
|
95
98
|
|
|
96
99
|
if (!isSelected) {
|
|
97
|
-
selection?.setRowSelection?.((old) => ({ ...old, [id]: true }));
|
|
100
|
+
selectionContext?.selection?.setRowSelection?.((old) => ({ ...old, [id]: true }));
|
|
98
101
|
} else {
|
|
99
|
-
selection?.setRowSelection?.((old) => {
|
|
102
|
+
selectionContext?.selection?.setRowSelection?.((old) => {
|
|
100
103
|
const newSelection = { ...old };
|
|
101
104
|
delete newSelection[id];
|
|
102
105
|
return newSelection;
|
|
@@ -144,13 +147,14 @@ export function DriveGridFileCard<TData extends DriveNode>({
|
|
|
144
147
|
node,
|
|
145
148
|
commands,
|
|
146
149
|
imageLoader,
|
|
150
|
+
unoptimized = false,
|
|
147
151
|
className,
|
|
148
152
|
...props
|
|
149
153
|
}: DriveGridCardProps<TData>) {
|
|
150
154
|
const { id } = node;
|
|
151
155
|
|
|
152
156
|
const { ref, isDragging } = useDraggable({ id });
|
|
153
|
-
const
|
|
157
|
+
const selectionContext = useDriveSelectionContext();
|
|
154
158
|
|
|
155
159
|
const subtype = findStatus(nodeSubtypeConfig, node.subtype);
|
|
156
160
|
const Icon = subtype?.icon;
|
|
@@ -165,11 +169,11 @@ export function DriveGridFileCard<TData extends DriveNode>({
|
|
|
165
169
|
{...props}
|
|
166
170
|
key={id}
|
|
167
171
|
ref={ref}
|
|
168
|
-
data-selected={selection?.rowSelection?.[id]}
|
|
172
|
+
data-selected={selectionContext?.selection?.rowSelection?.[id]}
|
|
169
173
|
data-dragging={isDragging}
|
|
170
174
|
className="@container flex max-h-48 max-w-full cursor-pointer flex-col items-center gap-2 overflow-hidden p-2 hover:bg-muted/70 active:bg-muted data-[selected=true]:bg-primary/30 data-[dragging=true]:opacity-50"
|
|
171
175
|
onClick={() => {
|
|
172
|
-
const conditions = selectionConditions?.(node);
|
|
176
|
+
const conditions = selectionContext?.selectionConditions?.(node);
|
|
173
177
|
|
|
174
178
|
if (conditions !== undefined) {
|
|
175
179
|
const canSelect = Array.isArray(conditions)
|
|
@@ -179,12 +183,12 @@ export function DriveGridFileCard<TData extends DriveNode>({
|
|
|
179
183
|
if (!canSelect) return;
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
const isSelected = selection?.rowSelection?.[id];
|
|
186
|
+
const isSelected = selectionContext?.selection?.rowSelection?.[id];
|
|
183
187
|
|
|
184
188
|
if (!isSelected) {
|
|
185
|
-
selection?.setRowSelection?.((old) => ({ ...old, [id]: true }));
|
|
189
|
+
selectionContext?.selection?.setRowSelection?.((old) => ({ ...old, [id]: true }));
|
|
186
190
|
} else {
|
|
187
|
-
selection?.setRowSelection?.((old) => {
|
|
191
|
+
selectionContext?.selection?.setRowSelection?.((old) => {
|
|
188
192
|
const newSelection = { ...old };
|
|
189
193
|
delete newSelection[id];
|
|
190
194
|
return newSelection;
|
|
@@ -222,6 +226,7 @@ export function DriveGridFileCard<TData extends DriveNode>({
|
|
|
222
226
|
height={200}
|
|
223
227
|
loader={imageLoader}
|
|
224
228
|
className="h-full w-full object-cover"
|
|
229
|
+
unoptimized={unoptimized}
|
|
225
230
|
/>
|
|
226
231
|
) : (
|
|
227
232
|
<div className="flex h-full w-full items-center justify-center">
|
|
@@ -19,8 +19,7 @@ const DriveSelectionContext = createContext<DriveSelectionContextValue | null>(n
|
|
|
19
19
|
*/
|
|
20
20
|
export function useDriveSelectionContext() {
|
|
21
21
|
const context = use(DriveSelectionContext);
|
|
22
|
-
|
|
23
|
-
return context;
|
|
22
|
+
return context ?? null;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
package/src/config/types.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -56,7 +56,7 @@ export function GoogleDriveFileUpdateCommand<
|
|
|
56
56
|
mutation,
|
|
57
57
|
}: GoogleDriveFileUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>) {
|
|
58
58
|
const form = useForm<UpdateGoogleDriveNodeInput>({
|
|
59
|
-
resolver:
|
|
59
|
+
resolver: standardSchemaResolver(updateGoogleDriveNodeInputSchema),
|
|
60
60
|
defaultValues,
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -60,7 +60,7 @@ export function GoogleDriveFoldersCreateCommand<
|
|
|
60
60
|
const [{ parentId }] = useQueryStates(driveTreeSearchParams);
|
|
61
61
|
|
|
62
62
|
const form = useForm<CreateGoogleDriveFolderInput>({
|
|
63
|
-
resolver:
|
|
63
|
+
resolver: standardSchemaResolver(createGoogleDriveFolderInputSchema),
|
|
64
64
|
defaultValues: { ...defaultValues, parentId },
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -56,7 +56,7 @@ export function GoogleDriveFoldersUpdateCommand<
|
|
|
56
56
|
mutation,
|
|
57
57
|
}: GoogleDriveFoldersUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>) {
|
|
58
58
|
const form = useForm<UpdateGoogleDriveNodeInput>({
|
|
59
|
-
resolver:
|
|
59
|
+
resolver: standardSchemaResolver(updateGoogleDriveNodeInputSchema),
|
|
60
60
|
defaultValues,
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -23,7 +23,6 @@ import { DriveGridCard, DriveGridCardSkeleton } from "@/components/grid-card.cli
|
|
|
23
23
|
import { useDriveSelectionContext } from "@/components/selection.client";
|
|
24
24
|
import { useDriveViewContext } from "@/components/view.client";
|
|
25
25
|
import { googleDriveColumns } from "../config/columns-data";
|
|
26
|
-
import { googleDriveImageLoader } from "../lib/helpers";
|
|
27
26
|
import type { GoogleDriveNode } from "../lib/validators";
|
|
28
27
|
import { useGoogleDriveContext } from "./provider.client";
|
|
29
28
|
|
|
@@ -108,12 +107,7 @@ function GoogleDriveGrid(props: ComponentProps<"div">) {
|
|
|
108
107
|
<DriveGrid {...props}>
|
|
109
108
|
{queryData.length > 0 ? (
|
|
110
109
|
queryData.map((node) => (
|
|
111
|
-
<DriveGridCard
|
|
112
|
-
key={node.id}
|
|
113
|
-
node={node}
|
|
114
|
-
commands={commands}
|
|
115
|
-
imageLoader={googleDriveImageLoader}
|
|
116
|
-
/>
|
|
110
|
+
<DriveGridCard key={node.id} node={node} commands={commands} unoptimized />
|
|
117
111
|
))
|
|
118
112
|
) : (
|
|
119
113
|
<DriveGridEmpty title="Geen resultaten gevonden" />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Readable } from "node:stream";
|
|
2
2
|
import type { ObjectBodyInput } from "@tulip-systems/core/storage";
|
|
3
|
-
import type { ImageLoaderProps } from "next/image";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Escapes dynamic values before interpolating them into Google Drive `q` strings.
|
|
@@ -36,11 +35,3 @@ export function toGoogleDriveReadable(body: ObjectBodyInput) {
|
|
|
36
35
|
if (typeof body === "string") return Readable.from([body]);
|
|
37
36
|
return Readable.from([body]);
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Use Google-provided thumbnail URLs directly instead of routing them through
|
|
42
|
-
* the Next.js optimizer.
|
|
43
|
-
*/
|
|
44
|
-
export function googleDriveImageLoader({ src }: ImageLoaderProps) {
|
|
45
|
-
return src;
|
|
46
|
-
}
|
|
@@ -514,9 +514,7 @@ export class GoogleDrive<TSchema extends TDatabaseSchema>
|
|
|
514
514
|
|
|
515
515
|
const nextSeen = new Set([...seen, node.id]);
|
|
516
516
|
const currentChild = {
|
|
517
|
-
|
|
518
|
-
type: node.type,
|
|
519
|
-
parentId: node.parentId,
|
|
517
|
+
...node,
|
|
520
518
|
depth: current.depth,
|
|
521
519
|
} satisfies GoogleDriveNodeChild;
|
|
522
520
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -49,7 +49,7 @@ export function LocalDriveFileUpdateCommand<
|
|
|
49
49
|
mutation,
|
|
50
50
|
}: LocalDriveFileUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>) {
|
|
51
51
|
const form = useForm<UpdateLocalDriveNodeInput>({
|
|
52
|
-
resolver:
|
|
52
|
+
resolver: standardSchemaResolver(updateLocalDriveNodeInputSchema),
|
|
53
53
|
defaultValues,
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -56,7 +56,7 @@ export function LocalDriveFoldersCreateCommand<
|
|
|
56
56
|
const [{ parentId }] = useQueryStates(driveTreeSearchParams);
|
|
57
57
|
|
|
58
58
|
const form = useForm<CreateLocalDriveFolderInput>({
|
|
59
|
-
resolver:
|
|
59
|
+
resolver: standardSchemaResolver(createLocalDriveFolderInputSchema),
|
|
60
60
|
defaultValues: { ...defaultValues, parentId },
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
4
4
|
import type { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
5
5
|
import {
|
|
6
6
|
CommandFormDialog,
|
|
@@ -49,7 +49,7 @@ export function LocalDriveFoldersUpdateCommand<
|
|
|
49
49
|
mutation,
|
|
50
50
|
}: LocalDriveFoldersUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>) {
|
|
51
51
|
const form = useForm<UpdateLocalDriveNodeInput>({
|
|
52
|
-
resolver:
|
|
52
|
+
resolver: standardSchemaResolver(updateLocalDriveNodeInputSchema),
|
|
53
53
|
defaultValues,
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -70,7 +70,6 @@ export function inferLocalDriveNodeSubtype({
|
|
|
70
70
|
name,
|
|
71
71
|
contentType,
|
|
72
72
|
}: Partial<Pick<LocalDriveNode, "name" | "contentType">>): LocalDriveNodeSubtype {
|
|
73
|
-
if (!contentType) return "other";
|
|
74
73
|
if (contentType?.startsWith("image/")) return "image";
|
|
75
74
|
if (contentType === "application/pdf") return "document";
|
|
76
75
|
if (contentType?.includes("spreadsheet")) return "spreadsheet";
|