@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 SvgIconArrowRight from"../../../icons/components/IconArrowRight.js";import Flex from"../../../../components/Flex/Flex.js";import
|
|
1
|
+
import SvgIconArrowRight from"../../../icons/components/IconArrowRight.js";import Flex from"../../../../components/Flex/Flex.js";import EmptyScreen from"../../../../components/EmptyScreen/EmptyScreen.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import LastInfos from"./LastInfos.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuLastInfosEmptyScreen from"@edifice.io/bootstrap/dist/images/homepage/illu-empty-last-infos.png";function LastInfosList({infos,onInfoClick:handleInfoClick=(threadId,id)=>{window.open(`/actualites/threads/${threadId}?info=${id}`,`_self`)},onSeeMoreClick:handleSeeMoreClick=()=>{window.open(`/actualites`,`_self`)}}){let{t}=useTranslation();return jsxs(Flex,{gap:`8`,direction:`column`,className:`last-infos-list`,children:[jsxs(Flex,{justify:`between`,align:`center`,className:`last-infos-list-header`,children:[jsx(`h2`,{className:`last-infos-list-title`,children:t(`homepage.last-infos-list.title`)}),jsx(ButtonBeta,{color:`tertiary`,variant:`ghost`,className:`last-infos-list-seemore`,rightIcon:jsx(SvgIconArrowRight,{}),onClick:handleSeeMoreClick,children:t(`homepage.last-infos-list.see.more`)})]}),jsx(`div`,{className:`last-infos-list-body`,children:infos.length===0?jsx(EmptyScreen,{imageSrc:illuLastInfosEmptyScreen,size:135,text:t(`homepage.last-infos-list.empty`)}):infos.map(infosProps=>jsx(LastInfos,{onClick:handleInfoClick,...infosProps},infosProps.id))})]})}export{LastInfosList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconAlertTriangle from"../../../icons/components/IconAlertTriangle.js";import SvgIconClose from"../../../icons/components/IconClose.js";import SvgIconInfoCircle from"../../../icons/components/IconInfoCircle.js";import Flex from"../../../../components/Flex/Flex.js";import IconButton from"../../../../components/Button/IconButton.js";import{useEdificeClient}from"../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";import useBreakpoint from"../../../../hooks/useBreakpoint/useBreakpoint.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import clsx$1 from"clsx";import{useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var MessageFlash=({message,onCloseMessage})=>{let{currentLanguage}=useEdificeClient(),[isCollapsed,setIsCollapsed]=useState(!0),[hasOverflow,setHasOverflow]=useState(!1),contentRef=useRef(null),checkContentTimeoutRef=useRef(void 0),{t}=useTranslation(),{lg}=useBreakpoint(),content=``;message.contents&&(content=currentLanguage&&message.contents[currentLanguage]?message.contents[currentLanguage]:message.contents.fr?message.contents.fr:Object.keys(message.contents).map(key=>message.contents[key]).filter(cont=>cont!==null)[0]),useEffect(()=>{content&&(checkContentTimeoutRef.current&&clearTimeout(checkContentTimeoutRef.current),checkContentTimeoutRef.current=setTimeout(()=>{if(contentRef.current){let element=contentRef.current,originalClass=element.className;element.className=element.className.replace(/text-truncate(-\d+)?/g,``).trim();let computedStyle=window.getComputedStyle(element),lineHeight=parseFloat(computedStyle.lineHeight)||parseFloat(computedStyle.fontSize)*1.2,contentHeight=element.scrollHeight;setHasOverflow(contentHeight>lineHeight*2+2),element.className=originalClass}},0))},[content]),useEffect(()=>()=>{checkContentTimeoutRef.current&&clearTimeout(checkContentTimeoutRef.current)});let classes=clsx$1(`message-flash`,message.color?`message-flash-${message.color}`:null),classesContent=clsx$1(`message-flash-content`,isCollapsed?`text-truncate text-truncate-2`:null);return jsxs(`div`,{className:classes,children:[(hasOverflow&&!isCollapsed||!hasOverflow)&&jsx(IconButton,{variant:`ghost`,color:`tertiary`,icon:jsx(SvgIconClose,{}),onClick:()=>{onCloseMessage?.(message)},className:`message-flash-close-button`,"data-testid":`message-flash-close-button`,"aria-label":t(`close.message`,{title:message.title}),title:t(`close.message`,{title:message.title})}),jsx(`div`,{className:`message-flash-icon`,role:`img`,"aria-label":message.color===`red`?t(`homepage.messageFlash.warning`):t(`homepage.messageFlash.information`),children:message.color&&message.color===`red`?jsx(SvgIconAlertTriangle,{}):jsx(SvgIconInfoCircle,{})}),jsxs(Flex,{direction:`column`,className:`w-100 message-flash-body`,children:[jsx(`div`,{ref:contentRef,className:classesContent,dangerouslySetInnerHTML:{__html:content}}),jsxs(Flex,{direction:lg?`row`:`column`,justify:`between`,className:`message-flash-footer`,children:[jsx(`div`,{className:`fst-italic`,children:message.signature||``}),hasOverflow&&jsx(ButtonBeta,{"data-testid":isCollapsed?`message-flash-view-more-button`:`message-flash-view-less-button`,color:`default`,variant:`ghost`,onClick:()=>{setIsCollapsed(collapsed=>!collapsed)},"aria-controls":`message-flash-${message.id}-content`,"aria-expanded":!isCollapsed,className:`message-flash-collapse-button`,children:t(isCollapsed?`read.more`:`read.less`)})]})]})]})};export{MessageFlash as default};
|
|
1
|
+
import SvgIconAlertTriangle from"../../../icons/components/IconAlertTriangle.js";import SvgIconClose from"../../../icons/components/IconClose.js";import SvgIconInfoCircle from"../../../icons/components/IconInfoCircle.js";import Flex from"../../../../components/Flex/Flex.js";import IconButton from"../../../../components/Button/IconButton.js";import{useEdificeClient}from"../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";import useBreakpoint from"../../../../hooks/useBreakpoint/useBreakpoint.js";import Card from"../../../../components/Card/Card.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import clsx$1 from"clsx";import{useEffect,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var MessageFlash=({message,onCloseMessage})=>{let{currentLanguage}=useEdificeClient(),[isCollapsed,setIsCollapsed]=useState(!0),[hasOverflow,setHasOverflow]=useState(!1),contentRef=useRef(null),checkContentTimeoutRef=useRef(void 0),{t}=useTranslation(),{lg}=useBreakpoint(),content=``;message.contents&&(content=currentLanguage&&message.contents[currentLanguage]?message.contents[currentLanguage]:message.contents.fr?message.contents.fr:Object.keys(message.contents).map(key=>message.contents[key]).filter(cont=>cont!==null)[0]),useEffect(()=>{content&&(checkContentTimeoutRef.current&&clearTimeout(checkContentTimeoutRef.current),checkContentTimeoutRef.current=setTimeout(()=>{if(contentRef.current){let element=contentRef.current,originalClass=element.className;element.className=element.className.replace(/text-truncate(-\d+)?/g,``).trim();let computedStyle=window.getComputedStyle(element),lineHeight=parseFloat(computedStyle.lineHeight)||parseFloat(computedStyle.fontSize)*1.2,contentHeight=element.scrollHeight;setHasOverflow(contentHeight>lineHeight*2+2),element.className=originalClass}},0))},[content]),useEffect(()=>()=>{checkContentTimeoutRef.current&&clearTimeout(checkContentTimeoutRef.current)});let classes=clsx$1(`message-flash`,message.color?`message-flash-${message.color}`:null),classesContent=clsx$1(`message-flash-content`,isCollapsed?`text-truncate text-truncate-2`:null);return jsxs(`div`,{className:classes,children:[(hasOverflow&&!isCollapsed||!hasOverflow)&&jsx(IconButton,{variant:`ghost`,color:`tertiary`,icon:jsx(SvgIconClose,{}),onClick:()=>{onCloseMessage?.(message)},className:`message-flash-close-button`,"data-testid":`message-flash-close-button`,"aria-label":t(`close.message`,{title:message.title}),title:t(`close.message`,{title:message.title})}),jsx(`div`,{className:`message-flash-icon`,role:`img`,"aria-label":message.color===`red`?t(`homepage.messageFlash.warning`):t(`homepage.messageFlash.information`),children:message.color&&message.color===`red`?jsx(SvgIconAlertTriangle,{}):jsx(SvgIconInfoCircle,{})}),jsxs(Flex,{direction:`column`,className:`w-100 message-flash-body`,children:[jsx(Card.Title,{children:message.title}),jsx(`div`,{ref:contentRef,className:classesContent,dangerouslySetInnerHTML:{__html:content}}),jsxs(Flex,{direction:lg?`row`:`column`,justify:`between`,className:`message-flash-footer`,children:[jsx(`div`,{className:`fst-italic`,children:message.signature||``}),hasOverflow&&jsx(ButtonBeta,{"data-testid":isCollapsed?`message-flash-view-more-button`:`message-flash-view-less-button`,color:`default`,variant:`ghost`,onClick:()=>{setIsCollapsed(collapsed=>!collapsed)},"aria-controls":`message-flash-${message.id}-content`,"aria-expanded":!isCollapsed,className:`message-flash-collapse-button`,children:t(isCollapsed?`read.more`:`read.less`)})]})]})]})};export{MessageFlash as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconClose from"../../../icons/components/IconClose.js";import Flex from"../../../../components/Flex/Flex.js";import
|
|
1
|
+
import SvgIconClose from"../../../icons/components/IconClose.js";import Flex from"../../../../components/Flex/Flex.js";import EmptyScreen from"../../../../components/EmptyScreen/EmptyScreen.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import useInfiniteScroll from"../../../../hooks/useInfiniteScroll/useInfiniteScroll.js";import Divider from"../../../../components/Divider/Divider.js";import NotificationFilterMenu from"./components/NotificationFilterMenu.js";import NotificationItem from"./NotificationItem.js";import NotificationSkeleton from"./NotificationSkeleton.js";import NotificationListSkeleton from"./NotificationListSkeleton.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEmptyNotification from"@edifice.io/bootstrap/dist/images/homepage/illu-empty-notifications.png";var NotificationList=({notifications,notificationTypes,selectedTypes,onFilterChange,onCloseNotifications,onLoadNextPage,hasNextPage,isLoading})=>{let{t}=useTranslation(),loadNextRef=useInfiniteScroll({callback:()=>onLoadNextPage?.()});return jsx(`section`,{role:`region`,className:`notification-list`,children:jsxs(Flex,{direction:`column`,children:[jsxs(Flex,{justify:`between`,align:`center`,wrap:`nowrap`,className:`py-16 ps-24 pe-8`,children:[jsxs(Flex,{align:`center`,gap:`8`,className:`notification-list-title`,children:[jsx(`h4`,{className:`text-truncate`,children:t(`homepage.notifications-list.title`)}),notificationTypes&¬ificationTypes.length>0&&jsx(NotificationFilterMenu,{notificationTypes,selectedTypes:selectedTypes??notificationTypes,onFilterChange:types=>onFilterChange?.(types)})]}),onCloseNotifications&&jsx(ButtonBeta,{color:`tertiary`,variant:`ghost`,rightIcon:jsx(SvgIconClose,{}),onClick:()=>{onCloseNotifications&&onCloseNotifications()},"aria-label":t(`homepage.notifications-list.close`),title:t(`homepage.notifications-list.close`),"data-testid":`notification-list-close-button`})]}),notifications?.length===0?jsx(`div`,{className:`mx-24`,children:jsx(EmptyScreen,{size:135,imageSrc:illuEmptyNotification,imageAlt:t(`homepage.notifications-list.empty.description`),text:t(`homepage.notifications-list.empty.description`)})}):jsxs(Fragment,{children:[jsx(`ul`,{children:notifications?.map((notification,index)=>jsxs(`li`,{children:[jsx(NotificationItem,{notification}),jsx(Divider,{className:`border-grey-300 my-0`})]},`notification-list-`+notification._id+`-`+index))}),hasNextPage&&jsx(NotificationSkeleton,{ref:loadNextRef}),isLoading&&jsx(NotificationListSkeleton,{})]})]})})};export{NotificationList as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Divider from"../../../../components/Divider/Divider.js";import NotificationSkeleton from"./NotificationSkeleton.js";import{jsx,jsxs}from"react/jsx-runtime";var
|
|
1
|
+
import Divider from"../../../../components/Divider/Divider.js";import NotificationSkeleton from"./NotificationSkeleton.js";import{jsx,jsxs}from"react/jsx-runtime";var NotificationListSkeleton=()=>jsxs(`ul`,{children:[jsxs(`li`,{children:[jsx(NotificationSkeleton,{}),jsx(Divider,{className:`border-grey-300 my-0`})]}),jsxs(`li`,{children:[jsx(NotificationSkeleton,{}),jsx(Divider,{className:`border-grey-300 my-0`})]}),jsx(`li`,{children:jsx(NotificationSkeleton,{})})]});export{NotificationListSkeleton as default};
|
package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconCheck from"../../../../icons/components/IconCheck.js";import Flex from"../../../../../components/Flex/Flex.js";import AppIcon from"../../../../../components/AppIcon/AppIcon.js";import
|
|
1
|
+
import SvgIconCheck from"../../../../icons/components/IconCheck.js";import Flex from"../../../../../components/Flex/Flex.js";import AppIcon from"../../../../../components/AppIcon/AppIcon.js";import ButtonBeta from"../../../../../components/ButtonBeta/ButtonBeta.js";import Modal from"../../../../../components/Modal/Modal.js";import{getAppCodeAndI18nKey}from"./notificationAdapter.js";import clsx$1 from"clsx";import{useEffect,useMemo,useRef,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var NotificationFilterModal=({isOpen,allTypes,appliedTypes,onCancel,onApply})=>{let{t,i18n}=useTranslation(),[selected,setSelected]=useState(appliedTypes),refSelectAllCheckbox=useRef(null),allTypesSorted=useMemo(()=>allTypes.map(type=>{let[appCode,appI18nKey]=getAppCodeAndI18nKey(type);return{type,appCode,appI18nKey,label:t(appI18nKey,{defaultValue:appCode})}}).sort((a,b)=>a.label.localeCompare(b.label,i18n.language,{sensitivity:`base`})),[allTypes,t,i18n.language]),toggleType=type=>{setSelected(current=>current.includes(type)?current.filter(value=>value!==type):[...current,type])};return useEffect(()=>{refSelectAllCheckbox.current&&(refSelectAllCheckbox.current.indeterminate=selected.length>0&&selected.length<allTypes.length)},[selected.length,allTypes.length]),jsxs(Modal,{id:`notification-filter-modal`,size:`lg`,scrollable:!0,isOpen,onModalClose:onCancel,children:[jsx(Modal.Header,{onModalClose:onCancel,children:t(`homepage.notifications.filter-modal.title`)}),jsx(Modal.Subtitle,{children:t(`homepage.notifications.filter-modal.subtitle`)}),jsxs(Modal.Body,{children:[jsxs(Flex,{align:`center`,gap:`8`,className:`mb-24`,children:[jsxs(`label`,{className:`notification-filter-select-all notification-filter-chip`,children:[jsx(`span`,{children:t(`homepage.notifications.filter-modal.select-all`)}),jsx(`input`,{type:`checkbox`,ref:refSelectAllCheckbox,checked:selected.length===allTypes.length,className:`notification-filter-checkbox`,onChange:()=>{setSelected(selected.length===allTypes.length?[]:allTypes)}})]}),jsx(`span`,{className:`notification-filter-count`,children:t(`homepage.notifications.filter-modal.count`,{selected:selected.length,total:allTypes.length})})]}),jsx(Flex,{wrap:`wrap`,gap:`16`,className:`notification-filter-options`,children:allTypesSorted.map(({type,label,appCode})=>{let checked=selected.includes(type);return jsxs(`label`,{className:clsx$1(`notification-filter-chip`,{"is-checked":checked}),children:[jsx(AppIcon,{app:appCode,size:`24`,iconFit:`contain`}),jsx(`span`,{children:label}),jsx(`input`,{type:`checkbox`,className:`notification-filter-checkbox`,checked,onChange:()=>toggleType(type)})]},type)})})]}),jsxs(Modal.Footer,{children:[jsx(ButtonBeta,{color:`tertiary`,onClick:onCancel,type:`button`,variant:`ghost`,children:t(`cancel`)}),jsx(ButtonBeta,{color:`default`,onClick:()=>onApply(selected),type:`button`,variant:`filled`,rightIcon:jsx(SvgIconCheck,{}),children:t(`homepage.notifications.filter-modal.confirm`)})]})]})};export{NotificationFilterModal as default};
|
package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconAlertTriangle from"../../../../icons/components/IconAlertTriangle.js";import ButtonBeta from"../../../../../components/ButtonBeta/ButtonBeta.js";import
|
|
1
|
+
import SvgIconAlertTriangle from"../../../../icons/components/IconAlertTriangle.js";import ButtonBeta from"../../../../../components/ButtonBeta/ButtonBeta.js";import Modal from"../../../../../components/Modal/Modal.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var ReportNotificationModal=({isOpen,onCancel,onConfirm})=>{let{t}=useTranslation();return jsxs(Modal,{id:`report-notification-modal`,size:`sm`,isOpen,onModalClose:onCancel,children:[jsx(Modal.Header,{onModalClose:onCancel,children:t(`homepage.notifications.report-modal.title`,{defaultValue:`Signaler une notification`})}),jsx(Modal.Body,{children:jsx(`p`,{children:t(`homepage.notifications.report-modal.body`,{defaultValue:`Attention ! Vous souhaitez signaler une notification inappropriée ou qui ne respecte pas les conditions d'utilisation de ONE. L'heure et l'origine de ce signalement seront enregistrées et transmises à un administrateur pour traitement.`})})}),jsxs(Modal.Footer,{children:[jsx(ButtonBeta,{color:`tertiary`,onClick:onCancel,type:`button`,variant:`ghost`,children:t(`cancel`)}),jsx(ButtonBeta,{color:`default`,onClick:onConfirm,type:`button`,variant:`filled`,leftIcon:jsx(SvgIconAlertTriangle,{}),children:t(`homepage.notifications.report-modal.confirm`,{defaultValue:`Signaler la notification`})})]})]})};export{ReportNotificationModal as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var resolveNotificationResourceUri=(params,type,appCode,eventType)=>{if(appCode===`timeline`&&eventType===`NOTIFY-REPORT`)return`/admin`;if(type===`user`)return params.resourceUri||params.uri;for(let[key,value]of Object.entries(params))if(typeof value==`string`&&value.length>0&&key.endsWith(`Uri`)&&key!==`profilUri`&&key!==`resourceFolderUri`)return value},parseNotificationMessage=message=>message.replace(/<\/a>/gi,`</strong>`).replace(/<a\b[^>]*>/gi,`<strong>`),getAppCodeAndI18nKey=appCode=>{appCode=appCode.toLowerCase();let appI18nKey
|
|
1
|
+
var resolveNotificationResourceUri=(params,type,appCode,eventType)=>{if(appCode===`timeline`&&eventType===`NOTIFY-REPORT`)return`/admin`;if(type===`user`)return params.resourceUri||params.uri;for(let[key,value]of Object.entries(params))if(typeof value==`string`&&value.length>0&&key.endsWith(`Uri`)&&key!==`profilUri`&&key!==`resourceFolderUri`)return value},parseNotificationMessage=message=>message.replace(/<\/a>/gi,`</strong>`).replace(/<a\b[^>]*>/gi,`<strong>`),getAppCodeAndI18nKey=appCode=>{appCode=appCode.toLowerCase();let appI18nKey=appCode;switch(appCode){case`collaborativewall`:appCode=`collaborative-wall`;break;case`collect`:appCode=`rack`;break;case`formulaire`:appI18nKey=`formulaire`,appCode=`forms`;break;case`messagerie`:appI18nKey=appCode=`conversation`;break;case`news`:appI18nKey=appCode=`actualites`;break;case`homeworks`:appCode=`cahier-de-texte`;break;case`userbook_motto`:appI18nKey=`userbook_motto`,appCode=`userbook`;break;case`userbook_mood`:appI18nKey=`userbook_mood`,appCode=`userbook`;break;case`userbook_discovervisiblegroups`:appI18nKey=`userbook_discovervisiblegroups`,appCode=`userbook`;break;default:appI18nKey=appCode=appCode.replace(/_/g,`-`)}return[appCode,appI18nKey]},notificationAdapter=notification=>{let type=notification.sender?`user`:`system`,[appCode,appI18nKey]=getAppCodeAndI18nKey(notification.type),uri=resolveNotificationResourceUri(notification.params,type,appCode,notification[`event-type`]||notification.eventType),date=new Date(notification.date.$date),message=parseNotificationMessage(notification.message),base={id:notification._id,uri,message,date};return type===`user`?{...base,type:`user`,params:{username:notification.params.username,userId:notification.sender,appCode,appI18nKey}}:{...base,type:`system`,params:{appCode,appI18nKey}}};export{getAppCodeAndI18nKey,notificationAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import useDate from"../../../../../hooks/useDate/useDate.js";import{useNotificationTypes,useNotifications,useSaveTimelinePreference,useTimelinePreference}from"../services/queries/notification.js";import{useEffect,useState}from"react";var useNotificationListContainer=()=>{let{data:notificationTypes,isLoading:isLoadingTypes,isFetched:isFetchedTypes,error:errorTypes}=useNotificationTypes(),{data:preference,isFetched:isFetchedPreference}=useTimelinePreference(),{mutate:saveTimelinePreference}=useSaveTimelinePreference(),[selectedTypes,setSelectedTypesState]=useState();useEffect(()=>{selectedTypes===void 0&&isFetchedTypes&&isFetchedPreference
|
|
1
|
+
import useDate from"../../../../../hooks/useDate/useDate.js";import{useNotificationTypes,useNotifications,useSaveTimelinePreference,useTimelinePreference}from"../services/queries/notification.js";import{useEffect,useState}from"react";var useNotificationListContainer=()=>{let{data:notificationTypes,isLoading:isLoadingTypes,isFetched:isFetchedTypes,error:errorTypes}=useNotificationTypes(),{data:preference,isFetched:isFetchedPreference}=useTimelinePreference(),{mutate:saveTimelinePreference}=useSaveTimelinePreference(),[selectedTypes,setSelectedTypesState]=useState();useEffect(()=>{if(selectedTypes===void 0&&isFetchedTypes&&isFetchedPreference){let preferredTypes=preference?.type;setSelectedTypesState(preferredTypes&&preferredTypes.length>0?preferredTypes:notificationTypes??[])}},[selectedTypes,isFetchedTypes,isFetchedPreference,preference,notificationTypes]);let setSelectedTypes=types=>{setSelectedTypesState(types),saveTimelinePreference({...preference,type:types})},{data:notifications,hasNextPage,isLoading:isLoadingNotifications,error:errorNotifications,fetchNextPage}=useNotifications(selectedTypes??[],isFetchedTypes&&!!selectedTypes);return{notifications,notificationTypes,selectedTypes,setSelectedTypes,hasNextPage,loadNextPage:()=>fetchNextPage(),isLoading:isLoadingTypes||isLoadingNotifications,error:errorTypes||errorNotifications}},useHasNotificationToday=()=>{let{dateIsToday}=useDate(),{data:notificationTypes,isFetched:isFetchedTypes}=useNotificationTypes(),{data:notifications}=useNotifications(notificationTypes??[],isFetchedTypes);return notifications?.some(notification=>dateIsToday(notification.date))??!1};export{useHasNotificationToday,useNotificationListContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconRafterUp from"../../../icons/components/IconRafterUp.js";import SvgIconUserSearch from"../../../icons/components/IconUserSearch.js";import Flex from"../../../../components/Flex/Flex.js";import IconButton from"../../../../components/Button/IconButton.js";import useToggle from"../../../../hooks/useToggle/useToggle.js";import
|
|
1
|
+
import SvgIconRafterUp from"../../../icons/components/IconRafterUp.js";import SvgIconUserSearch from"../../../icons/components/IconUserSearch.js";import Flex from"../../../../components/Flex/Flex.js";import IconButton from"../../../../components/Button/IconButton.js";import useToggle from"../../../../hooks/useToggle/useToggle.js";import Dropdown from"../../../../components/Dropdown/Dropdown.js";import{getRotateTransitionStyle}from"../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var SchoolSpace=({schools,selectedSchool,onSelectedSchoolChange})=>{let[isExpanded,toggleExpanded]=useToggle(!1),{t}=useTranslation();if(!selectedSchool)return null;let hasManySchools=schools&&schools.length>1,directoryUrl=`/userbook/annuaire#/search?${new URLSearchParams({structure:selectedSchool.id}).toString()}`;return jsxs(Flex,{gap:`4`,direction:`column`,className:`school-space`,children:[jsxs(Flex,{className:`school-space-container`,justify:`center`,gap:`4`,align:`center`,children:[jsx(`b`,{children:selectedSchool.name}),hasManySchools&&jsx(Dropdown,{placement:`bottom-end`,onToggle:toggleExpanded,children:triggerProps=>jsxs(Fragment,{children:[jsx(IconButton,{...triggerProps,"aria-label":t(`show`),color:`tertiary`,variant:`ghost`,icon:jsx(SvgIconRafterUp,{className:`w-16 min-w-0`,style:getRotateTransitionStyle(isExpanded,{degrees:180})})}),jsx(Dropdown.Menu,{children:schools.map(school=>jsx(Dropdown.Item,{onClick:()=>onSelectedSchoolChange?.(school),children:jsx(Flex,{direction:`column`,children:jsx(`p`,{children:school.name})})},school.id))})]})})]}),jsx(ButtonBeta,{variant:`outline`,className:`school-space-directory-button`,leftIcon:jsx(SvgIconUserSearch,{}),onClick:()=>window.location.href=directoryUrl,children:t(`homepage.school-space.directory`)})]})};export{SchoolSpace as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SchoolSpace from"./SchoolSpace.js";import{useUserSchools}from"./useUserSchools.js";import{jsx}from"react/jsx-runtime";function SchoolSpaceContainer(){let{handleSelectedSchoolChange,...otherProps}=useUserSchools();return jsx(SchoolSpace,{onSelectedSchoolChange:handleSelectedSchoolChange,...otherProps})}export{SchoolSpaceContainer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { School
|
|
2
|
-
export declare function useUserSchools(
|
|
1
|
+
import { School } from '@edifice.io/client';
|
|
2
|
+
export declare function useUserSchools(): {
|
|
3
3
|
schools: School[];
|
|
4
4
|
selectedSchool: School | undefined;
|
|
5
5
|
handleSelectedSchoolChange: (school: School) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import useSession from"../../../../hooks/useSession/useSession.js";import useWidget from"../../hooks/useWidget.js";import{useEffect,useState}from"react";import{WIDGET_NAME}from"@edifice.io/client";function useUserSchools(){let{data:session}=useSession(),{preference,savePreference}=useWidget(WIDGET_NAME.SCHOOL),[selectedSchool,setSelectedSchool]=useState(),[schools,setSchools]=useState(session?.userDescription?.schools);return useEffect(()=>{let newSchools=session?.userDescription?.schools;setSchools(newSchools),setSelectedSchool(newSchools?.[0])},[session?.userDescription?.schools]),useEffect(()=>{if(Array.isArray(schools)){if(schools.length===1)setSelectedSchool(schools[0]);else if(preference?.schoolId){let index=schools.findIndex(school=>school.id===preference?.schoolId);setSelectedSchool(index<0||index>=schools.length?schools[0]:schools[index])}}},[preference,schools]),{schools:schools??[],selectedSchool,handleSelectedSchoolChange:school=>{setSelectedSchool(school),preference&&savePreference({...preference,schoolId:school.id})}}}export{useUserSchools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Input from"../../../../components/Input/Input.js";import Label from"../../../../components/Label/Label.js";import FormControl from"../../../../components/Form/FormControl.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import ModalBeta from"../../../../components/ModalBeta/ModalBeta.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import{useForm}from"react-hook-form";var NAME_MAX_LENGTH=80,URL_PATTERN=/^https?:\/\/.+/i;function LinkForm({mode,link,isSubmitting,onCancel,onClose,onSubmit}){let{t}=useTranslation(),formId=`useful-link-form`,{register,handleSubmit,formState:{errors,isDirty,isValid}}=useForm({mode:`onChange`,defaultValues:{name:link?.name??``,url:link?.url??``}}),title=t(mode===`add`?`homepage.usefulLinks.form.addTitle`:`homepage.usefulLinks.form.editTitle`);return jsxs(ModalBeta,{id:`useful-link-modal`,isOpen:!0,size:`l`,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:title}),jsx(ModalBeta.Body,{children:jsxs(`form`,{id:formId,onSubmit:handleSubmit(data=>{onSubmit({name:data.name.trim(),url:data.url.trim()})}),children:[jsxs(FormControl,{id:`useful-link-name`,className:`mb-16`,isRequired:!0,children:[jsx(Label,{children:t(`homepage.usefulLinks.form.name`)}),jsx(Input,{type:`text`,size:`md`,maxLength:NAME_MAX_LENGTH,showCounter:!0,clearable:!0,"data-testid":`usefullinks-input-name`,placeholder:t(`homepage.usefulLinks.form.name.placeholder`),...register(`name`,{required:!0,maxLength:NAME_MAX_LENGTH})})]}),jsxs(FormControl,{id:`useful-link-url`,isRequired:!0,status:errors.url?`invalid`:void 0,children:[jsx(Label,{children:t(`homepage.usefulLinks.form.url`)}),jsx(Input,{type:`text`,size:`md`,"data-testid":`usefullinks-input-url`,placeholder:t(`homepage.usefulLinks.form.url.placeholder`),...register(`url`,{required:!0,pattern:URL_PATTERN})}),errors.url&&jsx(FormControl.Text,{children:t(`homepage.usefulLinks.form.url.error`)})]})]})}),jsxs(ModalBeta.Footer,{children:[jsx(ButtonBeta,{type:`button`,variant:`ghost`,color:`tertiary`,"data-testid":`usefullinks-button-cancel`,onClick:onCancel,children:t(`homepage.usefulLinks.form.cancel`)}),jsx(ButtonBeta,{form:formId,type:`submit`,isLoading:isSubmitting,disabled:!isValid||!isDirty||isSubmitting,"data-testid":`usefullinks-button-save`,children:t(`homepage.usefulLinks.form.save`)})]})]})}export{LinkForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconEdit from"../../../icons/components/IconEdit.js";import Flex from"../../../../components/Flex/Flex.js";import Image from"../../../../components/Image/Image.js";import LinkPill from"../../../../components/LinkPill/LinkPill.js";import HomeCard from"../HomeCard/HomeCard.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import
|
|
1
|
+
import SvgIconEdit from"../../../icons/components/IconEdit.js";import Flex from"../../../../components/Flex/Flex.js";import Image from"../../../../components/Image/Image.js";import LinkPill from"../../../../components/LinkPill/LinkPill.js";import HomeCard from"../HomeCard/HomeCard.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEmptyUsefulLinks from"@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";function UsefulLinks({links,onEditClick}){let{t}=useTranslation();return jsxs(HomeCard,{variant:`primary`,children:[jsx(HomeCard.Header,{title:t(`homepage.usefulLinks.title`),actionLabel:t(`homepage.usefulLinks.edit`),actionLeftIcon:jsx(SvgIconEdit,{}),onActionClick:onEditClick,actionProps:{"data-testid":`usefullinks-button-edit`}}),jsx(HomeCard.Content,{children:links.length===0?jsxs(`div`,{className:`useful-links-widget__empty`,children:[jsx(Image,{src:illuEmptyUsefulLinks,alt:``,"aria-hidden":`true`,style:{width:160,height:87}}),jsx(`p`,{className:`useful-links-widget__empty-text`,children:t(`homepage.usefulLinks.empty`)})]}):jsx(Flex,{direction:`column`,gap:`8`,children:links.map(link=>jsx(LinkPill,{href:link.url,label:link.name,"data-testid":`usefullinks-link-${link.id}`},link.id))})})]})}export{UsefulLinks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconClose from"../../../icons/components/IconClose.js";import SvgIconEdit from"../../../icons/components/IconEdit.js";import SvgIconPlus from"../../../icons/components/IconPlus.js";import Flex from"../../../../components/Flex/Flex.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 Table from"../../../../components/Table/components/Table.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import
|
|
1
|
+
import SvgIconClose from"../../../icons/components/IconClose.js";import SvgIconEdit from"../../../icons/components/IconEdit.js";import SvgIconPlus from"../../../icons/components/IconPlus.js";import Flex from"../../../../components/Flex/Flex.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 Table from"../../../../components/Table/components/Table.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import illuEmptyUsefulLinks from"@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";function UsefulLinksModal({isOpen,links,canAddLink,onClose,onAddClick,onEditLink,onDeleteLink}){let{t}=useTranslation(),{md}=useBreakpoint(),addLinkButton=jsx(ButtonBeta,{type:`button`,variant:`outline`,leftIcon:jsx(SvgIconPlus,{}),onClick:onAddClick,disabled:!canAddLink,"data-testid":`usefullinks-button-add`,children:t(`homepage.usefulLinks.modal.add`)});return jsxs(ModalBeta,{id:`useful-links-modal`,isOpen,size:`l`,onModalClose:onClose,children:[jsx(ModalBeta.Header,{onModalClose:onClose,children:t(`homepage.usefulLinks.modal.title`)}),jsx(ModalBeta.Body,{children:links.length===0?jsxs(Fragment,{children:[jsx(Flex,{justify:`end`,className:`mb-16`,children:addLinkButton}),jsxs(`div`,{className:`useful-links-modal__empty`,children:[jsx(Image,{src:illuEmptyUsefulLinks,alt:``,"aria-hidden":`true`,style:{width:200,height:109}}),jsx(`p`,{className:`useful-links-modal__empty-title`,children:t(`homepage.usefulLinks.modal.empty.title`)}),jsx(`p`,{className:`useful-links-modal__empty-text`,children:t(`homepage.usefulLinks.modal.empty.text`)})]})]}):jsx(`div`,{className:`useful-links-table`,children:jsxs(Table,{children:[jsx(Table.Thead,{children:jsxs(Table.Tr,{children:[jsx(Table.Th,{className:`visually-hidden`,children:t(`homepage.usefulLinks.modal.table.name`)}),jsx(Table.Th,{className:`visually-hidden`,children:t(`homepage.usefulLinks.modal.table.url`)}),jsx(Table.Th,{className:`visually-hidden`,children:t(`homepage.usefulLinks.modal.table.actions`)})]})}),jsxs(Table.Tbody,{children:[jsx(Table.Tr,{className:`useful-links-table__action-row`,children:jsx(Table.Td,{colSpan:md?3:2,children:jsx(Flex,{justify:`end`,children:addLinkButton})})}),links.map(link=>jsxs(Table.Tr,{"data-testid":`usefullinks-row-${link.id}`,children:[jsx(Table.Td,{className:`useful-links-table__name`,children:link.name}),jsx(Table.Td,{className:`useful-links-table__url`,children:link.url}),jsx(Table.Td,{className:`useful-links-table__actions`,children:jsxs(Flex,{gap:`4`,justify:`end`,children:[jsx(ButtonBeta,{type:`button`,variant:`ghost`,color:`tertiary`,size:`sm`,leftIcon:jsx(SvgIconEdit,{}),"aria-label":t(`homepage.usefulLinks.modal.table.edit`,{name:link.name}),"data-testid":`usefullinks-button-edit-${link.id}`,onClick:()=>onEditLink(link)}),jsx(ButtonBeta,{type:`button`,variant:`ghost`,color:`tertiary`,size:`sm`,leftIcon:jsx(SvgIconClose,{}),"aria-label":t(`homepage.usefulLinks.modal.table.delete`,{name:link.name}),"data-testid":`usefullinks-button-delete-${link.id}`,onClick:()=>onDeleteLink(link.id)})]})})]},link.id))]})]})})})]})}export{UsefulLinksModal};
|
|
@@ -5,10 +5,8 @@ export type UserSpaceProps = {
|
|
|
5
5
|
avatar: string;
|
|
6
6
|
profile: UserProfile[number];
|
|
7
7
|
children?: ReactNode;
|
|
8
|
-
/** Renders a trigger button in the top-right corner when provided. */
|
|
9
|
-
onCustomizeWidgetsClick?: () => void;
|
|
10
8
|
};
|
|
11
|
-
declare function UserSpace({ name, avatar, profile, children,
|
|
9
|
+
declare function UserSpace({ name, avatar, profile, children, }: UserSpaceProps): import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
declare namespace UserSpace {
|
|
13
11
|
var displayName: string;
|
|
14
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SvgIconClass from"../../../icons/components/IconClass.js";import Flex from"../../../../components/Flex/Flex.js";import Avatar from"../../../../components/Avatar/Avatar.js";import ButtonBeta from"../../../../components/ButtonBeta/ButtonBeta.js";import HomeCard from"../HomeCard/HomeCard.js";import{useProfileLinks}from"./hooks/useProfileLinks.js";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function UserSpace({name,avatar,profile,children}){let{t}=useTranslation(),links=useProfileLinks(profile);return jsxs(HomeCard,{variant:`user`,footer:!!links&&jsx(Flex,{children:links.map((link,index)=>jsx(ButtonBeta,{size:`sm`,variant:`ghost`,leftIcon:jsx(SvgIconClass,{}),onClick:()=>window.location.href=link.url,children:link.text},`${link.url}-${index}`))}),children:[jsxs(Flex,{className:`user-space`,direction:`row`,gap:`8`,children:[jsx(Avatar,{className:`user-space--avatar`,size:`auto`,alt:name,src:avatar,variant:`circle`}),jsxs(Flex,{direction:`column`,children:[jsx(`div`,{"data-testid":`user-space-name`,className:`user-space--name`,children:name}),jsx(`div`,{"data-testid":`user-space-profile`,className:`user-space--profile`,children:t(profile)})]})]}),children&&jsx(HomeCard.Content,{children})]})}export{UserSpace as default};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function UserSpaceContainer({ children }: {
|
|
3
3
|
children?: ReactNode;
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare function UserSpaceContainer({ children, onCustomizeWidgetsClick, }: UserSpaceContainerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
7
5
|
export declare namespace UserSpaceContainer {
|
|
8
6
|
var displayName: string;
|
|
9
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import useUser from"../../../../hooks/useUser/useUser.js";import UserSpace from"./UserSpace.js";import{jsx}from"react/jsx-runtime";function UserSpaceContainer({children
|
|
1
|
+
import useUser from"../../../../hooks/useUser/useUser.js";import UserSpace from"./UserSpace.js";import{jsx}from"react/jsx-runtime";function UserSpaceContainer({children}){let{user,avatar,userDescription}=useUser();return!user||!userDescription?null:jsx(UserSpace,{name:user.username||``,profile:userDescription.profiles?.[0]||`Guest`,avatar,children})}export{UserSpaceContainer};
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
export * from './Agenda';
|
|
2
|
-
export * from './AlloRegion';
|
|
3
|
-
export * from './Communities';
|
|
4
|
-
export * from './BriefMe';
|
|
5
|
-
export * from './Cantine';
|
|
6
|
-
export * from './Edumalin';
|
|
7
1
|
export * from './Favorites';
|
|
8
|
-
export * from './GenerationHdf';
|
|
9
2
|
export * from './Header';
|
|
10
3
|
export * from './HomeCard';
|
|
11
4
|
export * from './LastInfos';
|
|
12
|
-
export * from './Mediacentre';
|
|
13
5
|
export * from './MessageFlashList';
|
|
14
6
|
export * from './Notifications';
|
|
15
|
-
export * from './Qwant';
|
|
16
|
-
export * from './Rss';
|
|
17
7
|
export * from './SchoolSpace';
|
|
18
|
-
export * from './ScreenTime';
|
|
19
8
|
export * from './UsefulLinks';
|
|
20
|
-
export * from './Universalis';
|
|
21
9
|
export * from './UserSpace';
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
10
|
+
export * from './Communities';
|
|
11
|
+
export * from './AlloRegion';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconNextcloudPoll: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconNextcloudPoll;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconNextcloudPoll=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,width:`24`,height:`24`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsxs(`g`,{fill:`currentColor`,children:[jsx(`rect`,{width:7,height:26,x:3,y:2,rx:2.5,ry:2.5}),jsx(`rect`,{width:7,height:16,x:12,y:12,rx:2.3,ry:2.3}),jsx(`rect`,{width:7,height:20,x:21,y:8,rx:2.1,ry:2.1})]})]});export{SvgIconNextcloudPoll as default};
|
|
@@ -80,6 +80,7 @@ export { default as IconNextcloudDeck } from './IconNextcloudDeck';
|
|
|
80
80
|
export { default as IconNextcloudFiles } from './IconNextcloudFiles';
|
|
81
81
|
export { default as IconNextcloudForms } from './IconNextcloudForms';
|
|
82
82
|
export { default as IconNextcloudNotes } from './IconNextcloudNotes';
|
|
83
|
+
export { default as IconNextcloudPoll } from './IconNextcloudPoll';
|
|
83
84
|
export { default as IconNextcloudTalk } from './IconNextcloudTalk';
|
|
84
85
|
export { default as IconNote } from './IconNote';
|
|
85
86
|
export { default as IconNotebook } from './IconNotebook';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as IconAddUser } from './IconAddUser';
|
|
2
|
-
export { default as IconAddWidget } from './IconAddWidget';
|
|
3
2
|
export { default as IconAdd } from './IconAdd';
|
|
4
3
|
export { default as IconAdjustSettings } from './IconAdjustSettings';
|
|
5
4
|
export { default as IconAiFill } from './IconAiFill';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconCommunitiesBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconCommunitiesBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0 32 32`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsxs(`g`,{strokeMiterlimit:10,strokeWidth:2.667,clipPath:`url(#icon-communities-beta_svg__a)`,children:[jsx(`path`,{fill:`#FEECFE`,stroke:`#E26AE2`,d:`M19.96 5.803a3.803 3.803 0 1 0-7.605 0 3.803 3.803 0 0 0 7.606 0Z`}),jsx(`path`,{stroke:`#E26AE2`,d:`M9.668 11.861a3.803 3.803 0 1 0-7.606 0 3.803 3.803 0 0 0 7.606 0ZM30.254 11.861a3.803 3.803 0 1 0-7.606 0 3.803 3.803 0 0 0 7.606 0Z`}),jsx(`path`,{stroke:`#FC94FF`,d:`M6.389 18.847a5.25 5.25 0 0 1 5.248 5.248v6.837H1.14v-6.837a5.25 5.25 0 0 1 5.248-5.248ZM25.637 18.847a5.25 5.25 0 0 1 5.248 5.248v6.837H20.389v-6.837a5.25 5.25 0 0 1 5.248-5.248Z`}),jsx(`path`,{fill:`#FEECFE`,stroke:`#E26AE2`,d:`M16.158 12.955a5.25 5.25 0 0 1 5.248 5.248v12.73H10.91v-12.73a5.25 5.25 0 0 1 5.248-5.248Z`})]}),jsx(`defs`,{children:jsx(`clipPath`,{id:`icon-communities-beta_svg__a`,children:jsx(`path`,{fill:`#fff`,d:`M0 0h32v32H0z`})})})]});export{SvgIconCommunitiesBeta as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconHomeBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconHomeBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0 32 32`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsx(`g`,{clipPath:`url(#icon-home-beta_svg__a)`,children:jsx(`path`,{fill:`#383838`,d:`M15.183.28a1.334 1.334 0 0 1 1.636 0l12 9.335c.325.252.515.64.515 1.052v14.666a4 4 0 0 1-4 4H6.668a4 4 0 0 1-4-4V10.667c0-.411.19-.8.515-1.052zM5.334 11.32v14.014a1.335 1.335 0 0 0 1.334 1.334h4v-12c0-.736.597-1.334 1.333-1.334h8c.736 0 1.333.598 1.333 1.334v12h4a1.335 1.335 0 0 0 1.334-1.334V11.32L16.001 3.023zm8 15.348h5.334V16h-5.334z`})}),jsx(`defs`,{children:jsx(`clipPath`,{id:`icon-home-beta_svg__a`,children:jsx(`path`,{fill:`#fff`,d:`M0 0h32v32H0z`})})})]});export{SvgIconHomeBeta as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconMessagesBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconMessagesBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0 32 32`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsxs(`g`,{clipPath:`url(#icon-messages-beta_svg__a)`,children:[jsx(`path`,{stroke:`#E5A800`,strokeMiterlimit:10,strokeWidth:2.667,d:`m5.93 10.246-4.8 3.088v12.267a5.335 5.335 0 0 0 5.334 5.333h24.534v-17.6l-4.689-3.013`}),jsx(`path`,{fill:`#FCF3CF`,d:`M26.196 15.468v-14.4H5.93v14.4`}),jsx(`path`,{stroke:`#FFC403`,strokeMiterlimit:10,strokeWidth:2.667,d:`M26.196 15.468v-14.4H5.93v14.4`}),jsx(`path`,{stroke:`#E5A800`,strokeMiterlimit:10,strokeWidth:2.667,d:`M9.13 5.334h13.867M10.197 9.6h11.734M1.13 13.334l14.934 8.533 14.933-8.533`})]}),jsx(`defs`,{children:jsx(`clipPath`,{id:`icon-messages-beta_svg__a`,children:jsx(`path`,{fill:`#fff`,d:`M0 0h32v32H0z`})})})]});export{SvgIconMessagesBeta as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconMyAppsBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconMyAppsBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0 32 32`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsx(`g`,{stroke:`#1C1C73`,strokeMiterlimit:10,strokeWidth:2.667,clipPath:`url(#icon-my-apps-beta_svg__a)`,children:jsx(`path`,{d:`M31.117 1H19v12.117h12.117zM13.207 18.884H1.09V31h12.117zM1 1.084c6.688 0 12.117 5.43 12.117 12.117H1zM30.934 18.884H18.816V31h12.118z`})}),jsx(`defs`,{children:jsx(`clipPath`,{id:`icon-my-apps-beta_svg__a`,children:jsx(`path`,{fill:`#fff`,d:`M0 0h32v32H0z`})})})]});export{SvgIconMyAppsBeta as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconNotificationBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0
|
|
1
|
+
import{jsx,jsxs}from"react/jsx-runtime";var SvgIconNotificationBeta=({title,titleId,...props})=>jsxs(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`none`,viewBox:`0 0 32 32`,"aria-hidden":`true`,"aria-labelledby":titleId,...props,children:[title?jsx(`title`,{id:titleId,children:title}):null,jsx(`path`,{stroke:`#1C1C73`,strokeMiterlimit:10,strokeWidth:2.667,d:`M13.363 5.348a2.726 2.726 0 1 1 5.383-.622q0 .423-.12.808M19.886 25.184a3.919 3.919 0 1 1-7.559-.26`}),jsx(`path`,{stroke:`#1C1C73`,strokeMiterlimit:10,strokeWidth:2.667,d:`M28.62 18.901H4.058v6.682h24.56z`}),jsx(`path`,{stroke:`#1C1C73`,strokeMiterlimit:10,strokeWidth:2.667,d:`M16.189 4.889c5.639 0 10.22 4.581 10.22 10.22v3.794H5.97V15.11c0-5.639 4.581-10.22 10.22-10.22Z`})]});export{SvgIconNotificationBeta as default};
|
|
@@ -4,8 +4,6 @@ export interface AudioRecorderProps {
|
|
|
4
4
|
onRecordUpdated?: (recordURL?: string) => void;
|
|
5
5
|
hideSaveAction?: boolean;
|
|
6
6
|
visibility?: WorkspaceVisibility;
|
|
7
|
-
/** Called with the record name each time the user edits it. */
|
|
8
|
-
onNameChange?: (name: string) => void;
|
|
9
7
|
}
|
|
10
8
|
export interface AudioRecorderRef {
|
|
11
9
|
save: () => Promise<WorkspaceElement | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconMic from"../../icons/components/IconMic.js";import AudioRecorderTimer from"./AudioRecorderTimer.js";import useAudioRecorder from"./useAudioRecorder.js";import Input from"../../../components/Input/Input.js";import
|
|
1
|
+
import SvgIconMic from"../../icons/components/IconMic.js";import AudioRecorderTimer from"./AudioRecorderTimer.js";import useAudioRecorder from"./useAudioRecorder.js";import Input from"../../../components/Input/Input.js";import FormControl from"../../../components/Form/FormControl.js";import Toolbar from"../../../components/Toolbar/Toolbar.js";import clsx$1 from"clsx";import{forwardRef,useImperativeHandle,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var AudioRecorder=forwardRef(({onSaveSuccess,onRecordUpdated,hideSaveAction=!1,visibility=`protected`},ref)=>{let{recordState,playState,recordTime,audioRef,audioNameRef,toolbarItems,maxDuration,handlePlayEnded,handleSave}=useAudioRecorder(onSaveSuccess,onRecordUpdated,hideSaveAction,visibility,`media-library`),{t}=useTranslation();function getDefaultDate(){let d=new Date;return`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,`0`)}-${String(d.getDate()).padStart(2,`0`)} ${String(d.getHours()).padStart(2,`0`)}h${String(d.getMinutes()).padStart(2,`0`)} `+t(`bbm.audio.recorder.defaultName`)}useImperativeHandle(ref,()=>({save:handleSave}));let[audioTime,setAudioTime]=useState(0),classColor=clsx$1({"text-danger":recordState===`RECORDING`,"text-success":playState===`PLAYING`});return jsxs(`div`,{className:`audio-recorder m-auto d-flex flex-column`,children:[jsx(FormControl,{id:`recordName`,className:`mb-32`,isRequired:!0,isReadOnly:recordState===`SAVED`||recordState===`SAVING`,children:jsx(Input,{type:`text`,size:`sm`,placeholder:t(`bbm.audio.recorder.name`),ref:audioNameRef,defaultValue:getDefaultDate()})}),jsx(`div`,{className:`audio-recorder-icon mx-auto`,children:jsx(SvgIconMic,{width:64,height:64,className:classColor})}),jsx(AudioRecorderTimer,{recordState,playState,recordTime,audioTime,maxDuration}),jsx(`audio`,{ref:audioRef,onEnded:handlePlayEnded,onTimeUpdate:event=>{setAudioTime(event.target.currentTime)},children:jsx(`track`,{default:!0,kind:`captions`,srcLang:`fr`,src:``})}),jsx(Toolbar,{items:toolbarItems})]})});export{AudioRecorder as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconMic from"../../icons/components/IconMic.js";import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import{convertMsToMS}from"@edifice.io/utilities";import{jsx,jsxs}from"react/jsx-runtime";var AudioRecorderTimer=({recordState,playState,recordTime,audioTime,maxDuration})=>jsxs(`div`,{className:`audio-recorder-time`,children:[playState===`IDLE`&&jsxs(`div`,{className:`d-flex align-items-center`,children:[jsx(recordState===`PAUSED`?SvgIconPause:SvgIconRecord,{width:12,height:12,className:`me-8 text-danger`}),convertMsToMS(recordState===`IDLE`?0:recordTime)+` / `+convertMsToMS(maxDuration)]}),playState!==`IDLE`&&jsxs(`div`,{className:`d-flex align-items-center mx-auto`,children:[jsx(SvgIconMic,{width:12,height:12,className:`me-8`}),convertMsToMS(audioTime*1e3),` /`,convertMsToMS(recordTime)]})]});export{AudioRecorderTimer as default};
|
|
1
|
+
import SvgIconMic from"../../icons/components/IconMic.js";import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import{convertMsToMS}from"@edifice.io/utilities";import{jsx,jsxs}from"react/jsx-runtime";var AudioRecorderTimer=({recordState,playState,recordTime,audioTime,maxDuration})=>jsxs(`div`,{className:`audio-recorder-time my-16 mx-auto`,children:[playState===`IDLE`&&jsxs(`div`,{className:`d-flex align-items-center`,children:[jsx(recordState===`PAUSED`?SvgIconPause:SvgIconRecord,{width:12,height:12,className:`me-8 text-danger`}),convertMsToMS(recordState===`IDLE`?0:recordTime)+` / `+convertMsToMS(maxDuration)]}),playState!==`IDLE`&&jsxs(`div`,{className:`d-flex align-items-center mx-auto`,children:[jsx(SvgIconMic,{width:12,height:12,className:`me-8`}),convertMsToMS(audioTime*1e3),` /`,convertMsToMS(recordTime)]})]});export{AudioRecorderTimer as default};
|
|
@@ -11,7 +11,6 @@ export default function useAudioRecorder(onSaveSuccess?: (resource: WorkspaceEle
|
|
|
11
11
|
audioRef: import('react').RefObject<HTMLAudioElement>;
|
|
12
12
|
audioNameRef: import('react').RefObject<HTMLInputElement>;
|
|
13
13
|
toolbarItems: ToolbarItem[];
|
|
14
|
-
micError: unknown;
|
|
15
14
|
handlePlayEnded: () => void;
|
|
16
15
|
handleSave: () => Promise<WorkspaceElement | undefined>;
|
|
17
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconLoader from"../../icons/components/IconLoader.js";import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconPlayFilled from"../../icons/components/IconPlayFilled.js";import SvgIconRecordPause from"../../icons/components/IconRecordPause.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import SvgIconRefresh from"../../icons/components/IconRefresh.js";import SvgIconRestart from"../../icons/components/IconRestart.js";import SvgIconSave from"../../icons/components/IconSave.js";import useWorkspaceFile from"../../../hooks/useWorkspaceFile/useWorkspaceFile.js";import{useCallback,useEffect,useReducer,useRef
|
|
1
|
+
import SvgIconLoader from"../../icons/components/IconLoader.js";import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconPlayFilled from"../../icons/components/IconPlayFilled.js";import SvgIconRecordPause from"../../icons/components/IconRecordPause.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import SvgIconRefresh from"../../icons/components/IconRefresh.js";import SvgIconRestart from"../../icons/components/IconRestart.js";import SvgIconSave from"../../icons/components/IconSave.js";import useWorkspaceFile from"../../../hooks/useWorkspaceFile/useWorkspaceFile.js";import{useCallback,useEffect,useReducer,useRef}from"react";import{jsx}from"react/jsx-runtime";import{useTranslation}from"react-i18next";function useAudioRecorder(onSaveSuccess,onUpdateRecord,hideSaveAction=!1,visibility=`protected`,application=`media-library`){function audioReducer(state,action){return{...state,...action.updatedState}}let[{recordState,playState,micStream,micStreamAudioSourceNode,audioWorkletNode,audioContext,encoderWorker,maxDuration,recordTime,isEncoding},dispatch]=useReducer(audioReducer,{recordState:`IDLE`,isEncoding:!1,playState:`IDLE`,recordTime:0,maxDuration:180}),audioNameRef=useRef(null),audioRef=useRef(null),leftChannelRef=useRef(),rightChannelRef=useRef(),{t}=useTranslation(),{create}=useWorkspaceFile(),DEFAULT_SAMPLE_RATE=48e3;useEffect(()=>{let encoderWorker=new Worker(`/infra/public/js/audioEncoder.js`);return dispatch({type:`update`,updatedState:{encoderWorker}}),encoderWorker.postMessage([`init`,audioContext?.sampleRate||DEFAULT_SAMPLE_RATE]),()=>{closeAudioStream(),encoderWorker.terminate()}},[]);let handleAudioWorkletNodeMessage=event=>{let leftChannel=event.data.inputs[0][0],rightChannel=event.data.inputs[0][1];(!rightChannel||rightChannel.filter(data=>data!==void 0).length===0)&&(rightChannel=leftChannel),leftChannelRef.current?.push(leftChannel),rightChannelRef.current?.push(rightChannel)},closeAudioStream=useCallback(()=>{micStream?.getTracks().forEach(track=>track.stop()),micStreamAudioSourceNode?.disconnect(),audioWorkletNode?.port.removeEventListener(`message`,handleAudioWorkletNodeMessage),audioWorkletNode?.port.close(),audioWorkletNode?.disconnect(),audioContext?.close()},[audioContext,audioWorkletNode,micStream,micStreamAudioSourceNode]),initRecording=async()=>{let micStream=await navigator.mediaDevices.getUserMedia({audio:!0}),audioContext=new AudioContext({sampleRate:DEFAULT_SAMPLE_RATE}),micStreamAudioSourceNode=audioContext.createMediaStreamSource(micStream);try{await audioContext.audioWorklet.addModule(`/infra/public/js/audio-recorder-processor.js`)}catch(err){console.error(err)}let audioWorkletNode=new AudioWorkletNode(audioContext,`audio-recorder-processor`);audioWorkletNode.port.addEventListener(`message`,handleAudioWorkletNodeMessage),dispatch({type:`update`,updatedState:{micStream,micStreamAudioSourceNode,audioContext,recordTime:0,audioWorkletNode,recordState:`RECORDING`,playState:`IDLE`}}),rightChannelRef.current=[],leftChannelRef.current=[],audioWorkletNode.port.start(),micStreamAudioSourceNode.connect(audioWorkletNode),audioWorkletNode.connect(audioContext.destination)},handleRecord=useCallback(async()=>{audioRef.current&&(audioRef.current.currentTime=0,audioRef.current.pause()),recordState===`PAUSED`?(dispatch({type:`update`,updatedState:{recordState:`RECORDING`,playState:`IDLE`}}),audioContext?.resume(),onUpdateRecord?.(void 0)):initRecording()},[recordState,audioContext,audioRef]),handleRecordPause=useCallback(()=>{dispatch({type:`update`,updatedState:{recordState:`PAUSED`,playState:`IDLE`,isEncoding:!0}}),audioContext?.suspend(),encoderWorker&&leftChannelRef.current&&rightChannelRef.current&&(encoderWorker.postMessage([`wav`,rightChannelRef.current,leftChannelRef.current,rightChannelRef.current.length*128]),encoderWorker.onmessage=event=>{let audioUrl=window.URL.createObjectURL(event.data);dispatch({type:`update`,updatedState:{isEncoding:!1}}),audioRef.current&&(audioRef.current.src=audioUrl),onUpdateRecord&&onUpdateRecord(audioUrl)})},[audioContext,encoderWorker,onUpdateRecord]),handlePlay=useCallback(()=>{dispatch({type:`update`,updatedState:{playState:`PLAYING`}}),(audioRef?.current?.currentTime||audioRef.current)&&audioRef.current.play()},[audioRef]),handlePlayPause=useCallback(()=>{audioRef?.current?.pause(),dispatch({type:`update`,updatedState:{playState:`PAUSED`}})},[audioRef]),handleReset=useCallback(()=>{closeAudioStream(),dispatch({type:`update`,updatedState:{playState:`IDLE`,recordState:`IDLE`}}),rightChannelRef.current=[],leftChannelRef.current=[],onUpdateRecord&&onUpdateRecord(void 0)},[closeAudioStream,onUpdateRecord]),handleSave=useCallback(async()=>{let audioName=audioNameRef.current?.value;if(!audioName){console.error(`Audio name is required`);return}return audioRef.current&&(audioRef.current.pause(),audioRef.current.currentTime=0),dispatch({type:`update`,updatedState:{recordState:`SAVING`,playState:`IDLE`}}),new Promise((resolve,reject)=>{try{encoderWorker&&leftChannelRef.current&&rightChannelRef.current&&(encoderWorker.postMessage([`mp3`,rightChannelRef.current,leftChannelRef.current,rightChannelRef.current.length*128]),encoderWorker.onmessage=async event=>{if(event.data instanceof Blob){let resourceAudio=await create(new File([event.data],audioName,{type:`audio/mp3`}),{application,visibility});resourceAudio&&onSaveSuccess&&onSaveSuccess(resourceAudio),dispatch({type:`update`,updatedState:{recordState:`SAVED`}}),resolve(resourceAudio)}})}catch(error){dispatch({type:`update`,updatedState:{playState:`IDLE`,recordState:`IDLE`}}),console.error(`Error while saving`,error),reject()}})},[recordState,onSaveSuccess,closeAudioStream]),handlePlayStop=useCallback(()=>{audioRef?.current&&(audioRef.current.pause(),audioRef.current.currentTime=0),dispatch({type:`update`,updatedState:{playState:`IDLE`}})},[audioRef]),handlePlayEnded=useCallback(()=>{dispatch({type:`update`,updatedState:{playState:`PAUSED`}}),audioRef.current&&(audioRef.current.currentTime=0)},[audioRef]);useEffect(()=>{if(recordState===`RECORDING`&&audioContext){let timer=window.setInterval(()=>{dispatch({type:`update`,updatedState:{recordTime:audioContext.currentTime}}),audioContext.currentTime>=maxDuration&&(handleRecordPause(),window.clearInterval(timer))},100);return()=>window.clearInterval(timer)}},[audioContext,handleRecordPause,maxDuration,recordState]);let recordText=t(recordState===`IDLE`?`bbm.audio.record.start`:`bbm.audio.record.resume`),toolbarItems=[{type:`icon`,name:`record`,visibility:recordState===`RECORDING`?`hide`:`show`,props:{icon:jsx(SvgIconRecord,{}),color:`danger`,disabled:recordState!==`IDLE`&&recordState!==`PAUSED`||recordTime>=maxDuration,onClick:handleRecord,"aria-label":recordText},tooltip:recordText},{type:`icon`,name:`recordPause`,visibility:recordState===`RECORDING`?`show`:`hide`,props:{icon:jsx(SvgIconRecordPause,{}),color:`danger`,disabled:recordState!==`RECORDING`,onClick:handleRecordPause,"aria-label":t(`bbm.audio.record.pause`)},tooltip:t(`bbm.audio.record.pause`)},{type:`divider`},{type:`icon`,name:`encoding`,visibility:isEncoding?`show`:`hide`,props:{icon:jsx(SvgIconLoader,{style:{animation:`loading 1s infinite`}}),disabled:!0}},{type:`icon`,name:`play`,visibility:isEncoding||playState===`PLAYING`?`hide`:`show`,props:{icon:jsx(SvgIconPlayFilled,{}),disabled:recordState!==`RECORDED`&&recordState!==`PAUSED`&&recordState!==`SAVED`,onClick:handlePlay,"aria-label":t(`bbm.audio.play.start`)},tooltip:t(`bbm.audio.play.start`)},{type:`icon`,name:`playPause`,visibility:!isEncoding&&playState===`PLAYING`?`show`:`hide`,props:{icon:jsx(SvgIconPause,{}),onClick:handlePlayPause,"aria-label":t(`bbm.audio.play.pause`)},tooltip:t(`bbm.audio.play.pause`)},{type:`icon`,name:`stop`,props:{icon:jsx(SvgIconRestart,{}),disabled:playState!==`PLAYING`&&playState!==`PAUSED`,onClick:handlePlayStop,"aria-label":t(`bbm.audio.play.stop`)},tooltip:t(`bbm.audio.play.stop`)},{type:`divider`},{type:`icon`,name:`reset`,props:{icon:jsx(SvgIconRefresh,{}),disabled:recordState!==`RECORDED`&&recordState!==`PAUSED`&&playState!==`PLAYING`&&playState!==`PAUSED`,onClick:handleReset,"aria-label":t(`bbm.audio.record.reset`)},tooltip:t(`bbm.audio.record.reset`)},{type:`icon`,name:`save`,visibility:hideSaveAction?`hide`:`show`,props:{icon:jsx(SvgIconSave,{}),disabled:recordState!==`RECORDED`&&recordState!==`PAUSED`&&playState!==`PLAYING`&&playState!==`PAUSED`||recordState===`SAVED`||!audioNameRef.current?.value,onClick:handleSave,"aria-label":t(`bbm.audio.record.save`)},tooltip:t(`bbm.audio.record.save`)}];return{recordState,playState,audioContext,recordTime:recordTime*1e3,maxDuration:maxDuration*1e3,audioRef,audioNameRef,toolbarItems,handlePlayEnded,handleSave}}export{useAudioRecorder as default};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { WorkspaceElement } from '@edifice.io/client';
|
|
2
2
|
export interface VideoRecorderProps {
|
|
3
3
|
appCode: string;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Not part of the recorder design anymore, will be removed in
|
|
6
|
-
* a future major version.
|
|
7
|
-
*/
|
|
8
4
|
caption?: string;
|
|
9
5
|
onSuccess?: (res: WorkspaceElement[]) => void;
|
|
10
6
|
onError: (error: string) => void;
|
|
11
7
|
onRecordUpdated?: (recordURL?: string) => void;
|
|
12
8
|
hideSaveAction?: boolean;
|
|
13
|
-
/** Called with the record name each time the user edits it. */
|
|
14
|
-
onNameChange?: (name: string) => void;
|
|
15
9
|
}
|
|
16
10
|
export interface VideoRecorderRef {
|
|
17
11
|
save: () => Promise<WorkspaceElement | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconRecordVideo from"../../icons/components/IconRecordVideo.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import
|
|
1
|
+
import SvgIconRecordVideo from"../../icons/components/IconRecordVideo.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import Label from"../../../components/Label/Label.js";import FormControl from"../../../components/Form/FormControl.js";import LoadingScreen from"../../../components/LoadingScreen/LoadingScreen.js";import{useCameras}from"./useCameras.js";import{VideoRecorderToolbar}from"./VideoRecorderToolbar.js";import useUpload from"../../../hooks/useUpload/useUpload.js";import Select from"../../../components/Select/Select.js";import{convertMsToMS,getBestSupportedMimeType}from"@edifice.io/utilities";import{forwardRef,useCallback,useEffect,useImperativeHandle,useRef,useState}from"react";import{Fragment as Fragment$1,jsx,jsxs}from"react/jsx-runtime";import{useTranslation}from"react-i18next";import{odeServices}from"@edifice.io/client";var VideoRecorder=forwardRef(({appCode,caption,onSuccess,onError,onRecordUpdated,hideSaveAction=!1},ref)=>{let{inputDevices,setPreferedDevice,restartStream,stream}=useCameras(),[maxDuration,setMaxDuration]=useState(18e4),[recording,setRecording]=useState(!1),[recorded,setRecorded]=useState(!1),[playing,setPlaying]=useState(!1),[saving,setSaving]=useState(!1),[saved,setSaved]=useState(!1),[mimeType,setMimeType]=useState(``),[recordedChunks,setRecordedChunks]=useState([]),[recordedVideo,setRecordedVideo]=useState(),[recordedTime,setRecordedTime]=useState(0),[playedTime,setPlayedTime]=useState(0),videoRef=useRef(null),recorderRef=useRef(null),{uploadBlob}=useUpload(void 0,appCode);useImperativeHandle(ref,()=>({save:handleSave}));let{t}=useTranslation();useEffect(()=>{initMaxDuration()},[]);async function initMaxDuration(){try{setMaxDuration((await odeServices.video().getVideoConf()).maxDuration*60*1e3)}catch{setMaxDuration(180*1e3)}}useEffect(()=>{try{videoRef.current&&(videoRef.current.src&&(window.URL.revokeObjectURL(videoRef.current.src),videoRef.current.src=``),videoRef.current.srcObject instanceof MediaStream&&(videoRef.current.srcObject=null),stream&&(videoRef.current.srcObject=stream,videoRef.current.autoplay=!0,videoRef.current.volume=1,videoRef.current.muted=!0,videoRef.current.load()))}catch(err){console.error(err)}},[stream]),useEffect(()=>{if(recordedChunks.length&&!recording&&videoRef.current){let finalVideo=new Blob(recordedChunks,{type:mimeType});setRecordedVideo(finalVideo),onRecordUpdated&&onRecordUpdated(window.URL.createObjectURL(finalVideo)),videoRef.current.autoplay=!1,videoRef.current.srcObject=null,videoRef.current.src=window.URL.createObjectURL(finalVideo)}},[recording,recordedChunks]),useEffect(()=>{if(recording){let startedAt=Date.now(),timer=window.setInterval(()=>setRecordedTime(Date.now()-startedAt),500);return()=>{window.clearInterval(timer)}}},[recording]),useEffect(()=>{if(playing){let timer=window.setInterval(()=>setPlayedTime(prev=>prev+500),500);return()=>{window.clearInterval(timer)}}},[playing]);let handleRecord=useCallback(()=>{setRecording(!0),videoRef&&videoRef.current&&(videoRef.current.muted=!0);let mimeType=getBestSupportedMimeType();setMimeType(mimeType),stream&&(recorderRef.current=new MediaRecorder(stream,{mimeType}),recorderRef.current.ondataavailable=({data})=>{data.size>0&&setRecordedChunks(prev=>[...prev,data])},recorderRef.current.onerror=event=>console.error(event),recorderRef.current.start(1e3))},[stream]),handleStop=useCallback(()=>{setRecording(!1),setRecorded(!0),recorderRef.current?.state===`recording`&&(recorderRef.current.requestData(),recorderRef.current.stop())},[recorderRef]),handlePlayPause=useCallback(()=>{videoRef&&videoRef.current&&(videoRef.current.muted=!1),playing?(videoRef?.current?.pause(),setPlaying(!1)):(videoRef?.current?.play(),setPlaying(!0))},[playing]),handleReset=()=>{setRecorded(!1),setRecording(!1),setPlaying(!1),setSaved(!1),setRecordedTime(0),setRecordedChunks([]),setRecordedVideo(void 0),restartStream(),onRecordUpdated&&onRecordUpdated()},handleSave=async()=>{if(videoRef?.current?.pause(),setSaving(!0),!recordedVideo){console.error(`Error while saving video: recorded video is undefined.`);return}let resVideo=await uploadBlob(recordedVideo,{duration:recordedTime});if(resVideo!=null)return onSuccess?.([resVideo]),setSaving(!1),setSaved(!0),[resVideo];onError(`Error while uploading video`),setSaving(!1),setSaved(!0)};return useEffect(()=>{recordedTime>=maxDuration&&handleStop()},[recordedTime,handleStop]),jsxs(`div`,{className:`video-recorder d-flex flex-fill flex-column align-items-center pb-8`,children:[jsx(`div`,{className:`video-recorder-caption d-none d-md-block`,children:caption}),inputDevices.length>1&&jsx(`div`,{className:`video-recorder-devices mb-12`,children:jsxs(FormControl,{id:`selectInputDevice`,children:[jsx(Label,{className:`d-none d-md-block`,children:t(`bbm.video.record.select.devices.label`)}),jsx(Select,{placeholderOption:t(`bbm.video.record.select.devices.placeholder`),options:inputDevices.map(videoInputDevice=>videoInputDevice.label),onValueChange:option=>{let selectedDevice=inputDevices.find(inputDevice=>inputDevice.label===option);recorderRef.current?.state===`recording`&&(recorderRef.current.requestData(),recorderRef.current.stop()),setPreferedDevice(selectedDevice)}})]})}),jsxs(`div`,{className:`video-recorder-video-container position-relative align-self-stretch`,children:[jsx(`video`,{ref:videoRef,playsInline:!0,autoPlay:!0,controls:!1,muted:!0,onEnded:()=>{setPlaying(!1),setPlayedTime(0),videoRef.current&&(videoRef.current.currentTime=0)},className:`rounded`,children:jsx(`track`,{default:!0,kind:`captions`,srcLang:`fr`,src:``})}),(recording||recorded)&&jsxs(`div`,{className:`video-recorder-time d-flex align-items-center font-monospace fs-6 text-bg-dark rounded`,children:[recording&&jsxs(Fragment$1,{children:[jsx(SvgIconRecord,{width:12,height:12,color:`red`,className:`me-4`}),jsxs(`span`,{children:[convertMsToMS(recordedTime),`/`,convertMsToMS(maxDuration)]})]}),recorded&&jsxs(Fragment$1,{children:[jsx(SvgIconRecordVideo,{width:14,height:14,className:`me-4`}),jsxs(`span`,{children:[convertMsToMS(playedTime),`/`,convertMsToMS(recordedTime)]})]})]}),stream&&jsx(VideoRecorderToolbar,{playing,recording,recorded,saving,saved,hideSaveAction,handleRecord,handleStop,handlePlayPause,handleReset,handleSave})]}),saving&&jsx(LoadingScreen,{position:!1,caption:t(`bbm.video.save.loader.caption`)})]})});export{VideoRecorder as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconPlayFilled from"../../icons/components/IconPlayFilled.js";import SvgIconRecordStop from"../../icons/components/IconRecordStop.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import
|
|
1
|
+
import SvgIconPause from"../../icons/components/IconPause.js";import SvgIconPlayFilled from"../../icons/components/IconPlayFilled.js";import SvgIconRecordStop from"../../icons/components/IconRecordStop.js";import SvgIconRecord from"../../icons/components/IconRecord.js";import SvgIconRefresh from"../../icons/components/IconRefresh.js";import SvgIconSave from"../../icons/components/IconSave.js";import Toolbar from"../../../components/Toolbar/Toolbar.js";import{jsx}from"react/jsx-runtime";import{useTranslation}from"react-i18next";var VideoRecorderToolbar=({playing,recording,recorded,saving,saved,hideSaveAction,handleRecord,handleStop,handlePlayPause,handleReset,handleSave})=>{let{t}=useTranslation();return jsx(Toolbar,{items:[{type:`icon`,name:`record`,props:{icon:jsx(SvgIconRecord,{color:recording||recorded?``:`red`}),color:`danger`,disabled:recording||recorded||saving,onClick:handleRecord,"aria-label":t(`bbm.video.record.start`)},tooltip:t(`bbm.video.record.start`)},{type:`icon`,name:`stop`,props:{icon:jsx(SvgIconRecordStop,{}),disabled:!recording||recorded||saving,onClick:handleStop,"aria-label":t(`bbm.video.record.stop`)},tooltip:t(`bbm.video.record.stop`)},{type:`icon`,name:`play`,visibility:playing?`hide`:`show`,props:{icon:jsx(SvgIconPlayFilled,{}),disabled:!recorded||saving,onClick:handlePlayPause,"aria-label":t(`bbm.video.play.start`)},tooltip:t(`bbm.video.play.start`)},{type:`icon`,name:`pause`,visibility:playing?`show`:`hide`,props:{icon:jsx(SvgIconPause,{}),disabled:!recorded||saving,onClick:handlePlayPause,"aria-label":t(`bbm.video.play.pause`)},tooltip:t(`bbm.video.play.pause`)},{type:`divider`},{type:`icon`,name:`reset`,props:{icon:jsx(SvgIconRefresh,{}),disabled:!recorded||saving,onClick:handleReset,"aria-label":t(`bbm.video.record.reset`)},tooltip:t(`bbm.video.record.reset`)},{type:`icon`,name:`save`,visibility:hideSaveAction?`hide`:`show`,props:{icon:jsx(SvgIconSave,{}),disabled:!recorded||saving||saved,onClick:handleSave,"aria-label":t(`bbm.video.record.save`)},tooltip:t(`bbm.video.record.save`)}],className:`position-absolute bottom-0 start-50 bg-white`})};export{VideoRecorderToolbar};
|
|
@@ -5,8 +5,6 @@ export declare function useCameras(): {
|
|
|
5
5
|
setPreferedDevice: (device?: MediaDeviceInfo) => void;
|
|
6
6
|
/** The current video stream. */
|
|
7
7
|
stream: MediaStream | undefined;
|
|
8
|
-
/** Why no usable stream could be acquired, if so. */
|
|
9
|
-
streamError: unknown;
|
|
10
8
|
/** Start a video stream from the default or prefered device. */
|
|
11
9
|
restartStream: () => void;
|
|
12
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import useBrowserInfo from"../../../hooks/useBrowserInfo/useBrowserInfo.js";import{useEffect,useState}from"react";import{useTranslation}from"react-i18next";var VIDEO_HEIGHT=9,VIDEO_WIDTH=16;function useCameras(){let{device}=useBrowserInfo(navigator.userAgent),{t}=useTranslation(),[inputDevices,setInputDevices]=useState([]),[mediaStreamConstraints,setMediaStreamConstraints]=useState({audio:!0,video:!0}),[stream,setStream]=useState()
|
|
1
|
+
import useBrowserInfo from"../../../hooks/useBrowserInfo/useBrowserInfo.js";import{useEffect,useState}from"react";import{useTranslation}from"react-i18next";var VIDEO_HEIGHT=9,VIDEO_WIDTH=16;function useCameras(){let{device}=useBrowserInfo(navigator.userAgent),{t}=useTranslation(),[inputDevices,setInputDevices]=useState([]),[mediaStreamConstraints,setMediaStreamConstraints]=useState({audio:!0,video:!0}),[stream,setStream]=useState();async function getVideoInputDevices(){return(await navigator.mediaDevices.enumerateDevices()).filter(device=>device.kind===`videoinput`)}let enableStream=async constraints=>{try{setStream(await navigator.mediaDevices.getUserMedia(constraints))}catch(err){console.error(err)}},restartStream=()=>{stream?.getTracks().forEach(track=>track.stop()),enableStream(mediaStreamConstraints)};return useEffect(()=>{restartStream()},[mediaStreamConstraints]),useEffect(()=>{async function initInputDevices(){await enableStream(mediaStreamConstraints);let videoDevices=await getVideoInputDevices();switch(device.type){case`mobile`:case`tablet`:{let backCamera={deviceId:`environment`,label:t(`video.back.camera`),groupId:``,kind:`videoinput`},frontCamera={deviceId:`user`,label:t(`video.front.camera`),groupId:``,kind:`videoinput`};videoDevices?.length>1?setInputDevices([backCamera,frontCamera]):setInputDevices([backCamera]);break}default:setInputDevices(videoDevices);break}}initInputDevices()},[]),{inputDevices,setPreferedDevice:device=>{let constraints={};device?.deviceId?(constraints=device.deviceId===`environment`||device.deviceId===`user`?{audio:!0,video:{aspectRatio:VIDEO_WIDTH/VIDEO_HEIGHT,facingMode:device?.deviceId}}:{audio:!0,video:{aspectRatio:VIDEO_WIDTH/VIDEO_HEIGHT,deviceId:{exact:device.deviceId}}},setMediaStreamConstraints(constraints)):console.error(`Selected input device id is null`)},stream,restartStream}}export{useCameras};
|