@edifice.io/react 2.6.10-develop-b2school.20261023141442 → 2.6.10-develop-pedago.20261023145636
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 +4 -12
- package/dist/components/Layout/components/Header.js +4 -4
- package/dist/components/Layout/components/NavLink.d.ts +3 -3
- package/dist/components/Layout/components/NavLink.js +3 -5
- package/dist/editor.js +2 -0
- package/dist/homepage.js +24 -74
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +6 -2
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +8 -11
- package/dist/icons.js +402 -406
- package/dist/modules/HelpZone/HelpZone.js +8 -6
- package/dist/modules/HelpZone/HelpZoneContainer.js +5 -2
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
- package/dist/modules/editor/components/Editor/Editor.d.ts +0 -5
- package/dist/modules/editor/components/Editor/Editor.js +0 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +7 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +12 -4
- package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
- package/dist/modules/editor/hooks/useEditorState.js +16 -0
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +81 -24
- package/dist/modules/homepage/components/Communities/Communities.js +4 -4
- package/dist/modules/homepage/components/Header/Header.js +22 -28
- 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/MessageFlashList/MessageFlash.js +1 -1
- package/dist/modules/homepage/components/Notifications/NotificationList.js +8 -7
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +12 -7
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +4 -7
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +5 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +12 -10
- package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +9 -3
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +12 -6
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +10 -12
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +10 -9
- 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/{hooks → components/SchoolSpace}/useUserSchools.js +4 -4
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +1 -3
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +7 -13
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +2 -3
- package/dist/modules/homepage/components/index.d.ts +1 -9
- package/dist/modules/icons/components/index.d.ts +0 -2
- package/dist/modules/modals/ResourceModal/ResourceModal.js +16 -9
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +9 -13
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
- package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm@3.32.0/node_modules/@tiptap/extension-floating-menu/dist/index.js +159 -0
- package/dist/node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js +341 -0
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +549 -0
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.4/node_modules/prosemirror-transform/dist/index.js +659 -0
- package/package.json +35 -43
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
- package/dist/modules/homepage/components/Agenda/Agenda.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/Agenda.js +0 -54
- package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Agenda/AgendaContainer.js +0 -14
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +0 -10
- package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +0 -30
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +0 -14
- package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +0 -27
- 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 -45
- package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/Agenda/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +0 -19
- package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +0 -26
- package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +0 -9
- package/dist/modules/homepage/components/BriefMe/BriefMe.js +0 -59
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +0 -4
- package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +0 -17
- 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 -8
- package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +0 -31
- package/dist/modules/homepage/components/BriefMe/useBriefMe.js +0 -51
- package/dist/modules/homepage/components/Cantine/Cantine.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/Cantine.js +0 -44
- package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Cantine/CantineContainer.js +0 -18
- package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/CantineModal.js +0 -88
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +0 -7
- package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +0 -12
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +0 -5
- package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +0 -22
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +0 -6
- package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +0 -28
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +0 -12
- package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +0 -60
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +0 -11
- package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +0 -20
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +0 -24
- package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +0 -65
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +0 -23
- package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +0 -43
- 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/GenerationHdf/GenerationHdf.d.ts +0 -16
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +0 -48
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +0 -4
- package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +0 -12
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +0 -1
- package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +0 -6
- 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 -68
- package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +0 -13
- package/dist/modules/homepage/components/Header/AccountActionListPopover.js +0 -26
- package/dist/modules/homepage/components/Header/ActionItem.d.ts +0 -38
- package/dist/modules/homepage/components/Header/ActionItem.js +0 -34
- package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +0 -5
- package/dist/modules/homepage/components/Header/MyAppsPopover.js +0 -28
- package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +0 -32
- package/dist/modules/homepage/components/Qwant/Qwant.d.ts +0 -4
- package/dist/modules/homepage/components/Qwant/Qwant.js +0 -41
- package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Qwant/QwantContainer.js +0 -10
- 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 -64
- package/dist/modules/homepage/components/Rss/RssContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Rss/RssContainer.js +0 -45
- package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +0 -13
- package/dist/modules/homepage/components/Rss/RssFeedForm.js +0 -69
- package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +0 -11
- package/dist/modules/homepage/components/Rss/RssFeedsModal.js +0 -58
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +0 -25
- package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +0 -43
- 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 -5
- package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +0 -38
- package/dist/modules/homepage/components/Rss/services/api/rssService.js +0 -51
- package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +0 -28
- package/dist/modules/homepage/components/Rss/services/queries/rss.js +0 -71
- 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 -19
- package/dist/modules/homepage/components/Universalis/Universalis.d.ts +0 -8
- package/dist/modules/homepage/components/Universalis/Universalis.js +0 -62
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +0 -1
- package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +0 -16
- 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 -15
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -47
- package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
- package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
- package/dist/modules/icons/components/IconAddWidget.js +0 -12
- package/dist/modules/icons/components/IconLogout.d.ts +0 -7
- package/dist/modules/icons/components/IconLogout.js +0 -13
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useForm } from "react-hook-form";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { isValidRssFeedUrl } from "./utils.js";
|
|
5
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
6
|
-
import FormControl from "../../../../components/Form/FormControl.js";
|
|
7
|
-
import Label from "../../../../components/Label/Label.js";
|
|
8
|
-
import Input from "../../../../components/Input/Input.js";
|
|
9
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
10
|
-
const TITLE_MAX_LENGTH = 80;
|
|
11
|
-
function RssFeedForm({
|
|
12
|
-
mode,
|
|
13
|
-
feed,
|
|
14
|
-
isSubmitting,
|
|
15
|
-
onCancel,
|
|
16
|
-
onClose,
|
|
17
|
-
onSubmit
|
|
18
|
-
}) {
|
|
19
|
-
const {
|
|
20
|
-
t
|
|
21
|
-
} = useTranslation(), formId = "rss-feed-form", {
|
|
22
|
-
register,
|
|
23
|
-
handleSubmit,
|
|
24
|
-
formState: {
|
|
25
|
-
errors,
|
|
26
|
-
isDirty,
|
|
27
|
-
isValid
|
|
28
|
-
}
|
|
29
|
-
} = useForm({
|
|
30
|
-
mode: "onChange",
|
|
31
|
-
defaultValues: {
|
|
32
|
-
title: (feed == null ? void 0 : feed.title) ?? "",
|
|
33
|
-
link: (feed == null ? void 0 : feed.link) ?? ""
|
|
34
|
-
}
|
|
35
|
-
}), modalTitle = t(mode === "add" ? "homepage.widget.rss.form.addTitle" : "homepage.widget.rss.form.editTitle"), handleFormSubmit = (data) => {
|
|
36
|
-
onSubmit({
|
|
37
|
-
title: data.title.trim(),
|
|
38
|
-
link: data.link.trim()
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "rss-feed-modal", isOpen: !0, size: "l", onModalClose: onClose, children: [
|
|
42
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: modalTitle }),
|
|
43
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: /* @__PURE__ */ jsxs("form", { id: formId, className: "rss-widget-form", onSubmit: handleSubmit(handleFormSubmit), children: [
|
|
44
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "rss-feed-title", isRequired: !0, children: [
|
|
45
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.widget.rss.form.title") }),
|
|
46
|
-
/* @__PURE__ */ jsx(Input, { type: "text", size: "md", maxLength: TITLE_MAX_LENGTH, showCounter: !0, clearable: !0, "data-testid": "rss-input-title", placeholder: t("homepage.widget.rss.form.title.placeholder"), ...register("title", {
|
|
47
|
-
required: !0,
|
|
48
|
-
maxLength: TITLE_MAX_LENGTH,
|
|
49
|
-
validate: (value) => value.trim().length > 0
|
|
50
|
-
}) })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "rss-feed-link", isRequired: !0, status: errors.link ? "invalid" : void 0, children: [
|
|
53
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.widget.rss.form.link") }),
|
|
54
|
-
/* @__PURE__ */ jsx(Input, { type: "text", size: "md", "data-testid": "rss-input-link", placeholder: t("homepage.widget.rss.form.link.placeholder"), ...register("link", {
|
|
55
|
-
required: !0,
|
|
56
|
-
validate: isValidRssFeedUrl
|
|
57
|
-
}) }),
|
|
58
|
-
errors.link && /* @__PURE__ */ jsx(FormControl.Text, { children: t("homepage.widget.rss.error") })
|
|
59
|
-
] })
|
|
60
|
-
] }) }),
|
|
61
|
-
/* @__PURE__ */ jsxs(ModalBeta.Footer, { children: [
|
|
62
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", "data-testid": "rss-button-cancel", onClick: onCancel, children: t("homepage.widget.rss.form.cancel") }),
|
|
63
|
-
/* @__PURE__ */ jsx(ButtonBeta, { form: formId, type: "submit", isLoading: isSubmitting, disabled: !isValid || !isDirty || isSubmitting, "data-testid": "rss-button-save", children: t("homepage.widget.rss.form.save") })
|
|
64
|
-
] })
|
|
65
|
-
] });
|
|
66
|
-
}
|
|
67
|
-
export {
|
|
68
|
-
RssFeedForm
|
|
69
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RssFeed } from './types';
|
|
2
|
-
export interface RssFeedsModalProps {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
feeds: RssFeed[];
|
|
5
|
-
canAddFeed: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
onAddClick: () => void;
|
|
8
|
-
onEditFeed: (index: number) => void;
|
|
9
|
-
onDeleteFeed: (index: number) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function RssFeedsModal({ isOpen, feeds, canAddFeed, onClose, onAddClick, onEditFeed, onDeleteFeed, }: RssFeedsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyFeeds from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
|
-
import SvgIconClose from "../../../icons/components/IconClose.js";
|
|
5
|
-
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
6
|
-
import SvgIconPlus from "../../../icons/components/IconPlus.js";
|
|
7
|
-
import useBreakpoint from "../../../../hooks/useBreakpoint/useBreakpoint.js";
|
|
8
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
9
|
-
import Table from "../../../../components/Table/components/Table.js";
|
|
10
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
11
|
-
import Image from "../../../../components/Image/Image.js";
|
|
12
|
-
function RssFeedsModal({
|
|
13
|
-
isOpen,
|
|
14
|
-
feeds,
|
|
15
|
-
canAddFeed,
|
|
16
|
-
onClose,
|
|
17
|
-
onAddClick,
|
|
18
|
-
onEditFeed,
|
|
19
|
-
onDeleteFeed
|
|
20
|
-
}) {
|
|
21
|
-
const {
|
|
22
|
-
t
|
|
23
|
-
} = useTranslation(), {
|
|
24
|
-
md
|
|
25
|
-
} = useBreakpoint(), columnCount = md ? 3 : 2;
|
|
26
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "rss-feeds-modal", isOpen, size: "l", onModalClose: onClose, children: [
|
|
27
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: t("homepage.widget.rss.modal.title") }),
|
|
28
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: /* @__PURE__ */ jsx("div", { className: "rss-widget-table", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
29
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.widget.rss.modal.table.name") }),
|
|
31
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.widget.rss.modal.table.url") }),
|
|
32
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.widget.rss.modal.table.actions") })
|
|
33
|
-
] }) }),
|
|
34
|
-
/* @__PURE__ */ jsxs(Table.Tbody, { children: [
|
|
35
|
-
/* @__PURE__ */ jsx(Table.Tr, { className: "rss-widget-table__action-row", children: /* @__PURE__ */ jsx(Table.Td, { colSpan: columnCount, children: /* @__PURE__ */ jsx("div", { className: "rss-widget-table__toolbar", children: /* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "outline", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), onClick: onAddClick, disabled: !canAddFeed, "data-testid": "rss-button-add-feed", children: t("homepage.widget.rss.modal.add") }) }) }) }),
|
|
36
|
-
feeds.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { className: "rss-widget-table__empty-row", children: /* @__PURE__ */ jsx(Table.Td, { colSpan: columnCount, children: /* @__PURE__ */ jsxs("div", { className: "rss-widget-table__empty", children: [
|
|
37
|
-
/* @__PURE__ */ jsx(Image, { src: illuEmptyFeeds, alt: "", "aria-hidden": "true", className: "rss-widget-table__empty-image" }),
|
|
38
|
-
/* @__PURE__ */ jsx("p", { className: "rss-widget-table__empty-title", children: t("homepage.widget.rss.modal.empty.title") }),
|
|
39
|
-
/* @__PURE__ */ jsx("p", { className: "rss-widget-table__empty-text", children: t("homepage.widget.rss.empty") })
|
|
40
|
-
] }) }) }) : feeds.map((feed, index) => /* @__PURE__ */ jsxs(Table.Tr, { "data-testid": `rss-row-${index}`, children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "rss-widget-table__name", children: feed.title }),
|
|
42
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "rss-widget-table__url", children: feed.link }),
|
|
43
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "rss-widget-table__actions", children: /* @__PURE__ */ jsxs("div", { className: "rss-widget-table__actions-buttons", children: [
|
|
44
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconEdit, {}), "aria-label": t("homepage.widget.rss.modal.table.edit", {
|
|
45
|
-
title: feed.title
|
|
46
|
-
}), "data-testid": `rss-button-edit-${index}`, onClick: () => onEditFeed(index) }),
|
|
47
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), "aria-label": t("homepage.widget.rss.modal.table.delete", {
|
|
48
|
-
title: feed.title
|
|
49
|
-
}), "data-testid": `rss-button-delete-${index}`, onClick: () => onDeleteFeed(index) })
|
|
50
|
-
] }) })
|
|
51
|
-
] }, `${feed.link}-${index}`))
|
|
52
|
-
] })
|
|
53
|
-
] }) }) })
|
|
54
|
-
] });
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
RssFeedsModal
|
|
58
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { RssArticle, RssArticlesStatus, RssFeed, RssFeedPayload } from '../types';
|
|
2
|
-
/** Maximum number of feeds a user can follow. */
|
|
3
|
-
export declare const MAX_RSS_FEEDS = 10;
|
|
4
|
-
/** Maximum number of articles displayed for the selected feed. */
|
|
5
|
-
export declare const MAX_RSS_ARTICLES = 3;
|
|
6
|
-
export interface UseRssContainerReturn {
|
|
7
|
-
feeds: RssFeed[];
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
/** Whether the user can still add a feed (fewer than MAX_RSS_FEEDS). */
|
|
10
|
-
canAddFeed: boolean;
|
|
11
|
-
selectedIndex: number;
|
|
12
|
-
selectFeed: (index: number) => void;
|
|
13
|
-
/** The selected feed's latest articles, at most MAX_RSS_ARTICLES. */
|
|
14
|
-
articles: RssArticle[];
|
|
15
|
-
articlesStatus: RssArticlesStatus;
|
|
16
|
-
addFeed: (payload: RssFeedPayload, onSuccess?: () => void) => void;
|
|
17
|
-
updateFeed: (index: number, payload: RssFeedPayload, onSuccess?: () => void) => void;
|
|
18
|
-
deleteFeed: (index: number) => void;
|
|
19
|
-
isSaving: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Custom hook that provides the RSS feeds, the selected feed's articles and
|
|
23
|
-
* the feed CRUD handlers. Feeds have no id: they are handled by index.
|
|
24
|
-
*/
|
|
25
|
-
export declare const useRssContainer: () => UseRssContainerReturn;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { useRssChannel, useSaveRssFeeds, useRssArticles } from "../services/queries/rss.js";
|
|
3
|
-
const MAX_RSS_FEEDS = 10, MAX_RSS_ARTICLES = 3, DEFAULT_FEED_SHOW = 3, useRssContainer = () => {
|
|
4
|
-
var _a;
|
|
5
|
-
const {
|
|
6
|
-
data: channel,
|
|
7
|
-
isLoading
|
|
8
|
-
} = useRssChannel(), saveMutation = useSaveRssFeeds(), [selectedIndex, setSelectedIndex] = useState(0), feeds = (channel == null ? void 0 : channel.feeds) ?? [], currentIndex = Math.min(selectedIndex, Math.max(feeds.length - 1, 0)), articlesQuery = useRssArticles((_a = feeds[currentIndex]) == null ? void 0 : _a.link);
|
|
9
|
-
let articlesStatus = "loading";
|
|
10
|
-
articlesQuery.isError ? articlesStatus = "error" : articlesQuery.isSuccess && (articlesStatus = "success");
|
|
11
|
-
const saveFeeds = (nextFeeds, onSuccess) => saveMutation.mutate({
|
|
12
|
-
channelId: channel == null ? void 0 : channel.channelId,
|
|
13
|
-
feeds: nextFeeds
|
|
14
|
-
}, {
|
|
15
|
-
onSuccess
|
|
16
|
-
}), deleteFeed = (index) => {
|
|
17
|
-
index < currentIndex && setSelectedIndex(currentIndex - 1), saveFeeds(feeds.filter((_, i) => i !== index));
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
feeds,
|
|
21
|
-
isLoading,
|
|
22
|
-
canAddFeed: feeds.length < MAX_RSS_FEEDS,
|
|
23
|
-
selectedIndex: currentIndex,
|
|
24
|
-
selectFeed: setSelectedIndex,
|
|
25
|
-
articles: (articlesQuery.data ?? []).slice(0, MAX_RSS_ARTICLES),
|
|
26
|
-
articlesStatus,
|
|
27
|
-
addFeed: (payload, onSuccess) => saveFeeds([...feeds, {
|
|
28
|
-
...payload,
|
|
29
|
-
show: DEFAULT_FEED_SHOW
|
|
30
|
-
}], onSuccess),
|
|
31
|
-
updateFeed: (index, payload, onSuccess) => saveFeeds(feeds.map((feed, i) => i === index ? {
|
|
32
|
-
...feed,
|
|
33
|
-
...payload
|
|
34
|
-
} : feed), onSuccess),
|
|
35
|
-
deleteFeed,
|
|
36
|
-
isSaving: saveMutation.isPending
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
MAX_RSS_ARTICLES,
|
|
41
|
-
MAX_RSS_FEEDS,
|
|
42
|
-
useRssContainer
|
|
43
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { RssArticle, RssFeed } from '../../types';
|
|
2
|
-
/** The user's RSS channel: its id (none until first saved) and its feeds. */
|
|
3
|
-
export interface RssChannel {
|
|
4
|
-
channelId?: string;
|
|
5
|
-
feeds: RssFeed[];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Creates an RSS service for the homepage "RSS" widget, on top of the
|
|
9
|
-
* legacy `rss` backend module.
|
|
10
|
-
*
|
|
11
|
-
* Backend contract:
|
|
12
|
-
* - `GET /rss/channels` returns the user's channels; only the first one is
|
|
13
|
-
* used, and an empty array means the user has never saved a feed.
|
|
14
|
-
* - `POST /rss/channel { feeds }` creates the channel and returns `{ _id }`.
|
|
15
|
-
* - `PUT /rss/channel/:id { feeds }` replaces the whole feeds array: adding,
|
|
16
|
-
* editing and deleting a feed are all done this way.
|
|
17
|
-
* - `GET /rss/feed/items?url=…&force=0` fetches and parses a feed (served
|
|
18
|
-
* from the backend cache). The body carries its own `status`: anything
|
|
19
|
-
* other than 200 means the URL is not a readable RSS feed.
|
|
20
|
-
*
|
|
21
|
-
* @param baseURL The base URL for the rss service API.
|
|
22
|
-
*/
|
|
23
|
-
export declare const createRssService: (baseURL: string) => {
|
|
24
|
-
/**
|
|
25
|
-
* Get the current user's RSS channel.
|
|
26
|
-
*/
|
|
27
|
-
getChannel(): Promise<RssChannel>;
|
|
28
|
-
/**
|
|
29
|
-
* Save the whole feeds array, creating the channel on first save.
|
|
30
|
-
* @returns the channel id.
|
|
31
|
-
*/
|
|
32
|
-
saveFeeds(channelId: string | undefined, feeds: RssFeed[]): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Get the articles of a feed.
|
|
35
|
-
* @throws when the URL cannot be fetched or parsed as an RSS feed.
|
|
36
|
-
*/
|
|
37
|
-
getArticles(url: string): Promise<RssArticle[]>;
|
|
38
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { odeServices } from "@edifice.io/client";
|
|
2
|
-
const createRssService = (baseURL) => ({
|
|
3
|
-
/**
|
|
4
|
-
* Get the current user's RSS channel.
|
|
5
|
-
*/
|
|
6
|
-
async getChannel() {
|
|
7
|
-
const http = odeServices.http(), channels = await http.get(`${baseURL}/rss/channels`);
|
|
8
|
-
if (http.isResponseError())
|
|
9
|
-
throw new Error(http.latestResponse.statusText);
|
|
10
|
-
const [channel] = channels;
|
|
11
|
-
return {
|
|
12
|
-
channelId: channel == null ? void 0 : channel._id,
|
|
13
|
-
feeds: (channel == null ? void 0 : channel.feeds) ?? []
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* Save the whole feeds array, creating the channel on first save.
|
|
18
|
-
* @returns the channel id.
|
|
19
|
-
*/
|
|
20
|
-
async saveFeeds(channelId, feeds) {
|
|
21
|
-
const http = odeServices.http();
|
|
22
|
-
if (!channelId) {
|
|
23
|
-
const {
|
|
24
|
-
_id
|
|
25
|
-
} = await http.postJson(`${baseURL}/rss/channel`, {
|
|
26
|
-
feeds
|
|
27
|
-
});
|
|
28
|
-
if (http.isResponseError())
|
|
29
|
-
throw new Error(http.latestResponse.statusText);
|
|
30
|
-
return _id;
|
|
31
|
-
}
|
|
32
|
-
if (await http.putJson(`${baseURL}/rss/channel/${channelId}`, {
|
|
33
|
-
feeds
|
|
34
|
-
}), http.isResponseError())
|
|
35
|
-
throw new Error(http.latestResponse.statusText);
|
|
36
|
-
return channelId;
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Get the articles of a feed.
|
|
40
|
-
* @throws when the URL cannot be fetched or parsed as an RSS feed.
|
|
41
|
-
*/
|
|
42
|
-
async getArticles(url) {
|
|
43
|
-
const http = odeServices.http(), result = await http.get(`${baseURL}/rss/feed/items?url=${encodeURIComponent(url)}&force=0`);
|
|
44
|
-
if (http.isResponseError() || (result == null ? void 0 : result.status) !== 200)
|
|
45
|
-
throw new Error("rss.feed.invalid");
|
|
46
|
-
return result.Items ?? [];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
export {
|
|
50
|
-
createRssService
|
|
51
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { RssChannel } from '../api/rssService';
|
|
2
|
-
import { RssArticle } from '../../types';
|
|
3
|
-
export declare const rssQueryKeys: {
|
|
4
|
-
all: () => readonly ["rss"];
|
|
5
|
-
channel: () => readonly ["rss", "channel"];
|
|
6
|
-
articles: (url: string) => readonly ["rss", "articles", string];
|
|
7
|
-
};
|
|
8
|
-
export declare const rssQueryOptions: {
|
|
9
|
-
getChannel(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<RssChannel, Error, RssChannel, import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
10
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<RssChannel, import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
11
|
-
} & {
|
|
12
|
-
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, RssChannel>;
|
|
13
|
-
};
|
|
14
|
-
getArticles(url: string): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<RssArticle[], Error, RssArticle[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
15
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<RssArticle[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
16
|
-
} & {
|
|
17
|
-
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, RssArticle[]>;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const useRssChannel: () => import('@tanstack/react-query').UseQueryResult<RssChannel, Error>;
|
|
21
|
-
export declare const useRssArticles: (url: string | undefined) => import('@tanstack/react-query').UseQueryResult<RssArticle[], Error>;
|
|
22
|
-
/**
|
|
23
|
-
* Saves the whole feeds array (the backend has no per-feed route), with an
|
|
24
|
-
* optimistic update so that adding, editing and deleting feel immediate.
|
|
25
|
-
*/
|
|
26
|
-
export declare const useSaveRssFeeds: () => import('@tanstack/react-query').UseMutationResult<string, Error, RssChannel, {
|
|
27
|
-
previousChannel: RssChannel | undefined;
|
|
28
|
-
}>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useQuery, useQueryClient, useMutation, queryOptions } from "@tanstack/react-query";
|
|
2
|
-
import { rssService } from "../api/index.js";
|
|
3
|
-
const rssQueryKeys = {
|
|
4
|
-
all: () => ["rss"],
|
|
5
|
-
channel: () => [...rssQueryKeys.all(), "channel"],
|
|
6
|
-
articles: (url) => [...rssQueryKeys.all(), "articles", url]
|
|
7
|
-
}, rssQueryOptions = {
|
|
8
|
-
getChannel() {
|
|
9
|
-
return queryOptions({
|
|
10
|
-
queryKey: rssQueryKeys.channel(),
|
|
11
|
-
queryFn: async () => rssService.getChannel()
|
|
12
|
-
});
|
|
13
|
-
},
|
|
14
|
-
getArticles(url) {
|
|
15
|
-
return queryOptions({
|
|
16
|
-
queryKey: rssQueryKeys.articles(url),
|
|
17
|
-
queryFn: async () => rssService.getArticles(url),
|
|
18
|
-
// An invalid feed URL won't fix itself: show the error state right away.
|
|
19
|
-
retry: !1
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}, useRssChannel = () => useQuery(rssQueryOptions.getChannel()), useRssArticles = (url) => useQuery({
|
|
23
|
-
...rssQueryOptions.getArticles(url ?? ""),
|
|
24
|
-
enabled: !!url
|
|
25
|
-
}), useSaveRssFeeds = () => {
|
|
26
|
-
const queryClient = useQueryClient();
|
|
27
|
-
return useMutation({
|
|
28
|
-
mutationFn: ({
|
|
29
|
-
channelId,
|
|
30
|
-
feeds
|
|
31
|
-
}) => rssService.saveFeeds(channelId, feeds),
|
|
32
|
-
onMutate: async ({
|
|
33
|
-
channelId,
|
|
34
|
-
feeds
|
|
35
|
-
}) => {
|
|
36
|
-
await queryClient.cancelQueries({
|
|
37
|
-
queryKey: rssQueryKeys.channel()
|
|
38
|
-
});
|
|
39
|
-
const previousChannel = queryClient.getQueryData(rssQueryKeys.channel());
|
|
40
|
-
return queryClient.setQueryData(rssQueryKeys.channel(), {
|
|
41
|
-
channelId,
|
|
42
|
-
feeds
|
|
43
|
-
}), {
|
|
44
|
-
previousChannel
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
onSuccess: (channelId, {
|
|
48
|
-
feeds
|
|
49
|
-
}) => {
|
|
50
|
-
queryClient.setQueryData(rssQueryKeys.channel(), {
|
|
51
|
-
channelId,
|
|
52
|
-
feeds
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
onError: (_error, _variables, context) => {
|
|
56
|
-
context != null && context.previousChannel && queryClient.setQueryData(rssQueryKeys.channel(), context.previousChannel);
|
|
57
|
-
},
|
|
58
|
-
onSettled: () => {
|
|
59
|
-
queryClient.invalidateQueries({
|
|
60
|
-
queryKey: rssQueryKeys.channel()
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
rssQueryKeys,
|
|
67
|
-
rssQueryOptions,
|
|
68
|
-
useRssArticles,
|
|
69
|
-
useRssChannel,
|
|
70
|
-
useSaveRssFeeds
|
|
71
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An RSS feed followed by the user from the homepage "RSS" widget.
|
|
3
|
-
* Feeds have no id: they are stored as an ordered array in the user's
|
|
4
|
-
* RSS channel and identified by their position in it.
|
|
5
|
-
*/
|
|
6
|
-
export interface RssFeed {
|
|
7
|
-
title: string;
|
|
8
|
-
link: string;
|
|
9
|
-
/** Legacy number of articles to display, kept as-is when editing. */
|
|
10
|
-
show?: number;
|
|
11
|
-
}
|
|
12
|
-
export type RssFeedPayload = Pick<RssFeed, 'title' | 'link'>;
|
|
13
|
-
/**
|
|
14
|
-
* An article of an RSS feed, as parsed by the rss backend module.
|
|
15
|
-
*/
|
|
16
|
-
export interface RssArticle {
|
|
17
|
-
title: string;
|
|
18
|
-
link: string;
|
|
19
|
-
/** May contain HTML. */
|
|
20
|
-
description: string;
|
|
21
|
-
/** RFC 822 date, e.g. "Tue, 21 Jul 2026 08:00:00 +0200". */
|
|
22
|
-
pubDate: string;
|
|
23
|
-
}
|
|
24
|
-
/** Fetch status of the selected feed's articles. */
|
|
25
|
-
export type RssArticlesStatus = 'loading' | 'error' | 'success';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Same rule as the legacy RSS widget: an http(s) URL whose last path
|
|
3
|
-
* segment either has a feed extension or no extension at all.
|
|
4
|
-
*/
|
|
5
|
-
export declare function isValidRssFeedUrl(value: string): boolean;
|
|
6
|
-
/** Feed descriptions may contain HTML: only keep their text. */
|
|
7
|
-
export declare function htmlToText(html: string): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const FEED_EXTENSIONS = [".rss", ".xml", ".rdf", ".atom", ".feed"];
|
|
2
|
-
function isValidRssFeedUrl(value) {
|
|
3
|
-
let url;
|
|
4
|
-
try {
|
|
5
|
-
url = new URL(value.trim());
|
|
6
|
-
} catch {
|
|
7
|
-
return !1;
|
|
8
|
-
}
|
|
9
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") return !1;
|
|
10
|
-
const pathname = url.pathname.toLowerCase();
|
|
11
|
-
return !(pathname.split("/").pop() ?? "").includes(".") || FEED_EXTENSIONS.some((extension) => pathname.endsWith(extension));
|
|
12
|
-
}
|
|
13
|
-
function htmlToText(html) {
|
|
14
|
-
return (new DOMParser().parseFromString(html, "text/html").body.textContent ?? "").trim();
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
htmlToText,
|
|
18
|
-
isValidRssFeedUrl
|
|
19
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { School } from '@edifice.io/client';
|
|
2
|
-
export interface UniversalisProps {
|
|
3
|
-
handleActionClick: () => void;
|
|
4
|
-
selectedSchool?: School;
|
|
5
|
-
onSelectedSchoolChange?: (school: School) => void;
|
|
6
|
-
schools?: School[];
|
|
7
|
-
}
|
|
8
|
-
export default function Universalis({ handleActionClick, selectedSchool, onSelectedSchoolChange, schools, }: UniversalisProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import illuUniversalis from "@edifice.io/bootstrap/dist/images/homepage/illu-universalis.png";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
import { useForm } from "react-hook-form";
|
|
6
|
-
import { useTranslation } from "react-i18next";
|
|
7
|
-
import SvgIconExternalLink from "../../../icons/components/IconExternalLink.js";
|
|
8
|
-
import SvgIconRafterDown from "../../../icons/components/IconRafterDown.js";
|
|
9
|
-
import SvgIconSearch from "../../../icons/components/IconSearch.js";
|
|
10
|
-
import HomeCard from "../HomeCard/HomeCard.js";
|
|
11
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
12
|
-
import Image from "../../../../components/Image/Image.js";
|
|
13
|
-
import Dropdown from "../../../../components/Dropdown/Dropdown.js";
|
|
14
|
-
import FormControl from "../../../../components/Form/FormControl.js";
|
|
15
|
-
import Input from "../../../../components/Input/Input.js";
|
|
16
|
-
import { getRotateTransitionStyle } from "../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";
|
|
17
|
-
const UNIVERSALIS_ENGINE_PARAM = "www";
|
|
18
|
-
function Universalis({
|
|
19
|
-
handleActionClick,
|
|
20
|
-
selectedSchool,
|
|
21
|
-
onSelectedSchoolChange,
|
|
22
|
-
schools
|
|
23
|
-
}) {
|
|
24
|
-
const {
|
|
25
|
-
t
|
|
26
|
-
} = useTranslation(), {
|
|
27
|
-
register
|
|
28
|
-
} = useForm(), [isExpanded, setIsExpanded] = useState(!1), hasManySchools = !!(schools && schools.length > 1), hasUai = !!(selectedSchool != null && selectedSchool.UAI), searchLabel = t(hasUai ? "search" : "homepage.widget.universalis.noUai");
|
|
29
|
-
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
30
|
-
/* @__PURE__ */ jsxs("div", { className: "universalis__header", children: [
|
|
31
|
-
/* @__PURE__ */ jsx("h3", { className: "universalis__title", children: t("homepage.widget.universalis.title") }),
|
|
32
|
-
/* @__PURE__ */ jsx(ButtonBeta, { className: "universalis__header-button", "data-testid": "universalis-button-open", "aria-label": t("homepage.widget.universalis.open"), onClick: handleActionClick, leftIcon: /* @__PURE__ */ jsx(SvgIconExternalLink, {}), variant: "ghost", color: "tertiary" })
|
|
33
|
-
] }),
|
|
34
|
-
/* @__PURE__ */ jsx(HomeCard.Content, { children: /* @__PURE__ */ jsxs("div", { className: "universalis", children: [
|
|
35
|
-
/* @__PURE__ */ jsxs("div", { className: "universalis__intro", children: [
|
|
36
|
-
/* @__PURE__ */ jsx(Image, { src: illuUniversalis, alt: "Universalis Éducation", className: "universalis__logo" }),
|
|
37
|
-
/* @__PURE__ */ jsx("p", { className: "universalis__description", children: t("homepage.widget.universalis.description") })
|
|
38
|
-
] }),
|
|
39
|
-
hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-start", onToggle: setIsExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
-
/* @__PURE__ */ jsxs("button", { ...triggerProps, type: "button", "aria-expanded": isExpanded, className: clsx("universalis__school-selector", {
|
|
41
|
-
"universalis__school-selector--open": isExpanded
|
|
42
|
-
}), children: [
|
|
43
|
-
/* @__PURE__ */ jsx("span", { className: "universalis__school-selector-label", children: selectedSchool == null ? void 0 : selectedSchool.name }),
|
|
44
|
-
/* @__PURE__ */ jsx(SvgIconRafterDown, { className: "universalis__school-selector-icon", style: getRotateTransitionStyle(isExpanded, {
|
|
45
|
-
degrees: 180
|
|
46
|
-
}) })
|
|
47
|
-
] }),
|
|
48
|
-
/* @__PURE__ */ jsx(Dropdown.Menu, { children: schools == null ? void 0 : schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: school.name }, school.id)) })
|
|
49
|
-
] }) }),
|
|
50
|
-
/* @__PURE__ */ jsx("form", { method: "GET", action: "https://www.universalis-edu.com/nomade/precherche/", target: "_blank", className: "universalis__search", children: /* @__PURE__ */ jsxs(FormControl, { id: "inputUniversalisQuery", className: "universalis__search-field", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(FormControl.Label, { className: "visually-hidden", children: searchLabel }),
|
|
52
|
-
/* @__PURE__ */ jsx(Input, { placeholder: searchLabel, size: "md", type: "text", maxLength: 255, disabled: !hasUai, ...register("q") }),
|
|
53
|
-
/* @__PURE__ */ jsx("input", { type: "hidden", name: "r", value: UNIVERSALIS_ENGINE_PARAM }),
|
|
54
|
-
/* @__PURE__ */ jsx("input", { type: "hidden", name: "uai", value: selectedSchool == null ? void 0 : selectedSchool.UAI }),
|
|
55
|
-
/* @__PURE__ */ jsx(ButtonBeta, { leftIcon: /* @__PURE__ */ jsx(SvgIconSearch, {}), type: "submit", "aria-label": searchLabel, variant: "filled", color: "default", disabled: !hasUai })
|
|
56
|
-
] }) })
|
|
57
|
-
] }) })
|
|
58
|
-
] });
|
|
59
|
-
}
|
|
60
|
-
export {
|
|
61
|
-
Universalis as default
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UniversalisContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { WIDGET_NAME } from "@edifice.io/client";
|
|
3
|
-
import { useUserSchools } from "../../hooks/useUserSchools.js";
|
|
4
|
-
import Universalis from "./Universalis.js";
|
|
5
|
-
function UniversalisContainer() {
|
|
6
|
-
const {
|
|
7
|
-
handleSelectedSchoolChange,
|
|
8
|
-
...otherProps
|
|
9
|
-
} = useUserSchools(WIDGET_NAME.UNIVERSALIS);
|
|
10
|
-
return /* @__PURE__ */ jsx(Universalis, { handleActionClick: () => {
|
|
11
|
-
window.open("http://www.universalis-edu.com", "_blank", "noopener,noreferrer");
|
|
12
|
-
}, onSelectedSchoolChange: handleSelectedSchoolChange, ...otherProps });
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
UniversalisContainer
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
export interface WidgetToggleProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'type' | 'role' | 'aria-checked'> {
|
|
3
|
-
'checked': boolean;
|
|
4
|
-
'onChange': () => void;
|
|
5
|
-
'aria-label': string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Dedicated on/off control for a widget row in `WidgetsPersonalizationPanel`.
|
|
9
|
-
* The generic `Switch` component doesn't match this panel's design (size,
|
|
10
|
-
* filled-vs-outlined states), so this is a small purpose-built control
|
|
11
|
-
* rather than a `Switch` variant.
|
|
12
|
-
*/
|
|
13
|
-
export declare function WidgetToggle({ checked, onChange, disabled, ...rest }: WidgetToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare namespace WidgetToggle {
|
|
15
|
-
var displayName: string;
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
function WidgetToggle({
|
|
4
|
-
checked,
|
|
5
|
-
onChange,
|
|
6
|
-
disabled,
|
|
7
|
-
...rest
|
|
8
|
-
}) {
|
|
9
|
-
return /* @__PURE__ */ jsx("button", { type: "button", role: "switch", "aria-checked": checked, disabled, className: clsx("widget-toggle", {
|
|
10
|
-
"widget-toggle--checked": checked
|
|
11
|
-
}), onClick: onChange, ...rest, children: /* @__PURE__ */ jsx("span", { className: "widget-toggle__knob" }) });
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
WidgetToggle
|
|
15
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface WidgetPersonalizationItem {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
icon: ReactNode;
|
|
6
|
-
checked: boolean;
|
|
7
|
-
/** When true, the widget is pinned by an admin: no toggle, lock icon instead. */
|
|
8
|
-
locked?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface WidgetsPersonalizationPanelProps {
|
|
11
|
-
items: WidgetPersonalizationItem[];
|
|
12
|
-
isLoading?: boolean;
|
|
13
|
-
onToggle: (id: string) => void;
|
|
14
|
-
onClose: () => void;
|
|
15
|
-
title?: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function WidgetsPersonalizationPanel({ items, isLoading, onToggle, onClose, title, description, }: WidgetsPersonalizationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare namespace WidgetsPersonalizationPanel {
|
|
20
|
-
var displayName: string;
|
|
21
|
-
}
|