@edifice.io/react 2.6.10-develop-b2school.20261021144055 → 2.6.10-develop-integration.20261021201512
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/Checkbox/Checkbox.js +1 -1
- package/dist/components/Layout/Layout.js +4 -12
- package/dist/components/Layout/components/Header.js +4 -4
- package/dist/components/Layout/components/NavLink.d.ts +3 -3
- package/dist/components/Layout/components/NavLink.js +3 -5
- package/dist/homepage.js +24 -74
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +19 -0
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +6 -2
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +8 -11
- package/dist/icons-apps.js +184 -182
- package/dist/icons.js +402 -406
- package/dist/index.js +198 -192
- package/dist/modules/HelpZone/HelpZone.js +8 -6
- package/dist/modules/HelpZone/HelpZoneContainer.js +5 -2
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/Header/Header.js +22 -28
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +1 -5
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationList.js +8 -7
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +12 -7
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +4 -7
- package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +9 -9
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +5 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +12 -10
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +9 -3
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +12 -6
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +2 -1
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -14
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +10 -9
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.js +4 -4
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +1 -3
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +7 -13
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +2 -3
- package/dist/modules/homepage/components/index.d.ts +1 -9
- package/dist/modules/icons/components/apps/IconElea.d.ts +7 -0
- package/dist/modules/icons/components/apps/IconElea.js +23 -0
- package/dist/modules/icons/components/apps/index.d.ts +1 -0
- package/dist/modules/icons/components/index.d.ts +0 -2
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +103 -0
- package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +16 -5
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +26 -22
- package/package.json +6 -6
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/Agenda.js +0 -54
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +0 -14
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +0 -30
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +0 -14
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +0 -27
- package/dist/modules/homepage/components/Agenda/index.d.ts +0 -3
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +0 -24
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +0 -45
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/Agenda/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +0 -19
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +0 -26
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +0 -9
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +0 -59
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +0 -17
- package/dist/modules/homepage/components/BriefMe/index.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/types.d.ts +0 -17
- package/dist/modules/homepage/components/BriefMe/types.js +0 -8
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +0 -31
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +0 -51
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/Cantine.js +0 -44
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +0 -18
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/CantineModal.js +0 -88
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +0 -12
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +0 -5
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +0 -22
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +0 -6
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +0 -28
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +0 -12
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +0 -60
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +0 -11
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +0 -20
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +0 -65
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +0 -23
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +0 -43
- package/dist/modules/homepage/components/Cantine/index.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/types.d.ts +0 -42
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +0 -16
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +0 -48
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +0 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +0 -12
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +0 -1
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +0 -6
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +0 -3
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +0 -10
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +0 -68
- package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +0 -13
- package/dist/modules/homepage/components/Header/AccountActionListPopover.js +0 -26
- package/dist/modules/homepage/components/Header/ActionItem.d.ts +0 -38
- package/dist/modules/homepage/components/Header/ActionItem.js +0 -34
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +0 -5
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +0 -28
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +0 -32
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +0 -4
- package/dist/modules/homepage/components/Qwant/Qwant.js +0 -41
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +0 -10
- package/dist/modules/homepage/components/Qwant/index.d.ts +0 -3
- package/dist/modules/homepage/components/Rss/Rss.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/Rss.js +0 -64
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Rss/RssContainer.js +0 -45
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +0 -13
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +0 -69
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +0 -58
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +0 -43
- package/dist/modules/homepage/components/Rss/index.d.ts +0 -6
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +0 -5
- package/dist/modules/homepage/components/Rss/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +0 -38
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +0 -51
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +0 -28
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +0 -71
- package/dist/modules/homepage/components/Rss/types.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/utils.d.ts +0 -7
- package/dist/modules/homepage/components/Rss/utils.js +0 -19
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +0 -8
- package/dist/modules/homepage/components/Universalis/Universalis.js +0 -62
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +0 -16
- package/dist/modules/homepage/components/Universalis/index.d.ts +0 -3
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +0 -16
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +0 -15
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -47
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
- package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
- package/dist/modules/icons/components/IconAddWidget.js +0 -12
- package/dist/modules/icons/components/IconLogout.d.ts +0 -7
- package/dist/modules/icons/components/IconLogout.js +0 -13
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import SvgIconAddWidget from "../../../icons/components/IconAddWidget.js";
|
|
4
3
|
import SvgIconClass from "../../../icons/components/IconClass.js";
|
|
5
4
|
import { useProfileLinks } from "./hooks/useProfileLinks.js";
|
|
6
5
|
import HomeCard from "../HomeCard/HomeCard.js";
|
|
7
6
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
8
7
|
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
9
|
-
import IconButton from "../../../../components/Button/IconButton.js";
|
|
10
8
|
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
11
9
|
function UserSpace({
|
|
12
10
|
name,
|
|
13
11
|
avatar,
|
|
14
12
|
profile,
|
|
15
|
-
children
|
|
16
|
-
onCustomizeWidgetsClick
|
|
13
|
+
children
|
|
17
14
|
}) {
|
|
18
15
|
const {
|
|
19
16
|
t
|
|
20
17
|
} = useTranslation(), links = useProfileLinks(profile);
|
|
21
18
|
return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", footer: !!links && /* @__PURE__ */ jsx(Flex, { children: links.map((link, index) => /* @__PURE__ */ jsx(ButtonBeta, { size: "sm", variant: "ghost", leftIcon: /* @__PURE__ */ jsx(SvgIconClass, {}), onClick: () => window.location.href = link.url, children: link.text }, `${link.url}-${index}`)) }), children: [
|
|
22
|
-
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row",
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
] })
|
|
29
|
-
] }),
|
|
30
|
-
onCustomizeWidgetsClick && /* @__PURE__ */ jsx(IconButton, { className: "user-space--customize-widgets", icon: /* @__PURE__ */ jsx(SvgIconAddWidget, {}), variant: "ghost", color: "tertiary", "aria-label": t("homepage.userSpace.customizeWidgets"), onClick: onCustomizeWidgetsClick })
|
|
19
|
+
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
|
|
21
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-name", className: "user-space--name", children: name }),
|
|
23
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-profile", className: "user-space--profile", children: t(profile) })
|
|
24
|
+
] })
|
|
31
25
|
] }),
|
|
32
26
|
children && /* @__PURE__ */ jsx(HomeCard.Content, { children })
|
|
33
27
|
] });
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function UserSpaceContainer({ children }: {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare function UserSpaceContainer({ children, onCustomizeWidgetsClick, }: UserSpaceContainerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
5
|
export declare namespace UserSpaceContainer {
|
|
8
6
|
var displayName: string;
|
|
9
7
|
}
|
|
@@ -2,8 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import UserSpace from "./UserSpace.js";
|
|
3
3
|
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
4
4
|
function UserSpaceContainer({
|
|
5
|
-
children
|
|
6
|
-
onCustomizeWidgetsClick
|
|
5
|
+
children
|
|
7
6
|
}) {
|
|
8
7
|
var _a;
|
|
9
8
|
const {
|
|
@@ -13,7 +12,7 @@ function UserSpaceContainer({
|
|
|
13
12
|
} = useUser();
|
|
14
13
|
if (!user || !userDescription) return null;
|
|
15
14
|
const name = user.username || "", profile = ((_a = userDescription.profiles) == null ? void 0 : _a[0]) || "Guest";
|
|
16
|
-
return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar,
|
|
15
|
+
return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar, children });
|
|
17
16
|
}
|
|
18
17
|
export {
|
|
19
18
|
UserSpaceContainer
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
export * from './Agenda';
|
|
2
|
-
export * from './Communities';
|
|
3
|
-
export * from './BriefMe';
|
|
4
|
-
export * from './Cantine';
|
|
5
1
|
export * from './Favorites';
|
|
6
|
-
export * from './GenerationHdf';
|
|
7
2
|
export * from './Header';
|
|
8
3
|
export * from './HomeCard';
|
|
9
4
|
export * from './LastInfos';
|
|
10
5
|
export * from './MessageFlashList';
|
|
11
6
|
export * from './Notifications';
|
|
12
|
-
export * from './Qwant';
|
|
13
|
-
export * from './Rss';
|
|
14
7
|
export * from './SchoolSpace';
|
|
15
8
|
export * from './UsefulLinks';
|
|
16
|
-
export * from './Universalis';
|
|
17
9
|
export * from './UserSpace';
|
|
18
|
-
export * from './
|
|
10
|
+
export * from './Communities';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconElea: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconElea;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconElea = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 593 512", width: "24", height: "24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsx("path", { fill: "#c05382", d: "M484.091 53.268c8.412 6.559 16.526 13.34 24.562 20.353l6.236 5.268c48.117 43.915 74.575 113.077 77.843 176.915 1.737 74.603-24.159 143.023-75.034 197.535-18.204 18.599-39.779 36.844-65.933 41.929l4.274-10.157q2.78-6.738 5.555-13.477l2.817-6.66c16.47-40.282 12.872-79.412-2.83-119.327-9.178-19.688-22.28-45.218-43.32-53.961-11.269-.93-18.064 6.336-26.732 12.837l6.615 5.176c23.402 19.468 43.27 40.331 47.894 71.637 2.295 26.74.603 52.617-11.005 77.121-10.039 3.346-10.039 3.346-18.392-.157-54.682-31.662-93.019-75.478-120.963-132.257l-3.416-6.566-2.871-5.81c-15.451-18.111-42.847-25.361-64.41-33.575l-10.495-4.051a14418 14418 0 0 0-33.151-12.721q-10.926-4.203-21.85-8.412l-10.806-4.16q-10.66-4.105-21.318-8.212c-16.117-6.204-32.244-12.371-48.423-18.411l-8.369-3.16a1530 1530 0 0 0-15.16-5.634c-25.035-9.507-37.074-21.382-48.715-44.666C-4.515 134.531 5.537 90.65 20.08 56.887c11.997 2.117 19.761 7.095 29.647 14.091l9.569 6.722 10.143 7.213q10.424 7.335 20.849 14.666l10.358 7.311c13.306 9.362 26.695 18.6 40.113 27.8l6.317 4.345a2806 2806 0 0 0 36.977 24.936l.876-6.876c7.231-47.895 32.509-82.3 69.882-112.575 70.286-49.422 161.93-39.815 229.281 8.745z" }),
|
|
9
|
+
/* @__PURE__ */ jsx("path", { fill: "#6e1ce0", d: "M20.078 56.889c11.997 2.117 19.762 7.095 29.647 14.092l9.569 6.722 10.143 7.213q10.424 7.335 20.85 14.666l10.358 7.311c13.306 9.362 26.695 18.6 40.112 27.8l6.317 4.345a2796 2796 0 0 0 36.977 24.936l1.255-13.177c.706-7.412.706-7.412 2.091-13.595 10.437-5.219 18.557-4.294 30.118-3.346 17.552 6.399 28.767 16.411 36.81 33.464 2.294 16.696 1.129 28.598-6.693 43.504l10.706 7.137 7.146 4.764q7.974 5.315 15.95 10.627a15760 15760 0 0 1 45.257 30.255l9.403 6.299a9967 9967 0 0 1 18.05 12.121c12.151 8.132 24.244 16.104 37.017 23.227 27.212 15.589 44.403 39.745 53.909 69.543 4.356 28.334 2.286 57.639-10.039 83.66-10.039 3.346-10.039 3.346-18.392-.157-54.682-31.662-93.019-75.478-120.963-132.257l-3.416-6.566-2.871-5.81c-15.451-18.111-42.847-25.361-64.41-33.575l-10.495-4.051a14418 14418 0 0 0-33.151-12.721q-10.926-4.203-21.85-8.412l-10.806-4.16q-10.66-4.105-21.318-8.212c-16.117-6.204-32.244-12.371-48.423-18.411l-8.369-3.16a1530 1530 0 0 0-15.16-5.634c-25.035-9.507-37.074-21.382-48.715-44.666C-4.517 134.531 5.535 90.65 20.078 56.887z" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { fill: "#fcfbfc", d: "M390.418 75.098c31.719 20.682 52.493 49.127 63.294 85.373 6.565 32.149.214 67.381-16.993 95.281a317 317 0 0 1-10.471 13.151c-5.171 5.835-5.171 5.835-9.83 14.915-6.202 9.437-11.079 13.079-21.543 17.36-22.272-.501-35.343-9.995-52.706-22.588q-8.372-5.904-16.745-11.804l-8.682-6.182c-14.753-10.434-29.704-20.577-44.639-30.746q-8.074-5.52-16.144-11.046l-6.845-4.684-4.827-3.303 3.276-6.244c5.81-12.147 5.244-24.099 3.417-37.26-6.035-12.533-11.134-18.543-22.588-26.353-13.483-4.667-23.451-4.499-37.647-3.764l3.346-20.078c24.876-1.12 44.168-.465 66.928 10.039l.837-9.83c2.805-18.162 7.099-36.873 22.183-48.602 33.34-16.819 74.365-10.93 106.379 6.366z" }),
|
|
11
|
+
/* @__PURE__ */ jsx("path", { fill: "#6119dc", d: "m0 237.595 21.415 6.374 19.227 5.72a27471 27471 0 0 1 53.37 15.932c31.727 9.5 63.448 18.959 95.361 27.816q6.948 1.962 13.894 3.929a1567 1567 0 0 0 24.918 6.803c22.725 6.48 37.431 13.017 49.567 33.818 4.577 8.868 9.017 17.799 13.385 26.771-24.584.341-49.168.575-73.754.736q-12.526.1-25.053.274c-12.054.163-24.106.238-36.161.298l-11.18.209c-40.31.012-75.058-13.387-104.624-41.046C18.676 302.044-.001 269.893-.001 237.595z" }),
|
|
12
|
+
/* @__PURE__ */ jsx("path", { fill: "#761de2", d: "M73.621 394.876c30.021-.7 60.039-1.234 90.066-1.56 13.946-.156 27.886-.369 41.828-.712 13.475-.329 26.945-.507 40.423-.586a722 722 0 0 0 15.364-.327c40.142-1.229 40.142-1.229 56.617 10.089 7.435 7.385 13.938 14.726 20.067 23.212-14.862 11.424-30.487 18.016-47.687 25.307l-9.294 4.046c-44.125 18.852-84.121 24.262-130.431 8.307-28.063-11.745-53.128-32.043-73.608-54.392-2.085-7.142-2.085-7.142-3.347-13.385z" }),
|
|
13
|
+
/* @__PURE__ */ jsx("path", { fill: "#251742", d: "M358.065 80.314c14.965 8.032 27.32 17.26 33.464 33.464 2.344 16.513 1.721 29.822-5.438 44.968-12.831 13.844-24.406 19.105-43.085 20.078-15.076-.583-23.67-4.715-35.137-14.85-11.353-13.145-15.624-23.254-14.68-40.314 3.628-18.324 16.832-29.641 31.412-40 10.973-5.487 21.652-5.556 33.464-3.347z" }),
|
|
14
|
+
/* @__PURE__ */ jsx("path", { fill: "#ea9924", d: "M331.294 16.732v6.693a2500 2500 0 0 1-20.079 13.386c-18.004 16.718-30.594 32.238-39.111 55.425l-4.222 11.307c-2.704 7.871-5.058 15.51-6.863 23.621-3.658-1.035-7.316-2.07-11.085-3.138-17.302-4.38-34.736-5.662-52.496-6.902 14.762-39.941 49.191-72.072 87.007-90.353 15.966-6.079 29.702-10.039 46.849-10.039" }),
|
|
15
|
+
/* @__PURE__ */ jsx("path", { fill: "#9122ea", d: "M368.104 455.111c8.222 4.719 8.222 4.719 16.104 10.248l8.013 5.555 6 4.274c-1.252 8.404-2.235 12.404-8.706 18.118-32.296 19.328-64.678 23.728-101.921 16.784-21.82-6.017-21.82-6.017-29.921-18.17a5012 5012 0 0 1 39.113-17.341q6.657-2.931 13.291-5.912c6.37-2.858 12.764-5.658 19.164-8.447l11.63-5.151c11.142-3.508 16.295-3.603 27.233.04z" }),
|
|
16
|
+
/* @__PURE__ */ jsx("path", { fill: "#faf9fa", d: "M358.065 100.392c10.248 6.902 10.248 6.902 16.732 16.732 2.314 14.399 1.726 20.78-6.274 33.046-9.077 9.077-12.005 10.254-24.889 11.713-12.34-1.255-12.34-1.255-22.17-7.738-9.244-13.726-10.026-24.268-6.902-40.366 9.49-16.918 25.949-16.947 43.504-13.385z" }),
|
|
17
|
+
/* @__PURE__ */ jsx("path", { fill: "#1f103c", d: "M281.098 170.667c16.177 1.387 23.075 7.958 33.464 20.078 3.154 9.461 3.797 15.5 3.764 25.307l.026 7.961c-.445 6.889-.445 6.889-3.791 13.582-14.794-3.441-24.179-8.311-33.543-20.575-5.966-11.312-7.557-23.63-6.615-36.314l6.693-10.039z" }),
|
|
18
|
+
/* @__PURE__ */ jsx("path", { fill: "#2b1d47", d: "M217.517 133.856c17.552 6.399 28.767 16.411 36.81 33.464 2.155 15.929 2.354 26.587-6.693 40.157-6.483-1.255-6.483-1.255-13.386-3.346-1.105-2.208-2.208-4.417-3.346-6.693 1.105-2.208 2.208-4.417 3.346-6.693 1.28-11.776 1.489-17.875-5.229-27.817-10.584-7.327-18.829-8.298-31.582-8.994l-10.039 3.346v-20.078c10.437-5.219 18.557-4.294 30.118-3.346z" }),
|
|
19
|
+
/* @__PURE__ */ jsx("path", { fill: "#f4f2f7", d: "M220.863 153.935c11.454 8.53 16.131 12.974 18.405 27.19-1.849 10.631-3.992 12.72-11.713 19.66a1520 1520 0 0 1-19.869-14.013l-5.719-3.928c-9.131-6.616-14.083-10.631-17.51-21.549l-.405-7.359c12.934-4.656 23.607-3.243 36.81 0z" })
|
|
20
|
+
] });
|
|
21
|
+
export {
|
|
22
|
+
SvgIconElea as default
|
|
23
|
+
};
|
|
@@ -40,6 +40,7 @@ export { default as IconEducagri } from './IconEducagri';
|
|
|
40
40
|
export { default as IconEdumedia } from './IconEdumedia';
|
|
41
41
|
export { default as IconEdumoov } from './IconEdumoov';
|
|
42
42
|
export { default as IconEdutheque } from './IconEdutheque';
|
|
43
|
+
export { default as IconElea } from './IconElea';
|
|
43
44
|
export { default as IconElectron } from './IconElectron';
|
|
44
45
|
export { default as IconElyceepicardie } from './IconElyceepicardie';
|
|
45
46
|
export { default as IconEsidoc } from './IconEsidoc';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as IconAddUser } from './IconAddUser';
|
|
2
|
-
export { default as IconAddWidget } from './IconAddWidget';
|
|
3
2
|
export { default as IconAdd } from './IconAdd';
|
|
4
3
|
export { default as IconAdjustSettings } from './IconAdjustSettings';
|
|
5
4
|
export { default as IconAiFill } from './IconAiFill';
|
|
@@ -85,7 +84,6 @@ export { default as IconLink } from './IconLink';
|
|
|
85
84
|
export { default as IconListOrder } from './IconListOrder';
|
|
86
85
|
export { default as IconLoader } from './IconLoader';
|
|
87
86
|
export { default as IconLock } from './IconLock';
|
|
88
|
-
export { default as IconLogout } from './IconLogout';
|
|
89
87
|
export { default as IconLsuArt } from './IconLsuArt';
|
|
90
88
|
export { default as IconLsuCompetenceNumerique } from './IconLsuCompetenceNumerique';
|
|
91
89
|
export { default as IconLsuEmc } from './IconLsuEmc';
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1,102 @@
|
|
|
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,4 +1,6 @@
|
|
|
1
1
|
export { default as FileCard } from './FileCard';
|
|
2
2
|
export * from './FileCard';
|
|
3
|
+
export { default as GoogleDriveFileCard } from './GoogleDriveFileCard';
|
|
4
|
+
export * from './GoogleDriveFileCard';
|
|
3
5
|
export { default as NextcloudFileCard } from './NextcloudFileCard';
|
|
4
6
|
export * from './NextcloudFileCard';
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback } 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", SHARED_ROOT_ID = "shared";
|
|
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(), myDrive = useGoogleDriveSearch(ROOT_ID, t("google-drive.mydrive"), user == null ? void 0 : user.userId), sharedWithMe = useGoogleDriveSearch(SHARED_ROOT_ID, t("workspace.tree.shared"), user == null ? void 0 : user.userId, "shared"), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), sectionOf = (nodeId) => findNodeById(sharedWithMe.root, nodeId) ? sharedWithMe : myDrive, {
|
|
38
|
+
root,
|
|
39
|
+
loadContent,
|
|
40
|
+
loadError
|
|
41
|
+
} = sectionOf(currentNodeId), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = (nodeId) => {
|
|
42
|
+
setCurrentNodeId(nodeId), sectionOf(nodeId).loadContent(nodeId);
|
|
43
|
+
}, loadMyDrive = myDrive.loadContent;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
loadMyDrive(ROOT_ID);
|
|
46
|
+
}, [loadMyDrive]);
|
|
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) => (
|
|
54
|
+
// A document that can't leave Google Drive could never be added.
|
|
55
|
+
f.canCopyToWorkspace && (!normalizedSearchTerm || f.name.toLowerCase().includes(normalizedSearchTerm)) && matchesRole(f)
|
|
56
|
+
));
|
|
57
|
+
let sortFunction;
|
|
58
|
+
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);
|
|
59
|
+
}, [currentNode, searchTerm, sortOrder, roles]), selectedIds = useMemo(() => new Set(selectedDocuments.map((d) => d.id)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
|
|
60
|
+
setSearchTerm(e.target.value);
|
|
61
|
+
}, [setSearchTerm]);
|
|
62
|
+
function getSortOrderLabel() {
|
|
63
|
+
return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
|
|
64
|
+
}
|
|
65
|
+
function handleSelectDoc(doc) {
|
|
66
|
+
let currentDocuments = [...selectedDocuments];
|
|
67
|
+
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);
|
|
68
|
+
}
|
|
69
|
+
const googleDrive = clsx("workspace flex-grow-1 gap-0", className);
|
|
70
|
+
return /* @__PURE__ */ jsxs(Grid, { className: googleDrive, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
|
|
72
|
+
position: "sticky",
|
|
73
|
+
top: 0,
|
|
74
|
+
paddingTop: "1.2rem"
|
|
75
|
+
}, children: /* @__PURE__ */ jsx(Tree, { nodes: [myDrive.root, sharedWithMe.root], selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
|
|
76
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
|
|
77
|
+
/* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
|
|
79
|
+
/* @__PURE__ */ jsxs(Flex, { className: "px-8 py-4", align: "center", justify: "end", children: [
|
|
80
|
+
/* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
|
|
81
|
+
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
|
|
83
|
+
/* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
|
|
85
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
|
|
86
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
|
|
87
|
+
] })
|
|
88
|
+
] })
|
|
89
|
+
] })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__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: [
|
|
92
|
+
/* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("google-drive.error.title"), text: t("google-drive.error.description") }),
|
|
93
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => loadContent(currentNodeId), children: t("retry") })
|
|
94
|
+
] }) : documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
|
|
95
|
+
const isSelected = selectedIds.has(doc.id);
|
|
96
|
+
return /* @__PURE__ */ jsx(GoogleDriveFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.id);
|
|
97
|
+
}) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuTrash, text: t("workspace.empty.docSpace"), title: t("explorer.emptyScreen.trash.title") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
|
|
98
|
+
] }) })
|
|
99
|
+
] });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
GoogleDrive as default
|
|
103
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { App, ILinkedResource } from '@edifice.io/client';
|
|
2
3
|
/**
|
|
3
4
|
* Definition of an internal link.
|
|
@@ -32,6 +33,11 @@ export interface InternalLinkerProps {
|
|
|
32
33
|
applicationList?: ApplicationOption[];
|
|
33
34
|
/** Whether to show the application selector */
|
|
34
35
|
showApplicationSelector?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Rendered on the search row, where the application selector sits, for
|
|
38
|
+
* consumers that hide that selector but still need a filter of their own.
|
|
39
|
+
*/
|
|
40
|
+
searchFilter?: ReactNode;
|
|
35
41
|
/** Disable application selecetor */
|
|
36
42
|
disableApplicationSelector?: boolean;
|
|
37
43
|
/** Optional callback to filter resources after loading. Applied in addition to search filters. */
|
|
@@ -49,5 +55,5 @@ export interface InternalLinkerProps {
|
|
|
49
55
|
/** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
|
|
50
56
|
loadMoreLabel?: string;
|
|
51
57
|
}
|
|
52
|
-
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, searchFilter, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
59
|
export default InternalLinker;
|
|
@@ -23,6 +23,7 @@ const InternalLinker = ({
|
|
|
23
23
|
resourceList,
|
|
24
24
|
applicationList,
|
|
25
25
|
showApplicationSelector = !0,
|
|
26
|
+
searchFilter,
|
|
26
27
|
disableApplicationSelector = !1,
|
|
27
28
|
resourceFilter,
|
|
28
29
|
onSearch,
|
|
@@ -131,6 +132,7 @@ const InternalLinker = ({
|
|
|
131
132
|
] }), variant: "ghost", size: "md", disabled: disableApplicationSelector }),
|
|
132
133
|
/* @__PURE__ */ jsx(Dropdown.Menu, { children: options == null ? void 0 : options.map((option) => /* @__PURE__ */ jsx(Dropdown.Item, { icon: option.icon, onClick: () => handleOptionClick(option), children: option.displayName }, option.application)) })
|
|
133
134
|
] }) }),
|
|
135
|
+
!showApplicationSelector && searchFilter && /* @__PURE__ */ jsx("div", { className: "flex-shrink-1 px-8 py-12 border-end align-self-center", children: searchFilter }),
|
|
134
136
|
/* @__PURE__ */ jsx("div", { className: "flex-grow-1 align-self-center", children: /* @__PURE__ */ jsx("form", { className: "gap-16 d-flex w-100 align-items-center px-16 py-8", onSubmit: handleSubmit, children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, placeholder: t("search"), size: "lg", className: "w-100", disabled: !selectedApplication, onChange: handleSearchChange }) }) })
|
|
135
137
|
] }),
|
|
136
138
|
/* @__PURE__ */ jsxs("div", { className: "internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto", children: [
|
|
@@ -33,9 +33,11 @@ const orderedTabs = [
|
|
|
33
33
|
// Media browser
|
|
34
34
|
"nextcloud",
|
|
35
35
|
// Nextcloud media browser
|
|
36
|
+
"google-drive",
|
|
37
|
+
// Google Drive media browser
|
|
36
38
|
"video-embedder"
|
|
37
39
|
// Link to a hosted video
|
|
38
|
-
], mediaLibraryTypes = {
|
|
40
|
+
], GOOGLE_DRIVE_VIEW_WORKFLOW = "io.edifice.google.drive.controller.GoogleDriveController|view", mediaLibraryTypes = {
|
|
39
41
|
none: null,
|
|
40
42
|
audio: {
|
|
41
43
|
title: "bbm.audio.modal.title",
|
|
@@ -74,7 +76,7 @@ const orderedTabs = [
|
|
|
74
76
|
onCancel,
|
|
75
77
|
onTabChange
|
|
76
78
|
}, ref) => {
|
|
77
|
-
var _a, _b;
|
|
79
|
+
var _a, _b, _c;
|
|
78
80
|
const linkTabProps = useRef(), refModal = useRef(null);
|
|
79
81
|
useImperativeHandle(ref, () => ({
|
|
80
82
|
show,
|
|
@@ -85,9 +87,9 @@ const orderedTabs = [
|
|
|
85
87
|
}));
|
|
86
88
|
const {
|
|
87
89
|
t
|
|
88
|
-
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), {
|
|
90
|
+
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), googleDriveViewWorkflow = useHasWorkflow(GOOGLE_DRIVE_VIEW_WORKFLOW), {
|
|
89
91
|
data: workspacePublicConf
|
|
90
|
-
} = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
|
|
92
|
+
} = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, enableGoogleDriveTab = ((_b = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _b.includes("google-drive")) && googleDriveViewWorkflow, [type, setType] = useState(null);
|
|
91
93
|
useHttpErrorToast({
|
|
92
94
|
active: !!type,
|
|
93
95
|
isDismissible: !0,
|
|
@@ -110,6 +112,15 @@ const orderedTabs = [
|
|
|
110
112
|
availableFor: ["audio", "video", "image", "attachment"],
|
|
111
113
|
isEnable: () => !!enableNextcloudTab
|
|
112
114
|
},
|
|
115
|
+
"google-drive": {
|
|
116
|
+
id: "google-drive",
|
|
117
|
+
// FIXME No Google Drive icon in the pack yet; reusing the generic one.
|
|
118
|
+
icon: /* @__PURE__ */ jsx(SvgIconGlobe2, {}),
|
|
119
|
+
label: t("bbm.google-drive"),
|
|
120
|
+
content: /* @__PURE__ */ jsx(InnerTabs.GoogleDrive, {}),
|
|
121
|
+
availableFor: ["audio", "video", "image", "attachment"],
|
|
122
|
+
isEnable: () => !!enableGoogleDriveTab
|
|
123
|
+
},
|
|
113
124
|
upload: {
|
|
114
125
|
id: "upload",
|
|
115
126
|
icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
|
|
@@ -195,7 +206,7 @@ const orderedTabs = [
|
|
|
195
206
|
const typeKey = type || "none";
|
|
196
207
|
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
|
|
197
208
|
}, [defaultTabId, type]);
|
|
198
|
-
const modalHeader = t(((
|
|
209
|
+
const modalHeader = t(((_c = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _c.title) ?? "bbm"), resetState = () => {
|
|
199
210
|
linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
|
|
200
211
|
}, handleTabChange = (tab) => {
|
|
201
212
|
onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { odeServices, GoogleDriveCopyError } from "@edifice.io/client";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useMediaLibraryContext } from "../MediaLibraryContext.js";
|
|
5
|
+
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
6
|
+
import useToast from "../../../../hooks/useToast/useToast.js";
|
|
7
|
+
import GoogleDrive$1 from "../../GoogleDrive/GoogleDrive.js";
|
|
8
|
+
const GoogleDrive = () => {
|
|
9
|
+
const {
|
|
10
|
+
appCode,
|
|
11
|
+
visibility,
|
|
12
|
+
type,
|
|
13
|
+
setResultCounter,
|
|
14
|
+
setResult,
|
|
15
|
+
setPreSuccess,
|
|
16
|
+
multiple
|
|
17
|
+
} = useMediaLibraryContext(), {
|
|
18
|
+
user
|
|
19
|
+
} = useUser(), {
|
|
20
|
+
t
|
|
21
|
+
} = useTranslation(), toast = useToast();
|
|
22
|
+
function getDocumentRoleFilter() {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case "image":
|
|
25
|
+
return "img";
|
|
26
|
+
case "audio":
|
|
27
|
+
return "audio";
|
|
28
|
+
case "video":
|
|
29
|
+
return "video";
|
|
30
|
+
default:
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function copyToWorkspace(userId, ids) {
|
|
35
|
+
try {
|
|
36
|
+
return await odeServices.googledrive().copyDocumentToWorkspace(
|
|
37
|
+
userId,
|
|
38
|
+
ids,
|
|
39
|
+
void 0,
|
|
40
|
+
// Copy the documents straight to their final place, the way an upload
|
|
41
|
+
// does, instead of leaving a copy in the user's own documents for the
|
|
42
|
+
// modal to transfer afterwards.
|
|
43
|
+
{
|
|
44
|
+
application: appCode,
|
|
45
|
+
visibility
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (error instanceof GoogleDriveCopyError && error.copied.length > 0)
|
|
50
|
+
return toast.warning(t("google-drive.transfer.error")), error.copied;
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function handleSelect(result) {
|
|
55
|
+
setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? copyToWorkspace(user.userId, result.map((doc) => doc.id)) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ jsx(GoogleDrive$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
GoogleDrive
|
|
61
|
+
};
|
|
@@ -5,6 +5,7 @@ export declare const InnerTabs: {
|
|
|
5
5
|
ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Workspace: () => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
Nextcloud: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
Iframe: () => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Audio } from "./Audio.js";
|
|
2
2
|
import { ExternalLink } from "./ExternalLink.js";
|
|
3
|
+
import { GoogleDrive } from "./GoogleDrive.js";
|
|
3
4
|
import { Iframe } from "./Iframe.js";
|
|
4
5
|
import { InternalLink } from "./InternalLink.js";
|
|
5
6
|
import { Nextcloud } from "./Nextcloud.js";
|
|
@@ -14,6 +15,7 @@ const InnerTabs = {
|
|
|
14
15
|
ExternalLink,
|
|
15
16
|
Workspace,
|
|
16
17
|
Nextcloud,
|
|
18
|
+
GoogleDrive,
|
|
17
19
|
InternalLink,
|
|
18
20
|
Iframe,
|
|
19
21
|
VideoEmbedder
|