@edifice.io/react 2.6.2-develop-integration.20260820103059 → 2.6.2-develop-integration-crna.20260820104716
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/Alert/Alert.js +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -0
- package/dist/components/DatePicker/DatePicker.js +2 -0
- package/dist/components/Layout/Layout.js +5 -3
- package/dist/hooks/index.d.ts +0 -1
- package/dist/icons.js +340 -338
- package/dist/index.js +146 -152
- package/dist/modules/homepage/components/Communities/Communities.d.ts +10 -0
- package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +9 -0
- package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.d.ts +5 -0
- package/dist/modules/homepage/components/Communities/CommunityItem.d.ts +11 -0
- package/dist/modules/homepage/components/Communities/index.d.ts +8 -0
- package/dist/modules/homepage/components/Communities/useCommunities.d.ts +13 -0
- package/dist/modules/homepage/components/Favorites/Favorites.js +1 -1
- package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +5 -1
- package/dist/modules/homepage/components/HomeCard/HomeCard.js +10 -2
- package/dist/modules/homepage/components/LastInfos/LastInfosList.js +2 -2
- package/dist/modules/homepage/components/Notifications/NotificationList.js +2 -2
- package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.d.ts +2 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.js +3 -2
- package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.js +1 -1
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +21 -7
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +26 -13
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +20 -11
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +5 -2
- package/dist/modules/homepage/components/UserSpace/hooks/useChildren.d.ts +14 -0
- package/dist/modules/homepage/components/UserSpace/hooks/useChildren.js +23 -0
- package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.d.ts +8 -0
- package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +65 -0
- package/dist/modules/icons/components/IconClass.d.ts +7 -0
- package/dist/modules/icons/components/IconClass.js +13 -0
- package/dist/modules/icons/components/index.d.ts +1 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +7 -20
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -2
- package/dist/modules/multimedia/index.d.ts +0 -1
- package/dist/multimedia.js +12 -16
- package/package.json +6 -6
- package/dist/hooks/useNextcloudSearch/index.d.ts +0 -1
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +0 -12
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +0 -56
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +0 -25
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +0 -105
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +0 -35
- package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +0 -24
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +0 -109
- package/dist/modules/multimedia/Nextcloud/index.d.ts +0 -2
|
@@ -1,30 +1,41 @@
|
|
|
1
|
-
const resolveNotificationResourceUri = (params, type) => {
|
|
1
|
+
const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
|
|
2
|
+
if (appCode === "timeline" && eventType === "NOTIFY-REPORT")
|
|
3
|
+
return "/admin";
|
|
2
4
|
if (type === "user")
|
|
3
5
|
return params.resourceUri || params.uri;
|
|
4
6
|
for (const [key, value] of Object.entries(params))
|
|
5
7
|
if (typeof value == "string" && value.length > 0 && key.endsWith("Uri") && key !== "profilUri" && key !== "resourceFolderUri")
|
|
6
8
|
return value;
|
|
7
|
-
}, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"),
|
|
8
|
-
|
|
9
|
+
}, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCodeAndI18nKey = (appCode) => {
|
|
10
|
+
appCode = appCode.toLowerCase();
|
|
11
|
+
let appI18nKey = appCode;
|
|
12
|
+
switch (appCode) {
|
|
9
13
|
case "collaborativewall":
|
|
10
|
-
|
|
14
|
+
appCode = "collaborative-wall";
|
|
15
|
+
break;
|
|
11
16
|
case "formulaire":
|
|
12
|
-
|
|
17
|
+
appI18nKey = appCode = "forms";
|
|
18
|
+
break;
|
|
13
19
|
case "messagerie":
|
|
14
|
-
|
|
20
|
+
appI18nKey = appCode = "conversation";
|
|
21
|
+
break;
|
|
15
22
|
case "news":
|
|
16
|
-
|
|
23
|
+
appI18nKey = appCode = "actualites";
|
|
24
|
+
break;
|
|
17
25
|
case "homeworks":
|
|
18
|
-
|
|
26
|
+
appCode = "cahier-de-texte";
|
|
27
|
+
break;
|
|
19
28
|
case "userbook_motto":
|
|
20
29
|
case "userbook_mood":
|
|
21
30
|
case "userbook_discovervisiblegroups":
|
|
22
|
-
|
|
31
|
+
appCode = "userbook";
|
|
32
|
+
break;
|
|
23
33
|
default:
|
|
24
|
-
|
|
34
|
+
appI18nKey = appCode = appCode.replace(/_/g, "-");
|
|
25
35
|
}
|
|
36
|
+
return [appCode, appI18nKey];
|
|
26
37
|
}, notificationAdapter = (notification) => {
|
|
27
|
-
const type = notification.sender ? "user" : "system", uri = resolveNotificationResourceUri(notification.params, type), date = new Date(notification.date.$date),
|
|
38
|
+
const type = notification.sender ? "user" : "system", [appCode, appI18nKey] = getAppCodeAndI18nKey(notification.type), uri = resolveNotificationResourceUri(notification.params, type, appCode, notification["event-type"] || notification.eventType), date = new Date(notification.date.$date), message = parseNotificationMessage(notification.message), base = {
|
|
28
39
|
id: notification._id,
|
|
29
40
|
uri,
|
|
30
41
|
message,
|
|
@@ -38,13 +49,15 @@ const resolveNotificationResourceUri = (params, type) => {
|
|
|
38
49
|
// cannot be undefined if sender is present (user type)
|
|
39
50
|
userId: notification.sender,
|
|
40
51
|
// cannot be undefined if sender is present (user type)
|
|
41
|
-
appCode
|
|
52
|
+
appCode,
|
|
53
|
+
appI18nKey
|
|
42
54
|
}
|
|
43
55
|
} : {
|
|
44
56
|
...base,
|
|
45
57
|
type: "system",
|
|
46
58
|
params: {
|
|
47
|
-
appCode
|
|
59
|
+
appCode,
|
|
60
|
+
appI18nKey
|
|
48
61
|
}
|
|
49
62
|
};
|
|
50
63
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import SvgIconRafterUp from "../../../icons/components/IconRafterUp.js";
|
|
4
|
+
import SvgIconUserSearch from "../../../icons/components/IconUserSearch.js";
|
|
4
5
|
import useToggle from "../../../../hooks/useToggle/useToggle.js";
|
|
5
6
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
6
7
|
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
7
8
|
import IconButton from "../../../../components/Button/IconButton.js";
|
|
9
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
8
10
|
import { getRotateTransitionStyle } from "../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";
|
|
9
11
|
const SchoolSpace = ({
|
|
10
12
|
schools,
|
|
@@ -13,16 +15,23 @@ const SchoolSpace = ({
|
|
|
13
15
|
}) => {
|
|
14
16
|
const [isExpanded, toggleExpanded] = useToggle(!1), {
|
|
15
17
|
t
|
|
16
|
-
} = useTranslation()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
} = useTranslation();
|
|
19
|
+
if (!selectedSchool) return null;
|
|
20
|
+
const hasManySchools = schools && schools.length > 1, directoryUrl = `/userbook/annuaire#/search?${new URLSearchParams({
|
|
21
|
+
structure: selectedSchool.id
|
|
22
|
+
}).toString()}`;
|
|
23
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "4", direction: "column", className: "school-space", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(Flex, { className: "school-space-container", justify: "center", gap: "4", align: "center", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("b", { children: selectedSchool.name }),
|
|
26
|
+
hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-end", onToggle: toggleExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(IconButton, { ...triggerProps, "aria-label": t("show"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconRafterUp, { className: "w-16 min-w-0", style: getRotateTransitionStyle(isExpanded, {
|
|
28
|
+
degrees: 180
|
|
29
|
+
}) }) }),
|
|
30
|
+
/* @__PURE__ */ jsx(Dropdown.Menu, { children: schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: /* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx("p", { children: school.name }) }) }, school.id)) })
|
|
31
|
+
] }) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", className: "school-space-directory-button", leftIcon: /* @__PURE__ */ jsx(SvgIconUserSearch, {}), onClick: () => window.location.href = directoryUrl, children: t("homepage.school-space.directory") })
|
|
34
|
+
] });
|
|
26
35
|
};
|
|
27
36
|
export {
|
|
28
37
|
SchoolSpace as default
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
+
import SvgIconClass from "../../../icons/components/IconClass.js";
|
|
4
|
+
import { useProfileLinks } from "./hooks/useProfileLinks.js";
|
|
3
5
|
import HomeCard from "../HomeCard/HomeCard.js";
|
|
4
6
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
5
7
|
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
8
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
6
9
|
function UserSpace({
|
|
7
10
|
name,
|
|
8
11
|
avatar,
|
|
@@ -11,8 +14,8 @@ function UserSpace({
|
|
|
11
14
|
}) {
|
|
12
15
|
const {
|
|
13
16
|
t
|
|
14
|
-
} = useTranslation();
|
|
15
|
-
return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", children: [
|
|
17
|
+
} = useTranslation(), links = useProfileLinks(profile);
|
|
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: [
|
|
16
19
|
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
|
|
17
20
|
/* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
|
|
18
21
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Child, StructureChildren } from '@edifice.io/client';
|
|
2
|
+
export declare const childrenQueryKeys: {
|
|
3
|
+
all: (userId: string) => readonly ["children", string];
|
|
4
|
+
};
|
|
5
|
+
export declare const childrenQueryOptions: (userId: string | undefined, enabled: boolean) => import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<StructureChildren[], Error, Child[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
6
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<StructureChildren[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, StructureChildren[]>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fetches the children of a "Relative" user across all their structures,
|
|
12
|
+
* merged into a single list.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useChildren(userId: string | undefined, enabled: boolean): import('@tanstack/react-query').UseQueryResult<Child[], Error>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
3
|
+
const childrenQueryKeys = {
|
|
4
|
+
all: (userId) => ["children", userId]
|
|
5
|
+
};
|
|
6
|
+
function flattenChildrenByStructure(structures) {
|
|
7
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
8
|
+
return structures.flatMap((structure) => structure.children).filter((child) => seenIds.has(child.id) ? !1 : (seenIds.add(child.id), !0));
|
|
9
|
+
}
|
|
10
|
+
const childrenQueryOptions = (userId, enabled) => queryOptions({
|
|
11
|
+
queryKey: childrenQueryKeys.all(userId ?? ""),
|
|
12
|
+
queryFn: () => odeServices.directory().getChildren(userId),
|
|
13
|
+
enabled: enabled && !!userId,
|
|
14
|
+
select: flattenChildrenByStructure
|
|
15
|
+
});
|
|
16
|
+
function useChildren(userId, enabled) {
|
|
17
|
+
return useQuery(childrenQueryOptions(userId, enabled));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
childrenQueryKeys,
|
|
21
|
+
childrenQueryOptions,
|
|
22
|
+
useChildren
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UserProfile } from '@edifice.io/client';
|
|
2
|
+
type ProfileLink = {
|
|
3
|
+
url: string;
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
/** Generates user's links to show in the UserSpace home component. */
|
|
7
|
+
export declare function useProfileLinks(profile: UserProfile[number]): Array<ProfileLink> | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
import { useEdificeClient } from "../../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
3
|
+
import { useChildren } from "./useChildren.js";
|
|
4
|
+
function useProfileLinks(profile) {
|
|
5
|
+
var _a;
|
|
6
|
+
const {
|
|
7
|
+
user
|
|
8
|
+
} = useEdificeClient(), {
|
|
9
|
+
t
|
|
10
|
+
} = useTranslation(), isRelative = profile === "Relative", {
|
|
11
|
+
data: children
|
|
12
|
+
} = useChildren(user == null ? void 0 : user.userId, isRelative), structureId = (_a = user == null ? void 0 : user.structures) == null ? void 0 : _a[0];
|
|
13
|
+
if (structureId && profile) {
|
|
14
|
+
const baseUrl = "/userbook/annuaire#/search", buildStructureGroupsUrl = () => {
|
|
15
|
+
const params = new URLSearchParams({
|
|
16
|
+
filters: "groups",
|
|
17
|
+
structure: structureId
|
|
18
|
+
});
|
|
19
|
+
return `${baseUrl}?${params.toString()}`;
|
|
20
|
+
}, buildClassesUrl = (classIds = []) => {
|
|
21
|
+
const params = new URLSearchParams({
|
|
22
|
+
filters: "groups",
|
|
23
|
+
structure: structureId
|
|
24
|
+
});
|
|
25
|
+
return classIds.forEach((c) => params.append("class", String(c))), `${baseUrl}?${params.toString()}`;
|
|
26
|
+
};
|
|
27
|
+
switch (profile) {
|
|
28
|
+
case "Teacher":
|
|
29
|
+
return [{
|
|
30
|
+
text: t("homepage.userspace.teacher.link.classes"),
|
|
31
|
+
url: buildClassesUrl(user.classes)
|
|
32
|
+
}];
|
|
33
|
+
case "Student":
|
|
34
|
+
return [{
|
|
35
|
+
text: t("homepage.userspace.student.link.teachers"),
|
|
36
|
+
url: "/userbook/annuaire#/search?filters=groups&profile=Teacher"
|
|
37
|
+
}, {
|
|
38
|
+
text: t("homepage.userspace.student.link.classes"),
|
|
39
|
+
url: buildClassesUrl(user.classes)
|
|
40
|
+
}];
|
|
41
|
+
case "Relative":
|
|
42
|
+
return children != null && children.length ? children.map((child) => {
|
|
43
|
+
var _a2;
|
|
44
|
+
return {
|
|
45
|
+
text: t("homepage.userspace.relative.link.classes", {
|
|
46
|
+
childName: child.firstName
|
|
47
|
+
}),
|
|
48
|
+
url: buildClassesUrl((_a2 = child.classes) == null ? void 0 : _a2.map(({
|
|
49
|
+
id
|
|
50
|
+
}) => id))
|
|
51
|
+
};
|
|
52
|
+
}) : void 0;
|
|
53
|
+
case "Personnel":
|
|
54
|
+
return [{
|
|
55
|
+
text: t("homepage.userspace.personnel.link.classesAndGroups"),
|
|
56
|
+
url: buildStructureGroupsUrl()
|
|
57
|
+
}];
|
|
58
|
+
case "Guest":
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
useProfileLinks
|
|
65
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconClass: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconClass;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconClass = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M2.074 17.258c.707-.837 1.705-1.349 2.79-1.349h5.727c1.085 0 2.083.512 2.79 1.35.701.831 1.073 1.928 1.073 3.044V22a1 1 0 1 1-2 0v-1.697c0-.684-.23-1.314-.603-1.755-.367-.436-.826-.639-1.26-.639H4.864c-.434 0-.893.203-1.261.64-.372.44-.603 1.07-.603 1.754V22a1 1 0 1 1-2 0v-1.697c0-1.116.372-2.213 1.074-3.045M7.728 8.5a2.182 2.182 0 1 0 0 4.364 2.182 2.182 0 0 0 0-4.364m-4.182 2.182a4.182 4.182 0 1 1 8.364 0 4.182 4.182 0 0 1-8.364 0", clipRule: "evenodd" }),
|
|
9
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 5a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3h-5a1 1 0 1 1 0-2h5a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v10a1 1 0 1 1-2 0z", clipRule: "evenodd" })
|
|
10
|
+
] });
|
|
11
|
+
export {
|
|
12
|
+
SvgIconClass as default
|
|
13
|
+
};
|
|
@@ -30,6 +30,7 @@ export { default as IconCantoo } from './IconCantoo';
|
|
|
30
30
|
export { default as IconCenter } from './IconCenter';
|
|
31
31
|
export { default as IconCheck } from './IconCheck';
|
|
32
32
|
export { default as IconChecklist } from './IconChecklist';
|
|
33
|
+
export { default as IconClass } from './IconClass';
|
|
33
34
|
export { default as IconClockAlert } from './IconClockAlert';
|
|
34
35
|
export { default as IconClock } from './IconClock';
|
|
35
36
|
export { default as IconCloseFullScreen } from './IconCloseFullScreen';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
|
|
2
2
|
import { TabsItemProps } from '../../../components';
|
|
3
3
|
import { ExternalLinkTabProps } from './innertabs/ExternalLink';
|
|
4
4
|
import { InternalLinkTabProps, InternalLinkTabResult } from './innertabs/InternalLink';
|
|
@@ -54,7 +54,7 @@ export interface MediaLibraryRef {
|
|
|
54
54
|
/**
|
|
55
55
|
* The resulting type depends on the actual selected Tab when modal is closed.
|
|
56
56
|
*/
|
|
57
|
-
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement |
|
|
57
|
+
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
|
|
58
58
|
/**
|
|
59
59
|
* MediaLibrary component properties
|
|
60
60
|
*/
|
|
@@ -12,7 +12,6 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
|
|
|
12
12
|
import { InnerTabs } from "./innertabs/index.js";
|
|
13
13
|
import { MediaLibraryContext } from "./MediaLibraryContext.js";
|
|
14
14
|
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
15
|
-
import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
|
|
16
15
|
import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
17
16
|
import Modal from "../../../components/Modal/Modal.js";
|
|
18
17
|
import { Tabs } from "../../../components/Tabs/components/Tabs.js";
|
|
@@ -30,8 +29,6 @@ const orderedTabs = [
|
|
|
30
29
|
// Filesystem browser + drag'n'drop of files
|
|
31
30
|
"workspace",
|
|
32
31
|
// Media browser
|
|
33
|
-
"nextcloud",
|
|
34
|
-
// Nextcloud media browser
|
|
35
32
|
"video-embedder"
|
|
36
33
|
// Link to a hosted video
|
|
37
34
|
], mediaLibraryTypes = {
|
|
@@ -73,7 +70,7 @@ const orderedTabs = [
|
|
|
73
70
|
onCancel,
|
|
74
71
|
onTabChange
|
|
75
72
|
}, ref) => {
|
|
76
|
-
var _a
|
|
73
|
+
var _a;
|
|
77
74
|
const linkTabProps = useRef(), refModal = useRef(null);
|
|
78
75
|
useImperativeHandle(ref, () => ({
|
|
79
76
|
show,
|
|
@@ -84,9 +81,7 @@ const orderedTabs = [
|
|
|
84
81
|
}));
|
|
85
82
|
const {
|
|
86
83
|
t
|
|
87
|
-
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"),
|
|
88
|
-
data: workspacePublicConf
|
|
89
|
-
} = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
|
|
84
|
+
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null);
|
|
90
85
|
useHttpErrorToast({
|
|
91
86
|
active: !!type,
|
|
92
87
|
isDismissible: !0,
|
|
@@ -101,14 +96,6 @@ const orderedTabs = [
|
|
|
101
96
|
availableFor: ["audio", "video", "image", "attachment"],
|
|
102
97
|
isEnable: null
|
|
103
98
|
},
|
|
104
|
-
nextcloud: {
|
|
105
|
-
id: "nextcloud",
|
|
106
|
-
icon: /* @__PURE__ */ jsx(SvgIconGlobe, {}),
|
|
107
|
-
label: t("bbm.nextcloud"),
|
|
108
|
-
content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
|
|
109
|
-
availableFor: ["audio", "video", "image", "attachment"],
|
|
110
|
-
isEnable: () => !!enableNextcloudTab
|
|
111
|
-
},
|
|
112
99
|
upload: {
|
|
113
100
|
id: "upload",
|
|
114
101
|
icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
|
|
@@ -190,17 +177,17 @@ const orderedTabs = [
|
|
|
190
177
|
linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
|
|
191
178
|
};
|
|
192
179
|
useEffect(() => {
|
|
193
|
-
var _a2,
|
|
180
|
+
var _a2, _b;
|
|
194
181
|
const typeKey = type || "none";
|
|
195
|
-
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((
|
|
182
|
+
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b = mediaLibraryTypes[typeKey]) == null ? void 0 : _b.defaultTab);
|
|
196
183
|
}, [defaultTabId, type]);
|
|
197
|
-
const modalHeader = t(((
|
|
184
|
+
const modalHeader = t(((_a = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _a.title) ?? "bbm"), resetState = () => {
|
|
198
185
|
linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
|
|
199
186
|
}, handleTabChange = (tab) => {
|
|
200
187
|
onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
|
|
201
|
-
},
|
|
188
|
+
}, handleOnSuccess = useCallback(() => {
|
|
202
189
|
const triggerSuccess = async (result2) => {
|
|
203
|
-
|
|
190
|
+
result2 instanceof Array && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
|
|
204
191
|
};
|
|
205
192
|
onSuccessAction ? onSuccessAction().then((result2) => {
|
|
206
193
|
triggerSuccess(result2);
|
|
@@ -4,7 +4,6 @@ export declare const InnerTabs: {
|
|
|
4
4
|
Upload: () => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Workspace: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
Nextcloud: () => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
Iframe: () => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,6 @@ import { Audio } from "./Audio.js";
|
|
|
2
2
|
import { ExternalLink } from "./ExternalLink.js";
|
|
3
3
|
import { Iframe } from "./Iframe.js";
|
|
4
4
|
import { InternalLink } from "./InternalLink.js";
|
|
5
|
-
import { Nextcloud } from "./Nextcloud.js";
|
|
6
5
|
import { Upload } from "./Upload.js";
|
|
7
6
|
import { Video } from "./Video.js";
|
|
8
7
|
import { VideoEmbedder } from "./VideoEmbedder.js";
|
|
@@ -13,7 +12,6 @@ const InnerTabs = {
|
|
|
13
12
|
Upload,
|
|
14
13
|
ExternalLink,
|
|
15
14
|
Workspace,
|
|
16
|
-
Nextcloud,
|
|
17
15
|
InternalLink,
|
|
18
16
|
Iframe,
|
|
19
17
|
VideoEmbedder
|
package/dist/multimedia.js
CHANGED
|
@@ -4,14 +4,12 @@ import { default as default4 } from "./modules/multimedia/FileCard/FileCard.js";
|
|
|
4
4
|
import { default as default5 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
|
|
5
5
|
import { default as default6 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
|
|
6
6
|
import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
7
|
-
import { default as default8 } from "./modules/multimedia/
|
|
8
|
-
import { default as default9 } from "./modules/multimedia/
|
|
9
|
-
import { default as default10 } from "./modules/multimedia/
|
|
10
|
-
import { default as default11 } from "./modules/multimedia/
|
|
11
|
-
import { default as default12 } from "./modules/multimedia/
|
|
12
|
-
import { default as default13 } from "./modules/multimedia/
|
|
13
|
-
import { default as default14 } from "./modules/multimedia/Workspace/Workspace.js";
|
|
14
|
-
import { default as default15 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.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";
|
|
15
13
|
import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
|
|
16
14
|
import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
|
|
17
15
|
import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
|
|
@@ -24,13 +22,11 @@ export {
|
|
|
24
22
|
default6 as ImagePicker,
|
|
25
23
|
InternalLinker,
|
|
26
24
|
default7 as MediaLibrary,
|
|
27
|
-
default8 as Nextcloud,
|
|
28
|
-
default9 as NextcloudFileCard,
|
|
29
25
|
Upload,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
default8 as UploadCard,
|
|
27
|
+
default9 as UploadFiles,
|
|
28
|
+
default10 as VideoEmbed,
|
|
29
|
+
default11 as VideoRecorder,
|
|
30
|
+
default12 as Workspace,
|
|
31
|
+
default13 as WorkspaceFolders
|
|
36
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.2-develop-integration.
|
|
3
|
+
"version": "2.6.2-develop-integration-crna.20260820104716",
|
|
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/
|
|
144
|
-
"@edifice.io/
|
|
145
|
-
"@edifice.io/utilities": "2.6.2-develop-integration.
|
|
143
|
+
"@edifice.io/tiptap-extensions": "2.6.2-develop-integration-crna.20260820104716",
|
|
144
|
+
"@edifice.io/bootstrap": "2.6.2-develop-integration-crna.20260820104716",
|
|
145
|
+
"@edifice.io/utilities": "2.6.2-develop-integration-crna.20260820104716"
|
|
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/client": "2.6.2-develop-integration.
|
|
177
|
-
"@edifice.io/config": "2.6.2-develop-integration.
|
|
176
|
+
"@edifice.io/client": "2.6.2-develop-integration-crna.20260820104716",
|
|
177
|
+
"@edifice.io/config": "2.6.2-develop-integration-crna.20260820104716"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"@react-spring/web": "9.7.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as useNextcloudSearch } from './useNextcloudSearch';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ID, NextcloudDocument } from '@edifice.io/client';
|
|
2
|
-
import { TreeData } from '../../types';
|
|
3
|
-
export type NextcloudFolderNode = TreeData & {
|
|
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
|
-
refetchAuthStatus: () => void;
|
|
11
|
-
loadContent: (folderId?: ID) => void;
|
|
12
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useReducer, useCallback } from "react";
|
|
2
|
-
import { odeServices } from "@edifice.io/client";
|
|
3
|
-
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
|
4
|
-
import { findNodeById } from "../../components/TreeView/utilities/treeview.js";
|
|
5
|
-
function useNextcloudSearch(rootId, rootName, userId) {
|
|
6
|
-
var _a;
|
|
7
|
-
function treeReducer(state, action) {
|
|
8
|
-
switch (action.type) {
|
|
9
|
-
case "update": {
|
|
10
|
-
const node = findNodeById(state, action.folderId);
|
|
11
|
-
return node && (node.children = action.subfolders.map((f) => ({
|
|
12
|
-
id: f.path,
|
|
13
|
-
name: f.name
|
|
14
|
-
})), node.files = action.files), {
|
|
15
|
-
...state
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
default:
|
|
19
|
-
throw Error("[useNextcloudSearch] Unknown action type: " + action.type);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const [root, dispatch] = useReducer(treeReducer, {
|
|
23
|
-
id: rootId,
|
|
24
|
-
name: rootName,
|
|
25
|
-
section: !0
|
|
26
|
-
}), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
|
|
27
|
-
queryKey: ["nextcloud", "oauth2-status", userId],
|
|
28
|
-
queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
|
|
29
|
-
enabled: !!userId
|
|
30
|
-
}), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), loadContent = useCallback(async (folderId) => {
|
|
31
|
-
if (!userId) return;
|
|
32
|
-
const path = folderId === rootId ? void 0 : folderId, payload = await queryClient.fetchQuery({
|
|
33
|
-
queryKey: ["nextcloud", "documents", userId, path ?? "/"],
|
|
34
|
-
queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
|
|
35
|
-
staleTime: 6e4
|
|
36
|
-
}), subfolders = [], files = [], currentPath = path ?? "/";
|
|
37
|
-
payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
|
|
38
|
-
doc.isFolder ? subfolders.push(doc) : files.push(doc);
|
|
39
|
-
}), dispatch({
|
|
40
|
-
folderId,
|
|
41
|
-
subfolders,
|
|
42
|
-
files,
|
|
43
|
-
type: "update"
|
|
44
|
-
});
|
|
45
|
-
}, [rootId, userId, queryClient]);
|
|
46
|
-
return {
|
|
47
|
-
root,
|
|
48
|
-
needsAuth,
|
|
49
|
-
isCheckingAuth: oauth2StatusQuery.isLoading,
|
|
50
|
-
refetchAuthStatus: oauth2StatusQuery.refetch,
|
|
51
|
-
loadContent
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
useNextcloudSearch as default
|
|
56
|
-
};
|
|
@@ -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;
|