@edifice.io/react 2.6.9 → 2.6.10-develop-b2school.20261019104630
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/Layout/Layout.js +12 -4
- 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 +5 -3
- package/dist/components/RadioTile/RadioTile.d.ts +35 -0
- package/dist/components/RadioTile/RadioTile.js +22 -0
- package/dist/components/RadioTile/index.d.ts +2 -0
- package/dist/components/Tree/utilities/tree.js +21 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/homepage.js +62 -24
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBackground/useBackground.d.ts +1 -1
- package/dist/hooks/useCarbonioUnread/index.d.ts +1 -0
- package/dist/hooks/useCarbonioUnread/useCarbonioUnread.d.ts +5 -0
- package/dist/hooks/useCarbonioUnread/useCarbonioUnread.js +24 -0
- package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
- package/dist/icons.js +404 -402
- package/dist/index.js +160 -150
- package/dist/modules/HelpZone/HelpZone.js +6 -8
- package/dist/modules/HelpZone/HelpZoneContainer.js +2 -5
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/Agenda.js +54 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +14 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +30 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +27 -0
- package/dist/modules/homepage/components/Agenda/index.d.ts +3 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +24 -0
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +45 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +26 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +9 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +59 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +17 -0
- package/dist/modules/homepage/components/BriefMe/index.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/types.d.ts +17 -0
- package/dist/modules/homepage/components/BriefMe/types.js +8 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +31 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +51 -0
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/Cantine.js +44 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +18 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.js +88 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +12 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +5 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +22 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +6 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +28 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +12 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +60 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +11 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +20 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +65 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +23 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +43 -0
- package/dist/modules/homepage/components/Cantine/index.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/types.d.ts +42 -0
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +48 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +4 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +12 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +1 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +6 -0
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +3 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +10 -0
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +68 -0
- package/dist/modules/homepage/components/Header/Header.js +37 -14
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +5 -0
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +28 -0
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +32 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +5 -1
- 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 +5 -5
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +2 -2
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +1 -5
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +10 -12
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +3 -9
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +6 -12
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -10
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +9 -10
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +4 -0
- package/dist/modules/homepage/components/Qwant/Qwant.js +41 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +10 -0
- package/dist/modules/homepage/components/Qwant/index.d.ts +3 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +8 -0
- package/dist/modules/homepage/components/Universalis/Universalis.js +62 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +16 -0
- package/dist/modules/homepage/components/Universalis/index.d.ts +3 -0
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
- package/dist/modules/homepage/components/index.d.ts +8 -1
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.js +4 -4
- package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
- package/dist/modules/icons/components/IconAddWidget.js +12 -0
- package/dist/modules/icons/components/index.d.ts +1 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +36 -11
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -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/Nextcloud/Nextcloud.d.ts +24 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +120 -0
- package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
- package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +16 -12
- package/package.json +6 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import illuEmptyFavorite from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-favorite.svg";
|
|
4
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
5
|
+
import AppIcon from "../../../../components/AppIcon/AppIcon.js";
|
|
6
|
+
const MAX_VISIBLE_APPS = 10, appToOpenOnBlank = ["Administration"], MyAppsPopoverFooter = () => {
|
|
7
|
+
const {
|
|
8
|
+
t
|
|
9
|
+
} = useTranslation();
|
|
10
|
+
return /* @__PURE__ */ jsx("a", { href: "/welcome", className: "btn-beta btn-beta-tertiary btn-beta--ghost btn-beta--small", "data-testid": "header-my-apps-popover-more", children: /* @__PURE__ */ jsx("span", { children: t("homepage.header.myapps.seeMore") }) });
|
|
11
|
+
}, MyAppsPopoverBody = ({
|
|
12
|
+
bookmarkedApps
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
t
|
|
16
|
+
} = useTranslation(), getAppName = (app) => app.prefix && app.prefix.length > 1 ? t(app.prefix.substring(1)) : t(app.displayName) || "";
|
|
17
|
+
return bookmarkedApps != null && bookmarkedApps.length ? /* @__PURE__ */ jsx("div", { className: "my-apps-popover-grid", "data-testid": "header-my-apps-popover", children: bookmarkedApps.slice(0, MAX_VISIBLE_APPS).map((app, index) => {
|
|
18
|
+
const opensInNewTab = appToOpenOnBlank.includes(app.name) || app.isExternal || app.target === "_blank", appName = getAppName(app);
|
|
19
|
+
return /* @__PURE__ */ jsx("a", { href: app.address, title: appName, "aria-label": appName, className: "my-apps-popover-item", "data-testid": "header-my-apps-popover-item", target: opensInNewTab ? "_blank" : void 0, rel: opensInNewTab ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index);
|
|
20
|
+
}) }) : /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", gap: "8", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("img", { src: illuEmptyFavorite, alt: "", width: 50, height: 50 }),
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "my-apps-popover-empty-text text-center", children: t("homepage.header.myapps.empty") })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
MyAppsPopoverBody,
|
|
27
|
+
MyAppsPopoverFooter
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useFloating, useHover, safePolygon, useClick, useDismiss, useFocus, useInteractions } from "@floating-ui/react";
|
|
3
|
+
function useSafeHoverPopover({
|
|
4
|
+
hoverEnabled = !0,
|
|
5
|
+
clickEnabled = !1
|
|
6
|
+
} = {}) {
|
|
7
|
+
const [open, setOpen] = useState(!1), {
|
|
8
|
+
refs,
|
|
9
|
+
context
|
|
10
|
+
} = useFloating({
|
|
11
|
+
open,
|
|
12
|
+
onOpenChange: setOpen
|
|
13
|
+
}), hover = useHover(context, {
|
|
14
|
+
enabled: hoverEnabled,
|
|
15
|
+
handleClose: safePolygon()
|
|
16
|
+
}), click = useClick(context, {
|
|
17
|
+
enabled: clickEnabled
|
|
18
|
+
}), dismiss = useDismiss(context), focus = useFocus(context), {
|
|
19
|
+
getReferenceProps,
|
|
20
|
+
getFloatingProps
|
|
21
|
+
} = useInteractions([hover, click, dismiss, focus]);
|
|
22
|
+
return {
|
|
23
|
+
open,
|
|
24
|
+
setReference: refs.setReference,
|
|
25
|
+
setFloating: refs.setFloating,
|
|
26
|
+
getReferenceProps,
|
|
27
|
+
getFloatingProps
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
useSafeHoverPopover
|
|
32
|
+
};
|
|
@@ -3,7 +3,11 @@ import { ButtonBeta } from '../../../../components';
|
|
|
3
3
|
export interface HomeCardHeaderProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
4
4
|
/** Title displayed on the left side of the header. */
|
|
5
5
|
title: ReactNode;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Label of the action button displayed on the right side of the header.
|
|
8
|
+
* Can be omitted for an icon-only button — pass `aria-label` via
|
|
9
|
+
* `actionProps` in that case.
|
|
10
|
+
*/
|
|
7
11
|
actionLabel?: ReactNode;
|
|
8
12
|
/** Callback invoked when the action button is clicked. */
|
|
9
13
|
onActionClick?: MouseEventHandler<HTMLButtonElement>;
|
|
@@ -12,7 +12,7 @@ const HomeCardHeader = ({
|
|
|
12
12
|
className,
|
|
13
13
|
...rest
|
|
14
14
|
}) => {
|
|
15
|
-
const hasAction = !!
|
|
15
|
+
const hasAction = !!onActionClick && (!!actionLabel || !!actionLeftIcon || !!actionRightIcon);
|
|
16
16
|
return /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", gap: "8", wrap: "wrap", className: clsx("home-card-header", className), ...rest, children: [
|
|
17
17
|
/* @__PURE__ */ jsx("h3", { className: "home-card-header-title", children: title }),
|
|
18
18
|
hasAction && /* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", size: "sm", variant: "ghost", onClick: onActionClick, className: "home-card-header-action", leftIcon: actionLeftIcon, rightIcon: actionRightIcon, "data-testid": "home-card-header-action", ...actionProps, children: actionLabel })
|
|
@@ -47,7 +47,7 @@ const MessageFlash = ({
|
|
|
47
47
|
}), title: t("close.message", {
|
|
48
48
|
title: message.title
|
|
49
49
|
}) }),
|
|
50
|
-
/* @__PURE__ */ jsx("div", { className: "message-flash-icon", role: "img", "aria-label": message.color === "red" ? t("warning") : t("information"), children: message.color && message.color === "red" ? /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}) : /* @__PURE__ */ jsx(SvgIconInfoCircle, {}) }),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: "message-flash-icon", role: "img", "aria-label": message.color === "red" ? t("homepage.messageFlash.warning") : t("homepage.messageFlash.information"), children: message.color && message.color === "red" ? /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}) : /* @__PURE__ */ jsx(SvgIconInfoCircle, {}) }),
|
|
51
51
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", className: "w-100 message-flash-body", children: [
|
|
52
52
|
/* @__PURE__ */ jsx(Card.Title, { children: message.title }),
|
|
53
53
|
/* @__PURE__ */ jsx("div", { ref: contentRef, className: classesContent, dangerouslySetInnerHTML: {
|
|
@@ -14,7 +14,7 @@ import Divider from "../../../../components/Divider/Divider.js";
|
|
|
14
14
|
const NotificationList = ({
|
|
15
15
|
notifications,
|
|
16
16
|
notificationTypes,
|
|
17
|
-
selectedTypes,
|
|
17
|
+
selectedTypes = [],
|
|
18
18
|
onFilterChange,
|
|
19
19
|
onCloseNotifications,
|
|
20
20
|
onLoadNextPage,
|
|
@@ -25,19 +25,19 @@ const NotificationList = ({
|
|
|
25
25
|
t
|
|
26
26
|
} = useTranslation(), loadNextRef = useInfiniteScroll({
|
|
27
27
|
callback: () => onLoadNextPage == null ? void 0 : onLoadNextPage()
|
|
28
|
-
}), handleCloseClick = () => {
|
|
28
|
+
}), handleFilterChange = (types) => onFilterChange == null ? void 0 : onFilterChange(types), handleCloseClick = () => {
|
|
29
29
|
onCloseNotifications && onCloseNotifications();
|
|
30
30
|
};
|
|
31
31
|
return /* @__PURE__ */ jsx("section", { role: "region", className: "notification-list", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
32
32
|
/* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", wrap: "nowrap", className: "py-16 ps-24 pe-8", children: [
|
|
33
33
|
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "8", className: "notification-list-title", children: [
|
|
34
34
|
/* @__PURE__ */ jsx("h4", { className: "text-truncate", children: t("homepage.notifications-list.title") }),
|
|
35
|
-
notificationTypes && notificationTypes.length > 0 && /* @__PURE__ */ jsx(NotificationFilterMenu, { notificationTypes, selectedTypes
|
|
35
|
+
notificationTypes && notificationTypes.length > 0 && /* @__PURE__ */ jsx(NotificationFilterMenu, { notificationTypes, selectedTypes, onFilterChange: handleFilterChange })
|
|
36
36
|
] }),
|
|
37
37
|
onCloseNotifications && /* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", variant: "ghost", rightIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: handleCloseClick, "aria-label": t("homepage.notifications-list.close"), title: t("homepage.notifications-list.close"), "data-testid": "notification-list-close-button" })
|
|
38
38
|
] }),
|
|
39
|
-
(notifications
|
|
40
|
-
/* @__PURE__ */ jsx("ul", { children: notifications
|
|
39
|
+
isLoading && !(notifications != null && notifications.length) ? /* @__PURE__ */ jsx(NotificationListSkeleton, {}) : !notifications || notifications.length === 0 ? /* @__PURE__ */ jsx("div", { className: "mx-24", children: /* @__PURE__ */ jsx(EmptyScreen, { size: 135, imageSrc: illuEmptyNotification, imageAlt: t("homepage.notifications-list.empty.description"), text: t("homepage.notifications-list.empty.description") }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx("ul", { children: notifications.map((notification, index) => /* @__PURE__ */ jsxs("li", { children: [
|
|
41
41
|
/* @__PURE__ */ jsx(NotificationItem, { notification }),
|
|
42
42
|
/* @__PURE__ */ jsx(Divider, { className: "border-grey-300 my-0" })
|
|
43
43
|
] }, "notification-list-" + notification._id + "-" + index)) }),
|
|
@@ -3,9 +3,9 @@ import React from "react";
|
|
|
3
3
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
4
4
|
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
5
5
|
import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
|
|
6
|
-
const NotificationSkeleton = /* @__PURE__ */ React.forwardRef((_props, ref) => /* @__PURE__ */ jsx(Flex, { direction: "column", className: "notification", gap: "8", ref, children: /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: "8", children: [
|
|
6
|
+
const NotificationSkeleton = /* @__PURE__ */ React.forwardRef((_props, ref) => /* @__PURE__ */ jsx(Flex, { direction: "column", className: "notification-item", gap: "8", ref, children: /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: "8", children: [
|
|
7
7
|
/* @__PURE__ */ jsx("div", { className: "notification-item-picture", children: /* @__PURE__ */ jsx(Avatar, { alt: "Notification Picture", variant: "circle", className: "notification-item-avatar" }) }),
|
|
8
|
-
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "8", className: "notification-message", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "8", className: "notification-item-message", children: [
|
|
9
9
|
/* @__PURE__ */ jsx(TextSkeleton, {}),
|
|
10
10
|
/* @__PURE__ */ jsx(TextSkeleton, {}),
|
|
11
11
|
/* @__PURE__ */ jsx("div", { className: "placeholder col-4", style: {
|
|
@@ -16,11 +16,7 @@ const NotificationFilterMenu = ({
|
|
|
16
16
|
onFilterChange(types), setIsOpen(!1);
|
|
17
17
|
};
|
|
18
18
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", color: "secondary", variant: "outline", size: "md", leftIcon: /* @__PURE__ */ jsx(SvgIconFilter, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, {}), "aria-label": t("homepage.notifications.filter-modal.trigger",
|
|
20
|
-
defaultValue: "Filtrer les notifications"
|
|
21
|
-
}), title: t("homepage.notifications.filter-modal.trigger", {
|
|
22
|
-
defaultValue: "Filtrer les notifications"
|
|
23
|
-
}), onClick: () => setIsOpen(!0), "data-testid": "notification-filter-button" }),
|
|
19
|
+
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", color: "secondary", variant: "outline", size: "md", leftIcon: /* @__PURE__ */ jsx(SvgIconFilter, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, {}), "aria-label": t("homepage.notifications.filter-modal.trigger"), title: t("homepage.notifications.filter-modal.trigger"), onClick: () => setIsOpen(!0), "data-testid": "notification-filter-button" }),
|
|
24
20
|
isOpen && /* @__PURE__ */ jsx(NotificationFilterModal, { isOpen, allTypes: notificationTypes, appliedTypes: selectedTypes, onCancel: () => setIsOpen(!1), onApply: handleApply })
|
|
25
21
|
] });
|
|
26
22
|
};
|
package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useMemo } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import SvgIconCheck from "../../../../icons/components/IconCheck.js";
|
|
6
6
|
import { getAppCodeAndI18nKey } from "./notificationAdapter.js";
|
|
7
|
-
import
|
|
7
|
+
import ModalBeta from "../../../../../components/ModalBeta/ModalBeta.js";
|
|
8
8
|
import Flex from "../../../../../components/Flex/Flex.js";
|
|
9
|
+
import Checkbox from "../../../../../components/Checkbox/Checkbox.js";
|
|
9
10
|
import AppIcon from "../../../../../components/AppIcon/AppIcon.js";
|
|
10
11
|
import ButtonBeta from "../../../../../components/ButtonBeta/ButtonBeta.js";
|
|
11
12
|
const NotificationFilterModal = ({
|
|
@@ -18,7 +19,7 @@ const NotificationFilterModal = ({
|
|
|
18
19
|
const {
|
|
19
20
|
t,
|
|
20
21
|
i18n
|
|
21
|
-
} = useTranslation(), [selected, setSelected] = useState(appliedTypes),
|
|
22
|
+
} = useTranslation(), [selected, setSelected] = useState(appliedTypes), allTypesSorted = useMemo(() => allTypes.map((type) => {
|
|
22
23
|
const [appCode, appI18nKey] = getAppCodeAndI18nKey(type), label = t(appI18nKey, {
|
|
23
24
|
defaultValue: appCode
|
|
24
25
|
});
|
|
@@ -35,16 +36,13 @@ const NotificationFilterModal = ({
|
|
|
35
36
|
}, toggleAll = () => {
|
|
36
37
|
setSelected(selected.length === allTypes.length ? [] : allTypes);
|
|
37
38
|
};
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t("homepage.notifications.filter-modal.title") }),
|
|
42
|
-
/* @__PURE__ */ jsx(Modal.Subtitle, { children: t("homepage.notifications.filter-modal.subtitle") }),
|
|
43
|
-
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
|
39
|
+
return /* @__PURE__ */ jsxs(ModalBeta, { id: "notification-filter-modal", size: "l", isOpen, onModalClose: onCancel, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(ModalBeta.Header, { subtitle: t("homepage.notifications.filter-modal.subtitle"), onModalClose: onCancel, children: t("homepage.notifications.filter-modal.title") }),
|
|
41
|
+
/* @__PURE__ */ jsxs(ModalBeta.Body, { children: [
|
|
44
42
|
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "8", className: "mb-24", children: [
|
|
45
43
|
/* @__PURE__ */ jsxs("label", { className: "notification-filter-select-all notification-filter-chip", children: [
|
|
46
44
|
/* @__PURE__ */ jsx("span", { children: t("homepage.notifications.filter-modal.select-all") }),
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
45
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: selected.length === allTypes.length, indeterminate: selected.length > 0 && selected.length < allTypes.length, onChange: toggleAll })
|
|
48
46
|
] }),
|
|
49
47
|
/* @__PURE__ */ jsx("span", { className: "notification-filter-count", children: t("homepage.notifications.filter-modal.count", {
|
|
50
48
|
selected: selected.length,
|
|
@@ -62,11 +60,11 @@ const NotificationFilterModal = ({
|
|
|
62
60
|
}), children: [
|
|
63
61
|
/* @__PURE__ */ jsx(AppIcon, { app: appCode, size: "24", iconFit: "contain" }),
|
|
64
62
|
/* @__PURE__ */ jsx("span", { children: label }),
|
|
65
|
-
/* @__PURE__ */ jsx(
|
|
63
|
+
/* @__PURE__ */ jsx(Checkbox, { checked, onChange: () => toggleType(type) })
|
|
66
64
|
] }, type);
|
|
67
65
|
}) })
|
|
68
66
|
] }),
|
|
69
|
-
/* @__PURE__ */ jsxs(
|
|
67
|
+
/* @__PURE__ */ jsxs(ModalBeta.Footer, { children: [
|
|
70
68
|
/* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("cancel") }),
|
|
71
69
|
/* @__PURE__ */ jsx(ButtonBeta, { color: "default", onClick: () => onApply(selected), type: "button", variant: "filled", rightIcon: /* @__PURE__ */ jsx(SvgIconCheck, {}), children: t("homepage.notifications.filter-modal.confirm") })
|
|
72
70
|
] })
|
package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js
CHANGED
|
@@ -20,16 +20,10 @@ const NotificationOptionsMenu = ({
|
|
|
20
20
|
} = useDeleteNotification(), [isReportModalOpen, setIsReportModalOpen] = useState(!1);
|
|
21
21
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
22
|
/* @__PURE__ */ jsx(Dropdown, { overflow: !1, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
-
/* @__PURE__ */ jsx(IconButton, { ...triggerProps, type: "button", "aria-label": t("homepage.notifications.options.label", {
|
|
24
|
-
defaultValue: "Options de la notification"
|
|
25
|
-
}), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconOptions, {}), "data-testid": "notification-item-options-button" }),
|
|
23
|
+
/* @__PURE__ */ jsx(IconButton, { ...triggerProps, type: "button", "aria-label": t("homepage.notifications.options.label"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconOptions, {}), "data-testid": "notification-item-options-button" }),
|
|
26
24
|
/* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
|
|
27
|
-
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}), onClick: () => setIsReportModalOpen(!0), children: t("homepage.notifications.options.report",
|
|
28
|
-
|
|
29
|
-
}) }),
|
|
30
|
-
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), onClick: () => deleteNotification(notificationId), children: t("homepage.notifications.options.delete", {
|
|
31
|
-
defaultValue: "Supprimer"
|
|
32
|
-
}) })
|
|
25
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}), onClick: () => setIsReportModalOpen(!0), children: t("homepage.notifications.options.report") }),
|
|
26
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), onClick: () => deleteNotification(notificationId), children: t("homepage.notifications.options.delete") })
|
|
33
27
|
] })
|
|
34
28
|
] }) }),
|
|
35
29
|
isReportModalOpen && /* @__PURE__ */ jsx(ReportNotificationModal, { isOpen: isReportModalOpen, onCancel: () => setIsReportModalOpen(!1), onConfirm: () => {
|
package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import SvgIconAlertTriangle from "../../../../icons/components/IconAlertTriangle.js";
|
|
4
|
-
import
|
|
4
|
+
import ModalBeta from "../../../../../components/ModalBeta/ModalBeta.js";
|
|
5
5
|
import ButtonBeta from "../../../../../components/ButtonBeta/ButtonBeta.js";
|
|
6
6
|
const ReportNotificationModal = ({
|
|
7
7
|
isOpen,
|
|
@@ -11,18 +11,12 @@ const ReportNotificationModal = ({
|
|
|
11
11
|
const {
|
|
12
12
|
t
|
|
13
13
|
} = useTranslation();
|
|
14
|
-
return /* @__PURE__ */ jsxs(
|
|
15
|
-
/* @__PURE__ */ jsx(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("p", { children: t("homepage.notifications.report-modal.body", {
|
|
19
|
-
defaultValue: "Attention ! Vous souhaitez signaler une notification inappropriée ou qui ne respecte pas les conditions d'utilisation de ONE. L'heure et l'origine de ce signalement seront enregistrées et transmises à un administrateur pour traitement."
|
|
20
|
-
}) }) }),
|
|
21
|
-
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
14
|
+
return /* @__PURE__ */ jsxs(ModalBeta, { id: "report-notification-modal", size: "m", isOpen, onModalClose: onCancel, children: [
|
|
15
|
+
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onCancel, children: t("homepage.notifications.report-modal.title") }),
|
|
16
|
+
/* @__PURE__ */ jsx(ModalBeta.Body, { children: /* @__PURE__ */ jsx("p", { children: t("homepage.notifications.report-modal.body") }) }),
|
|
17
|
+
/* @__PURE__ */ jsxs(ModalBeta.Footer, { children: [
|
|
22
18
|
/* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("cancel") }),
|
|
23
|
-
/* @__PURE__ */ jsx(ButtonBeta, { color: "default", onClick: onConfirm, type: "button", variant: "filled", leftIcon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}), children: t("homepage.notifications.report-modal.confirm"
|
|
24
|
-
defaultValue: "Signaler la notification"
|
|
25
|
-
}) })
|
|
19
|
+
/* @__PURE__ */ jsx(ButtonBeta, { color: "default", onClick: onConfirm, type: "button", variant: "filled", leftIcon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}), children: t("homepage.notifications.report-modal.confirm") })
|
|
26
20
|
] })
|
|
27
21
|
] });
|
|
28
22
|
};
|
|
@@ -8,34 +8,36 @@ const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
}, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCodeAndI18nKey = (appCode) => {
|
|
10
10
|
appCode = appCode.toLowerCase();
|
|
11
|
-
|
|
11
|
+
const appI18nKey = `homepage.notification.type.${appCode}`;
|
|
12
12
|
switch (appCode) {
|
|
13
|
+
case "collaborativeeditor":
|
|
14
|
+
appCode = "pad";
|
|
15
|
+
break;
|
|
13
16
|
case "collaborativewall":
|
|
14
17
|
appCode = "collaborative-wall";
|
|
15
18
|
break;
|
|
16
19
|
case "formulaire":
|
|
17
|
-
|
|
20
|
+
appCode = "forms";
|
|
18
21
|
break;
|
|
19
22
|
case "messagerie":
|
|
20
|
-
|
|
23
|
+
appCode = "conversation";
|
|
21
24
|
break;
|
|
22
25
|
case "news":
|
|
23
|
-
|
|
26
|
+
appCode = "actualites";
|
|
24
27
|
break;
|
|
25
28
|
case "homeworks":
|
|
26
29
|
appCode = "cahier-de-texte";
|
|
27
30
|
break;
|
|
28
31
|
case "userbook_motto":
|
|
29
|
-
appI18nKey = "userbook_motto", appCode = "userbook";
|
|
30
|
-
break;
|
|
31
32
|
case "userbook_mood":
|
|
32
|
-
appI18nKey = "userbook_mood", appCode = "userbook";
|
|
33
|
-
break;
|
|
34
33
|
case "userbook_discovervisiblegroups":
|
|
35
|
-
|
|
34
|
+
appCode = "userbook";
|
|
35
|
+
break;
|
|
36
|
+
case "viescolaire":
|
|
37
|
+
appCode = "vie-scolaire";
|
|
36
38
|
break;
|
|
37
39
|
default:
|
|
38
|
-
|
|
40
|
+
appCode = appCode.replace(/_/g, "-");
|
|
39
41
|
}
|
|
40
42
|
return [appCode, appI18nKey];
|
|
41
43
|
}, notificationAdapter = (notification) => {
|
|
@@ -14,31 +14,30 @@ const useNotificationListContainer = () => {
|
|
|
14
14
|
mutate: saveTimelinePreference
|
|
15
15
|
} = useSaveTimelinePreference(), [selectedTypes, setSelectedTypesState] = useState();
|
|
16
16
|
useEffect(() => {
|
|
17
|
-
|
|
18
|
-
const preferredTypes = preference == null ? void 0 : preference.type;
|
|
19
|
-
setSelectedTypesState(preferredTypes && preferredTypes.length > 0 ? preferredTypes : notificationTypes ?? []);
|
|
20
|
-
}
|
|
17
|
+
selectedTypes === void 0 && isFetchedTypes && isFetchedPreference && setSelectedTypesState((preference == null ? void 0 : preference.type) ?? notificationTypes ?? []);
|
|
21
18
|
}, [selectedTypes, isFetchedTypes, isFetchedPreference, preference, notificationTypes]);
|
|
22
19
|
const setSelectedTypes = (types) => {
|
|
23
20
|
setSelectedTypesState(types), saveTimelinePreference({
|
|
24
21
|
...preference,
|
|
25
22
|
type: types
|
|
26
23
|
});
|
|
27
|
-
}, {
|
|
28
|
-
data
|
|
24
|
+
}, hasNoTypeSelected = (selectedTypes == null ? void 0 : selectedTypes.length) === 0, {
|
|
25
|
+
data,
|
|
29
26
|
hasNextPage,
|
|
30
27
|
isLoading: isLoadingNotifications,
|
|
31
28
|
error: errorNotifications,
|
|
32
29
|
fetchNextPage
|
|
33
|
-
} = useNotifications(selectedTypes ?? [], isFetchedTypes && !!selectedTypes);
|
|
30
|
+
} = useNotifications(selectedTypes ?? [], isFetchedTypes && !!selectedTypes && !hasNoTypeSelected);
|
|
34
31
|
return {
|
|
35
|
-
notifications,
|
|
32
|
+
notifications: hasNoTypeSelected ? [] : data,
|
|
36
33
|
notificationTypes,
|
|
37
34
|
selectedTypes,
|
|
38
35
|
setSelectedTypes,
|
|
39
|
-
hasNextPage,
|
|
36
|
+
hasNextPage: hasNoTypeSelected ? !1 : hasNextPage,
|
|
40
37
|
loadNextPage: () => fetchNextPage(),
|
|
41
|
-
|
|
38
|
+
// The notification query stays disabled until the saved filter is
|
|
39
|
+
// read, so this wait must count as loading too.
|
|
40
|
+
isLoading: isLoadingTypes || selectedTypes === void 0 || isLoadingNotifications,
|
|
42
41
|
error: errorTypes || errorNotifications
|
|
43
42
|
};
|
|
44
43
|
}, useHasNotificationToday = () => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import illuQwant from "@edifice.io/bootstrap/dist/images/homepage/illu-qwant.png";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
6
|
+
import SvgIconSearch from "../../../icons/components/IconSearch.js";
|
|
7
|
+
import HomeCard from "../HomeCard/HomeCard.js";
|
|
8
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
|
+
import Image from "../../../../components/Image/Image.js";
|
|
10
|
+
import FormControl from "../../../../components/Form/FormControl.js";
|
|
11
|
+
import Input from "../../../../components/Input/Input.js";
|
|
12
|
+
function Qwant({
|
|
13
|
+
handleActionClick
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation(), {
|
|
18
|
+
register
|
|
19
|
+
} = useForm();
|
|
20
|
+
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
21
|
+
/* @__PURE__ */ jsxs("div", { className: "qwant__header", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("h3", { className: "qwant__title", children: t("homepage.widget.qwant.title") }),
|
|
23
|
+
/* @__PURE__ */ jsx(ButtonBeta, { className: "qwant__header-button", "data-testid": "qwant-button-open", "aria-label": t("homepage.widget.qwant.open"), onClick: handleActionClick, leftIcon: /* @__PURE__ */ jsx(SvgIconExternalLink, {}), variant: "ghost", color: "tertiary" })
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ jsx(HomeCard.Content, { children: /* @__PURE__ */ jsxs("div", { className: "qwant", children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "qwant__intro", children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Image, { src: illuQwant, alt: "Qwant", className: "qwant__logo" }),
|
|
28
|
+
/* @__PURE__ */ jsx("p", { className: "qwant__description", children: t("homepage.widget.qwant.description") })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx("form", { method: "GET", action: "https://www.qwant.com", target: "_blank", className: "qwant__search", children: /* @__PURE__ */ jsxs(FormControl, { id: "inputQwantQuery", className: "qwant__search-field", children: [
|
|
31
|
+
/* @__PURE__ */ jsx(FormControl.Label, { className: "visually-hidden", children: t("search") }),
|
|
32
|
+
/* @__PURE__ */ jsx(Input, { "data-testid": "qwant-search-input", placeholder: t("search"), size: "md", type: "text", maxLength: 255, ...register("q") }),
|
|
33
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: "l", value: "fr" }),
|
|
34
|
+
/* @__PURE__ */ jsx(ButtonBeta, { leftIcon: /* @__PURE__ */ jsx(SvgIconSearch, {}), type: "submit", "aria-label": t("search"), variant: "filled", color: "default" })
|
|
35
|
+
] }) })
|
|
36
|
+
] }) })
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
Qwant as default
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QwantContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Qwant from "./Qwant.js";
|
|
3
|
+
function QwantContainer() {
|
|
4
|
+
return /* @__PURE__ */ jsx(Qwant, { handleActionClick: () => {
|
|
5
|
+
window.open("https://www.qwant.com", "_blank", "noopener,noreferrer");
|
|
6
|
+
} });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
QwantContainer
|
|
10
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import SchoolSpace from "./SchoolSpace.js";
|
|
3
|
-
import { useUserSchools } from "
|
|
3
|
+
import { useUserSchools } from "../../hooks/useUserSchools.js";
|
|
4
4
|
function SchoolSpaceContainer() {
|
|
5
5
|
const {
|
|
6
6
|
handleSelectedSchoolChange,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
export interface UniversalisProps {
|
|
3
|
+
handleActionClick: () => void;
|
|
4
|
+
selectedSchool?: School;
|
|
5
|
+
onSelectedSchoolChange?: (school: School) => void;
|
|
6
|
+
schools?: School[];
|
|
7
|
+
}
|
|
8
|
+
export default function Universalis({ handleActionClick, selectedSchool, onSelectedSchoolChange, schools, }: UniversalisProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import illuUniversalis from "@edifice.io/bootstrap/dist/images/homepage/illu-universalis.png";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useForm } from "react-hook-form";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
8
|
+
import SvgIconRafterDown from "../../../icons/components/IconRafterDown.js";
|
|
9
|
+
import SvgIconSearch from "../../../icons/components/IconSearch.js";
|
|
10
|
+
import HomeCard from "../HomeCard/HomeCard.js";
|
|
11
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
12
|
+
import Image from "../../../../components/Image/Image.js";
|
|
13
|
+
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
14
|
+
import FormControl from "../../../../components/Form/FormControl.js";
|
|
15
|
+
import Input from "../../../../components/Input/Input.js";
|
|
16
|
+
import { getRotateTransitionStyle } from "../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";
|
|
17
|
+
const UNIVERSALIS_ENGINE_PARAM = "www";
|
|
18
|
+
function Universalis({
|
|
19
|
+
handleActionClick,
|
|
20
|
+
selectedSchool,
|
|
21
|
+
onSelectedSchoolChange,
|
|
22
|
+
schools
|
|
23
|
+
}) {
|
|
24
|
+
const {
|
|
25
|
+
t
|
|
26
|
+
} = useTranslation(), {
|
|
27
|
+
register
|
|
28
|
+
} = useForm(), [isExpanded, setIsExpanded] = useState(!1), hasManySchools = !!(schools && schools.length > 1), hasUai = !!(selectedSchool != null && selectedSchool.UAI), searchLabel = t(hasUai ? "search" : "homepage.widget.universalis.noUai");
|
|
29
|
+
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "universalis__header", children: [
|
|
31
|
+
/* @__PURE__ */ jsx("h3", { className: "universalis__title", children: t("homepage.widget.universalis.title") }),
|
|
32
|
+
/* @__PURE__ */ jsx(ButtonBeta, { className: "universalis__header-button", "data-testid": "universalis-button-open", "aria-label": t("homepage.widget.universalis.open"), onClick: handleActionClick, leftIcon: /* @__PURE__ */ jsx(SvgIconExternalLink, {}), variant: "ghost", color: "tertiary" })
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx(HomeCard.Content, { children: /* @__PURE__ */ jsxs("div", { className: "universalis", children: [
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "universalis__intro", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Image, { src: illuUniversalis, alt: "Universalis Éducation", className: "universalis__logo" }),
|
|
37
|
+
/* @__PURE__ */ jsx("p", { className: "universalis__description", children: t("homepage.widget.universalis.description") })
|
|
38
|
+
] }),
|
|
39
|
+
hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-start", onToggle: setIsExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("button", { ...triggerProps, type: "button", "aria-expanded": isExpanded, className: clsx("universalis__school-selector", {
|
|
41
|
+
"universalis__school-selector--open": isExpanded
|
|
42
|
+
}), children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "universalis__school-selector-label", children: selectedSchool == null ? void 0 : selectedSchool.name }),
|
|
44
|
+
/* @__PURE__ */ jsx(SvgIconRafterDown, { className: "universalis__school-selector-icon", style: getRotateTransitionStyle(isExpanded, {
|
|
45
|
+
degrees: 180
|
|
46
|
+
}) })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx(Dropdown.Menu, { children: schools == null ? void 0 : schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: school.name }, school.id)) })
|
|
49
|
+
] }) }),
|
|
50
|
+
/* @__PURE__ */ jsx("form", { method: "GET", action: "https://www.universalis-edu.com/nomade/precherche/", target: "_blank", className: "universalis__search", children: /* @__PURE__ */ jsxs(FormControl, { id: "inputUniversalisQuery", className: "universalis__search-field", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(FormControl.Label, { className: "visually-hidden", children: searchLabel }),
|
|
52
|
+
/* @__PURE__ */ jsx(Input, { placeholder: searchLabel, size: "md", type: "text", maxLength: 255, disabled: !hasUai, ...register("q") }),
|
|
53
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: "r", value: UNIVERSALIS_ENGINE_PARAM }),
|
|
54
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name: "uai", value: selectedSchool == null ? void 0 : selectedSchool.UAI }),
|
|
55
|
+
/* @__PURE__ */ jsx(ButtonBeta, { leftIcon: /* @__PURE__ */ jsx(SvgIconSearch, {}), type: "submit", "aria-label": searchLabel, variant: "filled", color: "default", disabled: !hasUai })
|
|
56
|
+
] }) })
|
|
57
|
+
] }) })
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
Universalis as default
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function UniversalisContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { WIDGET_NAME } from "@edifice.io/client";
|
|
3
|
+
import { useUserSchools } from "../../hooks/useUserSchools.js";
|
|
4
|
+
import Universalis from "./Universalis.js";
|
|
5
|
+
function UniversalisContainer() {
|
|
6
|
+
const {
|
|
7
|
+
handleSelectedSchoolChange,
|
|
8
|
+
...otherProps
|
|
9
|
+
} = useUserSchools(WIDGET_NAME.UNIVERSALIS);
|
|
10
|
+
return /* @__PURE__ */ jsx(Universalis, { handleActionClick: () => {
|
|
11
|
+
window.open("http://www.universalis-edu.com", "_blank", "noopener,noreferrer");
|
|
12
|
+
}, onSelectedSchoolChange: handleSelectedSchoolChange, ...otherProps });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
UniversalisContainer
|
|
16
|
+
};
|
|
@@ -5,8 +5,10 @@ export type UserSpaceProps = {
|
|
|
5
5
|
avatar: string;
|
|
6
6
|
profile: UserProfile[number];
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/** Renders a trigger button in the top-right corner when provided. */
|
|
9
|
+
onCustomizeWidgetsClick?: () => void;
|
|
8
10
|
};
|
|
9
|
-
declare function UserSpace({ name, avatar, profile, children, }: UserSpaceProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function UserSpace({ name, avatar, profile, children, onCustomizeWidgetsClick, }: UserSpaceProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
declare namespace UserSpace {
|
|
11
13
|
var displayName: string;
|
|
12
14
|
}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
+
import SvgIconAddWidget from "../../../icons/components/IconAddWidget.js";
|
|
3
4
|
import SvgIconClass from "../../../icons/components/IconClass.js";
|
|
4
5
|
import { useProfileLinks } from "./hooks/useProfileLinks.js";
|
|
5
6
|
import HomeCard from "../HomeCard/HomeCard.js";
|
|
6
7
|
import Flex from "../../../../components/Flex/Flex.js";
|
|
7
8
|
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
9
|
+
import IconButton from "../../../../components/Button/IconButton.js";
|
|
8
10
|
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
11
|
function UserSpace({
|
|
10
12
|
name,
|
|
11
13
|
avatar,
|
|
12
14
|
profile,
|
|
13
|
-
children
|
|
15
|
+
children,
|
|
16
|
+
onCustomizeWidgetsClick
|
|
14
17
|
}) {
|
|
15
18
|
const {
|
|
16
19
|
t
|
|
17
20
|
} = useTranslation(), links = useProfileLinks(profile);
|
|
18
21
|
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: [
|
|
19
|
-
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", justify: "between", gap: "8", children: [
|
|
23
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "row", gap: "8", children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
|
|
25
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-name", className: "user-space--name", children: name }),
|
|
27
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "user-space-profile", className: "user-space--profile", children: t(profile) })
|
|
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 })
|
|
25
31
|
] }),
|
|
26
32
|
children && /* @__PURE__ */ jsx(HomeCard.Content, { children })
|
|
27
33
|
] });
|