@edifice.io/react 2.6.9-develop-integration.20261012100537 → 2.6.9-develop-b2school.20261013113840

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.
Files changed (91) hide show
  1. package/dist/components/Layout/Layout.js +12 -4
  2. package/dist/components/Layout/components/Header.js +4 -4
  3. package/dist/components/Layout/components/NavLink.d.ts +3 -3
  4. package/dist/components/Layout/components/NavLink.js +5 -3
  5. package/dist/components/RadioTile/RadioTile.d.ts +35 -0
  6. package/dist/components/RadioTile/RadioTile.js +22 -0
  7. package/dist/components/RadioTile/index.d.ts +2 -0
  8. package/dist/components/Tree/utilities/tree.js +1 -21
  9. package/dist/components/index.d.ts +1 -0
  10. package/dist/homepage.js +10 -0
  11. package/dist/hooks/index.d.ts +0 -2
  12. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
  13. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
  14. package/dist/icons.js +404 -402
  15. package/dist/index.js +184 -194
  16. package/dist/modules/HelpZone/HelpZone.js +6 -8
  17. package/dist/modules/HelpZone/HelpZoneContainer.js +2 -5
  18. package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
  19. package/dist/modules/homepage/components/Agenda/Agenda.js +54 -0
  20. package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
  21. package/dist/modules/homepage/components/Agenda/AgendaContainer.js +14 -0
  22. package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
  23. package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +30 -0
  24. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
  25. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +27 -0
  26. package/dist/modules/homepage/components/Agenda/index.d.ts +3 -0
  27. package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +24 -0
  28. package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +45 -0
  29. package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
  30. package/dist/modules/homepage/components/Agenda/services/api/index.js +5 -0
  31. package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
  32. package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +26 -0
  33. package/dist/modules/homepage/components/Header/Header.js +27 -11
  34. package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +5 -0
  35. package/dist/modules/homepage/components/Header/MyAppsPopover.js +28 -0
  36. package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +32 -0
  37. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +5 -1
  38. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
  39. package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
  40. package/dist/modules/homepage/components/Notifications/NotificationList.js +5 -5
  41. package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +2 -2
  42. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +1 -5
  43. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +10 -12
  44. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +3 -9
  45. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +6 -12
  46. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -10
  47. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +9 -10
  48. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
  49. package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
  50. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
  51. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
  52. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
  53. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
  54. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
  55. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
  56. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
  57. package/dist/modules/homepage/components/index.d.ts +3 -1
  58. package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
  59. package/dist/modules/icons/components/IconAddWidget.js +12 -0
  60. package/dist/modules/icons/components/index.d.ts +1 -0
  61. package/dist/modules/multimedia/FileCard/index.d.ts +0 -4
  62. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
  63. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
  64. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  65. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +12 -48
  66. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -2
  67. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -4
  68. package/dist/modules/multimedia/Workspace/Workspace.js +5 -8
  69. package/dist/modules/multimedia/index.d.ts +0 -2
  70. package/dist/multimedia.js +18 -26
  71. package/package.json +6 -6
  72. package/dist/hooks/useGoogleDriveSearch/index.d.ts +0 -1
  73. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +0 -14
  74. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +0 -60
  75. package/dist/hooks/useNextcloudSearch/index.d.ts +0 -1
  76. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +0 -14
  77. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +0 -64
  78. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +0 -25
  79. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +0 -102
  80. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +0 -25
  81. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +0 -102
  82. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +0 -24
  83. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +0 -100
  84. package/dist/modules/multimedia/GoogleDrive/index.d.ts +0 -2
  85. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +0 -1
  86. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +0 -61
  87. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +0 -1
  88. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +0 -48
  89. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +0 -24
  90. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +0 -124
  91. package/dist/modules/multimedia/Nextcloud/index.d.ts +0 -2
@@ -1,19 +1,15 @@
1
1
  import { default as default2 } from "./modules/multimedia/AudioRecorder/AudioRecorder.js";
2
2
  import { default as default3 } from "./modules/multimedia/Embed/Embed.js";
3
3
  import { default as default4 } from "./modules/multimedia/FileCard/FileCard.js";
4
- import { default as default5 } from "./modules/multimedia/GoogleDrive/GoogleDrive.js";
5
- import { default as default6 } from "./modules/multimedia/FileCard/GoogleDriveFileCard.js";
6
- import { default as default7 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
7
- import { default as default8 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
8
- import { default as default9 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
9
- import { default as default10 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
10
- import { default as default11 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
11
- import { default as default12 } from "./modules/multimedia/UploadCard/UploadCard.js";
12
- import { default as default13 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
13
- import { default as default14 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
14
- import { default as default15 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
15
- import { default as default16 } from "./modules/multimedia/Workspace/Workspace.js";
16
- import { default as default17 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
4
+ import { default as default5 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
5
+ import { default as default6 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
6
+ import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
7
+ import { default as default8 } from "./modules/multimedia/UploadCard/UploadCard.js";
8
+ import { default as default9 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
9
+ import { default as default10 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
10
+ import { default as default11 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
11
+ import { default as default12 } from "./modules/multimedia/Workspace/Workspace.js";
12
+ import { default as default13 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
17
13
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
18
14
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
19
15
  import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
@@ -22,19 +18,15 @@ export {
22
18
  default3 as Embed,
23
19
  ExternalLinker,
24
20
  default4 as FileCard,
25
- default5 as GoogleDrive,
26
- default6 as GoogleDriveFileCard,
27
- default7 as ImageEditor,
28
- default8 as ImagePicker,
21
+ default5 as ImageEditor,
22
+ default6 as ImagePicker,
29
23
  InternalLinker,
30
- default9 as MediaLibrary,
31
- default10 as Nextcloud,
32
- default11 as NextcloudFileCard,
24
+ default7 as MediaLibrary,
33
25
  Upload,
34
- default12 as UploadCard,
35
- default13 as UploadFiles,
36
- default14 as VideoEmbed,
37
- default15 as VideoRecorder,
38
- default16 as Workspace,
39
- default17 as WorkspaceFolders
26
+ default8 as UploadCard,
27
+ default9 as UploadFiles,
28
+ default10 as VideoEmbed,
29
+ default11 as VideoRecorder,
30
+ default12 as Workspace,
31
+ default13 as WorkspaceFolders
40
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.9-develop-integration.20261012100537",
3
+ "version": "2.6.9-develop-b2school.20261013113840",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -140,9 +140,9 @@
140
140
  "swiper": "10.1.0",
141
141
  "ua-parser-js": "1.0.36",
142
142
  "zustand": "4.5.7",
143
- "@edifice.io/tiptap-extensions": "2.6.9-develop-integration.20261012100537",
144
- "@edifice.io/utilities": "2.6.9-develop-integration.20261012100537",
145
- "@edifice.io/bootstrap": "2.6.9-develop-integration.20261012100537"
143
+ "@edifice.io/tiptap-extensions": "2.6.9-develop-b2school.20261013113840",
144
+ "@edifice.io/utilities": "2.6.9-develop-b2school.20261013113840",
145
+ "@edifice.io/bootstrap": "2.6.9-develop-b2school.20261013113840"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -173,8 +173,8 @@
173
173
  "vite": "5.4.14",
174
174
  "vite-plugin-dts": "4.5.4",
175
175
  "vite-tsconfig-paths": "5.1.4",
176
- "@edifice.io/config": "2.6.9-develop-integration.20261012100537",
177
- "@edifice.io/client": "2.6.9-develop-integration.20261012100537"
176
+ "@edifice.io/client": "2.6.9-develop-b2school.20261013113840",
177
+ "@edifice.io/config": "2.6.9-develop-b2school.20261013113840"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "@react-spring/web": "9.7.5",
@@ -1 +0,0 @@
1
- export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
@@ -1,14 +0,0 @@
1
- import { GoogleDriveDocument, ID } from '@edifice.io/client';
2
- import { TreeItem } from '../../components/Tree/types';
3
- export type GoogleDriveFolderNode = TreeItem & {
4
- files?: GoogleDriveDocument[];
5
- };
6
- export default function useGoogleDriveSearch(rootId: string, rootName: string, userId?: string): {
7
- root: GoogleDriveFolderNode;
8
- needsAuth: boolean;
9
- isCheckingAuth: boolean;
10
- isAuthError: boolean;
11
- refetchAuthStatus: () => void;
12
- loadContent: (folderId?: ID) => void;
13
- loadError: unknown;
14
- };
@@ -1,60 +0,0 @@
1
- import { useState, useCallback } from "react";
2
- import { odeServices } from "@edifice.io/client";
3
- import { useQueryClient } from "@tanstack/react-query";
4
- import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
- function useGoogleDriveSearch(rootId, rootName, userId) {
6
- const [root, setRoot] = useState({
7
- id: rootId,
8
- name: rootName,
9
- section: !0
10
- }), updateFolder = useCallback((folderId, subfolders, files) => {
11
- setRoot((prev) => {
12
- const node = findNodeById(prev, folderId);
13
- if (!node) return prev;
14
- const children = subfolders.map((f) => {
15
- var _a;
16
- const existing = (_a = node.children) == null ? void 0 : _a.find((c) => c.id === f.id);
17
- return existing ? {
18
- ...existing,
19
- name: f.name
20
- } : {
21
- id: f.id,
22
- name: f.name
23
- };
24
- });
25
- return modifyNode(prev, (n) => n.id === node.id ? {
26
- ...n,
27
- children,
28
- files
29
- } : n);
30
- });
31
- }, []), queryClient = useQueryClient(), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
32
- if (!userId) return;
33
- const parentId = folderId === rootId ? void 0 : folderId;
34
- try {
35
- const payload = await queryClient.fetchQuery({
36
- queryKey: ["googledrive", "documents", userId, parentId ?? "root"],
37
- queryFn: () => odeServices.googledrive().listDocuments(userId, parentId),
38
- staleTime: 6e4
39
- }), subfolders = [], files = [];
40
- payload.filter((doc) => doc.id !== parentId).forEach((doc) => {
41
- doc.isFolder ? subfolders.push(doc) : files.push(doc);
42
- }), setLoadError(null), updateFolder(folderId, subfolders, files);
43
- } catch (error) {
44
- setLoadError(error);
45
- }
46
- }, [rootId, userId, queryClient, updateFolder]);
47
- return {
48
- root,
49
- needsAuth: !1,
50
- isCheckingAuth: !1,
51
- isAuthError: !1,
52
- refetchAuthStatus: () => {
53
- },
54
- loadContent,
55
- loadError
56
- };
57
- }
58
- export {
59
- useGoogleDriveSearch as default
60
- };
@@ -1 +0,0 @@
1
- export { default as useNextcloudSearch } from './useNextcloudSearch';
@@ -1,14 +0,0 @@
1
- import { ID, NextcloudDocument } from '@edifice.io/client';
2
- import { TreeItem } from '../../components/Tree/types';
3
- export type NextcloudFolderNode = TreeItem & {
4
- files?: NextcloudDocument[];
5
- };
6
- export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
7
- root: NextcloudFolderNode;
8
- needsAuth: boolean;
9
- isCheckingAuth: boolean;
10
- isAuthError: boolean;
11
- refetchAuthStatus: () => void;
12
- loadContent: (folderId?: ID) => void;
13
- loadError: unknown;
14
- };
@@ -1,64 +0,0 @@
1
- import { useState, useCallback } from "react";
2
- import { odeServices } from "@edifice.io/client";
3
- import { useQueryClient, useQuery } from "@tanstack/react-query";
4
- import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
- function useNextcloudSearch(rootId, rootName, userId) {
6
- var _a;
7
- const [root, setRoot] = useState({
8
- id: rootId,
9
- name: rootName,
10
- section: !0
11
- }), updateFolder = useCallback((folderId, subfolders, files) => {
12
- setRoot((prev) => {
13
- const node = findNodeById(prev, folderId);
14
- if (!node) return prev;
15
- const children = subfolders.map((f) => {
16
- var _a2;
17
- const existing = (_a2 = node.children) == null ? void 0 : _a2.find((c) => c.id === f.path);
18
- return existing ? {
19
- ...existing,
20
- name: f.name
21
- } : {
22
- id: f.path,
23
- name: f.name
24
- };
25
- });
26
- return modifyNode(prev, (n) => n.id === node.id ? {
27
- ...n,
28
- children,
29
- files
30
- } : n);
31
- });
32
- }, []), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
33
- queryKey: ["nextcloud", "oauth2-status", userId],
34
- queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
35
- enabled: !!userId
36
- }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
37
- if (!userId) return;
38
- const path = folderId === rootId ? void 0 : folderId;
39
- try {
40
- const payload = await queryClient.fetchQuery({
41
- queryKey: ["nextcloud", "documents", userId, path ?? "/"],
42
- queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
43
- staleTime: 6e4
44
- }), subfolders = [], files = [], currentPath = path ?? "/";
45
- payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
46
- doc.isFolder ? subfolders.push(doc) : files.push(doc);
47
- }), setLoadError(null), updateFolder(folderId, subfolders, files);
48
- } catch (error) {
49
- setLoadError(error);
50
- }
51
- }, [rootId, userId, queryClient, updateFolder]);
52
- return {
53
- root,
54
- needsAuth,
55
- isCheckingAuth: oauth2StatusQuery.isLoading,
56
- isAuthError: oauth2StatusQuery.isError,
57
- refetchAuthStatus: oauth2StatusQuery.refetch,
58
- loadContent,
59
- loadError
60
- };
61
- }
62
- export {
63
- useNextcloudSearch as default
64
- };
@@ -1,25 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { GoogleDriveDocument } from '@edifice.io/client';
3
- import { CardProps } from '../../../components/Card';
4
- export interface GoogleDriveFileCardProps extends CardProps {
5
- doc: GoogleDriveDocument;
6
- /**
7
- * Id of the user who owns the Google Drive document, used to build the preview URL.
8
- */
9
- userId: string;
10
- /**
11
- * Custom icon to override the default based on file type
12
- * Can be a string or a React node
13
- */
14
- customIcon?: ReactNode;
15
- /**
16
- * Custom color class to override the default based on file type
17
- * Example: "bg-purple-300" or any valid CSS class
18
- */
19
- customColor?: string;
20
- }
21
- declare const GoogleDriveFileCard: {
22
- ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: GoogleDriveFileCardProps): import("react/jsx-runtime").JSX.Element;
23
- displayName: string;
24
- };
25
- export default GoogleDriveFileCard;
@@ -1,102 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { DocumentHelper, odeServices } from "@edifice.io/client";
4
- import clsx from "clsx";
5
- import SvgIconLandscape from "../../icons/components/IconLandscape.js";
6
- import SvgIconMic from "../../icons/components/IconMic.js";
7
- import SvgIconTextPage from "../../icons/components/IconTextPage.js";
8
- import SvgIconVideo from "../../icons/components/IconVideo.js";
9
- import FileIcon from "./FileIcon.js";
10
- import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
11
- import Card from "../../../components/Card/Card.js";
12
- const roleMappings = {
13
- csv: {
14
- icon: ".CSV",
15
- color: "bg-orange-200"
16
- },
17
- xls: {
18
- icon: ".XLS",
19
- color: "bg-green-200"
20
- },
21
- doc: {
22
- icon: ".DOC",
23
- color: "bg-blue-200"
24
- },
25
- txt: {
26
- icon: ".TXT",
27
- color: "bg-blue-200"
28
- },
29
- pdf: {
30
- icon: ".PDF",
31
- color: "bg-red-200"
32
- },
33
- audio: {
34
- icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
35
- color: "bg-red-200"
36
- },
37
- ppt: {
38
- icon: ".PPT",
39
- color: "bg-red-200"
40
- },
41
- img: {
42
- icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
43
- color: "bg-green-200"
44
- },
45
- video: {
46
- icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
47
- color: "bg-purple-200"
48
- },
49
- zip: {
50
- icon: ".ZIP",
51
- color: "bg-gray-300"
52
- },
53
- md: {
54
- icon: ".MD",
55
- color: "bg-blue-200"
56
- },
57
- unknown: {
58
- icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
59
- color: "bg-gray-300"
60
- }
61
- };
62
- function getRoleMap(type, customIcon, customColor) {
63
- return customIcon !== void 0 || customColor !== void 0 ? {
64
- icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
65
- color: customColor || "bg-gray-300",
66
- hasShadow: !1
67
- } : roleMappings[type] ?? roleMappings.unknown;
68
- }
69
- const GoogleDriveFileCard = ({
70
- doc,
71
- userId,
72
- isClickable = !0,
73
- isSelectable = !1,
74
- isSelected = !1,
75
- onClick,
76
- className,
77
- onSelect,
78
- isFocused,
79
- app,
80
- customIcon,
81
- customColor
82
- }) => {
83
- const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1), roleMap = getRoleMap(type ?? "unknown", customIcon, customColor), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.googledrive().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
84
- ref
85
- }), imageStyles = hasThumbnail && {
86
- backgroundImage: `url(${mediaSrc})`,
87
- backgroundSize: "cover"
88
- };
89
- return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
90
- /* @__PURE__ */ jsx("div", { ref, className: file, style: {
91
- aspectRatio: "16/10",
92
- ...imageStyles
93
- }, children: type !== "img" || !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
94
- /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
95
- /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
96
- /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
97
- ] })
98
- ] }) });
99
- };
100
- export {
101
- GoogleDriveFileCard as default
102
- };
@@ -1,25 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { NextcloudDocument } from '@edifice.io/client';
3
- import { CardProps } from '../../../components/Card';
4
- export interface NextcloudFileCardProps extends CardProps {
5
- doc: NextcloudDocument;
6
- /**
7
- * Id of the user who owns the Nextcloud document, used to build the preview URL.
8
- */
9
- userId: string;
10
- /**
11
- * Custom icon to override the default based on file type
12
- * Can be a string or a React node
13
- */
14
- customIcon?: ReactNode;
15
- /**
16
- * Custom color class to override the default based on file type
17
- * Example: "bg-purple-300" or any valid CSS class
18
- */
19
- customColor?: string;
20
- }
21
- declare const NextcloudFileCard: {
22
- ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: NextcloudFileCardProps): import("react/jsx-runtime").JSX.Element;
23
- displayName: string;
24
- };
25
- export default NextcloudFileCard;
@@ -1,102 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { DocumentHelper, odeServices } from "@edifice.io/client";
4
- import clsx from "clsx";
5
- import SvgIconLandscape from "../../icons/components/IconLandscape.js";
6
- import SvgIconMic from "../../icons/components/IconMic.js";
7
- import SvgIconTextPage from "../../icons/components/IconTextPage.js";
8
- import SvgIconVideo from "../../icons/components/IconVideo.js";
9
- import FileIcon from "./FileIcon.js";
10
- import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
11
- import Card from "../../../components/Card/Card.js";
12
- const roleMappings = {
13
- csv: {
14
- icon: ".CSV",
15
- color: "bg-orange-200"
16
- },
17
- xls: {
18
- icon: ".XLS",
19
- color: "bg-green-200"
20
- },
21
- doc: {
22
- icon: ".DOC",
23
- color: "bg-blue-200"
24
- },
25
- txt: {
26
- icon: ".TXT",
27
- color: "bg-blue-200"
28
- },
29
- pdf: {
30
- icon: ".PDF",
31
- color: "bg-red-200"
32
- },
33
- audio: {
34
- icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
35
- color: "bg-red-200"
36
- },
37
- ppt: {
38
- icon: ".PPT",
39
- color: "bg-red-200"
40
- },
41
- img: {
42
- icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
43
- color: "bg-green-200"
44
- },
45
- video: {
46
- icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
47
- color: "bg-purple-200"
48
- },
49
- zip: {
50
- icon: ".ZIP",
51
- color: "bg-gray-300"
52
- },
53
- md: {
54
- icon: ".MD",
55
- color: "bg-blue-200"
56
- },
57
- unknown: {
58
- icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
59
- color: "bg-gray-300"
60
- }
61
- };
62
- function getRoleMap(type, customIcon, customColor) {
63
- return customIcon !== void 0 || customColor !== void 0 ? {
64
- icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
65
- color: customColor || "bg-gray-300",
66
- hasShadow: !1
67
- } : roleMappings[type] ?? roleMappings.unknown;
68
- }
69
- const NextcloudFileCard = ({
70
- doc,
71
- userId,
72
- isClickable = !0,
73
- isSelectable = !1,
74
- isSelected = !1,
75
- onClick,
76
- className,
77
- onSelect,
78
- isFocused,
79
- app,
80
- customIcon,
81
- customColor
82
- }) => {
83
- const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1), roleMap = getRoleMap(type ?? "unknown", customIcon, customColor), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.nextcloud().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
84
- ref
85
- }), imageStyles = hasThumbnail && {
86
- backgroundImage: `url(${mediaSrc})`,
87
- backgroundSize: "cover"
88
- };
89
- return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
90
- /* @__PURE__ */ jsx("div", { ref, className: file, style: {
91
- aspectRatio: "16/10",
92
- ...imageStyles
93
- }, children: type !== "img" || !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
94
- /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
95
- /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
96
- /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
97
- ] })
98
- ] }) });
99
- };
100
- export {
101
- NextcloudFileCard as default
102
- };
@@ -1,24 +0,0 @@
1
- import { GoogleDriveDocument, Role } from '@edifice.io/client';
2
- /**
3
- * GoogleDrive component properties
4
- */
5
- export interface GoogleDriveProps {
6
- /**
7
- * Notify parent when media elements are successfully selected.
8
- */
9
- onSelect: (result: GoogleDriveDocument[]) => void;
10
- /**
11
- * Boolean to know if we can select 1 or many files.
12
- */
13
- multiple?: boolean | undefined;
14
- /**
15
- * Document roles to filter files by; null (default) shows all roles.
16
- */
17
- roles?: Role | Role[] | null;
18
- /**
19
- * Optional class for styling purpose
20
- */
21
- className?: string;
22
- }
23
- declare const GoogleDrive: ({ onSelect, multiple, roles, className, }: GoogleDriveProps) => import("react/jsx-runtime").JSX.Element;
24
- export default GoogleDrive;
@@ -1,100 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useCallback, useEffect, useMemo } from "react";
3
- import { DocumentHelper } from "@edifice.io/client";
4
- import clsx from "clsx";
5
- import { useTranslation } from "react-i18next";
6
- import { findNodeById } from "../../../components/Tree/utilities/tree.js";
7
- import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendingLetters.js";
8
- import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
9
- import SvgIconSortTime from "../../icons/components/IconSortTime.js";
10
- import illuError from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-error.svg";
11
- import illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
12
- import useUser from "../../../hooks/useUser/useUser.js";
13
- import useGoogleDriveSearch from "../../../hooks/useGoogleDriveSearch/useGoogleDriveSearch.js";
14
- import { Grid } from "../../../components/Grid/Grid.js";
15
- import Tree from "../../../components/Tree/components/Tree.js";
16
- import SearchBar from "../../../components/SearchBar/SearchBar.js";
17
- import Flex from "../../../components/Flex/Flex.js";
18
- import Dropdown from "../../../components/Dropdown/Dropdown.js";
19
- import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
20
- import Button from "../../../components/Button/Button.js";
21
- import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
22
- import GoogleDriveFileCard from "../FileCard/GoogleDriveFileCard.js";
23
- const ROOT_ID = "root";
24
- function compare(a, b) {
25
- return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : a.localeCompare(b);
26
- }
27
- const GoogleDrive = ({
28
- onSelect,
29
- multiple = !0,
30
- roles,
31
- className
32
- }) => {
33
- const {
34
- t
35
- } = useTranslation(), {
36
- user
37
- } = useUser(), {
38
- root,
39
- loadContent,
40
- loadError
41
- } = useGoogleDriveSearch(ROOT_ID, t("google-drive.mydrive"), user == null ? void 0 : user.userId), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
42
- setCurrentNodeId(nodeId), loadContent(nodeId);
43
- }, [loadContent]);
44
- useEffect(() => {
45
- loadContent(ROOT_ID);
46
- }, [loadContent]);
47
- const documents = useMemo(() => {
48
- if (!currentNode.files) return;
49
- const matchesRole = (doc) => {
50
- if (!roles) return !0;
51
- const role = DocumentHelper.role(doc.contentType, !1);
52
- return Array.isArray(roles) ? roles.includes(role) : roles === role;
53
- }, normalizedSearchTerm = searchTerm == null ? void 0 : searchTerm.toLowerCase(), list = currentNode.files.filter((f) => (!normalizedSearchTerm || f.name.toLowerCase().includes(normalizedSearchTerm)) && matchesRole(f));
54
- let sortFunction;
55
- return sortOrder[0] === "name" ? sortFunction = sortOrder[1] === "asc" ? (a, b) => compare(a.name, b.name) : (a, b) => compare(b.name, a.name) : sortFunction = (a, b) => compare(b.lastModified, a.lastModified), list.sort(sortFunction);
56
- }, [currentNode, searchTerm, sortOrder, roles]), selectedIds = useMemo(() => new Set(selectedDocuments.map((d) => d.id)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
57
- setSearchTerm(e.target.value);
58
- }, [setSearchTerm]);
59
- function getSortOrderLabel() {
60
- return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
61
- }
62
- function handleSelectDoc(doc) {
63
- let currentDocuments = [...selectedDocuments];
64
- multiple ? currentDocuments.some((selectedDocument) => selectedDocument.id === doc.id) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.id !== doc.id) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
65
- }
66
- const googleDrive = clsx("workspace flex-grow-1 gap-0", className);
67
- return /* @__PURE__ */ jsxs(Grid, { className: googleDrive, children: [
68
- /* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
69
- position: "sticky",
70
- top: 0,
71
- paddingTop: "1.2rem"
72
- }, children: /* @__PURE__ */ jsx(Tree, { nodes: root, selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
73
- /* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
74
- /* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
75
- /* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
76
- /* @__PURE__ */ jsxs(Flex, { className: "px-8 py-4", align: "center", justify: "end", children: [
77
- /* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
78
- /* @__PURE__ */ jsxs(Dropdown, { children: [
79
- /* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
80
- /* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
81
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
82
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
83
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
84
- ] })
85
- ] })
86
- ] })
87
- ] }),
88
- /* @__PURE__ */ jsx(Grid.Col, { sm: "4", md: "8", xl: "12", className: "p-8 gap-8", children: loadError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
89
- /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("google-drive.error.title"), text: t("google-drive.error.description") }),
90
- /* @__PURE__ */ jsx(Button, { onClick: () => loadContent(currentNodeId), children: t("retry") })
91
- ] }) : documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
92
- const isSelected = selectedIds.has(doc.id);
93
- return /* @__PURE__ */ jsx(GoogleDriveFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.id);
94
- }) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuTrash, text: t("workspace.empty.docSpace"), title: t("explorer.emptyScreen.trash.title") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
95
- ] }) })
96
- ] });
97
- };
98
- export {
99
- GoogleDrive as default
100
- };
@@ -1,2 +0,0 @@
1
- export { default as GoogleDrive } from './GoogleDrive';
2
- export * from './GoogleDrive';
@@ -1 +0,0 @@
1
- export declare const GoogleDrive: () => import("react/jsx-runtime").JSX.Element;