@edifice.io/react 2.6.13-develop-b2school.20261110192914 → 2.6.13-develop-pedago.20261113140442
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/SearchBar/SearchBar.js +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/homepage.js +1 -1
- package/dist/hooks/useBackground/useBackground.d.ts +1 -1
- package/dist/hooks/useBackground/useBackground.js +1 -1
- package/dist/hooks/useUpload/useUpload.js +1 -1
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +6 -2
- 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/Header/Header.js +1 -1
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +1 -5
- 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/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/SchoolSpace/SchoolSpace.js +1 -1
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
- package/dist/modules/homepage/{hooks → components/SchoolSpace}/useUserSchools.d.ts +2 -2
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +1 -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 +1 -3
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +1 -1
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +1 -1
- package/dist/modules/homepage/components/index.d.ts +2 -14
- 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 +0 -1
- 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 +0 -2
- 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 +0 -1
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.js +1 -1
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.d.ts +0 -6
- 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 +0 -2
- package/dist/modules/multimedia/VideoRecorder/useCameras.js +1 -1
- package/dist/modules/multimedia/Workspace/Workspace.js +1 -1
- package/package.json +6 -7
- package/dist/components/Masonry/Masonry.d.ts +0 -40
- package/dist/components/Masonry/Masonry.js +0 -1
- package/dist/components/Masonry/index.d.ts +0 -2
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/Agenda.js +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +0 -1
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +0 -14
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +0 -1
- package/dist/modules/homepage/components/Agenda/index.d.ts +0 -3
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +0 -24
- package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +0 -1
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/Agenda/services/api/index.js +0 -1
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +0 -19
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +0 -1
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +0 -9
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +0 -1
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +0 -1
- package/dist/modules/homepage/components/BriefMe/index.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/types.d.ts +0 -17
- package/dist/modules/homepage/components/BriefMe/types.js +0 -1
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +0 -31
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +0 -1
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/Cantine.js +0 -1
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +0 -1
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/CantineModal.js +0 -1
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +0 -10
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +0 -1
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +0 -5
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +0 -1
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +0 -6
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +0 -1
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +0 -12
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +0 -1
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +0 -11
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +0 -1
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +0 -1
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +0 -28
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +0 -1
- package/dist/modules/homepage/components/Cantine/index.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/types.d.ts +0 -42
- package/dist/modules/homepage/components/Captation/CaptationAudio/CaptationAudio.d.ts +0 -7
- package/dist/modules/homepage/components/Captation/CaptationVideo/CaptationVideo.d.ts +0 -9
- package/dist/modules/homepage/components/Edumalin/Edumalin.d.ts +0 -9
- package/dist/modules/homepage/components/Edumalin/Edumalin.js +0 -1
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Edumalin/EdumalinContainer.js +0 -1
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.d.ts +0 -8
- package/dist/modules/homepage/components/Edumalin/EdumalinModal.js +0 -1
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.d.ts +0 -5
- package/dist/modules/homepage/components/Edumalin/components/EdumalinBadge.js +0 -1
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.d.ts +0 -5
- package/dist/modules/homepage/components/Edumalin/components/EdumalinPicture.js +0 -1
- package/dist/modules/homepage/components/Edumalin/index.d.ts +0 -7
- package/dist/modules/homepage/components/Edumalin/types.d.ts +0 -24
- package/dist/modules/homepage/components/Edumalin/types.js +0 -1
- package/dist/modules/homepage/components/Edumalin/useEdumalin.d.ts +0 -16
- package/dist/modules/homepage/components/Edumalin/useEdumalin.js +0 -1
- package/dist/modules/homepage/components/Edumalin/utils.d.ts +0 -28
- package/dist/modules/homepage/components/Edumalin/utils.js +0 -1
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +0 -16
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +0 -1
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +0 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +0 -1
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +0 -1
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +0 -1
- package/dist/modules/homepage/components/GenerationHdf/index.d.ts +0 -3
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +0 -10
- package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/Mediacentre.d.ts +0 -13
- package/dist/modules/homepage/components/Mediacentre/Mediacentre.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Mediacentre/MediacentreContainer.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.d.ts +0 -6
- package/dist/modules/homepage/components/Mediacentre/components/MediacentreUniversalisSearch.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.d.ts +0 -17
- package/dist/modules/homepage/components/Mediacentre/hooks/useMediacentre.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/index.d.ts +0 -5
- package/dist/modules/homepage/components/Mediacentre/services/mediacentreService.d.ts +0 -24
- package/dist/modules/homepage/components/Mediacentre/services/mediacentreService.js +0 -1
- package/dist/modules/homepage/components/Mediacentre/types.d.ts +0 -8
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +0 -5
- package/dist/modules/homepage/components/Qwant/Qwant.js +0 -1
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +0 -2
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +0 -1
- package/dist/modules/homepage/components/Qwant/index.d.ts +0 -3
- package/dist/modules/homepage/components/Rss/Rss.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/Rss.js +0 -1
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Rss/RssContainer.js +0 -1
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +0 -13
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +0 -1
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +0 -1
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +0 -1
- package/dist/modules/homepage/components/Rss/index.d.ts +0 -6
- package/dist/modules/homepage/components/Rss/services/api/index.d.ts +0 -5
- package/dist/modules/homepage/components/Rss/services/api/index.js +0 -1
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +0 -38
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +0 -1
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +0 -28
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +0 -1
- package/dist/modules/homepage/components/Rss/types.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/utils.d.ts +0 -7
- package/dist/modules/homepage/components/Rss/utils.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTime.d.ts +0 -11
- package/dist/modules/homepage/components/ScreenTime/ScreenTime.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.d.ts +0 -10
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeChart.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.d.ts +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeContainer.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.d.ts +0 -5
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeError.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.d.ts +0 -22
- package/dist/modules/homepage/components/ScreenTime/ScreenTimeModal.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.d.ts +0 -14
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeContainer.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.d.ts +0 -6
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeKids.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.d.ts +0 -31
- package/dist/modules/homepage/components/ScreenTime/hooks/useScreenTimeModal.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/index.d.ts +0 -6
- package/dist/modules/homepage/components/ScreenTime/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/ScreenTime/services/api/index.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.d.ts +0 -28
- package/dist/modules/homepage/components/ScreenTime/services/api/screenTimeService.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.d.ts +0 -23
- package/dist/modules/homepage/components/ScreenTime/services/queries/screenTime.js +0 -1
- package/dist/modules/homepage/components/ScreenTime/types.d.ts +0 -30
- package/dist/modules/homepage/components/ScreenTime/utils.d.ts +0 -50
- package/dist/modules/homepage/components/ScreenTime/utils.js +0 -1
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.d.ts +0 -43
- package/dist/modules/homepage/components/TabsKids/components/TabsKids.js +0 -1
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.d.ts +0 -34
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsItem.js +0 -1
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.d.ts +0 -14
- package/dist/modules/homepage/components/TabsKids/components/TabsKidsList.js +0 -1
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.d.ts +0 -20
- package/dist/modules/homepage/components/TabsKids/hooks/useTabsKidsOverflow.js +0 -1
- package/dist/modules/homepage/components/TabsKids/index.d.ts +0 -3
- package/dist/modules/homepage/components/TabsKids/utils/visibleTabs.d.ts +0 -15
- package/dist/modules/homepage/components/TabsKids/utils/visibleTabs.js +0 -1
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +0 -9
- package/dist/modules/homepage/components/Universalis/Universalis.js +0 -1
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +0 -1
- package/dist/modules/homepage/components/Universalis/index.d.ts +0 -3
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +0 -16
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +0 -1
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -1
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
- package/dist/modules/homepage/hooks/useUserSchools.js +0 -1
- package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
- package/dist/modules/icons/components/IconAddWidget.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconSortAscendingLetters from"../../icons/components/IconSortAscendingLetters.js";import SvgIconSortDescendingLetters from"../../icons/components/IconSortDescendingLetters.js";import SvgIconSortTime from"../../icons/components/IconSortTime.js";import useHasWorkflow from"../../../hooks/useHasWorkflow/useHasWorkflow.js";import FileCard from"../FileCard/FileCard.js";import SearchBar from"../../../components/SearchBar/SearchBar.js";import Dropdown from"../../../components/Dropdown/Dropdown.js";import EmptyScreen from"../../../components/EmptyScreen/EmptyScreen.js";import{Grid}from"../../../components/Grid/Grid.js";import LoadingScreen from"../../../components/LoadingScreen/LoadingScreen.js";import{findTreeNode}from"../../../components/TreeView/utilities/treeview.js";import useWorkspaceSearch from"../../../hooks/useWorkspaceSearch/useWorkspaceSearch.js";import TreeView from"../../../components/TreeView/TreeView.js";import clsx$1 from"clsx";import{useCallback,useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuTrash from"@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";var WORKSPACE_VIEW_WORKFLOW=`org.entcore.workspace.controllers.WorkspaceController|view`,Workspace=({roles,onSelect,multiple=!0,className,defaultFolder,showPublicFolder})=>{let{t}=useTranslation(),hasWorkspaceViewRight=useHasWorkflow(WORKSPACE_VIEW_WORKFLOW),canViewPersonalFolders=!!hasWorkspaceViewRight,{root:ownerRoot,loadContent:loadOwnerDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.owner`),`owner`,roles),{root:sharedRoot,loadContent:loadSharedDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.shared`),`shared`,roles),{root:protectRoot,loadContent:loadProtectedDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.protected`),`protected`,roles),{root:publicRoot,loadContent:loadPublicDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.public`),`public`,roles),ownerRef=useRef(null),sharedRef=useRef(null),protectRef=useRef(null),publicRef=useRef(null),[currentFilter,setCurrentFilter]=useState(()=>defaultFolder===`public`?showPublicFolder?defaultFolder:`protected`:defaultFolder===`protected`||defaultFolder===`shared`?defaultFolder:`owner`),[currentNode,setCurrentNode]=useState(()=>defaultFolder===`public`?showPublicFolder?publicRoot:protectRoot:defaultFolder===`protected`?protectRoot:defaultFolder===`shared`?sharedRoot:ownerRoot),[documents,setDocuments]=useState(),[searchTerm,setSearchTerm]=useState(null),[sortOrder,setSortOrder]=useState([`modified`,`desc`]),[selectedDocuments,setSelectedDocuments]=useState([]),rootNodeFor=useCallback(filter=>{switch(filter){case`owner`:return{root:ownerRoot,othersRef:[sharedRef,protectRef,publicRef]};case`shared`:return{root:sharedRoot,othersRef:[ownerRef,protectRef,publicRef]};case`protected`:return{root:protectRoot,othersRef:[ownerRef,sharedRef,publicRef]};case`public`:return{root:publicRoot,othersRef:[ownerRef,sharedRef,protectRef]};default:throw`no.root.node`}},[ownerRoot,sharedRoot,protectRoot,publicRoot]),loadContent=useCallback(()=>{switch(currentFilter){case`owner`:loadOwnerDocs(currentNode.id);break;case`shared`:loadSharedDocs(currentNode.id);break;case`protected`:loadProtectedDocs(currentNode.id);break;case`public`:loadPublicDocs(currentNode.id);break;default:throw`no.way`}},[currentFilter,currentNode.id,loadOwnerDocs,loadProtectedDocs,loadPublicDocs,loadSharedDocs]);function selectAndLoadContent(filter,nodeId){setCurrentFilter(filter);let{root,othersRef}=rootNodeFor(filter),targetNode=findTreeNode(root,node=>node.id===nodeId);targetNode&&(setCurrentNode(targetNode),othersRef.forEach(otherRef=>otherRef.current?.unselectAll()))}useEffect(()=>{let ref;switch(currentFilter){case`owner`:ref=ownerRef;break;case`shared`:ref=sharedRef;break;case`protected`:ref=protectRef;break;case`public`:ref=publicRef;break;default:return}ref?.current?.select(`root`)},[currentFilter]),useEffect(()=>{hasWorkspaceViewRight===!1&&(currentFilter===`owner`||currentFilter===`shared`)&&selectAndLoadContent(`protected`,`root`)},[hasWorkspaceViewRight]),useEffect(loadContent,[loadContent]),useEffect(()=>{if(currentNode.files){let list=[].concat(currentNode.files);searchTerm&&(list=list.filter(f=>f.name.indexOf(searchTerm)>=0));let sortFunction=sortOrder[0]===`name`?sortOrder[1]===`asc`?(a,b)=>compare(a.name,b.name):(a,b)=>compare(b.name,a.name):(a,b)=>compare(b.modified,a.modified);setDocuments(()=>list.sort(sortFunction))}else setDocuments(void 0)},[currentNode,ownerRoot,protectRoot,sharedRoot,publicRoot,searchTerm,sortOrder]);let handleSearchChange=useCallback(e=>{setSearchTerm(e.target.value)},[setSearchTerm]);function compare(a,b){return a?b?a.localeCompare(b):1:-1}function getSortOrderLabel(){return sortOrder[0]===`name`?sortOrder[1]===`asc`?t(`sort.order.alpha.asc`):t(`sort.order.alpha.desc`):t(`sort.order.modify.desc`)}function handleSelectDoc(doc){let currentDocuments=[...selectedDocuments];currentDocuments=multiple?currentDocuments.includes(doc)?currentDocuments.filter(selectedDocument=>selectedDocument._id!==doc._id):[...currentDocuments,doc]:[doc],setSelectedDocuments(currentDocuments),onSelect(currentDocuments)}return jsxs(Grid,{className:clsx$1(`workspace flex-grow-1 gap-0`,className),children:[jsx(Grid.Col,{sm:`12`,md:`3`,xl:`4`,className:`workspace-folders p-12 pt-0 gap-12`,children:jsxs(`div`,{style:{position:`sticky`,top:0,paddingTop:`1.2rem`},children:[canViewPersonalFolders&&jsx(TreeView,{ref:ownerRef,data:ownerRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`owner`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`owner`,nodeId)}),canViewPersonalFolders&&jsx(TreeView,{ref:sharedRef,data:sharedRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`shared`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`shared`,nodeId)}),jsx(TreeView,{ref:protectRef,data:protectRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`protected`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`protected`,nodeId)}),showPublicFolder&&jsx(TreeView,{ref:publicRef,data:publicRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`public`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`public`,nodeId)})]})}),jsx(Grid.Col,{sm:`12`,md:`5`,xl:`8`,children:jsxs(Grid,{className:`flex-grow-1 gap-0`,children:[jsxs(Grid.Col,{sm:`4`,md:`8`,xl:`12`,children:[jsx(`div`,{className:`workspace-search px-16 py-8 `,children:jsx(SearchBar,{isVariant:!0,onChange:handleSearchChange})}),jsxs(`div`,{className:`d-flex align-items-center justify-content-end px-8 py-4`,children:[jsx(`small`,{className:`text-muted`,children:t(`workspace.search.order`)}),jsxs(Dropdown,{children:[jsx(Dropdown.Trigger,{size:`sm`,label:getSortOrderLabel(),variant:`ghost`}),jsxs(Dropdown.Menu,{children:[jsx(Dropdown.Item,{icon:jsx(SvgIconSortTime,{}),onClick:()=>setSortOrder([`modified`,`desc`]),children:t(`sort.order.modify.desc`)}),jsx(Dropdown.Item,{icon:jsx(SvgIconSortAscendingLetters,{}),onClick:()=>setSortOrder([`name`,`asc`]),children:t(`sort.order.alpha.asc`)}),jsx(Dropdown.Item,{icon:jsx(SvgIconSortDescendingLetters,{}),onClick:()=>setSortOrder([`name`,`desc`]),children:t(`sort.order.alpha.desc`)})]})]})]})]}),jsx(Grid.Col,{sm:`4`,md:`8`,xl:`12`,className:`p-8 gap-8`,children:documents?documents.length===0?jsx(EmptyScreen,{imageSrc:illuTrash,text:t(`workspace.empty.docSpace`),title:t(`explorer.emptyScreen.trash.title`)}):jsx(`div`,{className:`grid grid-workspace`,children:documents.map(doc=>jsx(FileCard,{doc,isSelected:selectedDocuments.includes(doc),onClick:()=>handleSelectDoc(doc)},doc._id))}):jsx(LoadingScreen,{})})]})})]})};export{Workspace as default};
|
|
1
|
+
import SvgIconSortAscendingLetters from"../../icons/components/IconSortAscendingLetters.js";import SvgIconSortDescendingLetters from"../../icons/components/IconSortDescendingLetters.js";import SvgIconSortTime from"../../icons/components/IconSortTime.js";import useHasWorkflow from"../../../hooks/useHasWorkflow/useHasWorkflow.js";import FileCard from"../FileCard/FileCard.js";import SearchBar from"../../../components/SearchBar/SearchBar.js";import Dropdown from"../../../components/Dropdown/Dropdown.js";import EmptyScreen from"../../../components/EmptyScreen/EmptyScreen.js";import{Grid}from"../../../components/Grid/Grid.js";import LoadingScreen from"../../../components/LoadingScreen/LoadingScreen.js";import{findTreeNode}from"../../../components/TreeView/utilities/treeview.js";import useWorkspaceSearch from"../../../hooks/useWorkspaceSearch/useWorkspaceSearch.js";import TreeView from"../../../components/TreeView/TreeView.js";import clsx$1 from"clsx";import{useCallback,useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuTrash from"@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";var WORKSPACE_VIEW_WORKFLOW=`org.entcore.workspace.controllers.WorkspaceController|view`,Workspace=({roles,onSelect,multiple=!0,className,defaultFolder,showPublicFolder})=>{let{t}=useTranslation(),hasWorkspaceViewRight=useHasWorkflow(WORKSPACE_VIEW_WORKFLOW),canViewPersonalFolders=!!hasWorkspaceViewRight,{root:ownerRoot,loadContent:loadOwnerDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.owner`),`owner`,roles),{root:sharedRoot,loadContent:loadSharedDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.shared`),`shared`,roles),{root:protectRoot,loadContent:loadProtectedDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.protected`),`protected`,roles),{root:publicRoot,loadContent:loadPublicDocs}=useWorkspaceSearch(`root`,t(`workspace.tree.public`),`public`,roles),ownerRef=useRef(null),sharedRef=useRef(null),protectRef=useRef(null),publicRef=useRef(null),[currentFilter,setCurrentFilter]=useState(()=>defaultFolder===`public`?showPublicFolder?defaultFolder:`protected`:defaultFolder===`protected`||defaultFolder===`shared`?defaultFolder:`owner`),[currentNode,setCurrentNode]=useState(()=>defaultFolder===`public`?showPublicFolder?publicRoot:protectRoot:defaultFolder===`protected`?protectRoot:defaultFolder===`shared`?sharedRoot:ownerRoot),[documents,setDocuments]=useState(),[searchTerm,setSearchTerm]=useState(null),[sortOrder,setSortOrder]=useState([`modified`,`desc`]),[selectedDocuments,setSelectedDocuments]=useState([]),rootNodeFor=useCallback(filter=>{switch(filter){case`owner`:return{root:ownerRoot,othersRef:[sharedRef,protectRef,publicRef]};case`shared`:return{root:sharedRoot,othersRef:[ownerRef,protectRef,publicRef]};case`protected`:return{root:protectRoot,othersRef:[ownerRef,sharedRef,publicRef]};case`public`:return{root:publicRoot,othersRef:[ownerRef,sharedRef,protectRef]};default:throw`no.root.node`}},[ownerRoot,sharedRoot,protectRoot,publicRoot]),loadContent=useCallback(()=>{switch(currentFilter){case`owner`:loadOwnerDocs(currentNode.id);break;case`shared`:loadSharedDocs(currentNode.id);break;case`protected`:loadProtectedDocs(currentNode.id);break;case`public`:loadPublicDocs(currentNode.id);break;default:throw`no.way`}},[currentFilter,currentNode.id,loadOwnerDocs,loadProtectedDocs,loadPublicDocs,loadSharedDocs]);function selectAndLoadContent(filter,nodeId){setCurrentFilter(filter);let{root,othersRef}=rootNodeFor(filter),targetNode=findTreeNode(root,node=>node.id===nodeId);targetNode&&(setCurrentNode(targetNode),othersRef.forEach(otherRef=>otherRef.current?.unselectAll()))}useEffect(()=>{let ref;switch(currentFilter){case`owner`:ref=ownerRef;break;case`shared`:ref=sharedRef;break;case`protected`:ref=protectRef;break;case`public`:ref=publicRef;break;default:return}ref?.current?.select(`root`)},[currentFilter]),useEffect(()=>{hasWorkspaceViewRight===!1&&(currentFilter===`owner`||currentFilter===`shared`)&&selectAndLoadContent(`protected`,`root`)},[hasWorkspaceViewRight]),useEffect(loadContent,[loadContent]),useEffect(()=>{if(currentNode.files){let list=[].concat(currentNode.files);searchTerm&&(list=list.filter(f=>f.name.indexOf(searchTerm)>=0));let sortFunction=sortOrder[0]===`name`?sortOrder[1]===`asc`?(a,b)=>compare(a.name,b.name):(a,b)=>compare(b.name,a.name):(a,b)=>compare(b.modified,a.modified);setDocuments(()=>list.sort(sortFunction))}else setDocuments(void 0)},[currentNode,ownerRoot,protectRoot,sharedRoot,publicRoot,searchTerm,sortOrder]);let handleSearchChange=useCallback(e=>{setSearchTerm(e.target.value)},[setSearchTerm]);function compare(a,b){return a?b?a.localeCompare(b):1:-1}function getSortOrderLabel(){return sortOrder[0]===`name`?sortOrder[1]===`asc`?t(`sort.order.alpha.asc`):t(`sort.order.alpha.desc`):t(`sort.order.modify.desc`)}function handleSelectDoc(doc){let currentDocuments=[...selectedDocuments];currentDocuments=multiple?currentDocuments.includes(doc)?currentDocuments.filter(selectedDocument=>selectedDocument._id!==doc._id):[...currentDocuments,doc]:[doc],setSelectedDocuments(currentDocuments),onSelect(currentDocuments)}return jsxs(Grid,{className:clsx$1(`workspace flex-grow-1 gap-0`,className),children:[jsx(Grid.Col,{sm:`12`,md:`3`,xl:`4`,className:`workspace-folders p-12 pt-0 gap-12`,children:jsxs(`div`,{style:{position:`sticky`,top:0,paddingTop:`1.2rem`},children:[canViewPersonalFolders&&jsx(TreeView,{ref:ownerRef,data:ownerRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`owner`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`owner`,nodeId)}),canViewPersonalFolders&&jsx(TreeView,{ref:sharedRef,data:sharedRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`shared`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`shared`,nodeId)}),jsx(TreeView,{ref:protectRef,data:protectRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`protected`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`protected`,nodeId)}),showPublicFolder&&jsx(TreeView,{ref:publicRef,data:publicRoot,onTreeItemClick:nodeId=>selectAndLoadContent(`public`,nodeId),onTreeItemUnfold:nodeId=>selectAndLoadContent(`public`,nodeId)})]})}),jsx(Grid.Col,{sm:`12`,md:`5`,xl:`8`,children:jsxs(Grid,{className:`flex-grow-1 gap-0`,children:[jsxs(Grid.Col,{sm:`4`,md:`8`,xl:`12`,children:[jsx(`div`,{className:`workspace-search px-16 py-8 `,children:jsx(SearchBar,{isVariant:!0,className:`gap-16`,onChange:handleSearchChange})}),jsxs(`div`,{className:`d-flex align-items-center justify-content-end px-8 py-4`,children:[jsx(`small`,{className:`text-muted`,children:t(`workspace.search.order`)}),jsxs(Dropdown,{children:[jsx(Dropdown.Trigger,{size:`sm`,label:getSortOrderLabel(),variant:`ghost`}),jsxs(Dropdown.Menu,{children:[jsx(Dropdown.Item,{icon:jsx(SvgIconSortTime,{}),onClick:()=>setSortOrder([`modified`,`desc`]),children:t(`sort.order.modify.desc`)}),jsx(Dropdown.Item,{icon:jsx(SvgIconSortAscendingLetters,{}),onClick:()=>setSortOrder([`name`,`asc`]),children:t(`sort.order.alpha.asc`)}),jsx(Dropdown.Item,{icon:jsx(SvgIconSortDescendingLetters,{}),onClick:()=>setSortOrder([`name`,`desc`]),children:t(`sort.order.alpha.desc`)})]})]})]})]}),jsx(Grid.Col,{sm:`4`,md:`8`,xl:`12`,className:`p-8 gap-8`,children:documents?documents.length===0?jsx(EmptyScreen,{imageSrc:illuTrash,text:t(`workspace.empty.docSpace`),title:t(`explorer.emptyScreen.trash.title`)}):jsx(`div`,{className:`grid grid-workspace`,children:documents.map(doc=>jsx(FileCard,{doc,isSelected:selectedDocuments.includes(doc),onClick:()=>handleSelectDoc(doc)},doc._id))}):jsx(LoadingScreen,{})})]})})]})};export{Workspace as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.13-develop-
|
|
3
|
+
"version": "2.6.13-develop-pedago.20261113140442",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -117,7 +117,6 @@
|
|
|
117
117
|
"@tiptap/starter-kit": "3.32.0",
|
|
118
118
|
"@uidotdev/usehooks": "2.4.1",
|
|
119
119
|
"antd": "5.29.1",
|
|
120
|
-
"chart.js": "4.5.1",
|
|
121
120
|
"clsx": "2.1.1",
|
|
122
121
|
"dayjs": "1.11.19",
|
|
123
122
|
"emoji-picker-react": "4.17.4",
|
|
@@ -134,9 +133,9 @@
|
|
|
134
133
|
"swiper": "10.1.0",
|
|
135
134
|
"ua-parser-js": "1.0.36",
|
|
136
135
|
"zustand": "4.5.7",
|
|
137
|
-
"@edifice.io/bootstrap": "2.6.13-develop-
|
|
138
|
-
"@edifice.io/
|
|
139
|
-
"@edifice.io/
|
|
136
|
+
"@edifice.io/bootstrap": "2.6.13-develop-pedago.20261113140442",
|
|
137
|
+
"@edifice.io/utilities": "2.6.13-develop-pedago.20261113140442",
|
|
138
|
+
"@edifice.io/tiptap-extensions": "2.6.13-develop-pedago.20261113140442"
|
|
140
139
|
},
|
|
141
140
|
"devDependencies": {
|
|
142
141
|
"@babel/plugin-transform-react-pure-annotations": "7.27.1",
|
|
@@ -166,8 +165,8 @@
|
|
|
166
165
|
"typescript-eslint": "8.54.0",
|
|
167
166
|
"vite": "8.0.14",
|
|
168
167
|
"vite-plugin-dts": "4.5.4",
|
|
169
|
-
"@edifice.io/client": "2.6.13-develop-
|
|
170
|
-
"@edifice.io/config": "2.6.13-develop-
|
|
168
|
+
"@edifice.io/client": "2.6.13-develop-pedago.20261113140442",
|
|
169
|
+
"@edifice.io/config": "2.6.13-develop-pedago.20261113140442"
|
|
171
170
|
},
|
|
172
171
|
"peerDependencies": {
|
|
173
172
|
"@react-spring/web": "9.7.5",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
export interface MasonryItemProps {
|
|
3
|
-
/**
|
|
4
|
-
* Number of columns the item spans (capped to the number of columns).
|
|
5
|
-
* @default 1
|
|
6
|
-
*/
|
|
7
|
-
span?: number;
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
export interface MasonryProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
-
/**
|
|
12
|
-
* Items to lay out. Each child is one masonry item, in reading order.
|
|
13
|
-
*/
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* Number of columns. Each column takes an equal share of the available
|
|
17
|
-
* width, gap excluded.
|
|
18
|
-
* @default 2
|
|
19
|
-
*/
|
|
20
|
-
columns?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Gap between columns and between items, as a spacing token (e.g. `16`).
|
|
23
|
-
* @default '16'
|
|
24
|
-
*/
|
|
25
|
-
gap?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Optional class for styling purpose
|
|
28
|
-
*/
|
|
29
|
-
className?: string;
|
|
30
|
-
}
|
|
31
|
-
export declare const Masonry: {
|
|
32
|
-
({ children, columns, gap, className, style, ...restProps }: MasonryProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
displayName: string;
|
|
34
|
-
} & {
|
|
35
|
-
Item: {
|
|
36
|
-
({ children }: MasonryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
displayName: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export default Masonry;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import clsx$1 from"clsx";import{Children,isValidElement,useCallback,useLayoutEffect,useRef,useState}from"react";import{Fragment as Fragment$1,jsx}from"react/jsx-runtime";var MasonryItem=({children})=>jsx(Fragment$1,{children}),Masonry=Object.assign(({children,columns=2,gap=`16`,className,style,...restProps})=>{let columnCount=Math.max(1,Math.floor(columns)),gridRef=useRef(null),itemRefs=useRef(new Map),[spans,setSpans]=useState({}),items=Children.toArray(children),measure=useCallback(()=>{let grid=gridRef.current;if(!grid)return;let rowGap=parseFloat(getComputedStyle(grid).columnGap)||0,next={};itemRefs.current.forEach((el,key)=>{next[key]=Math.ceil(el.getBoundingClientRect().height+rowGap)}),setSpans(prev=>{let keys=Object.keys(next);return keys.length===Object.keys(prev).length&&keys.every(key=>prev[key]===next[key])?prev:next})},[]);return useLayoutEffect(()=>{if(measure(),typeof ResizeObserver>`u`)return;let observer=new ResizeObserver(measure);return gridRef.current&&observer.observe(gridRef.current),itemRefs.current.forEach(el=>observer.observe(el)),()=>observer.disconnect()},[measure,columnCount,items.length]),jsx(`div`,{ref:gridRef,className:clsx$1(`masonry`,`column-gap-${gap}`,className),style:{display:`grid`,gridTemplateColumns:`repeat(${columnCount}, minmax(0, 1fr))`,gridAutoRows:`1px`,alignItems:`start`,...style},...restProps,children:items.map((item,index)=>{let key=String(item.key??index),span=isValidElement(item)&&item.type===MasonryItem?Math.min(Math.max(1,Math.floor(item.props.span??1)),columnCount):1;return jsx(`div`,{ref:el=>{el?itemRefs.current.set(key,el):itemRefs.current.delete(key)},className:`masonry__item`,"data-testid":`masonry-item-${index}`,style:{gridColumn:`span ${span}`,gridRowEnd:`span ${spans[key]??1}`},children:item},key)})})},{Item:MasonryItem});export{Masonry as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function AgendaContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createAgendaService}from"./agendaService.js";var agendaService=createAgendaService(``);export{agendaService};
|
|
@@ -1,19 +0,0 @@
|
|
|
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>;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,31 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
})[];
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,7 +0,0 @@
|
|
|
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';
|