@edifice.io/react 2.6.5-develop-b2school.20260917163248 → 2.6.5-develop-pedago.20260922142328
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/Form/FormText.js +6 -11
- package/dist/components/Input/Input.d.ts +2 -11
- package/dist/components/Input/Input.js +21 -38
- package/dist/components/Label/Label.js +4 -4
- package/dist/components/Layout/Layout.js +5 -10
- package/dist/components/PageLayout/PageLayout.d.ts +0 -4
- package/dist/components/PageLayout/PageLayout.js +12 -22
- package/dist/components/PageLayout/components/PageLayoutContent.js +1 -5
- package/dist/components/Table/components/Table.d.ts +2 -2
- package/dist/components/Table/components/TableTd.d.ts +1 -1
- package/dist/components/Table/components/TableTh.d.ts +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/homepage.js +28 -29
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -3
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -14
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +24 -51
- package/dist/index.js +160 -168
- package/dist/modules/homepage/components/Communities/Communities.js +32 -0
- package/dist/modules/homepage/components/Communities/CommunitiesContainer.js +23 -0
- package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.js +32 -0
- package/dist/modules/homepage/components/Communities/CommunityItem.js +27 -0
- package/dist/modules/homepage/components/Communities/useCommunities.d.ts +1 -4
- package/dist/modules/homepage/components/Communities/useCommunities.js +25 -0
- package/dist/modules/homepage/components/Header/Header.js +4 -11
- package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +8 -18
- package/dist/modules/homepage/components/index.d.ts +1 -1
- package/dist/modules/widgets/index.d.ts +1 -1
- package/package.json +6 -6
- package/dist/components/LinkPill/LinkPill.d.ts +0 -45
- package/dist/components/LinkPill/LinkPill.js +0 -27
- package/dist/components/LinkPill/index.d.ts +0 -2
- package/dist/components/ModalBeta/ModalBeta.d.ts +0 -47
- package/dist/components/ModalBeta/ModalBeta.js +0 -62
- package/dist/components/ModalBeta/ModalBetaBody.d.ts +0 -19
- package/dist/components/ModalBeta/ModalBetaBody.js +0 -15
- package/dist/components/ModalBeta/ModalBetaContext.d.ts +0 -7
- package/dist/components/ModalBeta/ModalBetaContext.js +0 -15
- package/dist/components/ModalBeta/ModalBetaFooter.d.ts +0 -13
- package/dist/components/ModalBeta/ModalBetaFooter.js +0 -7
- package/dist/components/ModalBeta/ModalBetaHeader.d.ts +0 -23
- package/dist/components/ModalBeta/ModalBetaHeader.js +0 -31
- package/dist/components/ModalBeta/index.d.ts +0 -2
- package/dist/components/PageLayout/components/PageLayoutHelpZone.d.ts +0 -12
- package/dist/components/PageLayout/components/PageLayoutHelpZone.js +0 -6
- package/dist/hooks/useBackground/index.d.ts +0 -1
- package/dist/hooks/useBackground/useBackground.d.ts +0 -7
- package/dist/hooks/useBackground/useBackground.js +0 -16
- package/dist/hooks/useUserPreferences/index.d.ts +0 -1
- package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +0 -9
- package/dist/hooks/useUserPreferences/useUserPreferences.js +0 -40
- package/dist/modules/HelpZone/HelpZone.d.ts +0 -13
- package/dist/modules/HelpZone/HelpZone.js +0 -48
- package/dist/modules/HelpZone/HelpZoneContainer.d.ts +0 -4
- package/dist/modules/HelpZone/HelpZoneContainer.js +0 -18
- package/dist/modules/HelpZone/index.d.ts +0 -3
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +0 -13
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +0 -67
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +0 -6
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +0 -29
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +0 -1
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +0 -40
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +0 -11
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +0 -65
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +0 -19
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +0 -26
- package/dist/modules/homepage/components/UsefulLinks/index.d.ts +0 -5
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +0 -6
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +0 -5
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +0 -31
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +0 -50
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +0 -20
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +0 -65
- package/dist/modules/icons/components/logo/IconLogoEdificeFull.d.ts +0 -7
- package/dist/modules/icons/components/logo/IconLogoEdificeFull.js +0 -26
- package/dist/modules/icons/components/logo/IconLogoEdificeSmall.d.ts +0 -7
- package/dist/modules/icons/components/logo/IconLogoEdificeSmall.js +0 -17
- package/dist/modules/icons/components/logo/index.d.ts +0 -2
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useForm } from "react-hook-form";
|
|
4
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
5
|
-
import FormControl from "../../../../components/Form/FormControl.js";
|
|
6
|
-
import Label from "../../../../components/Label/Label.js";
|
|
7
|
-
import Input from "../../../../components/Input/Input.js";
|
|
8
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
|
-
const NAME_MAX_LENGTH = 80, URL_PLACEHOLDER = "https://example.fr", URL_PATTERN = /^https?:\/\/.+/i;
|
|
10
|
-
function LinkForm({
|
|
11
|
-
mode,
|
|
12
|
-
link,
|
|
13
|
-
isSubmitting,
|
|
14
|
-
onCancel,
|
|
15
|
-
onClose,
|
|
16
|
-
onSubmit
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation(), formId = "useful-link-form", {
|
|
21
|
-
register,
|
|
22
|
-
handleSubmit,
|
|
23
|
-
formState: {
|
|
24
|
-
errors,
|
|
25
|
-
isDirty,
|
|
26
|
-
isValid
|
|
27
|
-
}
|
|
28
|
-
} = useForm({
|
|
29
|
-
mode: "onChange",
|
|
30
|
-
defaultValues: {
|
|
31
|
-
name: (link == null ? void 0 : link.name) ?? "",
|
|
32
|
-
url: (link == null ? void 0 : link.url) ?? ""
|
|
33
|
-
}
|
|
34
|
-
}), title = mode === "add" ? t("homepage.usefulLinks.form.addTitle", "Ajouter un lien") : t("homepage.usefulLinks.form.editTitle", "Modifier un lien"), handleFormSubmit = (data) => {
|
|
35
|
-
onSubmit({
|
|
36
|
-
name: data.name.trim(),
|
|
37
|
-
url: data.url.trim()
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "useful-link-modal", isOpen: !0, size: "l", onModalClose: onClose, children: [
|
|
41
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: title }),
|
|
42
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: /* @__PURE__ */ jsxs("form", { id: formId, onSubmit: handleSubmit(handleFormSubmit), children: [
|
|
43
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "useful-link-name", className: "mb-16", isRequired: !0, children: [
|
|
44
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.usefulLinks.form.name", "Nom") }),
|
|
45
|
-
/* @__PURE__ */ 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", "Nom du lien utile"), ...register("name", {
|
|
46
|
-
required: !0,
|
|
47
|
-
maxLength: NAME_MAX_LENGTH
|
|
48
|
-
}) })
|
|
49
|
-
] }),
|
|
50
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "useful-link-url", isRequired: !0, status: errors.url ? "invalid" : void 0, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.usefulLinks.form.url", "Lien") }),
|
|
52
|
-
/* @__PURE__ */ jsx(Input, { type: "text", size: "md", "data-testid": "usefullinks-input-url", placeholder: t("homepage.usefulLinks.form.url.placeholder", URL_PLACEHOLDER), ...register("url", {
|
|
53
|
-
required: !0,
|
|
54
|
-
pattern: URL_PATTERN
|
|
55
|
-
}) }),
|
|
56
|
-
errors.url && /* @__PURE__ */ jsx(FormControl.Text, { children: t("homepage.usefulLinks.form.url.error", "L'adresse doit être une URL valide (ex. https://exemple.fr)") })
|
|
57
|
-
] })
|
|
58
|
-
] }) }),
|
|
59
|
-
/* @__PURE__ */ jsxs(ModalBeta.Footer, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", "data-testid": "usefullinks-button-cancel", onClick: onCancel, children: t("homepage.usefulLinks.form.cancel", "Annuler") }),
|
|
61
|
-
/* @__PURE__ */ jsx(ButtonBeta, { form: formId, type: "submit", isLoading: isSubmitting, disabled: !isValid || !isDirty || isSubmitting, "data-testid": "usefullinks-button-save", children: t("homepage.usefulLinks.form.save", "Enregistrer") })
|
|
62
|
-
] })
|
|
63
|
-
] });
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
LinkForm
|
|
67
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
|
-
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
5
|
-
import HomeCard from "../HomeCard/HomeCard.js";
|
|
6
|
-
import Image from "../../../../components/Image/Image.js";
|
|
7
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
8
|
-
import LinkPill from "../../../../components/LinkPill/LinkPill.js";
|
|
9
|
-
function UsefulLinks({
|
|
10
|
-
links,
|
|
11
|
-
onEditClick
|
|
12
|
-
}) {
|
|
13
|
-
const {
|
|
14
|
-
t
|
|
15
|
-
} = useTranslation();
|
|
16
|
-
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
17
|
-
/* @__PURE__ */ jsx(HomeCard.Header, { title: t("homepage.usefulLinks.title", "Liens utiles"), actionLabel: t("homepage.usefulLinks.edit", "Éditer"), actionLeftIcon: /* @__PURE__ */ jsx(SvgIconEdit, {}), onActionClick: onEditClick }),
|
|
18
|
-
/* @__PURE__ */ jsx(HomeCard.Content, { children: links.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "useful-links-widget__empty", children: [
|
|
19
|
-
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
20
|
-
width: 160,
|
|
21
|
-
height: 87
|
|
22
|
-
} }),
|
|
23
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-widget__empty-text", children: t("homepage.usefulLinks.empty", "Gardez à portée de main les sites web que vous utilisez souvent !") })
|
|
24
|
-
] }) : /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", children: links.map((link) => /* @__PURE__ */ jsx(LinkPill, { href: link.url, label: link.name }, link.id)) }) })
|
|
25
|
-
] });
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
UsefulLinks
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UsefulLinksContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useUsefulLinksContainer } from "./hooks/useUsefulLinksContainer.js";
|
|
4
|
-
import { LinkForm } from "./LinkForm.js";
|
|
5
|
-
import { UsefulLinks } from "./UsefulLinks.js";
|
|
6
|
-
import { UsefulLinksModal } from "./UsefulLinksModal.js";
|
|
7
|
-
function UsefulLinksContainer() {
|
|
8
|
-
const [view, setView] = useState({
|
|
9
|
-
name: "closed"
|
|
10
|
-
}), {
|
|
11
|
-
links,
|
|
12
|
-
canAddLink,
|
|
13
|
-
createLink,
|
|
14
|
-
isCreating,
|
|
15
|
-
updateLink,
|
|
16
|
-
isUpdating,
|
|
17
|
-
deleteLink
|
|
18
|
-
} = useUsefulLinksContainer(), closeAll = () => setView({
|
|
19
|
-
name: "closed"
|
|
20
|
-
}), backToManage = () => setView({
|
|
21
|
-
name: "manage"
|
|
22
|
-
}), handleSubmit = async (payload) => {
|
|
23
|
-
view.name === "edit" ? await updateLink(view.link.id, payload) : await createLink(payload), backToManage();
|
|
24
|
-
};
|
|
25
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(UsefulLinks, { links, onEditClick: () => setView({
|
|
27
|
-
name: "manage"
|
|
28
|
-
}) }),
|
|
29
|
-
/* @__PURE__ */ jsx(UsefulLinksModal, { isOpen: view.name === "manage", links, canAddLink, onClose: closeAll, onAddClick: () => setView({
|
|
30
|
-
name: "add"
|
|
31
|
-
}), onEditLink: (link) => setView({
|
|
32
|
-
name: "edit",
|
|
33
|
-
link
|
|
34
|
-
}), onDeleteLink: deleteLink }),
|
|
35
|
-
(view.name === "add" || view.name === "edit") && /* @__PURE__ */ jsx(LinkForm, { mode: view.name, link: view.name === "edit" ? view.link : void 0, isSubmitting: view.name === "edit" ? isUpdating : isCreating, onCancel: backToManage, onClose: closeAll, onSubmit: handleSubmit })
|
|
36
|
-
] });
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
UsefulLinksContainer
|
|
40
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UsefulLink } from '@edifice.io/client';
|
|
2
|
-
export interface UsefulLinksModalProps {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
links: UsefulLink[];
|
|
5
|
-
canAddLink: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
onAddClick: () => void;
|
|
8
|
-
onEditLink: (link: UsefulLink) => void;
|
|
9
|
-
onDeleteLink: (id: string) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function UsefulLinksModal({ isOpen, links, canAddLink, onClose, onAddClick, onEditLink, onDeleteLink, }: UsefulLinksModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyUsefulLinks 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 ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
10
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
11
|
-
import Image from "../../../../components/Image/Image.js";
|
|
12
|
-
import Table from "../../../../components/Table/components/Table.js";
|
|
13
|
-
function UsefulLinksModal({
|
|
14
|
-
isOpen,
|
|
15
|
-
links,
|
|
16
|
-
canAddLink,
|
|
17
|
-
onClose,
|
|
18
|
-
onAddClick,
|
|
19
|
-
onEditLink,
|
|
20
|
-
onDeleteLink
|
|
21
|
-
}) {
|
|
22
|
-
const {
|
|
23
|
-
t
|
|
24
|
-
} = useTranslation(), {
|
|
25
|
-
md
|
|
26
|
-
} = useBreakpoint(), addLinkButton = /* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "outline", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), onClick: onAddClick, disabled: !canAddLink, "data-testid": "usefullinks-button-add", children: t("homepage.usefulLinks.modal.add", "Ajouter un lien") });
|
|
27
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "useful-links-modal", isOpen, size: "l", onModalClose: onClose, children: [
|
|
28
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: t("homepage.usefulLinks.modal.title", "Gérer les liens utiles") }),
|
|
29
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: links.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(Flex, { justify: "end", className: "mb-16", children: addLinkButton }),
|
|
31
|
-
/* @__PURE__ */ jsxs("div", { className: "useful-links-modal__empty", children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
33
|
-
width: 200,
|
|
34
|
-
height: 109
|
|
35
|
-
} }),
|
|
36
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-modal__empty-title", children: t("homepage.usefulLinks.modal.empty.title", "Pas encore de liens ajoutés") }),
|
|
37
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-modal__empty-text", children: t("homepage.usefulLinks.modal.empty.text", "Gardez à portée de main les sites web que vous utilisez souvent !") })
|
|
38
|
-
] })
|
|
39
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "useful-links-table", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
40
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.name", "Nom") }),
|
|
42
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.url", "Adresse URL") }),
|
|
43
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.actions", "Actions") })
|
|
44
|
-
] }) }),
|
|
45
|
-
/* @__PURE__ */ jsxs(Table.Tbody, { children: [
|
|
46
|
-
/* @__PURE__ */ jsx(Table.Tr, { className: "useful-links-table__action-row", children: /* @__PURE__ */ jsx(Table.Td, { colSpan: md ? 3 : 2, children: /* @__PURE__ */ jsx(Flex, { justify: "end", children: addLinkButton }) }) }),
|
|
47
|
-
links.map((link) => /* @__PURE__ */ jsxs(Table.Tr, { "data-testid": `usefullinks-row-${link.id}`, children: [
|
|
48
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__name", children: link.name }),
|
|
49
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__url", children: link.url }),
|
|
50
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__actions", children: /* @__PURE__ */ jsxs(Flex, { gap: "4", justify: "end", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconEdit, {}), "aria-label": t("homepage.usefulLinks.modal.table.edit", "Modifier [[name]]", {
|
|
52
|
-
name: link.name
|
|
53
|
-
}), "data-testid": `usefullinks-button-edit-${link.id}`, onClick: () => onEditLink(link) }),
|
|
54
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), "aria-label": t("homepage.usefulLinks.modal.table.delete", "Supprimer [[name]]", {
|
|
55
|
-
name: link.name
|
|
56
|
-
}), "data-testid": `usefullinks-button-delete-${link.id}`, onClick: () => onDeleteLink(link.id) })
|
|
57
|
-
] }) })
|
|
58
|
-
] }, link.id))
|
|
59
|
-
] })
|
|
60
|
-
] }) }) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
UsefulLinksModal
|
|
65
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
|
|
2
|
-
/** Maximum number of useful links a user can save. */
|
|
3
|
-
export declare const MAX_USEFUL_LINKS = 10;
|
|
4
|
-
export interface UseUsefulLinksContainerReturn {
|
|
5
|
-
links: UsefulLink[];
|
|
6
|
-
isLoading: boolean;
|
|
7
|
-
error: Error | null;
|
|
8
|
-
/** Whether the user can still add a new link (fewer than MAX_USEFUL_LINKS). */
|
|
9
|
-
canAddLink: boolean;
|
|
10
|
-
createLink: (payload: UsefulLinkPayload) => Promise<UsefulLink>;
|
|
11
|
-
isCreating: boolean;
|
|
12
|
-
updateLink: (id: string, payload: UsefulLinkPayload) => Promise<UsefulLink>;
|
|
13
|
-
isUpdating: boolean;
|
|
14
|
-
deleteLink: (id: string) => void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Custom hook that provides useful links data and CRUD handlers.
|
|
18
|
-
*/
|
|
19
|
-
export declare const useUsefulLinksContainer: () => UseUsefulLinksContainerReturn;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useUsefulLinks, useCreateUsefulLink, useUpdateUsefulLink, useDeleteUsefulLink } from "../services/queries/usefulLinks.js";
|
|
2
|
-
const MAX_USEFUL_LINKS = 10, useUsefulLinksContainer = () => {
|
|
3
|
-
const {
|
|
4
|
-
data: links,
|
|
5
|
-
isLoading,
|
|
6
|
-
error
|
|
7
|
-
} = useUsefulLinks(), createMutation = useCreateUsefulLink(), updateMutation = useUpdateUsefulLink(), deleteMutation = useDeleteUsefulLink();
|
|
8
|
-
return {
|
|
9
|
-
links: links ?? [],
|
|
10
|
-
isLoading,
|
|
11
|
-
error,
|
|
12
|
-
canAddLink: ((links == null ? void 0 : links.length) ?? 0) < MAX_USEFUL_LINKS,
|
|
13
|
-
createLink: (payload) => createMutation.mutateAsync(payload),
|
|
14
|
-
isCreating: createMutation.isPending,
|
|
15
|
-
updateLink: (id, payload) => updateMutation.mutateAsync({
|
|
16
|
-
id,
|
|
17
|
-
payload
|
|
18
|
-
}),
|
|
19
|
-
isUpdating: updateMutation.isPending,
|
|
20
|
-
deleteLink: (id) => deleteMutation.mutate(id)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
MAX_USEFUL_LINKS,
|
|
25
|
-
useUsefulLinksContainer
|
|
26
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const usefulLinksService: {
|
|
2
|
-
getUsefulLinks(): Promise<import('@edifice.io/client').UsefulLink[]>;
|
|
3
|
-
createUsefulLink(payload: import('@edifice.io/client').UsefulLinkPayload): Promise<import('@edifice.io/client').UsefulLink>;
|
|
4
|
-
updateUsefulLink(id: string, payload: import('@edifice.io/client').UsefulLinkPayload): Promise<import('@edifice.io/client').UsefulLink>;
|
|
5
|
-
deleteUsefulLink(id: string): Promise<void>;
|
|
6
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a useful links service with methods to manage the current user's
|
|
4
|
-
* personal "useful links" (homepage "Liens utiles" widget).
|
|
5
|
-
*
|
|
6
|
-
* Backend contract: `GET`/`POST`/`PUT`/`DELETE /bookmark/api/v2/bookmarks`.
|
|
7
|
-
* `POST`/`PUT` only return the bookmark's `_id`, not the full resource.
|
|
8
|
-
* Known error code: `bookmark.widget.bad.request.limit.reached` (POST, 400,
|
|
9
|
-
* once the user already has 10 links). `PUT` returns 401 if the id doesn't
|
|
10
|
-
* belong to the user, `DELETE` returns 404 if the id doesn't exist.
|
|
11
|
-
*
|
|
12
|
-
* @param baseURL The base URL for the useful links service API.
|
|
13
|
-
*/
|
|
14
|
-
export declare const createUsefulLinksService: (baseURL: string) => {
|
|
15
|
-
/**
|
|
16
|
-
* Get the current user's useful links.
|
|
17
|
-
*/
|
|
18
|
-
getUsefulLinks(): Promise<UsefulLink[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Create a new useful link.
|
|
21
|
-
*/
|
|
22
|
-
createUsefulLink(payload: UsefulLinkPayload): Promise<UsefulLink>;
|
|
23
|
-
/**
|
|
24
|
-
* Update an existing useful link.
|
|
25
|
-
*/
|
|
26
|
-
updateUsefulLink(id: string, payload: UsefulLinkPayload): Promise<UsefulLink>;
|
|
27
|
-
/**
|
|
28
|
-
* Delete a useful link.
|
|
29
|
-
*/
|
|
30
|
-
deleteUsefulLink(id: string): Promise<void>;
|
|
31
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { odeServices } from "@edifice.io/client";
|
|
2
|
-
const toUsefulLink = ({
|
|
3
|
-
_id,
|
|
4
|
-
name,
|
|
5
|
-
url
|
|
6
|
-
}) => ({
|
|
7
|
-
id: _id,
|
|
8
|
-
name,
|
|
9
|
-
url
|
|
10
|
-
}), createUsefulLinksService = (baseURL) => ({
|
|
11
|
-
/**
|
|
12
|
-
* Get the current user's useful links.
|
|
13
|
-
*/
|
|
14
|
-
async getUsefulLinks() {
|
|
15
|
-
const {
|
|
16
|
-
bookmarks
|
|
17
|
-
} = await odeServices.http().get(`${baseURL}/bookmark/api/v2/bookmarks`);
|
|
18
|
-
return bookmarks.map(toUsefulLink);
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* Create a new useful link.
|
|
22
|
-
*/
|
|
23
|
-
async createUsefulLink(payload) {
|
|
24
|
-
const {
|
|
25
|
-
_id
|
|
26
|
-
} = await odeServices.http().postJson(`${baseURL}/bookmark/api/v2/bookmarks`, payload);
|
|
27
|
-
return {
|
|
28
|
-
id: _id,
|
|
29
|
-
...payload
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* Update an existing useful link.
|
|
34
|
-
*/
|
|
35
|
-
async updateUsefulLink(id, payload) {
|
|
36
|
-
return await odeServices.http().putJson(`${baseURL}/bookmark/api/v2/bookmarks/${id}`, payload), {
|
|
37
|
-
id,
|
|
38
|
-
...payload
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* Delete a useful link.
|
|
43
|
-
*/
|
|
44
|
-
async deleteUsefulLink(id) {
|
|
45
|
-
await odeServices.http().delete(`${baseURL}/bookmark/api/v2/bookmarks/${id}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
export {
|
|
49
|
-
createUsefulLinksService
|
|
50
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
|
|
2
|
-
export declare const usefulLinksQueryKeys: {
|
|
3
|
-
all: () => readonly ["usefulLinks"];
|
|
4
|
-
};
|
|
5
|
-
export declare const usefulLinksQueryOptions: {
|
|
6
|
-
getUsefulLinks(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<UsefulLink[], Error, UsefulLink[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
|
|
7
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<UsefulLink[], import('@tanstack/react-query').QueryKey, never> | undefined;
|
|
8
|
-
} & {
|
|
9
|
-
queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, UsefulLink[]>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare const useUsefulLinks: () => import('@tanstack/react-query').UseQueryResult<UsefulLink[], Error>;
|
|
13
|
-
export declare const useCreateUsefulLink: () => import('@tanstack/react-query').UseMutationResult<UsefulLink, Error, UsefulLinkPayload, unknown>;
|
|
14
|
-
export declare const useUpdateUsefulLink: () => import('@tanstack/react-query').UseMutationResult<UsefulLink, Error, {
|
|
15
|
-
id: string;
|
|
16
|
-
payload: UsefulLinkPayload;
|
|
17
|
-
}, unknown>;
|
|
18
|
-
export declare const useDeleteUsefulLink: () => import('@tanstack/react-query').UseMutationResult<void, Error, string, {
|
|
19
|
-
previousLinks: UsefulLink[] | undefined;
|
|
20
|
-
}>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useQuery, useQueryClient, useMutation, queryOptions } from "@tanstack/react-query";
|
|
2
|
-
import { usefulLinksService } from "../api/index.js";
|
|
3
|
-
const usefulLinksQueryKeys = {
|
|
4
|
-
all: () => ["usefulLinks"]
|
|
5
|
-
}, usefulLinksQueryOptions = {
|
|
6
|
-
getUsefulLinks() {
|
|
7
|
-
return queryOptions({
|
|
8
|
-
queryKey: usefulLinksQueryKeys.all(),
|
|
9
|
-
queryFn: async () => usefulLinksService.getUsefulLinks()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}, useUsefulLinks = () => useQuery(usefulLinksQueryOptions.getUsefulLinks()), useCreateUsefulLink = () => {
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
return useMutation({
|
|
15
|
-
mutationFn: (payload) => usefulLinksService.createUsefulLink(payload),
|
|
16
|
-
onSuccess: () => {
|
|
17
|
-
queryClient.invalidateQueries({
|
|
18
|
-
queryKey: usefulLinksQueryKeys.all()
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}, useUpdateUsefulLink = () => {
|
|
23
|
-
const queryClient = useQueryClient();
|
|
24
|
-
return useMutation({
|
|
25
|
-
mutationFn: ({
|
|
26
|
-
id,
|
|
27
|
-
payload
|
|
28
|
-
}) => usefulLinksService.updateUsefulLink(id, payload),
|
|
29
|
-
onSuccess: () => {
|
|
30
|
-
queryClient.invalidateQueries({
|
|
31
|
-
queryKey: usefulLinksQueryKeys.all()
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}, useDeleteUsefulLink = () => {
|
|
36
|
-
const queryClient = useQueryClient();
|
|
37
|
-
return useMutation({
|
|
38
|
-
mutationFn: (id) => usefulLinksService.deleteUsefulLink(id),
|
|
39
|
-
onMutate: async (id) => {
|
|
40
|
-
await queryClient.cancelQueries({
|
|
41
|
-
queryKey: usefulLinksQueryKeys.all()
|
|
42
|
-
});
|
|
43
|
-
const previousLinks = queryClient.getQueryData(usefulLinksQueryKeys.all());
|
|
44
|
-
return queryClient.setQueryData(usefulLinksQueryKeys.all(), (links) => links == null ? void 0 : links.filter((link) => link.id !== id)), {
|
|
45
|
-
previousLinks
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
onError: (_error, _id, context) => {
|
|
49
|
-
context != null && context.previousLinks && queryClient.setQueryData(usefulLinksQueryKeys.all(), context.previousLinks);
|
|
50
|
-
},
|
|
51
|
-
onSettled: () => {
|
|
52
|
-
queryClient.invalidateQueries({
|
|
53
|
-
queryKey: usefulLinksQueryKeys.all()
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
export {
|
|
59
|
-
useCreateUsefulLink,
|
|
60
|
-
useDeleteUsefulLink,
|
|
61
|
-
useUpdateUsefulLink,
|
|
62
|
-
useUsefulLinks,
|
|
63
|
-
usefulLinksQueryKeys,
|
|
64
|
-
usefulLinksQueryOptions
|
|
65
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SVGProps } from 'react';
|
|
2
|
-
interface SVGRProps {
|
|
3
|
-
title?: string;
|
|
4
|
-
titleId?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const SvgIconLogoEdificeFull: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default SvgIconLogoEdificeFull;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const SvgIconLogoEdificeFull = ({
|
|
3
|
-
title,
|
|
4
|
-
titleId,
|
|
5
|
-
...props
|
|
6
|
-
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 81 18", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
-
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
-
/* @__PURE__ */ jsxs("g", { clipPath: "url(#icon-logo-edifice-full_svg__a)", children: [
|
|
9
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M72.667 1.944c-4.424 0-8.01 3.602-8.01 8.045h16.02c0-4.443-3.586-8.045-8.01-8.045" }),
|
|
10
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M76.346 12.173a4.3 4.3 0 0 1-.659.84 4.25 4.25 0 0 1-3.02 1.249 4.26 4.26 0 0 1-3.02-1.249 4.3 4.3 0 0 1-1.27-3.02V9.99h-3.72v.038c.04 4.408 3.61 7.969 8.009 7.969 3.657 0 6.74-2.462 7.7-5.825h-4.022zM55.596 10.014a4.28 4.28 0 0 1 1.253-2.998 4.2 4.2 0 0 1 2.98-1.24h3.618V2.07h-3.67c-4.317.029-7.812 3.552-7.852 7.908v.077c.04 4.356 3.535 7.879 7.85 7.907h3.672v-3.707h-3.618a4.2 4.2 0 0 1-2.98-1.24 4.28 4.28 0 0 1-1.255-2.997v-.007z" }),
|
|
11
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M50.302 7.711h-3.56v10.252h3.56z" }),
|
|
12
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M50.302 2.07h-3.56v3.608h3.56z" }),
|
|
13
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M40.983 2.07h-3.56v15.893h3.56z" }),
|
|
14
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M44.529 2.07h-3.56v3.576h.222a3.345 3.345 0 0 0 3.337-3.353zM44.529 7.711h-3.56v3.576h.222a3.345 3.345 0 0 0 3.337-3.353z" }),
|
|
15
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M35.19 7.711h-3.56v10.252h3.56z" }),
|
|
16
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M35.19 2.07h-3.56v3.608h3.56zM29.636 10.017c0-4.39-3.542-7.947-7.911-7.947v15.893c4.369 0 7.91-3.558 7.91-7.946" }),
|
|
17
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M21.726 2.07h-3.56v15.893h3.56z" }),
|
|
18
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M11.677 0H4.952v1.987h6.725z" }),
|
|
19
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M8.316 1.949c-4.424 0-8.01 3.601-8.01 8.045h16.02c0-4.444-3.586-8.045-8.01-8.045" }),
|
|
20
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M11.995 12.176a4.3 4.3 0 0 1-.658.84 4.25 4.25 0 0 1-3.021 1.25 4.26 4.26 0 0 1-3.02-1.25 4.3 4.3 0 0 1-1.27-3.02v-.003H.305v.039C.346 14.439 3.916 18 8.315 18c3.657 0 6.74-2.461 7.7-5.825h-4.022z" })
|
|
21
|
-
] }),
|
|
22
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-logo-edifice-full_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h81v18H0z" }) }) })
|
|
23
|
-
] });
|
|
24
|
-
export {
|
|
25
|
-
SvgIconLogoEdificeFull as default
|
|
26
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SVGProps } from 'react';
|
|
2
|
-
interface SVGRProps {
|
|
3
|
-
title?: string;
|
|
4
|
-
titleId?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const SvgIconLogoEdificeSmall: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default SvgIconLogoEdificeSmall;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const SvgIconLogoEdificeSmall = ({
|
|
3
|
-
title,
|
|
4
|
-
titleId,
|
|
5
|
-
...props
|
|
6
|
-
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 18 18", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
-
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
-
/* @__PURE__ */ jsxs("g", { clipPath: "url(#icon-logo-edifice-small_svg__a)", children: [
|
|
9
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M12.36 0H5.637v1.987h6.725z" }),
|
|
10
|
-
/* @__PURE__ */ jsx("path", { fill: "#C8D3FE", d: "M9 1.949C4.576 1.949.99 5.55.99 9.994h16.02C17.01 5.55 13.424 1.95 9 1.95" }),
|
|
11
|
-
/* @__PURE__ */ jsx("path", { fill: "#fff", d: "M12.679 12.176a4.3 4.3 0 0 1-.659.84A4.25 4.25 0 0 1 9 14.266a4.26 4.26 0 0 1-3.02-1.25 4.3 4.3 0 0 1-1.27-3.02v-.003H.99v.039C1.03 14.439 4.6 18 8.999 18c3.656 0 6.74-2.461 7.7-5.825h-4.022z" })
|
|
12
|
-
] }),
|
|
13
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-logo-edifice-small_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h18v18H0z" }) }) })
|
|
14
|
-
] });
|
|
15
|
-
export {
|
|
16
|
-
SvgIconLogoEdificeSmall as default
|
|
17
|
-
};
|