@edifice.io/react 2.6.13-develop.20261110094922 → 2.6.14-develop-b2school.20261116134947
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 +1 -1
- package/dist/components/Masonry/Masonry.d.ts +40 -0
- package/dist/components/Masonry/Masonry.js +1 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/SearchBar/SearchBar.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/homepage.js +1 -1
- package/dist/hooks/useBackground/useBackground.d.ts +6 -2
- package/dist/hooks/useBackground/useBackground.js +1 -1
- package/dist/hooks/useUpload/useUpload.js +1 -1
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +1 -1
- package/dist/icons-apps.js +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/HelpZone/HelpZone.js +1 -1
- package/dist/modules/HelpZone/HelpZoneContainer.js +1 -1
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/Agenda.js +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +1 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +1 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Agenda/services/api/index.js +1 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +1 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +9 -0
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +1 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +4 -0
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +1 -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 +1 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +31 -0
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +1 -0
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +7 -0
- package/dist/modules/homepage/components/Cantine/Cantine.js +1 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +1 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/CantineModal.js +1 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +10 -0
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +1 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +5 -0
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +1 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +6 -0
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +1 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +12 -0
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +1 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +11 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +1 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +24 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +1 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +28 -0
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Captation/CaptationVideo/CaptationVideo.d.ts +9 -0
- package/dist/modules/homepage/components/Captation/CaptationVideo/CaptationVideo.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBord.d.ts +9 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBord.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordCategoryRow.d.ts +17 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordCategoryRow.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordContainer.d.ts +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordContainer.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordError.d.ts +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordError.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordModal.d.ts +13 -0
- package/dist/modules/homepage/components/CarnetDeBord/CarnetDeBordModal.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/categoryConfig.d.ts +13 -0
- package/dist/modules/homepage/components/CarnetDeBord/categoryConfig.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/hooks/useCarnetDeBordContainer.d.ts +14 -0
- package/dist/modules/homepage/components/CarnetDeBord/hooks/useCarnetDeBordContainer.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/index.d.ts +6 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/api/carnetDeBordService.d.ts +16 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/api/carnetDeBordService.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/api/index.d.ts +3 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/api/index.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/queries/carnetDeBord.d.ts +11 -0
- package/dist/modules/homepage/components/CarnetDeBord/services/queries/carnetDeBord.js +1 -0
- package/dist/modules/homepage/components/CarnetDeBord/types.d.ts +37 -0
- package/dist/modules/homepage/components/CarnetDeBord/utils.d.ts +14 -0
- package/dist/modules/homepage/components/CarnetDeBord/utils.js +1 -0
- package/dist/modules/homepage/components/Edumalin/Edumalin.d.ts +9 -0
- package/dist/modules/homepage/components/Edumalin/Edumalin.js +1 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.js +1 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.d.ts +8 -0
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.js +1 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.d.ts +5 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.js +1 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.d.ts +5 -0
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Edumalin/useEdumalin.d.ts +16 -0
- package/dist/modules/homepage/components/Edumalin/useEdumalin.js +1 -0
- package/dist/modules/homepage/components/Edumalin/utils.d.ts +28 -0
- package/dist/modules/homepage/components/Edumalin/utils.js +1 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +1 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +4 -0
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +1 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +1 -0
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Header/Header.js +1 -1
- 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/LastInfos/LastInfosList.js +1 -1
- package/dist/modules/homepage/components/Mediacentre/Mediacentre.d.ts +13 -0
- package/dist/modules/homepage/components/Mediacentre/Mediacentre.js +1 -0
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.js +1 -0
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.d.ts +6 -0
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.js +1 -0
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.d.ts +17 -0
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Mediacentre/types.d.ts +8 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationList.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +1 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +1 -1
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +1 -1
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +1 -1
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +1 -1
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +5 -0
- package/dist/modules/homepage/components/Qwant/Qwant.js +1 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +2 -0
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Rss/RssContainer.js +1 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +13 -0
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +1 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +11 -0
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +1 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +25 -0
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +38 -0
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +1 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +33 -0
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +1 -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 +1 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +1 -1
- 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 +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.d.ts +10 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.d.ts +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.d.ts +5 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.d.ts +22 -0
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.d.ts +14 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.d.ts +6 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.d.ts +31 -0
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.js +1 -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 +1 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.d.ts +28 -0
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.js +1 -0
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.d.ts +23 -0
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.js +1 -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 +1 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.d.ts +43 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.js +1 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.d.ts +34 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.js +1 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.d.ts +14 -0
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.js +1 -0
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.d.ts +20 -0
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.js +1 -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 +1 -0
- package/dist/modules/homepage/components/Tools/CreateDocumentModal.d.ts +12 -0
- package/dist/modules/homepage/components/Tools/CreateDocumentModal.js +1 -0
- package/dist/modules/homepage/components/Tools/Tools.d.ts +17 -0
- package/dist/modules/homepage/components/Tools/Tools.js +1 -0
- package/dist/modules/homepage/components/Tools/ToolsContainer.d.ts +18 -0
- package/dist/modules/homepage/components/Tools/ToolsContainer.js +1 -0
- package/dist/modules/homepage/components/Tools/index.d.ts +4 -0
- package/dist/modules/homepage/components/Tools/utils.d.ts +8 -0
- package/dist/modules/homepage/components/Tools/utils.js +1 -0
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +9 -0
- package/dist/modules/homepage/components/Universalis/Universalis.js +1 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +1 -0
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +1 -0
- package/dist/modules/homepage/components/Universalis/index.d.ts +3 -0
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +1 -1
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +1 -1
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +1 -1
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +1 -1
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +1 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +1 -0
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
- package/dist/modules/homepage/components/index.d.ts +16 -2
- package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/hooks/useUserSchools.js +1 -0
- package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
- package/dist/modules/icons/components/IconAddWidget.js +1 -0
- package/dist/modules/icons/components/apps/IconNextcloudPoll.d.ts +7 -0
- package/dist/modules/icons/components/apps/IconNextcloudPoll.js +1 -0
- package/dist/modules/icons/components/apps/index.d.ts +1 -0
- package/dist/modules/icons/components/index.d.ts +1 -0
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.js +1 -1
- package/dist/modules/icons/components/nav/IconHomeBeta.js +1 -1
- package/dist/modules/icons/components/nav/IconMessagesBeta.js +1 -1
- package/dist/modules/icons/components/nav/IconMyAppsBeta.js +1 -1
- package/dist/modules/icons/components/nav/IconNotificationBeta.js +1 -1
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.d.ts +2 -0
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js +1 -1
- 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 +1 -1
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.d.ts +6 -0
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +1 -1
- package/dist/modules/multimedia/VideoRecorder/VideoRecorderToolbar.js +1 -1
- package/dist/modules/multimedia/VideoRecorder/useCameras.d.ts +2 -0
- package/dist/modules/multimedia/VideoRecorder/useCameras.js +1 -1
- package/dist/modules/multimedia/Workspace/Workspace.js +1 -1
- package/package.json +7 -6
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +0 -1
|
@@ -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 @@
|
|
|
1
|
+
import SvgIconExternalLink from"../../../icons/components/IconExternalLink.js";import Flex from"../../../../components/Flex/Flex.js";import useDate from"../../../../hooks/useDate/useDate.js";import HomeCard from"../HomeCard/HomeCard.js";import{AgendaEventCard}from"./AgendaEventCard.js";import{useMemo}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEmptyAgenda from"@edifice.io/bootstrap/dist/images/homepage/illu-empty-agenda.svg";var capitalize=value=>value.charAt(0).toUpperCase()+value.slice(1),Agenda=({events,onEventClick,onOpenAgendaClick=()=>window.open(`/calendar`,`_self`)})=>{let{t}=useTranslation(),{formatDate,dateIsSame}=useDate(),dayGroups=useMemo(()=>{let now=new Date().toISOString();return events.reduce((groups,event)=>{let lastGroup=groups[groups.length-1];return lastGroup&&dateIsSame(lastGroup.date,event.startMoment,`day`)?(lastGroup.events.push(event),groups):(groups.push({key:event.id,date:event.startMoment,weekday:capitalize(formatDate(event.startMoment,`ddd`)),day:formatDate(event.startMoment,`D`),month:dateIsSame(event.startMoment,now,`month`)?void 0:formatDate(event.startMoment,`MMM`),events:[event]}),groups)},[])},[events,dateIsSame,formatDate]);return jsxs(HomeCard,{variant:`primary`,children:[jsx(HomeCard.Header,{title:t(`homepage.agenda.title`),actionLeftIcon:jsx(SvgIconExternalLink,{width:`20`,height:`20`}),onActionClick:onOpenAgendaClick,actionProps:{"aria-label":t(`homepage.agenda.openAgenda`),"data-testid":`agenda-button-open`}}),jsx(HomeCard.Content,{children:dayGroups.length===0?jsxs(Flex,{direction:`column`,align:`center`,gap:`8`,className:`agenda-empty`,children:[jsx(`img`,{src:illuEmptyAgenda,alt:``,width:64,height:64}),jsx(`span`,{className:`agenda-empty-text`,children:t(`homepage.agenda.empty`)})]}):jsx(Flex,{direction:`column`,gap:`8`,className:`agenda-content`,children:dayGroups.map(group=>jsxs(Flex,{gap:`4`,className:`agenda-day-group`,"data-testid":`agenda-day-group`,children:[jsxs(Flex,{direction:`column`,align:`center`,className:`agenda-day-group-date`,children:[jsx(`span`,{children:group.weekday}),jsx(`span`,{className:`agenda-day-group-date-number`,children:group.day}),group.month&&jsx(`span`,{children:group.month})]}),jsx(Flex,{direction:`column`,gap:`8`,className:`agenda-day-group-events`,children:group.events.map(event=>jsx(AgendaEventCard,{event,onClick:()=>onEventClick?.(event)},event.id))})]},group.key))})})]})};export{Agenda};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AgendaContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Agenda}from"./Agenda.js";import{useAgendaContainer}from"./hooks/useAgendaContainer.js";import{jsx}from"react/jsx-runtime";function AgendaContainer(){let{events}=useAgendaContainer();return jsx(Agenda,{events,onEventClick:()=>{window.open(`/calendar`,`_self`)}})}export{AgendaContainer};
|
|
@@ -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 @@
|
|
|
1
|
+
import SvgIconClock from"../../../icons/components/IconClock.js";import Flex from"../../../../components/Flex/Flex.js";import useDate from"../../../../hooks/useDate/useDate.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var capitalize=value=>value.charAt(0).toUpperCase()+value.slice(1),AgendaEventCard=({event,onClick})=>{let{t}=useTranslation(),{formatDate,dateIsSame}=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`,{startTime:formatTime(event.startMoment),endDay:capitalize(formatDate(event.endMoment,`ddd D`)),endTime:formatTime(event.endMoment)});return jsxs(`button`,{type:`button`,className:`agenda-event-card`,onClick,"data-testid":`agenda-event-card`,children:[jsxs(Flex,{align:`center`,gap:`8`,className:`agenda-event-card-time`,children:[jsx(SvgIconClock,{width:`20`,height:`20`}),jsx(`span`,{children:timeLabel})]}),jsx(`p`,{className:`agenda-event-card-title`,children:event.title})]})};export{AgendaEventCard};
|
|
@@ -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 @@
|
|
|
1
|
+
import{useCalendars,useEvents}from"../services/queries/agenda.js";import{useMemo}from"react";import dayjs from"dayjs";var useAgendaContainer=()=>{let{data:calendars,isLoading:isLoadingCalendars,error:calendarsError}=useCalendars(),{data:rawEvents,isLoading:isLoadingEvents,error:eventsError}=useEvents(useMemo(()=>calendars?.map(calendar=>calendar.id)??[],[calendars]),3);return{events:useMemo(()=>{if(!rawEvents)return[];let now=dayjs();return rawEvents.filter(event=>dayjs(event.endMoment).isAfter(now)).sort((a,b)=>dayjs(a.startMoment).diff(dayjs(b.startMoment))).slice(0,3)},[rawEvents]),isLoading:isLoadingCalendars||isLoadingEvents,error:calendarsError??eventsError}};export{useAgendaContainer};
|
|
@@ -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 @@
|
|
|
1
|
+
import{odeServices}from"@edifice.io/client";var toCalendar=({_id,title,color,isExternal})=>({id:_id,title,color,isExternal}),toCalendarEvent=({_id,title,allday,startMoment,endMoment,calendar})=>({id:_id,calendarId:calendar[0],title,startMoment,endMoment,allDay:allday}),createAgendaService=baseURL=>({async getCalendars(){return(await odeServices.http().get(`${baseURL}/calendar/calendars`)).map(toCalendar)},async getEvents(calendarIds,nb){if(calendarIds.length===0)return[];let query=new URLSearchParams;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)}});export{createAgendaService};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createAgendaService}from"./agendaService.js";var agendaService=createAgendaService(``);export{agendaService};
|
|
@@ -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 @@
|
|
|
1
|
+
import{agendaService}from"../api/index.js";import{queryOptions,useQuery}from"@tanstack/react-query";var agendaQueryKeys={calendars:()=>[`agenda`,`calendars`],events:(calendarIds,nb)=>[`agenda`,`events`,calendarIds,nb]},agendaQueryOptions={getCalendars(){return queryOptions({queryKey:agendaQueryKeys.calendars(),queryFn:async()=>agendaService.getCalendars()})},getEvents(calendarIds,nb){return queryOptions({queryKey:agendaQueryKeys.events(calendarIds,nb),queryFn:async()=>agendaService.getEvents(calendarIds,nb),enabled:calendarIds.length>0})}},useCalendars=()=>useQuery(agendaQueryOptions.getCalendars()),useEvents=(calendarIds,nb)=>useQuery(agendaQueryOptions.getEvents(calendarIds,nb));export{useCalendars,useEvents};
|
|
@@ -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 @@
|
|
|
1
|
+
import SvgIconExternalLink from"../../../icons/components/IconExternalLink.js";import IconButton from"../../../../components/Button/IconButton.js";import Image from"../../../../components/Image/Image.js";import SegmentedControl from"../../../../components/SegmentedControl/SegmentedControl.js";import TextSkeleton from"../../../../components/Skeleton/TextSkeleton.js";import HomeCard from"../HomeCard/HomeCard.js";import clsx$1 from"clsx";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEdumalinError from"@edifice.io/bootstrap/dist/images/homepage/illu-briefme-error.svg";function BriefMe({handleActionClick,status,category,onCategoryChange,articles}){let{t}=useTranslation(),categoryOptions=[{label:t(`homepage.briefme.category.briefme`),value:`briefme`},{label:t(`homepage.briefme.category.brief-eco`),value:`brief-eco`},{label:t(`homepage.briefme.category.brief-science`),value:`brief-science`}];return jsxs(HomeCard,{variant:`primary`,className:`briefme`,children:[jsxs(`div`,{className:`briefme__header`,children:[jsx(`h3`,{className:`briefme__title`,children:t(`homepage.briefme.title`)}),jsx(IconButton,{"aria-label":t(`homepage.briefme.open`),onClick:handleActionClick,icon:jsx(SvgIconExternalLink,{}),variant:`ghost`,color:`tertiary`})]}),jsxs(HomeCard.Content,{className:clsx$1(`briefme__body`,`briefme__body--${status}`),children:[status!==`error`&&jsx(SegmentedControl,{"aria-label":t(`homepage.briefme.categories`),options:categoryOptions,value:category,onChange:onCategoryChange,className:`briefme__categories`}),status===`loading`&&jsxs(`div`,{className:`briefme__loading`,"data-testid":`briefme-loading`,children:[jsx(TextSkeleton,{size:`lg`,className:`briefme__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`briefme__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`briefme__loading-item`})]}),status===`error`&&jsxs(`div`,{className:`briefme__error`,children:[jsx(Image,{src:illuEdumalinError,alt:``,className:`briefme__error-illu`}),jsxs(`p`,{className:`briefme__error-message`,children:[jsx(`span`,{className:`briefme__error-line`,children:t(`homepage.briefme.error.connection`)}),jsx(`span`,{className:`briefme__error-line`,children:t(`homepage.briefme.error.help`)})]})]}),status===`empty`&&jsx(`p`,{className:`briefme__empty`,children:t(`homepage.briefme.empty`)}),status===`default`&&jsx(`ul`,{className:`briefme__list`,children:articles.map(article=>jsxs(`li`,{className:`briefme__article`,children:[jsx(`span`,{className:`briefme__article-date`,children:article.date}),jsx(`a`,{className:`briefme__article-title`,href:article.url,target:`_blank`,rel:`noopener noreferrer`,children:article.title})]},article.id))})]})]})}export{BriefMe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import BriefMe from"./BriefMe.js";import{useBriefMe}from"./useBriefMe.js";import{jsx}from"react/jsx-runtime";function BriefMeContainer(){let{category,setCategory,articles,status}=useBriefMe();return jsx(BriefMe,{handleActionClick:()=>{window.open(`https://brief.me`,`_blank`,`noopener,noreferrer`)},status,category,onCategoryChange:value=>setCategory(value),articles})}export{BriefMeContainer};
|
|
@@ -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 @@
|
|
|
1
|
+
var BRIEFME_ENDPOINTS={briefme:`/appregistry/widget/cache/external/briefme`,"brief-eco":`/appregistry/widget/cache/external/briefeco`,"brief-science":`/appregistry/widget/cache/external/briefscience`};export{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 @@
|
|
|
1
|
+
import useDate from"../../../../hooks/useDate/useDate.js";import{useUserSchools}from"../../hooks/useUserSchools.js";import{BRIEFME_ENDPOINTS}from"./types.js";import{useMemo,useState}from"react";import{odeServices}from"@edifice.io/client";import{queryOptions,useQuery}from"@tanstack/react-query";var BRIEFME_DEFAULT_CATEGORY=`briefme`,BRIEFME_MAX_ARTICLES=5;function buildGarLink(url,school){let schoolExports=school?.exports??[],garExport=schoolExports.find(entry=>entry.startsWith(`GAR-`)),garCode=garExport?garExport.replace(`GAR-`,``):schoolExports[0]??``;return url.replace(`ID_ETAB`,btoa(school?.UAI??``)).replace(`ID_ENT`,btoa(garCode))}function briefMeQueryOptions(category){return queryOptions({queryKey:[`briefme`,category],queryFn:async()=>{let http=odeServices.http(),feed=await http.get(BRIEFME_ENDPOINTS[category]);if(http.isResponseError())throw Error(http.latestResponse.statusText);if(!feed||feed.error||!Array.isArray(feed.results))throw Error(feed?.error??`briefme.invalid.response`);return feed.results}})}function useBriefMe(){let[category,setCategory]=useState(BRIEFME_DEFAULT_CATEGORY),{selectedSchool}=useUserSchools(),{formatDate}=useDate(),{data,isLoading,error}=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=>({id:entry.url,date:formatDate(entry.published_at,`long`),title:entry.title,url:buildGarLink(entry.url,selectedSchool)})),[data,selectedSchool,formatDate]);return{category,setCategory,articles,status:error?`error`:isLoading?`loading`:articles.length>0?`default`:`empty`}}export{briefMeQueryOptions,buildGarLink,useBriefMe};
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import SvgIconFullScreen from"../../../icons/components/IconFullScreen.js";import Image from"../../../../components/Image/Image.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import TextSkeleton from"../../../../components/Skeleton/TextSkeleton.js";import HomeCard from"../HomeCard/HomeCard.js";import CantineMenuSection from"./components/CantineMenuSection.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuCantineEmpty from"@edifice.io/bootstrap/dist/images/homepage/cantine/illu-cantine-empty.svg";function Cantine({status,sections,handleFullScreenClick}){let{t}=useTranslation();return jsxs(HomeCard,{variant:`primary`,className:`cantine`,children:[jsxs(`div`,{className:`cantine__header`,children:[jsx(`h3`,{className:`cantine__title`,children:t(`homepage.widget.cantine.title`)}),status!==`error`&&jsx(ButtonBeta,{"aria-label":t(`homepage.widget.cantine.open`),onClick:handleFullScreenClick,leftIcon:jsx(SvgIconFullScreen,{}),variant:`ghost`,color:`tertiary`})]}),jsxs(HomeCard.Content,{className:`cantine__content`,children:[status===`loading`&&jsxs(`div`,{className:`cantine__loading`,"data-testid":`cantine-loading`,children:[jsx(TextSkeleton,{size:`lg`,className:`cantine__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`cantine__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`cantine__loading-item`})]}),status===`error`&&jsxs(`div`,{className:`cantine__error`,children:[jsx(Image,{src:illuCantineEmpty,alt:t(`homepage.widget.cantine.emptyIllustration`),className:`cantine__error-illu`}),jsx(`p`,{className:`cantine__error-message`,children:t(`homepage.widget.cantine.error`)})]}),status===`empty`&&jsxs(`div`,{className:`cantine__empty`,children:[jsx(Image,{src:illuCantineEmpty,alt:t(`homepage.widget.cantine.emptyIllustration`),className:`cantine__empty-illu`}),jsx(`p`,{className:`cantine__empty-message`,children:t(`homepage.widget.cantine.empty`)}),jsx(ButtonBeta,{variant:`outline`,rightIcon:jsx(SvgIconFullScreen,{}),onClick:handleFullScreenClick,children:t(`homepage.widget.cantine.seeMore`)})]}),status===`default`&&jsx(`ul`,{className:`cantine__menu`,children:sections.map(section=>jsx(CantineMenuSection,{category:section.category,items:section.items},section.category))})]})]})}export{Cantine as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useUserSchools}from"../../hooks/useUserSchools.js";import Cantine from"./Cantine.js";import{CantineModalContainer}from"./CantineModalContainer.js";import{useCantine}from"./hooks/useCantine.js";import{useState}from"react";import{Fragment as Fragment$1,jsx,jsxs}from"react/jsx-runtime";function CantineContainer(){let{schools,selectedSchool}=useUserSchools(),{sections,status}=useCantine(selectedSchool),[isModalOpen,setIsModalOpen]=useState(!1);return jsxs(Fragment$1,{children:[jsx(Cantine,{status,sections,handleFullScreenClick:()=>setIsModalOpen(!0)}),isModalOpen&&jsx(CantineModalContainer,{schools,defaultSchool:selectedSchool,onClose:()=>setIsModalOpen(!1)})]})}export{CantineContainer};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
import { CantineMenuType, CantineSection, CantineStatus } from './types';
|
|
3
|
+
export interface CantineModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
schools: School[];
|
|
7
|
+
selectedSchool?: School;
|
|
8
|
+
onSchoolChange: (schoolId: string) => void;
|
|
9
|
+
hasDinner: boolean;
|
|
10
|
+
menuType: CantineMenuType;
|
|
11
|
+
onMenuTypeChange: (menuType: CantineMenuType) => void;
|
|
12
|
+
date: string;
|
|
13
|
+
canGoPrevious: boolean;
|
|
14
|
+
canGoNext: boolean;
|
|
15
|
+
onPreviousDay: () => void;
|
|
16
|
+
onNextDay: () => void;
|
|
17
|
+
sections: CantineSection[];
|
|
18
|
+
status: CantineStatus;
|
|
19
|
+
}
|
|
20
|
+
declare const CantineModal: {
|
|
21
|
+
({ isOpen, onClose, schools, selectedSchool, onSchoolChange, hasDinner, menuType, onMenuTypeChange, date, canGoPrevious, canGoNext, onPreviousDay, onNextDay, sections, status, }: CantineModalProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export default CantineModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import SvgIconRafterLeft from"../../../icons/components/IconRafterLeft.js";import SvgIconRafterRight from"../../../icons/components/IconRafterRight.js";import useDate from"../../../../hooks/useDate/useDate.js";import Image from"../../../../components/Image/Image.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import Label from"../../../../components/Label/Label.js";import FormControl from"../../../../components/Form/FormControl.js";import ModalBeta from"../../../../components/ModalBeta/ModalBeta.js";import Select from"../../../../components/Select/Select.js";import TextSkeleton from"../../../../components/Skeleton/TextSkeleton.js";import CantineMenuSection from"./components/CantineMenuSection.js";import CantineLegend from"./components/CantineLegend.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuCantineEmpty from"@edifice.io/bootstrap/dist/images/homepage/cantine/illu-cantine-empty.svg";var CantineModal=({isOpen,onClose,schools,selectedSchool,onSchoolChange,hasDinner,menuType,onMenuTypeChange,date,canGoPrevious,canGoNext,onPreviousDay,onNextDay,sections,status})=>{let{t}=useTranslation(),{formatDate}=useDate(),hasSchoolSelect=schools.length>1,menuTypeOptions=[{value:`lunch`,label:t(`homepage.widget.cantine.lunch`)},{value:`dinner`,label:t(`homepage.widget.cantine.dinner`)}];return jsxs(ModalBeta,{id:`cantine-modal`,size:`l`,isOpen,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:t(`homepage.widget.cantine.title`)}),jsxs(ModalBeta.Body,{className:`cantine-modal`,children:[jsxs(`div`,{className:`cantine-modal__aside`,children:[(hasSchoolSelect||hasDinner)&&jsx(`div`,{className:`cantine-modal__form`,children:jsxs(`div`,{className:`cantine-modal__fields`,children:[hasSchoolSelect&&jsxs(FormControl,{id:`cantine-modal-school`,className:`cantine-modal__field`,children:[jsx(Label,{className:`cantine-modal__label`,children:t(`homepage.widget.cantine.school`)}),jsx(Select,{block:!0,placeholderOption:t(`homepage.widget.cantine.school`),options:schools.map(school=>({value:school.id,label:school.name})),selectedValue:selectedSchool&&{value:selectedSchool.id,label:selectedSchool.name},onValueChange:option=>onSchoolChange(typeof option==`string`?option:option.value)})]}),hasDinner&&jsxs(FormControl,{id:`cantine-modal-menu`,className:`cantine-modal__field`,children:[jsx(Label,{className:`cantine-modal__label`,children:t(`homepage.widget.cantine.menu`)}),jsx(Select,{block:!0,placeholderOption:t(`homepage.widget.cantine.lunch`),options:menuTypeOptions,selectedValue:menuTypeOptions.find(option=>option.value===menuType),onValueChange:option=>onMenuTypeChange(typeof option==`string`?option:option.value)})]})]})}),jsx(CantineLegend,{})]}),jsxs(`div`,{className:`cantine-modal__panel`,children:[jsxs(`div`,{className:`cantine-modal__nav`,children:[jsx(ButtonBeta,{"aria-label":t(`homepage.widget.cantine.previousDay`),leftIcon:jsx(SvgIconRafterLeft,{}),variant:`ghost`,color:`tertiary`,disabled:!canGoPrevious,onClick:onPreviousDay}),jsx(`p`,{className:`cantine-modal__date`,children:formatDate(date,`dddd D MMMM`)}),jsx(ButtonBeta,{"aria-label":t(`homepage.widget.cantine.nextDay`),leftIcon:jsx(SvgIconRafterRight,{}),variant:`ghost`,color:`tertiary`,disabled:!canGoNext,onClick:onNextDay})]}),status===`loading`&&jsxs(`div`,{className:`cantine-modal__loading`,"data-testid":`cantine-modal-loading`,children:[jsx(TextSkeleton,{size:`lg`,className:`cantine-modal__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`cantine-modal__loading-item`}),jsx(TextSkeleton,{size:`lg`,className:`cantine-modal__loading-item`})]}),(status===`empty`||status===`error`)&&jsxs(`div`,{className:`cantine-modal__empty`,children:[jsx(Image,{src:illuCantineEmpty,alt:t(`homepage.widget.cantine.emptyIllustration`),className:`cantine-modal__empty-illu`}),jsx(`p`,{className:`cantine-modal__empty-message`,children:t(`homepage.widget.cantine.empty`)})]}),status===`default`&&jsx(`ul`,{className:`cantine-modal__menu`,children:sections.map(section=>jsx(CantineMenuSection,{category:section.category,items:section.items},section.category))})]})]})]})};export{CantineModal as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
export interface CantineModalContainerProps {
|
|
3
|
+
schools: School[];
|
|
4
|
+
defaultSchool?: School;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CantineModalContainer({ schools, defaultSchool, onClose, }: CantineModalContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare namespace CantineModalContainer {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import CantineModal from"./CantineModal.js";import{useCantineModal}from"./hooks/useCantineModal.js";import{jsx}from"react/jsx-runtime";function CantineModalContainer({schools,defaultSchool,onClose}){return jsx(CantineModal,{isOpen:!0,onClose,...useCantineModal(schools,defaultSchool)})}export{CantineModalContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Image from"../../../../../components/Image/Image.js";import{DISH_TAGS}from"./cantineLabels.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function CantineLegend(){let{t}=useTranslation();return jsxs(`div`,{className:`cantine-modal__legend`,children:[jsxs(`div`,{className:`cantine-modal__legend-list`,children:[jsx(`h3`,{className:`cantine-modal__legend-title`,children:t(`homepage.widget.cantine.legend.title`)}),DISH_TAGS.map(tag=>jsxs(`p`,{className:`cantine-modal__legend-item`,children:[jsx(Image,{src:tag.icon,alt:t(tag.i18nKey,tag.defaultLabel),className:`cantine-modal__legend-icon`}),t(tag.i18nKey,tag.defaultLabel)]},tag.flag))]}),jsx(`p`,{className:`cantine-modal__notice`,children:t(`homepage.widget.cantine.legend.notice`)})]})}export{CantineLegend as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CantineCategory, CantineDish } from '../types';
|
|
2
|
+
export interface CantineMenuSectionProps {
|
|
3
|
+
category: CantineCategory;
|
|
4
|
+
items: CantineDish[];
|
|
5
|
+
}
|
|
6
|
+
export default function CantineMenuSection({ category, items, }: CantineMenuSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Image from"../../../../../components/Image/Image.js";import{CATEGORY_CONFIG,DISH_TAGS}from"./cantineLabels.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function CantineMenuSection({category,items}){let{t}=useTranslation(),config=CATEGORY_CONFIG[category];return jsxs(`li`,{className:`cantine__section cantine__section-${category}`,children:[jsxs(`div`,{className:`cantine__section-header`,children:[jsx(`span`,{className:`cantine__section-icon`,children:jsx(Image,{src:config.icon,alt:t(config.i18nKey,config.defaultLabel)})}),jsx(`h4`,{className:`cantine__section-title`,children:t(config.i18nKey,config.defaultLabel)})]}),jsx(`ul`,{className:`cantine__items`,children:items.map(item=>jsxs(`li`,{className:`cantine__item`,children:[jsxs(`div`,{className:`cantine__item-text`,children:[jsx(`p`,{className:`cantine__item-label`,children:item.label}),item.allergens.length>0&&jsx(`p`,{className:`cantine__item-allergens`,children:item.allergens.join(`, `)})]}),jsx(`div`,{className:`cantine__item-tags`,children:DISH_TAGS.filter(tag=>item[tag.flag]).map(tag=>jsx(Image,{src:tag.icon,alt:t(tag.i18nKey,tag.defaultLabel),className:`cantine__item-tag`},tag.flag))})]},item.id))})]})}export{CantineMenuSection as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CantineCategory } from '../types';
|
|
2
|
+
export interface IllustratedLabel {
|
|
3
|
+
icon: string;
|
|
4
|
+
i18nKey: string;
|
|
5
|
+
defaultLabel: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CATEGORY_CONFIG: Record<CantineCategory, IllustratedLabel>;
|
|
8
|
+
/** Boolean quality flags of a dish */
|
|
9
|
+
export type DishFlag = 'vegetarien' | 'faitmaison' | 'bio' | 'local';
|
|
10
|
+
export declare const DISH_TAGS: (IllustratedLabel & {
|
|
11
|
+
flag: DishFlag;
|
|
12
|
+
})[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import illuAccompagnement from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-dish-accompagnement.svg";import illuDessert from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-dish-dessert.svg";import illuEntree from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-dish-entree.svg";import illuLaitage from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-dish-laitage.svg";import illuPlat from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-dish-plat.svg";import labelBio from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-label-bio.png";import labelFaitmaison from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-label-faitmaison.png";import labelLocal from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-label-local.png";import labelVegetarien from"@edifice.io/bootstrap/dist/images/homepage/cantine/cantine-label-vegetarien.png";var CATEGORY_CONFIG={entree:{icon:illuEntree,i18nKey:`homepage.widget.cantine.category.entree`,defaultLabel:`Entrée`},plat:{icon:illuPlat,i18nKey:`homepage.widget.cantine.category.plat`,defaultLabel:`Plat`},accompagnement:{icon:illuAccompagnement,i18nKey:`homepage.widget.cantine.category.accompagnement`,defaultLabel:`Accompagnement`},laitage:{icon:illuLaitage,i18nKey:`homepage.widget.cantine.category.laitage`,defaultLabel:`Laitage`},dessert:{icon:illuDessert,i18nKey:`homepage.widget.cantine.category.dessert`,defaultLabel:`Dessert`}},DISH_TAGS=[{flag:`vegetarien`,icon:labelVegetarien,i18nKey:`homepage.widget.cantine.tag.vegetarien`,defaultLabel:`Végétarien`},{flag:`faitmaison`,icon:labelFaitmaison,i18nKey:`homepage.widget.cantine.tag.faitmaison`,defaultLabel:`Fait maison`},{flag:`bio`,icon:labelBio,i18nKey:`homepage.widget.cantine.tag.bio`,defaultLabel:`Agriculture biologique`},{flag:`local`,icon:labelLocal,i18nKey:`homepage.widget.cantine.tag.local`,defaultLabel:`Produit local`}];export{CATEGORY_CONFIG,DISH_TAGS};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
/**
|
|
3
|
+
* Today's lunch menu for the given school (see `useUserSchools`).
|
|
4
|
+
*
|
|
5
|
+
* Only lunch is exposed: the widget design has no lunch/dinner toggle, unlike
|
|
6
|
+
* the modal and the legacy AngularJS widget.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useCantine(school?: School): {
|
|
9
|
+
sections: import('..').CantineSection[];
|
|
10
|
+
status: import('..').CantineStatus;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import useDate from"../../../../../hooks/useDate/useDate.js";import{useCantineMenu}from"./useCantineMenu.js";function useCantine(school){let{formatDate}=useDate(),{sections,status}=useCantineMenu(school?.UAI??``,formatDate(new Date,`YYYY-MM-DD`));return{sections,status}}export{useCantine};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CantineMenuItem, CantineMenus, CantineMenuType, CantineSection, CantineStatus } from '../types';
|
|
2
|
+
export declare function buildSections(menu: CantineMenuItem[]): CantineSection[];
|
|
3
|
+
export declare function cantineMenuQueryOptions(uai: string, date: string): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<CantineMenus, Error, CantineMenus, import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
4
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<CantineMenus, import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, CantineMenus>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Loads one day's menu for one school and groups the requested service's
|
|
10
|
+
* dishes by category. Shared by the widget and its full-screen modal.
|
|
11
|
+
*
|
|
12
|
+
* `loading` also covers "no school selected yet": an absent UAI leaves
|
|
13
|
+
* `enabled: false`, so the query never starts.
|
|
14
|
+
*
|
|
15
|
+
* When the day or the school has no dinner service, the returned `menuType`
|
|
16
|
+
* falls back on lunch: the caller keeps its own request untouched and simply
|
|
17
|
+
* renders what is actually served.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useCantineMenu(uai: string, date: string, requestedMenuType?: CantineMenuType): {
|
|
20
|
+
sections: CantineSection[];
|
|
21
|
+
dinnerAvailable: boolean;
|
|
22
|
+
menuType: CantineMenuType;
|
|
23
|
+
status: CantineStatus;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo}from"react";import{odeServices}from"@edifice.io/client";import{queryOptions,useQuery}from"@tanstack/react-query";var CANTINE_CATEGORIES=[`entree`,`plat`,`accompagnement`,`laitage`,`dessert`];function getAllergens(item){return Object.keys(item).filter(key=>key.startsWith(`allerg_`)&&item[key]!==0&&item[key]!==void 0).map(key=>key.slice(7).replace(/_/g,` `))}function normalizeDish(item,index){let designation=item.designationMenu?.trim();return{id:`${item.type}-${index}`,label:designation||item.nom,vegetarien:!!item.vegetarien,faitmaison:!!item.faitmaison,bio:!!item.bio,local:!!item.local,allergens:getAllergens(item)}}function buildSections(menu){return CANTINE_CATEGORIES.map(category=>({category,items:menu.filter(item=>item.type===category).map((item,index)=>normalizeDish(item,index))})).filter(section=>section.items.length>0)}function cantineMenuQueryOptions(uai,date){return queryOptions({queryKey:[`cantine`,uai,date],enabled:!!uai,staleTime:300*1e3,queryFn:async()=>{let http=odeServices.http(),body=await http.get(`/appregistry/${encodeURIComponent(uai)}/cantine/menu?date=${date}`);if(http.isResponseError())throw Error(http.latestResponse.statusText);let lunch=Array.isArray(body?.menu)?body.menu:[],dinner=Array.isArray(body?.dinnerMenu)?body.dinnerMenu:[];return{lunch,dinner,dinnerAvailable:body?.dinnerAvailable===!0&&dinner.length>0}}})}function useCantineMenu(uai,date,requestedMenuType=`lunch`){let{data,isPending,error}=useQuery(cantineMenuQueryOptions(uai,date)),dinnerAvailable=data?.dinnerAvailable===!0,menuType=requestedMenuType===`dinner`&&dinnerAvailable?`dinner`:`lunch`,sections=useMemo(()=>buildSections((menuType===`lunch`?data?.lunch:data?.dinner)??[]),[data,menuType]);return{sections,dinnerAvailable,menuType,status:error?`error`:!uai||isPending?`loading`:sections.length>0?`default`:`empty`}}export{useCantineMenu};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
import { CantineMenuType } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Browsing state of the full-screen canteen modal: day, school and service.
|
|
5
|
+
*
|
|
6
|
+
* The school picked here stays local to the modal on purpose: it must not
|
|
7
|
+
* change the school shared with the other homepage widgets (see
|
|
8
|
+
* `useUserSchools`), only the menu being read.
|
|
9
|
+
*
|
|
10
|
+
* `defaultSchool` must come from the widget card, already settled: a fresh
|
|
11
|
+
* `useUserSchools` here would still be switching schools when `Select` echoes
|
|
12
|
+
* its value back, making the two bounce forever.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useCantineModal(schools: School[], defaultSchool?: School): {
|
|
15
|
+
schools: School[];
|
|
16
|
+
selectedSchool: School | undefined;
|
|
17
|
+
onSchoolChange: import('react').Dispatch<import('react').SetStateAction<string | undefined>>;
|
|
18
|
+
hasDinner: boolean;
|
|
19
|
+
menuType: CantineMenuType;
|
|
20
|
+
onMenuTypeChange: import('react').Dispatch<import('react').SetStateAction<CantineMenuType>>;
|
|
21
|
+
date: string;
|
|
22
|
+
canGoPrevious: boolean;
|
|
23
|
+
canGoNext: boolean;
|
|
24
|
+
onPreviousDay: () => void;
|
|
25
|
+
onNextDay: () => void;
|
|
26
|
+
sections: import('..').CantineSection[];
|
|
27
|
+
status: import('..').CantineStatus;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import useDate from"../../../../../hooks/useDate/useDate.js";import{useCantineMenu}from"./useCantineMenu.js";import{useMemo,useState}from"react";var DATE_RANGE_IN_DAYS=40,DATE_FORMAT=`YYYY-MM-DD`,addDays=(date,days)=>{let shifted=new Date(date);return shifted.setDate(shifted.getDate()+days),shifted};function useCantineModal(schools,defaultSchool){let{formatDate}=useDate(),[schoolId,setSchoolId]=useState(),[menuType,setMenuType]=useState(`lunch`),[date,setDate]=useState(()=>formatDate(new Date,DATE_FORMAT)),{minDate,maxDate}=useMemo(()=>{let today=new Date;return{minDate:formatDate(addDays(today,-40),DATE_FORMAT),maxDate:formatDate(addDays(today,DATE_RANGE_IN_DAYS),DATE_FORMAT)}},[formatDate]),selectedSchool=schools.find(school=>school.id===schoolId)??defaultSchool,menu=useCantineMenu(selectedSchool?.UAI??``,date,menuType),shiftDate=days=>setDate(current=>formatDate(addDays(new Date(`${current}T00:00:00`),days),DATE_FORMAT));return{schools,selectedSchool,onSchoolChange:setSchoolId,hasDinner:menu.dinnerAvailable,menuType:menu.menuType,onMenuTypeChange:setMenuType,date,canGoPrevious:date>minDate,canGoNext:date<maxDate,onPreviousDay:()=>shiftDate(-1),onNextDay:()=>shiftDate(1),sections:menu.sections,status:menu.status}}export{useCantineModal};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './Cantine';
|
|
2
|
+
export { default as Cantine } from './Cantine';
|
|
3
|
+
export * from './CantineContainer';
|
|
4
|
+
export * from './CantineModal';
|
|
5
|
+
export { default as CantineModal } from './CantineModal';
|
|
6
|
+
export * from './CantineModalContainer';
|
|
7
|
+
export type { CantineCategory, CantineDish, CantineMenuType, CantineSection, CantineStatus, } from './types';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type CantineCategory = 'entree' | 'plat' | 'accompagnement' | 'laitage' | 'dessert';
|
|
2
|
+
/**
|
|
3
|
+
* Raw dish shape returned by the Webgerest upstream API, forwarded unmapped by
|
|
4
|
+
* app-registry. Everything besides `type` and `nom` is effectively optional.
|
|
5
|
+
*/
|
|
6
|
+
export interface CantineMenuItem {
|
|
7
|
+
type: string;
|
|
8
|
+
nom: string;
|
|
9
|
+
designationMenu?: string;
|
|
10
|
+
vegetarien?: boolean;
|
|
11
|
+
faitmaison?: boolean;
|
|
12
|
+
bio?: boolean;
|
|
13
|
+
local?: boolean;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface CantineMenuResponse {
|
|
17
|
+
menu?: CantineMenuItem[];
|
|
18
|
+
dinnerAvailable?: boolean;
|
|
19
|
+
dinnerMenu?: CantineMenuItem[];
|
|
20
|
+
}
|
|
21
|
+
export interface CantineDish {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
vegetarien: boolean;
|
|
25
|
+
faitmaison: boolean;
|
|
26
|
+
bio: boolean;
|
|
27
|
+
local: boolean;
|
|
28
|
+
allergens: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface CantineSection {
|
|
31
|
+
category: CantineCategory;
|
|
32
|
+
items: CantineDish[];
|
|
33
|
+
}
|
|
34
|
+
/** Both services of a given day, as exposed by app-registry. */
|
|
35
|
+
export interface CantineMenus {
|
|
36
|
+
lunch: CantineMenuItem[];
|
|
37
|
+
dinner: CantineMenuItem[];
|
|
38
|
+
/** True when the school also serves a dinner menu that day. */
|
|
39
|
+
dinnerAvailable: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type CantineStatus = 'loading' | 'default' | 'empty' | 'error';
|
|
42
|
+
export type CantineMenuType = 'lunch' | 'dinner';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WorkspaceElement } from '@edifice.io/client';
|
|
2
|
+
export interface CaptationAudioProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSaveSuccess?: (resource: WorkspaceElement) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CaptationAudio({ isOpen, onClose, onSaveSuccess, }: CaptationAudioProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import AudioRecorder from"../../../../multimedia/AudioRecorder/AudioRecorder.js";import ButtonBeta from"../../../../../components/ButtonBeta/ButtonBeta.js";import useToast from"../../../../../hooks/useToast/useToast.js";import ModalBeta from"../../../../../components/ModalBeta/ModalBeta.js";import{useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function CaptationAudio({isOpen,onClose,onSaveSuccess}){let{t}=useTranslation(),recorderRef=useRef(null),[recordURL,setRecordURL]=useState(),[hasName,setHasName]=useState(!0),[isSaving,setIsSaving]=useState(!1),toast=useToast();return useEffect(()=>{isOpen&&setHasName(!0)},[isOpen]),jsxs(ModalBeta,{id:`captation-audio-modal`,isOpen,size:`xl`,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:t(`homepage.captationAudio.modal.title`)}),jsx(ModalBeta.Body,{children:jsx(AudioRecorder,{ref:recorderRef,hideSaveAction:!0,onRecordUpdated:setRecordURL,onNameChange:name=>setHasName(!!name.trim())})}),jsxs(ModalBeta.Footer,{children:[jsx(ButtonBeta,{type:`button`,variant:`ghost`,color:`tertiary`,"data-testid":`captation-audio-button-cancel`,onClick:onClose,children:t(`homepage.captationAudio.cancel`)}),jsx(ButtonBeta,{type:`button`,isLoading:isSaving,disabled:!recordURL||!hasName||isSaving,"data-testid":`captation-audio-button-save`,onClick:async()=>{setIsSaving(!0);try{let resource=await recorderRef.current?.save();if(!resource)throw Error(`Audio record was not saved`);onSaveSuccess?.(resource),toast.success(t(`homepage.captationAudio.alert.sucess`)),onClose()}catch(err){toast.error(t(`homepage.captationAudio.alert.error`)),console.error(err)}finally{setIsSaving(!1)}},children:t(`homepage.captationAudio.save`)})]})]})}export{CaptationAudio};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WorkspaceElement } from '@edifice.io/client';
|
|
2
|
+
export interface CaptationVideoProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSaveSuccess?: (resource: WorkspaceElement) => void;
|
|
6
|
+
/** Application code used to upload the video (defaults to `homepage`). */
|
|
7
|
+
appCode?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CaptationVideo({ isOpen, onClose, onSaveSuccess, appCode, }: CaptationVideoProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import ButtonBeta from"../../../../../components/ButtonBeta/ButtonBeta.js";import VideoRecorder from"../../../../multimedia/VideoRecorder/VideoRecorder.js";import useToast from"../../../../../hooks/useToast/useToast.js";import ModalBeta from"../../../../../components/ModalBeta/ModalBeta.js";import{useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function CaptationVideo({isOpen,onClose,onSaveSuccess,appCode=`homepage`}){let{t}=useTranslation(),recorderRef=useRef(null),[recordURL,setRecordURL]=useState(),[hasName,setHasName]=useState(!0),[isSaving,setIsSaving]=useState(!1),toast=useToast();return useEffect(()=>{isOpen&&setHasName(!0)},[isOpen]),jsxs(ModalBeta,{id:`captation-video-modal`,isOpen,size:`xl`,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:t(`homepage.captationVideo.modal.title`)}),jsx(ModalBeta.Body,{children:jsx(VideoRecorder,{ref:recorderRef,appCode,hideSaveAction:!0,onRecordUpdated:setRecordURL,onNameChange:name=>setHasName(!!name.trim()),onSuccess:resources=>{toast.success(t(`homepage.captationVideo.save.success`)),resources[0]&&onSaveSuccess?.(resources[0]),onClose()},onError:error=>{toast.error(t(`homepage.captationVideo.save.error`)),console.error(error)}})}),jsxs(ModalBeta.Footer,{children:[jsx(ButtonBeta,{type:`button`,variant:`ghost`,color:`tertiary`,"data-testid":`captation-video-button-cancel`,onClick:onClose,children:t(`homepage.captationVideo.cancel`)}),jsx(ButtonBeta,{type:`button`,isLoading:isSaving,disabled:!recordURL||!hasName||isSaving,"data-testid":`captation-video-button-save`,onClick:async()=>{setIsSaving(!0);try{await recorderRef.current?.save()}finally{setIsSaving(!1)}},children:t(`homepage.captationVideo.save`)})]})]})}export{CaptationVideo};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CarnetDeBordStatus, ParsedEleve } from './types';
|
|
2
|
+
export interface CarnetDeBordProps {
|
|
3
|
+
status: CarnetDeBordStatus;
|
|
4
|
+
eleves: ParsedEleve[];
|
|
5
|
+
currentEleveIndex: number;
|
|
6
|
+
onEleveChange: (index: number) => void;
|
|
7
|
+
isRelative?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function CarnetDeBord({ status, eleves, currentEleveIndex, onEleveChange, isRelative, }: CarnetDeBordProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import SvgIconFullScreen from"../../../icons/components/IconFullScreen.js";import Skeleton from"../../../../components/Skeleton/Skeleton.js";import HomeCard from"../HomeCard/HomeCard.js";import TabsKids from"../TabsKids/components/TabsKids.js";import{getCategoryI18nKey}from"./categoryConfig.js";import{CarnetDeBordCategoryIcon,CarnetDeBordCategoryRow}from"./CarnetDeBordCategoryRow.js";import{CarnetDeBordError}from"./CarnetDeBordError.js";import{CarnetDeBordModal}from"./CarnetDeBordModal.js";import{computeContentTypes,getItemCount}from"./utils.js";import{useMemo,useState}from"react";import{Fragment as Fragment$1,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function CarnetDeBord({status,eleves,currentEleveIndex,onEleveChange,isRelative=!1}){let{t}=useTranslation(),[isModalOpen,setIsModalOpen]=useState(!1),[activeTab,setActiveTab]=useState(`retards-absences`),currentEleve=eleves[currentEleveIndex]??null,contentTypes=useMemo(()=>computeContentTypes(currentEleve),[currentEleve]),tabs=useMemo(()=>eleves.map((eleve,index)=>({id:String(index),label:eleve.name,avatar:eleve.avatar||void 0})),[eleves]),openModal=title=>{setActiveTab(title),setIsModalOpen(!0)},seeMoreTab=(contentTypes.find(contentType=>getItemCount(contentType)>0)??contentTypes[0]).title,renderCategories=()=>jsx(`div`,{className:`carnet-de-bord__categories`,children:contentTypes.map(contentType=>{let label=t(getCategoryI18nKey(contentType.title,`label`));if(!currentEleve)return jsxs(`div`,{className:`carnet-de-bord__entry`,children:[jsx(CarnetDeBordCategoryIcon,{category:contentType.title}),jsxs(`span`,{className:`carnet-de-bord__entry-text`,children:[jsx(`span`,{className:`carnet-de-bord__entry-label`,children:label}),jsx(Skeleton,{variant:`text`,className:`carnet-de-bord-skeleton-subtext`})]})]},contentType.title);let itemCount=getItemCount(contentType),isEmpty=contentType.compact===!1&&itemCount===0;return jsx(CarnetDeBordCategoryRow,{category:contentType.title,label,subtext:isEmpty?t(getCategoryI18nKey(contentType.title,`empty`)):contentType.compact||``,isSubtextEmpty:isEmpty,isDisabled:itemCount===0,onClick:()=>openModal(contentType.title)},contentType.title)})});return jsxs(Fragment$1,{children:[jsxs(HomeCard,{variant:`primary`,className:`carnet-de-bord`,children:[jsx(HomeCard.Header,{title:t(`homepage.widget.carnetDeBord.title`),actionLabel:t(`homepage.widget.carnetDeBord.open`),actionRightIcon:jsx(SvgIconFullScreen,{}),onActionClick:status===`default`&¤tEleve?()=>openModal(seeMoreTab):void 0,actionProps:{"data-testid":`carnet-de-bord-button-see-more`}}),jsx(HomeCard.Content,{className:`carnet-de-bord__content`,children:status===`error`?jsx(CarnetDeBordError,{}):status===`empty`?jsx(`p`,{className:`carnet-de-bord__empty`,children:t(`homepage.widget.carnetDeBord.empty`)}):eleves.length===0?renderCategories():jsx(TabsKids,{items:tabs,activeId:String(currentEleveIndex),onChange:id=>onEleveChange(Number(id)),showTabBar:isRelative||eleves.length>1,ariaLabel:t(`homepage.widget.carnetDeBord.kids`),overflowLabel:t(`homepage.widget.carnetDeBord.moreKids`),children:renderCategories()})})]}),jsx(CarnetDeBordModal,{isOpen:isModalOpen,onClose:()=>setIsModalOpen(!1),studentName:isRelative?currentEleve?.name:void 0,contentTypes,activeTab,onTabChange:setActiveTab,address:currentEleve?.address??``})]})}export{CarnetDeBord};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContentTitle } from './types';
|
|
2
|
+
export interface CarnetDeBordCategoryIconProps {
|
|
3
|
+
category: ContentTitle;
|
|
4
|
+
}
|
|
5
|
+
export declare function CarnetDeBordCategoryIcon({ category, }: CarnetDeBordCategoryIconProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface CarnetDeBordCategoryRowProps {
|
|
7
|
+
category: ContentTitle;
|
|
8
|
+
label: string;
|
|
9
|
+
/** Compact summary of the category, or its empty message. */
|
|
10
|
+
subtext: string;
|
|
11
|
+
/** The subtext is the empty message (displayed in italic). */
|
|
12
|
+
isSubtextEmpty: boolean;
|
|
13
|
+
/** No entry to open: the row is inert. */
|
|
14
|
+
isDisabled: boolean;
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function CarnetDeBordCategoryRow({ category, label, subtext, isSubtextEmpty, isDisabled, onClick, }: CarnetDeBordCategoryRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CATEGORY_CONFIG}from"./categoryConfig.js";import clsx$1 from"clsx";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function CarnetDeBordCategoryIcon({category}){let{color,icon}=CATEGORY_CONFIG[category];return jsx(`span`,{className:clsx$1(`carnet-de-bord__icon`,`carnet-de-bord__icon--${color}`),"aria-hidden":`true`,children:icon})}function CarnetDeBordCategoryRow({category,label,subtext,isSubtextEmpty,isDisabled,onClick}){let content=jsxs(Fragment,{children:[jsx(CarnetDeBordCategoryIcon,{category}),jsxs(`span`,{className:`carnet-de-bord__entry-text`,children:[jsx(`span`,{className:`carnet-de-bord__entry-label`,children:label}),jsx(`span`,{className:clsx$1(`carnet-de-bord__entry-subtext`,{"carnet-de-bord__entry-subtext--empty":isSubtextEmpty}),children:subtext})]})]});return isDisabled?jsx(`div`,{className:`carnet-de-bord__entry`,children:content}):jsx(`button`,{type:`button`,className:`carnet-de-bord__entry carnet-de-bord__entry--clickable`,onClick,"data-testid":`carnet-de-bord-button-${category}`,children:content})}export{CarnetDeBordCategoryIcon,CarnetDeBordCategoryRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CarnetDeBordContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CarnetDeBord}from"./CarnetDeBord.js";import{useCarnetDeBordContainer}from"./hooks/useCarnetDeBordContainer.js";import{jsx}from"react/jsx-runtime";function CarnetDeBordContainer(){let{status,eleves,currentEleveIndex,onEleveChange,isRelative}=useCarnetDeBordContainer();return jsx(CarnetDeBord,{status,eleves,currentEleveIndex,onEleveChange,isRelative})}export{CarnetDeBordContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CarnetDeBordError(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Image from"../../../../components/Image/Image.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuError from"@edifice.io/bootstrap/dist/images/homepage/illu-error-carnetDeBord.svg";function CarnetDeBordError(){let{t}=useTranslation();return jsxs(`div`,{className:`carnet-de-bord__error`,children:[jsx(Image,{src:illuError,alt:``,className:`carnet-de-bord__error-illu`}),jsx(`p`,{className:`carnet-de-bord__error-message`,children:t(`homepage.widget.carnetDeBord.error`)})]})}export{CarnetDeBordError};
|