@edifice.io/react 2.5.23-fix-query-params.20260623180310 → 2.5.24-develop.20260623184311
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/AppIcon/AppIcon.js +4 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +2 -1
- package/dist/components/BetaSwitch/BetaSwitch.d.ts +13 -0
- package/dist/components/BetaSwitch/BetaSwitch.js +27 -0
- package/dist/components/BetaSwitch/index.d.ts +1 -0
- package/dist/components/ButtonBeta/ButtonBeta.d.ts +47 -0
- package/dist/components/ButtonBeta/ButtonBeta.js +34 -0
- package/dist/components/ButtonBeta/index.d.ts +2 -0
- package/dist/components/Flex/Flex.js +5 -1
- package/dist/components/Logo/index.d.ts +1 -1
- package/dist/components/LogoBeta/LogoBeta.d.ts +7 -0
- package/dist/components/LogoBeta/LogoBeta.js +14 -0
- package/dist/components/LogoBeta/index.d.ts +2 -0
- package/dist/components/PageLayout/PageLayout.d.ts +45 -0
- package/dist/components/PageLayout/PageLayout.js +94 -0
- package/dist/components/PageLayout/PageLayoutContext.d.ts +14 -0
- package/dist/components/PageLayout/PageLayoutContext.js +8 -0
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.js +10 -0
- package/dist/components/PageLayout/components/PageLayoutContent.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutContent.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutHeader.d.ts +10 -0
- package/dist/components/PageLayout/components/PageLayoutHeader.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutOverlay.d.ts +15 -0
- package/dist/components/PageLayout/components/PageLayoutOverlay.js +51 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.js +18 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.d.ts +9 -0
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.js +18 -0
- package/dist/components/PageLayout/hook/useOverlay.d.ts +5 -0
- package/dist/components/PageLayout/hook/useOverlay.js +15 -0
- package/dist/components/PageLayout/index.d.ts +4 -0
- package/dist/components/PageLayout/store/overlayStore.d.ts +15 -0
- package/dist/components/PageLayout/store/overlayStore.js +12 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/homepage.js +34 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useEdificeIcons/useEdificeIcons.js +10 -9
- package/dist/icons-nav.js +38 -28
- package/dist/index.js +215 -202
- package/dist/modules/homepage/components/Favorites/Favorites.d.ts +6 -0
- package/dist/modules/homepage/components/Favorites/Favorites.js +28 -0
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.d.ts +4 -0
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.js +10 -0
- package/dist/modules/homepage/components/Favorites/index.d.ts +2 -0
- package/dist/modules/homepage/components/Header/Header.d.ts +9 -0
- package/dist/modules/homepage/components/Header/Header.js +80 -0
- package/dist/modules/homepage/components/Header/index.d.ts +2 -0
- package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +37 -0
- package/dist/modules/homepage/components/HomeCard/HomeCard.js +17 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.d.ts +7 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.js +10 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +18 -0
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +22 -0
- package/dist/modules/homepage/components/HomeCard/index.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/LastInfos.d.ts +49 -0
- package/dist/modules/homepage/components/LastInfos/LastInfos.js +58 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.js +37 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosList.d.ts +13 -0
- package/dist/modules/homepage/components/LastInfos/LastInfosList.js +31 -0
- package/dist/modules/homepage/components/LastInfos/index.d.ts +4 -0
- package/dist/modules/homepage/components/LastInfos/useLastInfos.d.ts +18 -0
- package/dist/modules/homepage/components/LastInfos/useLastInfos.js +25 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.d.ts +12 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +65 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.d.ts +12 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.js +10 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.d.ts +5 -0
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.js +14 -0
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.d.ts +16 -0
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.js +19 -0
- package/dist/modules/homepage/components/MessageFlashList/index.d.ts +4 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.js +5 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.d.ts +20 -0
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.js +21 -0
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.d.ts +13 -0
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.js +31 -0
- package/dist/modules/homepage/components/Notifications/Notification.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/Notification.js +16 -0
- package/dist/modules/homepage/components/Notifications/NotificationList.d.ts +18 -0
- package/dist/modules/homepage/components/Notifications/NotificationList.js +44 -0
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.d.ts +9 -0
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.js +20 -0
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.d.ts +5 -0
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +17 -0
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.d.ts +3 -0
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +19 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.d.ts +24 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.js +28 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.js +19 -0
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.js +20 -0
- package/dist/modules/homepage/components/Notifications/components/UserNotification.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/components/UserNotification.js +25 -0
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +27 -0
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +53 -0
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +26 -0
- package/dist/modules/homepage/components/Notifications/index.d.ts +6 -0
- package/dist/modules/homepage/components/Notifications/services/api/index.d.ts +4 -0
- package/dist/modules/homepage/components/Notifications/services/api/index.js +5 -0
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.d.ts +15 -0
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.js +22 -0
- package/dist/modules/homepage/components/Notifications/services/queries/notification.d.ts +20 -0
- package/dist/modules/homepage/components/Notifications/services/queries/notification.js +40 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.d.ts +15 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +29 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.d.ts +4 -0
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +13 -0
- package/dist/modules/homepage/components/SchoolSpace/index.d.ts +3 -0
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.d.ts +6 -0
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +39 -0
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +13 -0
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +28 -0
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +7 -0
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +19 -0
- package/dist/modules/homepage/components/UserSpace/index.d.ts +3 -0
- package/dist/modules/homepage/components/index.d.ts +8 -0
- package/dist/modules/homepage/hooks/useWidget.d.ts +6 -0
- package/dist/modules/homepage/hooks/useWidget.js +83 -0
- package/dist/modules/homepage/hooks/useWidgetPreferences.d.ts +6 -0
- package/dist/modules/homepage/hooks/useWidgetPreferences.js +34 -0
- package/dist/modules/homepage/index.d.ts +1 -0
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.js +18 -0
- package/dist/modules/icons/components/nav/IconHomeBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconHomeBeta.js +13 -0
- package/dist/modules/icons/components/nav/IconMessagesBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconMessagesBeta.js +18 -0
- package/dist/modules/icons/components/nav/IconMyAppsBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconMyAppsBeta.js +13 -0
- package/dist/modules/icons/components/nav/IconNotificationBeta.d.ts +7 -0
- package/dist/modules/icons/components/nav/IconNotificationBeta.js +14 -0
- package/dist/modules/icons/components/nav/index.d.ts +5 -0
- package/dist/modules/modals/OnboardingModal/index.d.ts +1 -1
- package/dist/providers/EdificeClientProvider/EdificeClientProvider.d.ts +0 -7
- package/dist/utilities/create-selectors/createSelectors.d.ts +10 -0
- package/dist/utilities/create-selectors/createSelectors.js +11 -0
- package/package.json +13 -8
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { Navbar } from "../../../../components/Layout/components/Navbar.js";
|
|
6
|
+
import { NavItem } from "../../../../components/Layout/components/NavItem.js";
|
|
7
|
+
import { NavLink } from "../../../../components/Layout/components/NavLink.js";
|
|
8
|
+
import useHeader from "../../../../components/Layout/hooks/useHeader.js";
|
|
9
|
+
import SvgIconCommunitiesBeta from "../../../icons/components/nav/IconCommunitiesBeta.js";
|
|
10
|
+
import SvgIconDisconnect from "../../../icons/components/nav/IconDisconnect.js";
|
|
11
|
+
import SvgIconHomeBeta from "../../../icons/components/nav/IconHomeBeta.js";
|
|
12
|
+
import SvgIconMessagesBeta from "../../../icons/components/nav/IconMessagesBeta.js";
|
|
13
|
+
import SvgIconMyAppsBeta from "../../../icons/components/nav/IconMyAppsBeta.js";
|
|
14
|
+
import SvgIconNotificationBeta from "../../../icons/components/nav/IconNotificationBeta.js";
|
|
15
|
+
import useConversation from "../../../../hooks/useConversation/useConversation.js";
|
|
16
|
+
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
17
|
+
import useHasWorkflow from "../../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
18
|
+
import { useEdificeTheme } from "../../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
19
|
+
import useHover from "../../../../hooks/useHover/useHover.js";
|
|
20
|
+
import LogoBeta from "../../../../components/LogoBeta/LogoBeta.js";
|
|
21
|
+
import Badge from "../../../../components/Badge/Badge.js";
|
|
22
|
+
import VisuallyHidden from "../../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
23
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
24
|
+
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
25
|
+
import { Popover, PopoverBody } from "../../../../components/Popover/Popover.js";
|
|
26
|
+
const Header = ({
|
|
27
|
+
src = "",
|
|
28
|
+
onNotificationsClick
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
t
|
|
32
|
+
} = useTranslation(), {
|
|
33
|
+
messages
|
|
34
|
+
} = useConversation(), {
|
|
35
|
+
user,
|
|
36
|
+
avatar
|
|
37
|
+
} = useUser(), hasCarbonioPreauthWorkflow = useHasWorkflow("org.entcore.auth.controllers.CarbonioPreauthController|preauth") || !1, classes = clsx("header-beta d-print-none no-2d no-1d"), {
|
|
38
|
+
userAvatar,
|
|
39
|
+
userName,
|
|
40
|
+
communityWorkflow,
|
|
41
|
+
conversationWorflow
|
|
42
|
+
} = useHeader({
|
|
43
|
+
user,
|
|
44
|
+
avatar
|
|
45
|
+
}), {
|
|
46
|
+
theme
|
|
47
|
+
} = useEdificeTheme(), hasMessages = messages > 0, [userRef, isUserHovered] = useHover(), popoverUserId = useId(), handleNotificationsClick = () => {
|
|
48
|
+
onNotificationsClick == null || onNotificationsClick();
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ jsx("header", { className: classes, children: /* @__PURE__ */ jsxs(Navbar, { className: "px-24", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(LogoBeta, { src: `${src}/img/illustrations/logo.png` }),
|
|
52
|
+
/* @__PURE__ */ jsxs("ul", { className: "navbar-nav", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/timeline/timeline", translate: t("navbar.home"), "data-testid": "header-home-button", children: /* @__PURE__ */ jsx(SvgIconHomeBeta, {}) }) }),
|
|
54
|
+
communityWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/communities", translate: t("navbar.community"), "data-testid": "header-community-button", children: /* @__PURE__ */ jsx(SvgIconCommunitiesBeta, { className: "icon community" }) }) }),
|
|
55
|
+
conversationWorflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs(NavLink, { className: "position-relative", link: "/conversation/conversation", translate: t("conversation"), "data-testid": "header-messagerie-button", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
|
|
57
|
+
hasMessages && /* @__PURE__ */ jsx(Badge, { variant: {
|
|
58
|
+
type: "notification",
|
|
59
|
+
level: "danger"
|
|
60
|
+
}, className: "position-absolute", children: messages })
|
|
61
|
+
] }) }),
|
|
62
|
+
hasCarbonioPreauthWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs("a", { className: "nav-link position-relative", href: "/auth/carbonio/preauth", target: "_blank", "data-testid": "header-messagerie-button", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
|
|
64
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("conversation") })
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/welcome", translate: t("navbar.applications"), "data-testid": "header-my-apps-button", children: /* @__PURE__ */ jsx(SvgIconMyAppsBeta, {}) }) }),
|
|
67
|
+
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(ButtonBeta, { leftIcon: /* @__PURE__ */ jsx(SvgIconNotificationBeta, {}), variant: "ghost", onClick: handleNotificationsClick }) }),
|
|
68
|
+
/* @__PURE__ */ jsxs(NavItem, { className: "position-relative", ref: userRef, id: popoverUserId, "aria-haspopup": "true", "aria-expanded": isUserHovered, "data-testid": "header-user-menu-button", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(NavLink, { link: "/userbook/mon-compte", translate: t("navbar.myaccount"), "data-testid": "header-user-profile-button", children: /* @__PURE__ */ jsx(Avatar, { alt: userName, size: "sm", src: userAvatar, variant: "circle", className: "bg-white", width: "32", height: "32" }) }),
|
|
70
|
+
/* @__PURE__ */ jsx(Popover, { className: "top-100 widget", id: popoverUserId, isVisible: isUserHovered, children: /* @__PURE__ */ jsx(PopoverBody, { children: /* @__PURE__ */ jsxs("a", { href: "/auth/logout?callback=" + ((theme == null ? void 0 : theme.logoutCallback) ?? ""), className: "nav-link d-flex align-items-center gap-8", "data-testid": "header-logout-button", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(SvgIconDisconnect, { className: "icon logout" }),
|
|
72
|
+
/* @__PURE__ */ jsx("span", { id: "logout-label", className: "nav-text", children: t("navbar.disconnect") })
|
|
73
|
+
] }) }) })
|
|
74
|
+
] })
|
|
75
|
+
] })
|
|
76
|
+
] }) });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
Header as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { HomeCardHeaderProps } from './HomeCardHeader';
|
|
3
|
+
export type HomeCardVariant = 'user' | 'primary' | 'secondary';
|
|
4
|
+
export interface HomeCardProps extends ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant of the card.
|
|
7
|
+
* - `user` (default): padding 16, gap 16
|
|
8
|
+
* - `primary`: padding 8/16/16/16, gap 8
|
|
9
|
+
* - `secondary`: padding 8/16/16/16, gap 4, grey background, smaller title, no shadowbox
|
|
10
|
+
*/
|
|
11
|
+
variant?: HomeCardVariant;
|
|
12
|
+
/**
|
|
13
|
+
* Children of the card. When omitted, a default `HomeCardHeader` will be
|
|
14
|
+
* rendered using the `headerProps` prop (handy for the common case where the
|
|
15
|
+
* card only needs a header + content slot).
|
|
16
|
+
*/
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Convenience prop: when provided and `children` is empty, a default
|
|
20
|
+
* `HomeCard.Header` is rendered with these props.
|
|
21
|
+
*/
|
|
22
|
+
headerProps?: HomeCardHeaderProps;
|
|
23
|
+
}
|
|
24
|
+
declare const HomeCard: {
|
|
25
|
+
({ variant, children, headerProps, className, ...rest }: HomeCardProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
} & {
|
|
28
|
+
Header: {
|
|
29
|
+
({ title, actionLabel, onActionClick, actionLeftIcon, actionRightIcon, className, ...rest }: HomeCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
Content: {
|
|
33
|
+
({ children, className, ...rest }: import('./HomeCardContent').HomeCardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default HomeCard;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import HomeCardContent from "./HomeCardContent.js";
|
|
4
|
+
import HomeCardHeader from "./HomeCardHeader.js";
|
|
5
|
+
const Root = ({
|
|
6
|
+
variant = "user",
|
|
7
|
+
children,
|
|
8
|
+
headerProps,
|
|
9
|
+
className,
|
|
10
|
+
...rest
|
|
11
|
+
}) => /* @__PURE__ */ jsx("div", { "data-testid": "home-card", "data-variant": variant, className: clsx("home-card", `home-card--${variant}`, className), ...rest, children: headerProps && !children ? /* @__PURE__ */ jsx(HomeCardHeader, { ...headerProps }) : children }), HomeCard = Object.assign(Root, {
|
|
12
|
+
Header: HomeCardHeader,
|
|
13
|
+
Content: HomeCardContent
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
HomeCard as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type HomeCardContentProps = ComponentPropsWithoutRef<'div'>;
|
|
3
|
+
declare const HomeCardContent: {
|
|
4
|
+
({ children, className, ...rest }: HomeCardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
export default HomeCardContent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
const HomeCardContent = ({
|
|
4
|
+
children,
|
|
5
|
+
className,
|
|
6
|
+
...rest
|
|
7
|
+
}) => /* @__PURE__ */ jsx("div", { className: clsx("home-card-content", className), ...rest, children });
|
|
8
|
+
export {
|
|
9
|
+
HomeCardContent as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
export interface HomeCardHeaderProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
3
|
+
/** Title displayed on the left side of the header. */
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
/** Label of the action button displayed on the right side of the header. */
|
|
6
|
+
actionLabel?: ReactNode;
|
|
7
|
+
/** Callback invoked when the action button is clicked. */
|
|
8
|
+
onActionClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
/** Optional left icon of the action button. */
|
|
10
|
+
actionLeftIcon?: ReactNode;
|
|
11
|
+
/** Optional right icon of the action button. */
|
|
12
|
+
actionRightIcon?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const HomeCardHeader: {
|
|
15
|
+
({ title, actionLabel, onActionClick, actionLeftIcon, actionRightIcon, className, ...rest }: HomeCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default HomeCardHeader;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
4
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
5
|
+
const HomeCardHeader = ({
|
|
6
|
+
title,
|
|
7
|
+
actionLabel,
|
|
8
|
+
onActionClick,
|
|
9
|
+
actionLeftIcon,
|
|
10
|
+
actionRightIcon,
|
|
11
|
+
className,
|
|
12
|
+
...rest
|
|
13
|
+
}) => {
|
|
14
|
+
const hasAction = !!actionLabel && !!onActionClick;
|
|
15
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", gap: "8", className: clsx("home-card-header", className), ...rest, children: [
|
|
16
|
+
/* @__PURE__ */ jsx("h3", { className: "home-card-header-title", children: title }),
|
|
17
|
+
hasAction && /* @__PURE__ */ jsx(ButtonBeta, { color: "default", variant: "ghost", onClick: onActionClick, leftIcon: actionLeftIcon, rightIcon: actionRightIcon, "data-testid": "home-card-header-action", children: actionLabel })
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
HomeCardHeader as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface LastInfosProps {
|
|
2
|
+
/**
|
|
3
|
+
* ID of the info.
|
|
4
|
+
*/
|
|
5
|
+
id: number | string;
|
|
6
|
+
/**
|
|
7
|
+
* URL of the icon to display in the upper left corner.
|
|
8
|
+
* i.e. "/workspace/document/36a04526-15a2-4e8f-adb6-cca75630e50d"
|
|
9
|
+
*/
|
|
10
|
+
icon: string;
|
|
11
|
+
/**
|
|
12
|
+
* ID of the thread to be displayed next to the icon.
|
|
13
|
+
*/
|
|
14
|
+
threadId: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of the thread to be displayed next to the icon.
|
|
17
|
+
* i.e. "Informations importantes"
|
|
18
|
+
*/
|
|
19
|
+
threadName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Title of the info.
|
|
22
|
+
*/
|
|
23
|
+
title: string;
|
|
24
|
+
/**
|
|
25
|
+
* Content of the info.
|
|
26
|
+
*/
|
|
27
|
+
content: string;
|
|
28
|
+
/**
|
|
29
|
+
* Publication date in ISO format.
|
|
30
|
+
*/
|
|
31
|
+
publicationDate: string;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the info is highlighted.
|
|
34
|
+
*/
|
|
35
|
+
isHeadline: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Name of the user who posted this info.
|
|
38
|
+
*/
|
|
39
|
+
username: string;
|
|
40
|
+
/**
|
|
41
|
+
* Handle the click event.
|
|
42
|
+
*/
|
|
43
|
+
onClick?: (threadId: number | string, id: number | string) => void;
|
|
44
|
+
}
|
|
45
|
+
declare const LastInfos: {
|
|
46
|
+
({ id, icon, threadId, threadName, content, isHeadline, title, onClick, }: LastInfosProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
export default LastInfos;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import SvgIconActualites from "../../../icons/components/apps/IconActualites.js";
|
|
5
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
6
|
+
const LastInfos = ({
|
|
7
|
+
id,
|
|
8
|
+
icon,
|
|
9
|
+
threadId,
|
|
10
|
+
threadName,
|
|
11
|
+
content,
|
|
12
|
+
isHeadline,
|
|
13
|
+
title,
|
|
14
|
+
onClick
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
excerpt,
|
|
18
|
+
images
|
|
19
|
+
} = useMemo(() => {
|
|
20
|
+
if (!content)
|
|
21
|
+
return {
|
|
22
|
+
excerpt: "",
|
|
23
|
+
images: []
|
|
24
|
+
};
|
|
25
|
+
const doc = new DOMParser().parseFromString(content, "text/html"), imageSources = Array.from(doc.querySelectorAll("img")).map((image) => image.getAttribute("src") ?? "").filter((src) => src.trim().length > 0);
|
|
26
|
+
return Array.from(doc.querySelectorAll("img, video, iframe, audio, embed")).forEach((mediaElement) => {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = mediaElement.parentNode) == null || _a.removeChild(mediaElement);
|
|
29
|
+
}), {
|
|
30
|
+
excerpt: (doc.body.textContent ?? "").trim(),
|
|
31
|
+
images: imageSources
|
|
32
|
+
};
|
|
33
|
+
}, [content]), previewImages = images.slice(0, 3), hasMoreImages = images.length > previewImages.length, remainingImagesCount = Math.max(images.length - previewImages.length, 0), actionLabel = `${threadName} - ${title}`;
|
|
34
|
+
return /* @__PURE__ */ jsxs("article", { className: clsx("last-infos-card", {
|
|
35
|
+
"last-infos-card-headline": isHeadline,
|
|
36
|
+
"last-infos-card-clickable": !!onClick
|
|
37
|
+
}), children: [
|
|
38
|
+
onClick && /* @__PURE__ */ jsx("button", { type: "button", className: "last-infos-card-action", onClick: () => onClick(threadId, id), "aria-label": actionLabel }),
|
|
39
|
+
/* @__PURE__ */ jsx("header", { className: "last-infos-card-header", children: /* @__PURE__ */ jsxs(Flex, { gap: "8", align: "center", justify: "start", className: "last-infos-card-thread", children: [
|
|
40
|
+
icon ? /* @__PURE__ */ jsx("img", { src: icon, alt: threadName, width: 24, height: 24, loading: "lazy", className: "last-infos-card-thread-icon" }) : /* @__PURE__ */ jsx(SvgIconActualites, { width: 24, height: 24, className: "last-infos-card-thread-icon" }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "last-infos-card-thread-name", children: threadName })
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "4", direction: "column", className: "last-infos-card-content", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "last-infos-card-title", children: title }),
|
|
45
|
+
/* @__PURE__ */ jsx("p", { className: "last-infos-card-excerpt", children: excerpt }),
|
|
46
|
+
previewImages.length > 0 && /* @__PURE__ */ jsx("div", { className: "last-infos-card-medias", children: previewImages.map((image, index) => /* @__PURE__ */ jsxs("div", { className: "last-infos-card-media", children: [
|
|
47
|
+
/* @__PURE__ */ jsx("img", { src: image, alt: "", className: "last-infos-card-media-image", loading: "lazy" }),
|
|
48
|
+
hasMoreImages && index === 2 && /* @__PURE__ */ jsxs("div", { className: "last-infos-card-media-overlay", children: [
|
|
49
|
+
"+",
|
|
50
|
+
remainingImagesCount
|
|
51
|
+
] })
|
|
52
|
+
] }, `${image}-${index}`)) })
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
LastInfos as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LastInfosList } from "./LastInfosList.js";
|
|
3
|
+
import { useLastInfos } from "./useLastInfos.js";
|
|
4
|
+
import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
|
|
5
|
+
function LastInfosContainer() {
|
|
6
|
+
const {
|
|
7
|
+
infos,
|
|
8
|
+
isLoading,
|
|
9
|
+
error
|
|
10
|
+
} = useLastInfos();
|
|
11
|
+
return isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" }),
|
|
13
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" }),
|
|
14
|
+
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" })
|
|
15
|
+
] }) : error ? error.message : /* @__PURE__ */ jsx(LastInfosList, { infos: (infos == null ? void 0 : infos.map(({
|
|
16
|
+
id,
|
|
17
|
+
content,
|
|
18
|
+
title,
|
|
19
|
+
username,
|
|
20
|
+
thread,
|
|
21
|
+
modifiedDate,
|
|
22
|
+
headline: isHeadline
|
|
23
|
+
}) => ({
|
|
24
|
+
id,
|
|
25
|
+
content,
|
|
26
|
+
title,
|
|
27
|
+
username,
|
|
28
|
+
icon: thread.icon,
|
|
29
|
+
threadId: thread.id,
|
|
30
|
+
threadName: thread.title,
|
|
31
|
+
publicationDate: modifiedDate,
|
|
32
|
+
isHeadline
|
|
33
|
+
}))) ?? [] });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
LastInfosContainer
|
|
37
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LastInfosProps } from './LastInfos';
|
|
2
|
+
export interface LastInfosListProps {
|
|
3
|
+
/** List of Info to display. */
|
|
4
|
+
infos: Array<LastInfosProps>;
|
|
5
|
+
/** Handle a click on an info. If undefined, Actualites will be opened to read the info details. */
|
|
6
|
+
onInfoClick?: (threadId: number | string, id: number | string) => void;
|
|
7
|
+
/** Handle a click on the "See more" button. If undefined, Actualites will be opened. */
|
|
8
|
+
onSeeMoreClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function LastInfosList({ infos, onInfoClick: handleInfoClick, onSeeMoreClick: handleSeeMoreClick, }: LastInfosListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare namespace LastInfosList {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import SvgIconArrowRight from "../../../icons/components/IconArrowRight.js";
|
|
4
|
+
import LastInfos from "./LastInfos.js";
|
|
5
|
+
import illuLastInfosEmptyScreen from "@edifice.io/bootstrap/dist/images/homepage/illu-last-infos-beta.svg";
|
|
6
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
7
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
8
|
+
import EmptyScreen from "../../../../components/EmptyScreen/EmptyScreen.js";
|
|
9
|
+
function LastInfosList({
|
|
10
|
+
infos,
|
|
11
|
+
onInfoClick: handleInfoClick = (threadId, id) => {
|
|
12
|
+
window.open(`/actualites/threads/${threadId}?info=${id}`, "_self");
|
|
13
|
+
},
|
|
14
|
+
onSeeMoreClick: handleSeeMoreClick = () => {
|
|
15
|
+
window.open("/actualites", "_self");
|
|
16
|
+
}
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = useTranslation();
|
|
21
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "8", direction: "column", className: "last-infos-list", children: [
|
|
22
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", className: "last-infos-list-header", children: [
|
|
23
|
+
/* @__PURE__ */ jsx("h2", { className: "last-infos-list-title", children: t("homepage.last-infos-list.title") }),
|
|
24
|
+
/* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", variant: "ghost", className: "last-infos-list-seemore", rightIcon: /* @__PURE__ */ jsx(SvgIconArrowRight, {}), onClick: handleSeeMoreClick, children: t("homepage.last-infos-list.see.more") })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ jsx(Flex, { gap: "16", direction: "column", className: "last-infos-list-body", children: infos.length === 0 ? /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuLastInfosEmptyScreen, size: 64, text: t("homepage.last-infos-list.empty") }) : infos.map((infosProps) => /* @__PURE__ */ jsx(LastInfos, { onClick: handleInfoClick, ...infosProps }, infosProps.id)) })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
LastInfosList
|
|
31
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LastInfosModel {
|
|
2
|
+
modifiedDate: string;
|
|
3
|
+
headline: boolean;
|
|
4
|
+
thread: {
|
|
5
|
+
id: number;
|
|
6
|
+
icon: string;
|
|
7
|
+
title: string;
|
|
8
|
+
};
|
|
9
|
+
title: string;
|
|
10
|
+
content: string;
|
|
11
|
+
username: string;
|
|
12
|
+
id: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function useLastInfos(): {
|
|
15
|
+
infos: LastInfosModel[] | undefined;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
3
|
+
function useLastInfos() {
|
|
4
|
+
const {
|
|
5
|
+
data,
|
|
6
|
+
isLoading,
|
|
7
|
+
error
|
|
8
|
+
} = useQuery(queryOptions({
|
|
9
|
+
queryKey: ["infos", "preview", "last", 6],
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const http = odeServices.http(), infos = await http.get("/actualites/api/v1/infos/preview/last/6");
|
|
12
|
+
if (http.isResponseError())
|
|
13
|
+
throw new Error(http.latestResponse.statusText);
|
|
14
|
+
return infos;
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
return {
|
|
18
|
+
infos: data,
|
|
19
|
+
isLoading,
|
|
20
|
+
error
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
useLastInfos
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFlashMessageModel } from '@edifice.io/client';
|
|
2
|
+
export type MessageFlashProps = {
|
|
3
|
+
/** Message to display */
|
|
4
|
+
message: IFlashMessageModel;
|
|
5
|
+
/** Callback when the message is closed */
|
|
6
|
+
onCloseMessage?: (message: IFlashMessageModel) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const MessageFlash: {
|
|
9
|
+
({ message, onCloseMessage }: MessageFlashProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default MessageFlash;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconAlertTriangle from "../../../icons/components/IconAlertTriangle.js";
|
|
6
|
+
import SvgIconClose from "../../../icons/components/IconClose.js";
|
|
7
|
+
import SvgIconInfoCircle from "../../../icons/components/IconInfoCircle.js";
|
|
8
|
+
import { useEdificeClient } from "../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
9
|
+
import useBreakpoint from "../../../../hooks/useBreakpoint/useBreakpoint.js";
|
|
10
|
+
import IconButton from "../../../../components/Button/IconButton.js";
|
|
11
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
12
|
+
import Card from "../../../../components/Card/Card.js";
|
|
13
|
+
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
14
|
+
const MessageFlash = ({
|
|
15
|
+
message,
|
|
16
|
+
onCloseMessage
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
currentLanguage
|
|
20
|
+
} = useEdificeClient(), [isCollapsed, setIsCollapsed] = useState(!0), [hasOverflow, setHasOverflow] = useState(!1), contentRef = useRef(null), checkContentTimeoutRef = useRef(void 0), {
|
|
21
|
+
t
|
|
22
|
+
} = useTranslation(), {
|
|
23
|
+
md
|
|
24
|
+
} = useBreakpoint();
|
|
25
|
+
let content = "";
|
|
26
|
+
message.contents && (currentLanguage && message.contents[currentLanguage] ? content = message.contents[currentLanguage] : message.contents.fr ? content = message.contents.fr : content = Object.keys(message.contents).map((key) => message.contents[key]).filter((cont) => cont !== null)[0]), useEffect(() => {
|
|
27
|
+
const checkOverflow = () => {
|
|
28
|
+
if (contentRef.current) {
|
|
29
|
+
const element = contentRef.current, originalClass = element.className;
|
|
30
|
+
element.className = element.className.replace(/text-truncate(-\d+)?/g, "").trim();
|
|
31
|
+
const computedStyle = window.getComputedStyle(element), lineHeight = parseFloat(computedStyle.lineHeight) || parseFloat(computedStyle.fontSize) * 1.2, contentHeight = element.scrollHeight, twoLinesHeight = lineHeight * 2;
|
|
32
|
+
setHasOverflow(contentHeight > twoLinesHeight + 2), element.className = originalClass;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
content && (checkContentTimeoutRef.current && clearTimeout(checkContentTimeoutRef.current), checkContentTimeoutRef.current = setTimeout(checkOverflow, 0));
|
|
36
|
+
}, [content]), useEffect(() => () => {
|
|
37
|
+
checkContentTimeoutRef.current && clearTimeout(checkContentTimeoutRef.current);
|
|
38
|
+
});
|
|
39
|
+
const classes = clsx("message-flash", message.color ? `message-flash-${message.color}` : null), classesContent = clsx("message-flash-content", isCollapsed ? "text-truncate text-truncate-2" : null), handleCollapse = () => {
|
|
40
|
+
setIsCollapsed((collapsed) => !collapsed);
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
43
|
+
(hasOverflow && !isCollapsed || !hasOverflow) && /* @__PURE__ */ jsx(IconButton, { variant: "ghost", color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: () => {
|
|
44
|
+
onCloseMessage == null || onCloseMessage(message);
|
|
45
|
+
}, className: "message-flash-close-button", "data-testid": "message-flash-close-button", "aria-label": t("close.message", {
|
|
46
|
+
title: message.title
|
|
47
|
+
}), title: t("close.message", {
|
|
48
|
+
title: message.title
|
|
49
|
+
}) }),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: "message-flash-icon", role: "img", "aria-label": message.color === "red" ? t("warning") : t("information"), children: message.color && message.color === "red" ? /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}) : /* @__PURE__ */ jsx(SvgIconInfoCircle, {}) }),
|
|
51
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", className: "w-100 message-flash-body", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Card.Title, { children: message.title }),
|
|
53
|
+
/* @__PURE__ */ jsx("div", { ref: contentRef, className: classesContent, dangerouslySetInnerHTML: {
|
|
54
|
+
__html: content
|
|
55
|
+
} }),
|
|
56
|
+
/* @__PURE__ */ jsxs(Flex, { direction: md ? "row" : "column", justify: "between", className: "message-flash-footer", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("div", { className: "fst-italic", children: message.signature || "" }),
|
|
58
|
+
hasOverflow && /* @__PURE__ */ jsx(ButtonBeta, { "data-testid": isCollapsed ? "message-flash-view-more-button" : "message-flash-view-less-button", color: "default", variant: "ghost", onClick: handleCollapse, "aria-controls": `message-flash-${message.id}-content`, "aria-expanded": !isCollapsed, className: "message-flash-collapse-button", children: t(isCollapsed ? "read.more" : "read.less") })
|
|
59
|
+
] })
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
MessageFlash as default
|
|
65
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFlashMessageModel } from '@edifice.io/client';
|
|
2
|
+
export type MessageFlashListProps = {
|
|
3
|
+
/** List of messages to display */
|
|
4
|
+
messages: IFlashMessageModel[];
|
|
5
|
+
/** Callback when the message is closed */
|
|
6
|
+
onCloseMessage?: (message: IFlashMessageModel) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const MessageFlashList: {
|
|
9
|
+
({ messages, onCloseMessage, }: MessageFlashListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default MessageFlashList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import MessageFlash from "./MessageFlash.js";
|
|
3
|
+
import Flex from "../../../../components/Flex/Flex.js";
|
|
4
|
+
const MessageFlashList = ({
|
|
5
|
+
messages,
|
|
6
|
+
onCloseMessage
|
|
7
|
+
}) => /* @__PURE__ */ jsx("section", { role: "region", className: "message-flash-list", children: /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "16", role: "list", children: messages.map((message) => /* @__PURE__ */ jsx("div", { role: "listitem", children: /* @__PURE__ */ jsx(MessageFlash, { message, onCloseMessage: (msg) => onCloseMessage == null ? void 0 : onCloseMessage(msg) }) }, message.id)) }) });
|
|
8
|
+
export {
|
|
9
|
+
MessageFlashList as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMessageFlashListContainer } from "./hooks/useMessageFlashList.js";
|
|
3
|
+
import MessageFlashList from "./MessageFlashList.js";
|
|
4
|
+
const MessageFlashListContainer = () => {
|
|
5
|
+
const {
|
|
6
|
+
messages,
|
|
7
|
+
error,
|
|
8
|
+
handleMarkAsRead
|
|
9
|
+
} = useMessageFlashListContainer();
|
|
10
|
+
return !messages || messages.length === 0 || error ? null : /* @__PURE__ */ jsx(MessageFlashList, { messages, onCloseMessage: handleMarkAsRead });
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
MessageFlashListContainer
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IFlashMessageModel } from '@edifice.io/client';
|
|
2
|
+
export interface UseMessageFlashListContainerReturn {
|
|
3
|
+
/** Array of flash messages */
|
|
4
|
+
messages: IFlashMessageModel[] | undefined;
|
|
5
|
+
/** Loading state for fetching messages */
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
/** Error state from fetching messages */
|
|
8
|
+
error: Error | null;
|
|
9
|
+
/** Handler to mark a message as read */
|
|
10
|
+
handleMarkAsRead: (message: IFlashMessageModel) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook that provides flash messages data and handlers with exposed loading states
|
|
14
|
+
* @returns Object containing messages, loading state, error state, and mark as read handler
|
|
15
|
+
*/
|
|
16
|
+
export declare const useMessageFlashListContainer: () => UseMessageFlashListContainerReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMessagesFlash, useMarkAsRead } from "../services/queries/messagesFlash.js";
|
|
2
|
+
const useMessageFlashListContainer = () => {
|
|
3
|
+
const {
|
|
4
|
+
data: messages,
|
|
5
|
+
isLoading,
|
|
6
|
+
error
|
|
7
|
+
} = useMessagesFlash(), markAsReadMessage = useMarkAsRead();
|
|
8
|
+
return {
|
|
9
|
+
messages,
|
|
10
|
+
isLoading,
|
|
11
|
+
error,
|
|
12
|
+
handleMarkAsRead: (message) => {
|
|
13
|
+
markAsReadMessage.mutate(message);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
useMessageFlashListContainer
|
|
19
|
+
};
|