@edifice.io/react 2.6.13-develop-integration-demo.20261108115137 → 2.6.13-develop-integration-demo.20261108143606
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 +12 -4
- package/dist/components/Masonry/Masonry.d.ts +40 -0
- package/dist/components/Masonry/Masonry.js +50 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/SearchBar/SearchBar.js +17 -26
- package/dist/components/index.d.ts +1 -0
- package/dist/homepage.js +110 -24
- package/dist/hooks/useUpload/useUpload.js +1 -1
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
- package/dist/icons.js +406 -404
- package/dist/index.js +2 -0
- 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/Captation/CaptationAudio/CaptationAudio.d.ts +7 -0
- package/dist/modules/homepage/components/Captation/CaptationAudio/CaptationAudio.js +44 -0
- package/dist/modules/homepage/components/Captation/CaptationVideo/CaptationVideo.d.ts +9 -0
- package/dist/modules/homepage/components/Captation/CaptationVideo/CaptationVideo.js +44 -0
- package/dist/modules/homepage/components/Captation/index.d.ts +2 -0
- package/dist/modules/homepage/components/Edumalin/Edumalin.d.ts +9 -0
- package/dist/modules/homepage/components/Edumalin/Edumalin.js +65 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.js +21 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.d.ts +8 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.js +62 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.d.ts +5 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.js +38 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.d.ts +5 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.js +12 -0
- package/dist/modules/homepage/components/Edumalin/index.d.ts +7 -0
- package/dist/modules/homepage/components/Edumalin/types.d.ts +24 -0
- package/dist/modules/homepage/components/Edumalin/types.js +4 -0
- package/dist/modules/homepage/components/Edumalin/useEdumalin.d.ts +16 -0
- package/dist/modules/homepage/components/Edumalin/useEdumalin.js +35 -0
- package/dist/modules/homepage/components/Edumalin/utils.d.ts +28 -0
- package/dist/modules/homepage/components/Edumalin/utils.js +56 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +65 -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 +69 -0
- package/dist/modules/homepage/components/Header/Header.js +8 -20
- 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/Mediacentre/Mediacentre.d.ts +13 -0
- package/dist/modules/homepage/components/Mediacentre/Mediacentre.js +57 -0
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.js +12 -0
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.d.ts +6 -0
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.js +30 -0
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.d.ts +17 -0
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.js +32 -0
- package/dist/modules/homepage/components/Mediacentre/index.d.ts +5 -0
- package/dist/modules/homepage/components/Mediacentre/services/mediacentreService.d.ts +24 -0
- package/dist/modules/homepage/components/Mediacentre/services/mediacentreService.js +25 -0
- package/dist/modules/homepage/components/Mediacentre/types.d.ts +8 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +0 -2
- package/dist/modules/homepage/components/Notifications/NotificationList.js +7 -8
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +7 -12
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +7 -4
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +11 -13
- 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/Rss/Rss.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/Rss.js +64 -0
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Rss/RssContainer.js +45 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +13 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +69 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +58 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +43 -0
- package/dist/modules/homepage/components/Rss/index.d.ts +6 -0
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +5 -0
- package/dist/modules/homepage/components/Rss/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +38 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +51 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +28 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +71 -0
- package/dist/modules/homepage/components/Rss/types.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/utils.d.ts +7 -0
- package/dist/modules/homepage/components/Rss/utils.js +19 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTime.d.ts +11 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTime.js +49 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.d.ts +10 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.js +115 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.d.ts +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.js +25 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.d.ts +5 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.js +22 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.d.ts +22 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.js +81 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.d.ts +14 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.js +22 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.d.ts +6 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.js +25 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.d.ts +31 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.js +34 -0
- package/dist/modules/homepage/components/ScreenTime/index.d.ts +6 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/index.js +5 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.d.ts +28 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.js +39 -0
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.d.ts +23 -0
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.js +41 -0
- package/dist/modules/homepage/components/ScreenTime/types.d.ts +30 -0
- package/dist/modules/homepage/components/ScreenTime/utils.d.ts +50 -0
- package/dist/modules/homepage/components/ScreenTime/utils.js +115 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.d.ts +43 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.js +23 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.d.ts +34 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.js +26 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.d.ts +14 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.js +64 -0
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.d.ts +20 -0
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.js +43 -0
- package/dist/modules/homepage/components/TabsKids/index.d.ts +3 -0
- package/dist/modules/homepage/components/TabsKids/utils/visibleTabs.d.ts +15 -0
- package/dist/modules/homepage/components/TabsKids/utils/visibleTabs.js +21 -0
- 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/UsefulLinks/UsefulLinks.js +2 -2
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
- 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 +14 -0
- 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/AudioRecorder/AudioRecorder.d.ts +2 -0
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js +24 -10
- package/dist/modules/multimedia/AudioRecorder/AudioRecorderTimer.js +1 -1
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.d.ts +1 -0
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.js +89 -50
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.d.ts +6 -0
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +53 -19
- package/dist/modules/multimedia/VideoRecorder/VideoRecorderToolbar.js +27 -27
- package/dist/modules/multimedia/VideoRecorder/useCameras.d.ts +2 -0
- package/dist/modules/multimedia/VideoRecorder/useCameras.js +10 -4
- package/dist/modules/multimedia/Workspace/Workspace.js +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import { default as default40 } from "./components/Loading/Loading.js";
|
|
|
42
42
|
import { default as default41 } from "./components/LoadingScreen/LoadingScreen.js";
|
|
43
43
|
import { default as default42 } from "./components/Logo/Logo.js";
|
|
44
44
|
import { default as default43 } from "./components/LogoBeta/LogoBeta.js";
|
|
45
|
+
import { Masonry } from "./components/Masonry/Masonry.js";
|
|
45
46
|
import { default as default44 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
46
47
|
import { default as default45 } from "./components/MediaViewer/MediaViewer.js";
|
|
47
48
|
import { default as default46 } from "./components/Modal/Modal.js";
|
|
@@ -231,6 +232,7 @@ export {
|
|
|
231
232
|
default41 as LoadingScreen,
|
|
232
233
|
default42 as Logo,
|
|
233
234
|
default43 as LogoBeta,
|
|
235
|
+
Masonry,
|
|
234
236
|
default44 as MediaLibrary,
|
|
235
237
|
default45 as MediaViewer,
|
|
236
238
|
Menu,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState,
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
@@ -16,22 +16,20 @@ const HelpZone = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const {
|
|
18
18
|
t
|
|
19
|
-
} = useTranslation(), [portalRoot, setPortalRoot] = useState(null), [isCompact, setIsCompact] = useState(!1)
|
|
19
|
+
} = useTranslation(), [portalRoot, setPortalRoot] = useState(null), [isCompact, setIsCompact] = useState(!1);
|
|
20
20
|
if (useEffect(() => (document.body.classList.add("help-zone-active"), setPortalRoot(document.getElementById("portal")), () => {
|
|
21
21
|
document.body.classList.remove("help-zone-active");
|
|
22
22
|
}), []), useEffect(() => {
|
|
23
23
|
if (isCompact)
|
|
24
24
|
return;
|
|
25
|
-
const goCompact = () => setIsCompact(!0)
|
|
26
|
-
questionButtonRef.current && event.target instanceof Node && questionButtonRef.current.contains(event.target) || goCompact();
|
|
27
|
-
};
|
|
25
|
+
const goCompact = () => setIsCompact(!0);
|
|
28
26
|
return document.addEventListener("scroll", goCompact, {
|
|
29
27
|
capture: !0,
|
|
30
28
|
passive: !0
|
|
31
|
-
}),
|
|
29
|
+
}), () => {
|
|
32
30
|
document.removeEventListener("scroll", goCompact, {
|
|
33
31
|
capture: !0
|
|
34
|
-
})
|
|
32
|
+
});
|
|
35
33
|
};
|
|
36
34
|
}, [isCompact]), !isReady || !portalRoot)
|
|
37
35
|
return null;
|
|
@@ -44,7 +42,7 @@ const HelpZone = ({
|
|
|
44
42
|
"help-zone-logo--full": !isCompact
|
|
45
43
|
}), children: isCompact ? /* @__PURE__ */ jsx(SvgIconLogoEdificeSmall, { width: 18, height: 18 }) : /* @__PURE__ */ jsx(SvgIconLogoEdificeFull, { width: 81, height: 18 }) }) }) }),
|
|
46
44
|
/* @__PURE__ */ jsx("span", { className: "help-zone-divider" }),
|
|
47
|
-
/* @__PURE__ */ jsx(ButtonBeta, {
|
|
45
|
+
/* @__PURE__ */ jsx(ButtonBeta, { className: "help-zone-question", "aria-label": t("help-zone.support.open"), color: "tertiary", variant: "ghost", onClick: handleOpenHelpZone, children: /* @__PURE__ */ jsx(Tooltip, { message: t("help-zone.support.open"), placement: "top", children: /* @__PURE__ */ jsx(SvgIconQuestion, { width: 24, height: 24, color: "white" }) }) })
|
|
48
46
|
] }), portalRoot);
|
|
49
47
|
};
|
|
50
48
|
export {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import HelpZone from "./HelpZone.js";
|
|
3
3
|
import useZendeskGuide from "../../hooks/useZendeskGuide/useZendeskGuide.js";
|
|
4
|
-
function getHeaderColor() {
|
|
5
|
-
return getComputedStyle(document.documentElement).getPropertyValue("--primitive-blue-400").trim();
|
|
6
|
-
}
|
|
7
4
|
function HelpZoneContainer() {
|
|
8
|
-
const
|
|
5
|
+
const {
|
|
9
6
|
isReady,
|
|
10
7
|
isOpen,
|
|
11
8
|
open,
|
|
12
9
|
close
|
|
13
|
-
} = useZendeskGuide(
|
|
10
|
+
} = useZendeskGuide();
|
|
14
11
|
return /* @__PURE__ */ jsx(HelpZone, { isReady, isOpen, onOpen: open, onClose: close });
|
|
15
12
|
}
|
|
16
13
|
export {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
export interface AgendaProps {
|
|
3
|
+
events: CalendarEvent[];
|
|
4
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
5
|
+
onOpenAgendaClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Agenda: {
|
|
8
|
+
({ events, onEventClick, onOpenAgendaClick, }: AgendaProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import illuEmptyAgenda from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-agenda.svg";
|
|
5
|
+
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
6
|
+
import HomeCard from "../HomeCard/HomeCard.js";
|
|
7
|
+
import { AgendaEventCard } from "./AgendaEventCard.js";
|
|
8
|
+
import useDate from "../../../../hooks/useDate/useDate.js";
|
|
9
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
10
|
+
const capitalize = (value) => value.charAt(0).toUpperCase() + value.slice(1), Agenda = ({
|
|
11
|
+
events,
|
|
12
|
+
onEventClick,
|
|
13
|
+
onOpenAgendaClick = () => window.open("/calendar", "_self")
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation(), {
|
|
18
|
+
formatDate,
|
|
19
|
+
dateIsSame
|
|
20
|
+
} = useDate(), dayGroups = useMemo(() => {
|
|
21
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
22
|
+
return events.reduce((groups, event) => {
|
|
23
|
+
const lastGroup = groups[groups.length - 1];
|
|
24
|
+
return lastGroup && dateIsSame(lastGroup.date, event.startMoment, "day") ? (lastGroup.events.push(event), groups) : (groups.push({
|
|
25
|
+
key: event.id,
|
|
26
|
+
date: event.startMoment,
|
|
27
|
+
weekday: capitalize(formatDate(event.startMoment, "ddd")),
|
|
28
|
+
day: formatDate(event.startMoment, "D"),
|
|
29
|
+
month: dateIsSame(event.startMoment, now, "month") ? void 0 : formatDate(event.startMoment, "MMM"),
|
|
30
|
+
events: [event]
|
|
31
|
+
}), groups);
|
|
32
|
+
}, []);
|
|
33
|
+
}, [events, dateIsSame, formatDate]);
|
|
34
|
+
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(HomeCard.Header, { title: t("homepage.agenda.title"), actionLeftIcon: /* @__PURE__ */ jsx(SvgIconExternalLink, { width: "20", height: "20" }), onActionClick: onOpenAgendaClick, actionProps: {
|
|
36
|
+
"aria-label": t("homepage.agenda.openAgenda"),
|
|
37
|
+
"data-testid": "agenda-button-open"
|
|
38
|
+
} }),
|
|
39
|
+
/* @__PURE__ */ jsx(HomeCard.Content, { children: dayGroups.length === 0 ? /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", gap: "8", className: "agenda-empty", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("img", { src: illuEmptyAgenda, alt: "", width: 64, height: 64 }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "agenda-empty-text", children: t("homepage.agenda.empty") })
|
|
42
|
+
] }) : /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", className: "agenda-content", children: dayGroups.map((group) => /* @__PURE__ */ jsxs(Flex, { gap: "4", className: "agenda-day-group", "data-testid": "agenda-day-group", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", className: "agenda-day-group-date", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { children: group.weekday }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: "agenda-day-group-date-number", children: group.day }),
|
|
46
|
+
group.month && /* @__PURE__ */ jsx("span", { children: group.month })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", className: "agenda-day-group-events", children: group.events.map((event) => /* @__PURE__ */ jsx(AgendaEventCard, { event, onClick: () => onEventClick == null ? void 0 : onEventClick(event) }, event.id)) })
|
|
49
|
+
] }, group.key)) }) })
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
Agenda
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AgendaContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Agenda } from "./Agenda.js";
|
|
3
|
+
import { useAgendaContainer } from "./hooks/useAgendaContainer.js";
|
|
4
|
+
function AgendaContainer() {
|
|
5
|
+
const {
|
|
6
|
+
events
|
|
7
|
+
} = useAgendaContainer();
|
|
8
|
+
return /* @__PURE__ */ jsx(Agenda, { events, onEventClick: () => {
|
|
9
|
+
window.open("/calendar", "_self");
|
|
10
|
+
} });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
AgendaContainer
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
import { MouseEventHandler } from 'react';
|
|
3
|
+
export interface AgendaEventCardProps {
|
|
4
|
+
event: CalendarEvent;
|
|
5
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare const AgendaEventCard: {
|
|
8
|
+
({ event, onClick }: AgendaEventCardProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import SvgIconClock from "../../../icons/components/IconClock.js";
|
|
4
|
+
import useDate from "../../../../hooks/useDate/useDate.js";
|
|
5
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
6
|
+
const capitalize = (value) => value.charAt(0).toUpperCase() + value.slice(1), AgendaEventCard = ({
|
|
7
|
+
event,
|
|
8
|
+
onClick
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
t
|
|
12
|
+
} = useTranslation(), {
|
|
13
|
+
formatDate,
|
|
14
|
+
dateIsSame
|
|
15
|
+
} = useDate(), formatTime = (date) => formatDate(date, "HH[h]mm"), timeLabel = event.allDay ? t("homepage.agenda.allDay") : dateIsSame(event.startMoment, event.endMoment, "day") ? `${formatTime(event.startMoment)} - ${formatTime(event.endMoment)}` : t("homepage.agenda.multiDayTime", {
|
|
16
|
+
startTime: formatTime(event.startMoment),
|
|
17
|
+
endDay: capitalize(formatDate(event.endMoment, "ddd D")),
|
|
18
|
+
endTime: formatTime(event.endMoment)
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", className: "agenda-event-card", onClick, "data-testid": "agenda-event-card", children: [
|
|
21
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "8", className: "agenda-event-card-time", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(SvgIconClock, { width: "20", height: "20" }),
|
|
23
|
+
/* @__PURE__ */ jsx("span", { children: timeLabel })
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ jsx("p", { className: "agenda-event-card-title", children: event.title })
|
|
26
|
+
] });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
AgendaEventCard
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
/** Number of upcoming events shown by the widget. */
|
|
3
|
+
export declare const MAX_VISIBLE_EVENTS = 3;
|
|
4
|
+
export interface UseAgendaContainerReturn {
|
|
5
|
+
events: CalendarEvent[];
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Loads the current user's calendars, then their events, and keeps only the
|
|
11
|
+
* next `MAX_VISIBLE_EVENTS` events that haven't fully elapsed yet — an event
|
|
12
|
+
* still in progress (end date in the future) counts as "upcoming" too.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useAgendaContainer: () => UseAgendaContainerReturn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useCalendars, useEvents } from "../services/queries/agenda.js";
|
|
4
|
+
const MAX_VISIBLE_EVENTS = 3, useAgendaContainer = () => {
|
|
5
|
+
const {
|
|
6
|
+
data: calendars,
|
|
7
|
+
isLoading: isLoadingCalendars,
|
|
8
|
+
error: calendarsError
|
|
9
|
+
} = useCalendars(), calendarIds = useMemo(() => (calendars == null ? void 0 : calendars.map((calendar) => calendar.id)) ?? [], [calendars]), {
|
|
10
|
+
data: rawEvents,
|
|
11
|
+
isLoading: isLoadingEvents,
|
|
12
|
+
error: eventsError
|
|
13
|
+
} = useEvents(calendarIds, MAX_VISIBLE_EVENTS);
|
|
14
|
+
return {
|
|
15
|
+
events: useMemo(() => {
|
|
16
|
+
if (!rawEvents) return [];
|
|
17
|
+
const now = dayjs();
|
|
18
|
+
return rawEvents.filter((event) => dayjs(event.endMoment).isAfter(now)).sort((a, b) => dayjs(a.startMoment).diff(dayjs(b.startMoment))).slice(0, MAX_VISIBLE_EVENTS);
|
|
19
|
+
}, [rawEvents]),
|
|
20
|
+
isLoading: isLoadingCalendars || isLoadingEvents,
|
|
21
|
+
error: calendarsError ?? eventsError
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
MAX_VISIBLE_EVENTS,
|
|
26
|
+
useAgendaContainer
|
|
27
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Calendar, CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an agenda service with methods to fetch the current user's
|
|
4
|
+
* calendars and upcoming events (homepage "Agenda" widget).
|
|
5
|
+
*
|
|
6
|
+
* Backend contract (provisional, see IMPULS-5880/IMPULS-6095): `GET
|
|
7
|
+
* /calendar/calendars` lists the user's calendars, `GET
|
|
8
|
+
* /calendar/events/widget?calendarId=...&nb=N` returns up to `N` events for
|
|
9
|
+
* the given calendars. Whether that second endpoint already excludes past
|
|
10
|
+
* (fully elapsed) events isn't guaranteed, so callers should re-apply that
|
|
11
|
+
* filter themselves.
|
|
12
|
+
*
|
|
13
|
+
* @param baseURL The base URL for the agenda service API.
|
|
14
|
+
*/
|
|
15
|
+
export declare const createAgendaService: (baseURL: string) => {
|
|
16
|
+
/**
|
|
17
|
+
* Get the calendars the current user can see events from.
|
|
18
|
+
*/
|
|
19
|
+
getCalendars(): Promise<Calendar[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get up to `nb` events for the given calendars, in no particular order.
|
|
22
|
+
*/
|
|
23
|
+
getEvents(calendarIds: string[], nb: number): Promise<CalendarEvent[]>;
|
|
24
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
|
+
const toCalendar = ({
|
|
3
|
+
_id,
|
|
4
|
+
title,
|
|
5
|
+
color,
|
|
6
|
+
isExternal
|
|
7
|
+
}) => ({
|
|
8
|
+
id: _id,
|
|
9
|
+
title,
|
|
10
|
+
color,
|
|
11
|
+
isExternal
|
|
12
|
+
}), toCalendarEvent = ({
|
|
13
|
+
_id,
|
|
14
|
+
title,
|
|
15
|
+
allday,
|
|
16
|
+
startMoment,
|
|
17
|
+
endMoment,
|
|
18
|
+
calendar
|
|
19
|
+
}) => ({
|
|
20
|
+
id: _id,
|
|
21
|
+
calendarId: calendar[0],
|
|
22
|
+
title,
|
|
23
|
+
startMoment,
|
|
24
|
+
endMoment,
|
|
25
|
+
allDay: allday
|
|
26
|
+
}), createAgendaService = (baseURL) => ({
|
|
27
|
+
/**
|
|
28
|
+
* Get the calendars the current user can see events from.
|
|
29
|
+
*/
|
|
30
|
+
async getCalendars() {
|
|
31
|
+
return (await odeServices.http().get(`${baseURL}/calendar/calendars`)).map(toCalendar);
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Get up to `nb` events for the given calendars, in no particular order.
|
|
35
|
+
*/
|
|
36
|
+
async getEvents(calendarIds, nb) {
|
|
37
|
+
if (calendarIds.length === 0)
|
|
38
|
+
return [];
|
|
39
|
+
const query = new URLSearchParams();
|
|
40
|
+
return calendarIds.forEach((id) => query.append("calendarId", id)), query.set("nb", String(nb)), (await odeServices.http().get(`${baseURL}/calendar/events/widget?${query.toString()}`)).map(toCalendarEvent);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
createAgendaService
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Calendar, CalendarEvent } from '@edifice.io/client';
|
|
2
|
+
export declare const agendaQueryKeys: {
|
|
3
|
+
calendars: () => readonly ["agenda", "calendars"];
|
|
4
|
+
events: (calendarIds: string[], nb: number) => readonly ["agenda", "events", string[], number];
|
|
5
|
+
};
|
|
6
|
+
export declare const agendaQueryOptions: {
|
|
7
|
+
getCalendars(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Calendar[], Error, Calendar[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
8
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<Calendar[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, Calendar[]>;
|
|
11
|
+
};
|
|
12
|
+
getEvents(calendarIds: string[], nb: number): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<CalendarEvent[], Error, CalendarEvent[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
13
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<CalendarEvent[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, CalendarEvent[]>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const useCalendars: () => import('@tanstack/react-query').UseQueryResult<Calendar[], Error>;
|
|
19
|
+
export declare const useEvents: (calendarIds: string[], nb: number) => import('@tanstack/react-query').UseQueryResult<CalendarEvent[], Error>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { agendaService } from "../api/index.js";
|
|
3
|
+
const agendaQueryKeys = {
|
|
4
|
+
calendars: () => ["agenda", "calendars"],
|
|
5
|
+
events: (calendarIds, nb) => ["agenda", "events", calendarIds, nb]
|
|
6
|
+
}, agendaQueryOptions = {
|
|
7
|
+
getCalendars() {
|
|
8
|
+
return queryOptions({
|
|
9
|
+
queryKey: agendaQueryKeys.calendars(),
|
|
10
|
+
queryFn: async () => agendaService.getCalendars()
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
getEvents(calendarIds, nb) {
|
|
14
|
+
return queryOptions({
|
|
15
|
+
queryKey: agendaQueryKeys.events(calendarIds, nb),
|
|
16
|
+
queryFn: async () => agendaService.getEvents(calendarIds, nb),
|
|
17
|
+
enabled: calendarIds.length > 0
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}, useCalendars = () => useQuery(agendaQueryOptions.getCalendars()), useEvents = (calendarIds, nb) => useQuery(agendaQueryOptions.getEvents(calendarIds, nb));
|
|
21
|
+
export {
|
|
22
|
+
agendaQueryKeys,
|
|
23
|
+
agendaQueryOptions,
|
|
24
|
+
useCalendars,
|
|
25
|
+
useEvents
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BriefMeArticle, BriefMeStatus } from './types';
|
|
2
|
+
export interface BriefMeProps {
|
|
3
|
+
handleActionClick: () => void;
|
|
4
|
+
status: BriefMeStatus;
|
|
5
|
+
category: string;
|
|
6
|
+
onCategoryChange: (value: string) => void;
|
|
7
|
+
articles: BriefMeArticle[];
|
|
8
|
+
}
|
|
9
|
+
export default function BriefMe({ handleActionClick, status, category, onCategoryChange, articles, }: BriefMeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import illuEdumalinError from "@edifice.io/bootstrap/dist/images/homepage/illu-briefme-error.svg";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
6
|
+
import HomeCard from "../HomeCard/HomeCard.js";
|
|
7
|
+
import IconButton from "../../../../components/Button/IconButton.js";
|
|
8
|
+
import SegmentedControl from "../../../../components/SegmentedControl/SegmentedControl.js";
|
|
9
|
+
import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
|
|
10
|
+
import Image from "../../../../components/Image/Image.js";
|
|
11
|
+
function BriefMe({
|
|
12
|
+
handleActionClick,
|
|
13
|
+
status,
|
|
14
|
+
category,
|
|
15
|
+
onCategoryChange,
|
|
16
|
+
articles
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = useTranslation(), categoryOptions = [{
|
|
21
|
+
label: t("homepage.briefme.category.briefme"),
|
|
22
|
+
value: "briefme"
|
|
23
|
+
}, {
|
|
24
|
+
label: t("homepage.briefme.category.brief-eco"),
|
|
25
|
+
value: "brief-eco"
|
|
26
|
+
}, {
|
|
27
|
+
label: t("homepage.briefme.category.brief-science"),
|
|
28
|
+
value: "brief-science"
|
|
29
|
+
}];
|
|
30
|
+
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", className: "briefme", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "briefme__header", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("h3", { className: "briefme__title", children: t("homepage.briefme.title") }),
|
|
33
|
+
/* @__PURE__ */ jsx(IconButton, { "aria-label": t("homepage.briefme.open"), onClick: handleActionClick, icon: /* @__PURE__ */ jsx(SvgIconExternalLink, {}), variant: "ghost", color: "tertiary" })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsxs(HomeCard.Content, { className: clsx("briefme__body", `briefme__body--${status}`), children: [
|
|
36
|
+
status !== "error" && /* @__PURE__ */ jsx(SegmentedControl, { "aria-label": t("homepage.briefme.categories"), options: categoryOptions, value: category, onChange: onCategoryChange, className: "briefme__categories" }),
|
|
37
|
+
status === "loading" && /* @__PURE__ */ jsxs("div", { className: "briefme__loading", "data-testid": "briefme-loading", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg", className: "briefme__loading-item" }),
|
|
39
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg", className: "briefme__loading-item" }),
|
|
40
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg", className: "briefme__loading-item" })
|
|
41
|
+
] }),
|
|
42
|
+
status === "error" && /* @__PURE__ */ jsxs("div", { className: "briefme__error", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Image, { src: illuEdumalinError, alt: "", className: "briefme__error-illu" }),
|
|
44
|
+
/* @__PURE__ */ jsxs("p", { className: "briefme__error-message", children: [
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: "briefme__error-line", children: t("homepage.briefme.error.connection") }),
|
|
46
|
+
/* @__PURE__ */ jsx("span", { className: "briefme__error-line", children: t("homepage.briefme.error.help") })
|
|
47
|
+
] })
|
|
48
|
+
] }),
|
|
49
|
+
status === "empty" && /* @__PURE__ */ jsx("p", { className: "briefme__empty", children: t("homepage.briefme.empty") }),
|
|
50
|
+
status === "default" && /* @__PURE__ */ jsx("ul", { className: "briefme__list", children: articles.map((article) => /* @__PURE__ */ jsxs("li", { className: "briefme__article", children: [
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: "briefme__article-date", children: article.date }),
|
|
52
|
+
/* @__PURE__ */ jsx("a", { className: "briefme__article-title", href: article.url, target: "_blank", rel: "noopener noreferrer", children: article.title })
|
|
53
|
+
] }, article.id)) })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
BriefMe as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import BriefMe from "./BriefMe.js";
|
|
3
|
+
import { useBriefMe } from "./useBriefMe.js";
|
|
4
|
+
function BriefMeContainer() {
|
|
5
|
+
const {
|
|
6
|
+
category,
|
|
7
|
+
setCategory,
|
|
8
|
+
articles,
|
|
9
|
+
status
|
|
10
|
+
} = useBriefMe();
|
|
11
|
+
return /* @__PURE__ */ jsx(BriefMe, { handleActionClick: () => {
|
|
12
|
+
window.open("https://brief.me", "_blank", "noopener,noreferrer");
|
|
13
|
+
}, status, category, onCategoryChange: (value) => setCategory(value), articles });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
BriefMeContainer
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface BriefMeArticle {
|
|
2
|
+
id: string;
|
|
3
|
+
date: string;
|
|
4
|
+
title: string;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
export type BriefMeStatus = 'loading' | 'default' | 'empty' | 'error';
|
|
8
|
+
/**
|
|
9
|
+
* Brief.me feeds are proxied and cached by app-registry, one endpoint per
|
|
10
|
+
* category. Keys match the SegmentedControl option values of `BriefMe`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BRIEFME_ENDPOINTS: {
|
|
13
|
+
readonly briefme: "/appregistry/widget/cache/external/briefme";
|
|
14
|
+
readonly 'brief-eco': "/appregistry/widget/cache/external/briefeco";
|
|
15
|
+
readonly 'brief-science': "/appregistry/widget/cache/external/briefscience";
|
|
16
|
+
};
|
|
17
|
+
export type BriefMeCategory = keyof typeof BRIEFME_ENDPOINTS;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
import { BriefMeArticle, BriefMeCategory, BriefMeStatus } from './types';
|
|
3
|
+
interface BriefMeEntry {
|
|
4
|
+
title: string;
|
|
5
|
+
published_at: string;
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Article URLs served by Brief.me embed the literal `ID_ETAB` and `ID_ENT`
|
|
10
|
+
* placeholders, which identify the subscribing school to their SSO. Both are
|
|
11
|
+
* replaced by base64-encoded values: the school UAI, and the GAR code taken
|
|
12
|
+
* from its exports.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildGarLink(url: string, school?: School): string;
|
|
15
|
+
export declare function briefMeQueryOptions(category: BriefMeCategory): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<BriefMeEntry[], Error, BriefMeEntry[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
16
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<BriefMeEntry[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, BriefMeEntry[]>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Loads the Brief.me articles of the selected category (most recent first,
|
|
22
|
+
* capped at `BRIEFME_MAX_ARTICLES`), and resolves their links against the
|
|
23
|
+
* school currently selected by the user.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useBriefMe(): {
|
|
26
|
+
category: "briefme" | "brief-eco" | "brief-science";
|
|
27
|
+
setCategory: import('react').Dispatch<import('react').SetStateAction<"briefme" | "brief-eco" | "brief-science">>;
|
|
28
|
+
articles: BriefMeArticle[];
|
|
29
|
+
status: BriefMeStatus;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
|
+
import { queryOptions, useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useState, useMemo } from "react";
|
|
4
|
+
import useDate from "../../../../hooks/useDate/useDate.js";
|
|
5
|
+
import { useUserSchools } from "../../hooks/useUserSchools.js";
|
|
6
|
+
import { BRIEFME_ENDPOINTS } from "./types.js";
|
|
7
|
+
const BRIEFME_DEFAULT_CATEGORY = "briefme", BRIEFME_MAX_ARTICLES = 5;
|
|
8
|
+
function buildGarLink(url, school) {
|
|
9
|
+
const schoolExports = (school == null ? void 0 : school.exports) ?? [], garExport = schoolExports.find((entry) => entry.startsWith("GAR-")), garCode = garExport ? garExport.replace("GAR-", "") : schoolExports[0] ?? "";
|
|
10
|
+
return url.replace("ID_ETAB", btoa((school == null ? void 0 : school.UAI) ?? "")).replace("ID_ENT", btoa(garCode));
|
|
11
|
+
}
|
|
12
|
+
function briefMeQueryOptions(category) {
|
|
13
|
+
return queryOptions({
|
|
14
|
+
queryKey: ["briefme", category],
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
const http = odeServices.http(), feed = await http.get(BRIEFME_ENDPOINTS[category]);
|
|
17
|
+
if (http.isResponseError())
|
|
18
|
+
throw new Error(http.latestResponse.statusText);
|
|
19
|
+
if (!feed || feed.error || !Array.isArray(feed.results))
|
|
20
|
+
throw new Error((feed == null ? void 0 : feed.error) ?? "briefme.invalid.response");
|
|
21
|
+
return feed.results;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function useBriefMe() {
|
|
26
|
+
const [category, setCategory] = useState(BRIEFME_DEFAULT_CATEGORY), {
|
|
27
|
+
selectedSchool
|
|
28
|
+
} = useUserSchools(), {
|
|
29
|
+
formatDate
|
|
30
|
+
} = useDate(), {
|
|
31
|
+
data,
|
|
32
|
+
isLoading,
|
|
33
|
+
error
|
|
34
|
+
} = useQuery(briefMeQueryOptions(category)), articles = useMemo(() => [...data ?? []].sort((a, b) => new Date(b.published_at).getTime() - new Date(a.published_at).getTime()).slice(0, BRIEFME_MAX_ARTICLES).map((entry) => ({
|
|
35
|
+
id: entry.url,
|
|
36
|
+
date: formatDate(entry.published_at, "long"),
|
|
37
|
+
title: entry.title,
|
|
38
|
+
url: buildGarLink(entry.url, selectedSchool)
|
|
39
|
+
})), [data, selectedSchool, formatDate]), status = error ? "error" : isLoading ? "loading" : articles.length > 0 ? "default" : "empty";
|
|
40
|
+
return {
|
|
41
|
+
category,
|
|
42
|
+
setCategory,
|
|
43
|
+
articles,
|
|
44
|
+
status
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
briefMeQueryOptions,
|
|
49
|
+
buildGarLink,
|
|
50
|
+
useBriefMe
|
|
51
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CantineSection, CantineStatus } from './types';
|
|
2
|
+
export interface CantineProps {
|
|
3
|
+
status: CantineStatus;
|
|
4
|
+
sections: CantineSection[];
|
|
5
|
+
handleFullScreenClick: () => void;
|
|
6
|
+
}
|
|
7
|
+
export default function Cantine({ status, sections, handleFullScreenClick, }: CantineProps): import("react/jsx-runtime").JSX.Element;
|