@edifice.io/react 2.6.14 → 2.6.15
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/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.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/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/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/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +1 -1
- package/package.json +7 -6
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +0 -1
- /package/dist/node_modules/.pnpm/{prosemirror-transform@1.12.5 → prosemirror-transform@1.12.7}/node_modules/prosemirror-transform/dist/index.js +0 -0
|
@@ -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 illuBriefMeError 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:illuBriefMeError,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};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContentTitle, ContentType } from './types';
|
|
2
|
+
export interface CarnetDeBordModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
/** Displayed in the title in parent view only; omitted in student view. */
|
|
6
|
+
studentName?: string;
|
|
7
|
+
contentTypes: ContentType[];
|
|
8
|
+
activeTab: ContentTitle;
|
|
9
|
+
onTabChange: (title: ContentTitle) => void;
|
|
10
|
+
/** URL of the student's Pronote instance. */
|
|
11
|
+
address: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function CarnetDeBordModal({ isOpen, onClose, studentName, contentTypes, activeTab, onTabChange, address, }: CarnetDeBordModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import SvgIconExternalLink from"../../../icons/components/IconExternalLink.js";import useBreakpoint from"../../../../hooks/useBreakpoint/useBreakpoint.js";import Image from"../../../../components/Image/Image.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import ModalBeta from"../../../../components/ModalBeta/ModalBeta.js";import Select from"../../../../components/Select/Select.js";import{getCategoryI18nKey}from"./categoryConfig.js";import{CarnetDeBordCategoryIcon}from"./CarnetDeBordCategoryRow.js";import clsx$1 from"clsx";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEmpty from"@edifice.io/bootstrap/dist/images/homepage/illu-carnet-de-bord-empty.png";function Row({date,title,details,aside}){return jsxs(`li`,{className:`carnet-de-bord-modal__row`,children:[jsxs(`div`,{className:`carnet-de-bord-modal__row-main`,children:[date&&jsx(`span`,{className:`carnet-de-bord-modal__row-date`,children:date}),title&&jsx(`strong`,{className:`carnet-de-bord-modal__row-title`,children:title}),details]}),aside]})}function RetardsAbsencesRow({item}){let{t}=useTranslation();return jsx(Row,{date:item.value,title:t(`homepage.widget.carnetDeBord.absences.${item.kind===`absence`?`absence`:`lateness`}`),details:item.motif&&jsx(`span`,{className:`carnet-de-bord-modal__row-details`,children:item.motif})})}function NoteRow({item}){let match=item.value.match(/^(.+) en (.+) le (.+)$/),[grade,subject,date]=match?[match[1],match[2],match[3]]:[item.value,``,``];return jsx(Row,{date,title:subject,aside:jsx(`span`,{className:`carnet-de-bord-modal__row-value`,children:grade})})}function DiaryDayRow({subject,date,content}){let{t}=useTranslation(),format=options=>date?new Intl.DateTimeFormat(`fr-FR`,options).format(date):``;return jsx(Row,{date:date?t(`homepage.widget.carnetDeBord.diary.dueDate`,{date:format({weekday:`long`,day:`numeric`,month:`long`,year:`numeric`})}):void 0,title:subject,details:jsx(`span`,{className:`carnet-de-bord-modal__row-details carnet-de-bord-modal__row-details--italic`,children:content||t(`homepage.widget.carnetDeBord.diary.noDescription`)}),aside:date&&jsxs(`span`,{className:`carnet-de-bord-modal__day`,"aria-hidden":`true`,children:[jsx(`span`,{className:`carnet-de-bord-modal__day-number`,children:format({day:`2-digit`})}),jsx(`span`,{className:`carnet-de-bord-modal__day-month`,children:format({month:`long`})})]})})}function SkillRow({item}){let withSubject=item.value.match(/^(.+) le (.+) en (.+)$/),withoutSubject=item.value.match(/^(.+) le (.+)$/),[status,date,subject]=withSubject?[withSubject[1],withSubject[2],withSubject[3]]:withoutSubject?[withoutSubject[1],withoutSubject[2],``]:[item.value,``,``];return jsx(Row,{date,title:subject,details:item.subsections?.map((sub,index)=>sub.content&&jsxs(`span`,{className:`carnet-de-bord-modal__row-details`,children:[sub.header,` : `,sub.content]},index)),aside:jsx(`span`,{className:`carnet-de-bord-modal__row-value`,children:status})})}function renderRow(type,item,index){switch(type){case`grades`:return jsx(NoteRow,{item},index);case`skills`:return jsx(SkillRow,{item},index);default:return jsx(RetardsAbsencesRow,{item},index)}}function CarnetDeBordModal({isOpen,onClose,studentName,contentTypes,activeTab,onTabChange,address}){let{t}=useTranslation(),{md}=useBreakpoint(),activeContentType=contentTypes.find(ct=>ct.title===activeTab),items=Array.isArray(activeContentType?.full)?activeContentType.full:[],diaryRows=activeTab===`diary`?items.flatMap(item=>{let subject=item.value.replace(/^Nouveau devoir\s+/i,``);return(item.subsections??[]).map(sub=>({subject,date:sub.date,content:sub.content}))}):[],hasContent=activeTab===`diary`?diaryRows.length>0:items.length>0,railLabel=title=>t(getCategoryI18nKey(title,`short`)),categoryOptions=contentTypes.map(ct=>({value:ct.title,label:railLabel(ct.title)})),pronoteButton=address&&jsx(ButtonBeta,{"data-testid":`carnet-de-bord-modal-button-pronote`,variant:`ghost`,color:`tertiary`,size:`sm`,rightIcon:jsx(SvgIconExternalLink,{}),className:`carnet-de-bord-modal__pronote`,onClick:()=>window.open(address,`_blank`,`noopener,noreferrer`),children:t(`homepage.widget.carnetDeBord.pronote`)});return jsxs(ModalBeta,{id:`carnet-de-bord-modal`,size:`l`,isOpen,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:studentName?t(`homepage.widget.carnetDeBord.modal.title`,{name:studentName}):t(`homepage.widget.carnetDeBord.title`)}),jsx(ModalBeta.Body,{children:jsxs(`div`,{className:clsx$1(`carnet-de-bord-modal`,{"carnet-de-bord-modal--mobile":!md}),children:[md?jsx(`div`,{className:`carnet-de-bord-modal__rail`,role:`tablist`,"aria-orientation":`vertical`,"aria-label":t(`homepage.widget.carnetDeBord.modal.categories`),children:contentTypes.map(ct=>jsxs(`button`,{type:`button`,role:`tab`,"aria-selected":ct.title===activeTab,className:clsx$1(`carnet-de-bord-modal__rail-tab`,{active:ct.title===activeTab}),onClick:()=>onTabChange(ct.title),"data-testid":`carnet-de-bord-modal-button-${ct.title}`,children:[jsx(CarnetDeBordCategoryIcon,{category:ct.title}),jsx(`span`,{className:`carnet-de-bord-modal__rail-label`,children:railLabel(ct.title)})]},ct.title))}):jsx(`div`,{"data-testid":`carnet-de-bord-modal-input-category`,children:jsx(Select,{block:!0,placeholderOption:railLabel(activeTab),options:categoryOptions,selectedValue:categoryOptions.find(option=>option.value===activeTab),onValueChange:option=>onTabChange(typeof option==`string`?option:option.value)})}),jsxs(`div`,{className:`carnet-de-bord-modal__content`,children:[jsx(`h3`,{className:`carnet-de-bord-modal__content-title`,children:t(getCategoryI18nKey(activeTab,`label`))}),hasContent?jsx(`ul`,{className:`carnet-de-bord-modal__rows`,children:activeTab===`diary`?diaryRows.map((row,index)=>jsx(DiaryDayRow,{...row},index)):items.map((item,index)=>renderRow(activeTab,item,index))}):jsxs(`div`,{className:`carnet-de-bord-modal__empty`,children:[jsx(Image,{src:illuEmpty,alt:``,className:`carnet-de-bord-modal__empty-illu`}),jsx(`p`,{className:`carnet-de-bord-modal__empty-message`,children:t(getCategoryI18nKey(activeTab,`empty`))})]}),pronoteButton]})]})})]})}export{CarnetDeBordModal};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ContentTitle } from './types';
|
|
3
|
+
export type CarnetDeBordCategoryColor = 'orange' | 'blue' | 'green' | 'pink';
|
|
4
|
+
interface CategoryConfig {
|
|
5
|
+
/** Segment of the category's i18n keys. */
|
|
6
|
+
i18nKey: string;
|
|
7
|
+
color: CarnetDeBordCategoryColor;
|
|
8
|
+
icon: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const CATEGORY_CONFIG: Record<ContentTitle, CategoryConfig>;
|
|
11
|
+
export declare const getCategoryI18nKey: (category: ContentTitle, suffix: string) => string;
|
|
12
|
+
export declare const CONTENT_TITLES: ContentTitle[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import SvgIconClockAlert from"../../../icons/components/IconClockAlert.js";import SvgIconNotes from"../../../icons/components/IconNotes.js";import SvgIconTeacher from"../../../icons/components/IconTeacher.js";import SvgIconCahierDeTexte from"../../../icons/components/apps/IconCahierDeTexte.js";import{jsx}from"react/jsx-runtime";var CATEGORY_CONFIG={"retards-absences":{i18nKey:`absences`,color:`orange`,icon:jsx(SvgIconClockAlert,{width:20,height:20})},grades:{i18nKey:`grades`,color:`blue`,icon:jsx(SvgIconNotes,{width:20,height:20})},diary:{i18nKey:`diary`,color:`green`,icon:jsx(SvgIconCahierDeTexte,{width:20,height:20})},skills:{i18nKey:`skills`,color:`pink`,icon:jsx(SvgIconTeacher,{width:20,height:20})}},getCategoryI18nKey=(category,suffix)=>`homepage.widget.carnetDeBord.${CATEGORY_CONFIG[category].i18nKey}.${suffix}`;export{CATEGORY_CONFIG,getCategoryI18nKey};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CarnetDeBordStatus, ParsedEleve } from '../types';
|
|
2
|
+
export interface UseCarnetDeBordContainerReturn {
|
|
3
|
+
status: CarnetDeBordStatus;
|
|
4
|
+
eleves: ParsedEleve[];
|
|
5
|
+
currentEleveIndex: number;
|
|
6
|
+
onEleveChange: (index: number) => void;
|
|
7
|
+
/** True when the user is a parent ("Relative"), false for a student. */
|
|
8
|
+
isRelative: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Custom hook that provides the students ("eleves") parsed from the Pronote
|
|
12
|
+
* exports of the user's structures.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useCarnetDeBordContainer: () => UseCarnetDeBordContainerReturn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import useUser from"../../../../../hooks/useUser/useUser.js";import{parseEleves}from"../utils.js";import{usePronoteStructures}from"../services/queries/carnetDeBord.js";import{useMemo,useState}from"react";var useCarnetDeBordContainer=()=>{let{user}=useUser(),{data,isPending,isError}=usePronoteStructures(),[currentEleveIndex,setCurrentEleveIndex]=useState(0),eleves=useMemo(()=>data?parseEleves(data,user?.children??{}):[],[data,user?.children]),status=`default`;return isError?status=`error`:isPending?status=`loading`:eleves.length===0&&(status=`empty`),{status,eleves,currentEleveIndex,onEleveChange:setCurrentEleveIndex,isRelative:user?.type===`PERSRELELEVE`}};export{useCarnetDeBordContainer};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Structure } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates the service of the homepage "Carnet de bord" (Pronote logbook)
|
|
4
|
+
* widget.
|
|
5
|
+
*
|
|
6
|
+
* Backend contract: `GET /sso/pronote` returns one Pronote XML export per
|
|
7
|
+
* structure of the user.
|
|
8
|
+
*
|
|
9
|
+
* @param baseURL The base URL for the Pronote SSO API.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createCarnetDeBordService: (baseURL: string) => {
|
|
12
|
+
/**
|
|
13
|
+
* Get the Pronote exports of the user's structures.
|
|
14
|
+
*/
|
|
15
|
+
getStructures(): Promise<Structure[]>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{odeServices}from"@edifice.io/client";var createCarnetDeBordService=baseURL=>({async getStructures(){let body=await odeServices.http().get(`${baseURL}/sso/pronote`,{disableNotifications:!0});if(!Array.isArray(body))throw Error(`carnet-de-bord.nodata`);return body}});export{createCarnetDeBordService};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createCarnetDeBordService}from"./carnetDeBordService.js";var carnetDeBordService=createCarnetDeBordService(``);export{carnetDeBordService};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const carnetDeBordQueryKeys: {
|
|
2
|
+
all: () => readonly ["carnet-de-bord"];
|
|
3
|
+
};
|
|
4
|
+
export declare const carnetDeBordQueryOptions: {
|
|
5
|
+
getStructures(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<import('../..').Structure[], Error, import('../..').Structure[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
6
|
+
queryFn?: import('@tanstack/react-query').QueryFunction<import('../..').Structure[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, import('../..').Structure[]>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const usePronoteStructures: () => import('@tanstack/react-query').UseQueryResult<import('../..').Structure[], Error>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{carnetDeBordService}from"../api/index.js";import{queryOptions,useQuery}from"@tanstack/react-query";var STALE_TIME=300*1e3,carnetDeBordQueryKeys={all:()=>[`carnet-de-bord`]},carnetDeBordQueryOptions={getStructures(){return queryOptions({queryKey:carnetDeBordQueryKeys.all(),queryFn:()=>carnetDeBordService.getStructures(),staleTime:STALE_TIME})}},usePronoteStructures=()=>useQuery(carnetDeBordQueryOptions.getStructures());export{usePronoteStructures};
|