@edifice.io/react 2.6.2-develop-pedago.20260810101026 → 2.6.2-develop-b2school.20260814142937

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.
Files changed (33) hide show
  1. package/dist/components/Alert/Alert.js +1 -1
  2. package/dist/components/Badge/Badge.d.ts +1 -6
  3. package/dist/components/Badge/Badge.js +1 -1
  4. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  5. package/dist/components/DatePicker/DatePicker.js +2 -0
  6. package/dist/components/Layout/components/Header.js +6 -0
  7. package/dist/components/Layout/hooks/useHeader.js +3 -2
  8. package/dist/icons.js +340 -338
  9. package/dist/modules/homepage/components/Communities/Communities.d.ts +10 -0
  10. package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +9 -0
  11. package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.d.ts +5 -0
  12. package/dist/modules/homepage/components/Communities/CommunityItem.d.ts +11 -0
  13. package/dist/modules/homepage/components/Communities/index.d.ts +8 -0
  14. package/dist/modules/homepage/components/Communities/useCommunities.d.ts +13 -0
  15. package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +5 -1
  16. package/dist/modules/homepage/components/HomeCard/HomeCard.js +10 -2
  17. package/dist/modules/homepage/components/LastInfos/LastInfosList.js +2 -2
  18. package/dist/modules/homepage/components/Notifications/NotificationList.js +2 -2
  19. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.d.ts +2 -1
  20. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.js +3 -2
  21. package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.js +1 -1
  22. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +21 -7
  23. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +26 -13
  24. package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +20 -11
  25. package/dist/modules/homepage/components/UserSpace/UserSpace.js +5 -2
  26. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.d.ts +14 -0
  27. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.js +23 -0
  28. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.d.ts +8 -0
  29. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +65 -0
  30. package/dist/modules/icons/components/IconClass.d.ts +7 -0
  31. package/dist/modules/icons/components/IconClass.js +13 -0
  32. package/dist/modules/icons/components/index.d.ts +1 -0
  33. package/package.json +6 -6
@@ -0,0 +1,10 @@
1
+ import { CommunityItemProps } from './CommunityItem';
2
+ export interface CommunitiesProps {
3
+ communitiesList?: CommunityItemProps[];
4
+ handleActionClick: () => void;
5
+ }
6
+ declare const Communities: {
7
+ ({ communitiesList, handleActionClick, }: CommunitiesProps): import("react/jsx-runtime").JSX.Element;
8
+ displayName: string;
9
+ };
10
+ export default Communities;
@@ -0,0 +1,9 @@
1
+ import { CommunitiesModel } from './useCommunities';
2
+ export type CommunitiesContainerProps = {
3
+ onCommunityClick?: (community: CommunitiesModel) => void;
4
+ onHeaderActionClick: () => void;
5
+ };
6
+ export declare function CommunitiesContainer({ onCommunityClick, onHeaderActionClick, }: CommunitiesContainerProps): import("react/jsx-runtime").JSX.Element | "An error occurred while loading communities.";
7
+ export declare namespace CommunitiesContainer {
8
+ var displayName: string;
9
+ }
@@ -0,0 +1,5 @@
1
+ declare const CommunitiesSkeleton: {
2
+ (): import("react/jsx-runtime").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default CommunitiesSkeleton;
@@ -0,0 +1,11 @@
1
+ export interface CommunityItemProps {
2
+ title: string;
3
+ communityImage: string;
4
+ onActionClick: () => void;
5
+ nbNotifications?: number;
6
+ }
7
+ declare const CommunityItem: {
8
+ ({ title, communityImage, nbNotifications, onActionClick, }: CommunityItemProps): import("react/jsx-runtime").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default CommunityItem;
@@ -0,0 +1,8 @@
1
+ export * from './Communities';
2
+ export { default as Communities } from './Communities';
3
+ export * from './CommunitiesContainer';
4
+ export * from './CommunitiesSkeleton';
5
+ export { default as CommunitiesSkeleton } from './CommunitiesSkeleton';
6
+ export * from './CommunityItem';
7
+ export { default as CommunitiesItem } from './CommunityItem';
8
+ export * from './useCommunities';
@@ -0,0 +1,13 @@
1
+ export interface CommunitiesModel {
2
+ id: number | string;
3
+ title: string;
4
+ communityImage?: string;
5
+ icon?: string;
6
+ nbNotifications?: number;
7
+ notifications?: number;
8
+ }
9
+ export declare function useCommunities(): {
10
+ communities: CommunitiesModel[];
11
+ isLoading: boolean;
12
+ error: Error | null;
13
+ };
@@ -20,9 +20,13 @@ export interface HomeCardProps extends ComponentPropsWithoutRef<'div'> {
20
20
  * `HomeCard.Header` is rendered with these props.
21
21
  */
22
22
  headerProps?: HomeCardHeaderProps;
23
+ /**
24
+ * Optional footer
25
+ */
26
+ footer?: ReactNode;
23
27
  }
24
28
  declare const HomeCard: {
25
- ({ variant, children, headerProps, className, ...rest }: HomeCardProps): import("react/jsx-runtime").JSX.Element;
29
+ ({ variant, children, headerProps, footer, className, ...rest }: HomeCardProps): import("react/jsx-runtime").JSX.Element;
26
30
  displayName: string;
27
31
  } & {
28
32
  Header: {
@@ -1,14 +1,22 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import HomeCardContent from "./HomeCardContent.js";
4
4
  import HomeCardHeader from "./HomeCardHeader.js";
5
+ import Flex from "../../../../components/Flex/Flex.js";
5
6
  const Root = ({
6
7
  variant = "user",
7
8
  children,
8
9
  headerProps,
10
+ footer,
9
11
  className,
10
12
  ...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, {
13
+ }) => {
14
+ const classNames = clsx("home-card", `home-card--${variant}`, className), content = /* @__PURE__ */ jsx("div", { "data-testid": "home-card", "data-variant": variant, className: classNames, ...rest, children: headerProps && !children ? /* @__PURE__ */ jsx(HomeCardHeader, { ...headerProps }) : children });
15
+ return footer ? /* @__PURE__ */ jsxs("div", { className: "home-card--with-footer", children: [
16
+ content,
17
+ /* @__PURE__ */ jsx(Flex, { direction: "row", gap: "8", className: "px-16 py-4 home-card-footer", children: footer })
18
+ ] }) : content;
19
+ }, HomeCard = Object.assign(Root, {
12
20
  Header: HomeCardHeader,
13
21
  Content: HomeCardContent
14
22
  });
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import SvgIconArrowRight from "../../../icons/components/IconArrowRight.js";
4
4
  import LastInfos from "./LastInfos.js";
5
- import illuLastInfosEmptyScreen from "@edifice.io/bootstrap/dist/images/homepage/illu-last-infos-beta.svg";
5
+ import illuLastInfosEmptyScreen from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-last-infos.png";
6
6
  import Flex from "../../../../components/Flex/Flex.js";
7
7
  import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
8
8
  import EmptyScreen from "../../../../components/EmptyScreen/EmptyScreen.js";
@@ -23,7 +23,7 @@ function LastInfosList({
23
23
  /* @__PURE__ */ jsx("h2", { className: "last-infos-list-title", children: t("homepage.last-infos-list.title") }),
24
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
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)) })
26
+ /* @__PURE__ */ jsx("div", { className: "last-infos-list-body", children: infos.length === 0 ? /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuLastInfosEmptyScreen, size: 135, text: t("homepage.last-infos-list.empty") }) : infos.map((infosProps) => /* @__PURE__ */ jsx(LastInfos, { onClick: handleInfoClick, ...infosProps }, infosProps.id)) })
27
27
  ] });
28
28
  }
29
29
  export {
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import illuEmptyNotification from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-notifications.png";
2
+ import illuEmptyNotification from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-notifications.png";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import SvgIconClose from "../../../icons/components/IconClose.js";
5
5
  import NotificationItem from "./NotificationItem.js";
@@ -29,7 +29,7 @@ const NotificationList = ({
29
29
  /* @__PURE__ */ jsx("h4", { className: "text-truncate", children: t("homepage.notifications-list.title") }),
30
30
  onCloseNotifications && /* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", variant: "ghost", rightIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: handleCloseClick, "aria-label": t("homepage.notifications-list.close"), title: t("homepage.notifications-list.close"), "data-testid": "notification-list-close-button" })
31
31
  ] }),
32
- (notifications == null ? void 0 : notifications.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "mx-24", children: /* @__PURE__ */ jsx(EmptyScreen, { size: 120, imageSrc: illuEmptyNotification, imageAlt: t("homepage.notifications-list.empty.description"), text: t("homepage.notifications-list.empty.description") }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
32
+ (notifications == null ? void 0 : notifications.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "mx-24", children: /* @__PURE__ */ jsx(EmptyScreen, { size: 135, imageSrc: illuEmptyNotification, imageAlt: t("homepage.notifications-list.empty.description"), text: t("homepage.notifications-list.empty.description") }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
33
33
  /* @__PURE__ */ jsx("ul", { children: notifications == null ? void 0 : notifications.map((notification, index) => /* @__PURE__ */ jsxs("li", { children: [
34
34
  /* @__PURE__ */ jsx(NotificationItem, { notification }),
35
35
  /* @__PURE__ */ jsx(Divider, { className: "border-grey-300 my-0" })
@@ -1,5 +1,6 @@
1
1
  export type NotificationItemResourceProps = {
2
2
  appCode: string;
3
+ appI18nKey: string;
3
4
  };
4
5
  /**
5
6
  * Displays the originating application of a notification as a small icon + label.
@@ -9,7 +10,7 @@ export type NotificationItemResourceProps = {
9
10
  *
10
11
  */
11
12
  declare const NotificationItemResource: {
12
- ({ appCode, }: NotificationItemResourceProps): import("react/jsx-runtime").JSX.Element;
13
+ ({ appCode, appI18nKey, }: NotificationItemResourceProps): import("react/jsx-runtime").JSX.Element;
13
14
  displayName: string;
14
15
  };
15
16
  export default NotificationItemResource;
@@ -2,11 +2,12 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import AppIcon from "../../../../../components/AppIcon/AppIcon.js";
4
4
  const NotificationItemResource = ({
5
- appCode
5
+ appCode,
6
+ appI18nKey
6
7
  }) => {
7
8
  const {
8
9
  t
9
- } = useTranslation(), appLabel = t(`${appCode}`, {
10
+ } = useTranslation(), appLabel = t(`${appI18nKey}`, {
10
11
  defaultValue: appCode
11
12
  }), appCssClass = `app-${appCode}`;
12
13
  return /* @__PURE__ */ jsxs("div", { className: `notification-item-resource ${appCssClass} bg-app-light`, children: [
@@ -18,7 +18,7 @@ const UserNotificationItem = ({
18
18
  } = notification, {
19
19
  t
20
20
  } = useTranslation(), userName = t(params.username);
21
- return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, picture: /* @__PURE__ */ jsx("a", { href: getUserbookURL(params.userId, "user"), title: userName, "data-testid": "notification-item-avatar", children: /* @__PURE__ */ jsx(Avatar, { "aria-label": t("homepage.notifications.avatar.placeholder"), src: getAvatarURL(params.userId, "user"), alt: userName, variant: "circle", className: "notification-item-avatar" }) }), children: /* @__PURE__ */ jsx(NotificationItemResource, { appCode: params.appCode }) });
21
+ return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, picture: /* @__PURE__ */ jsx("a", { href: getUserbookURL(params.userId, "user"), title: userName, "data-testid": "notification-item-avatar", children: /* @__PURE__ */ jsx(Avatar, { "aria-label": t("homepage.notifications.avatar.placeholder"), src: getAvatarURL(params.userId, "user"), alt: userName, variant: "circle", className: "notification-item-avatar" }) }), children: /* @__PURE__ */ jsx(NotificationItemResource, { appCode: params.appCode, appI18nKey: params.appI18nKey }) });
22
22
  };
23
23
  export {
24
24
  UserNotificationItem as default
@@ -1,15 +1,21 @@
1
1
  import { NotificationModel } from '@edifice.io/client';
2
- type WebNotificationBase = {
2
+ type NotificationType = 'system' | 'user';
3
+ interface WebNotificationParamsBase {
4
+ appCode: string;
5
+ appI18nKey: string;
6
+ }
7
+ interface WebNotificationBase {
8
+ type: NotificationType;
3
9
  id: string;
4
10
  uri?: string;
5
11
  message: string;
6
12
  date: Date;
7
- };
13
+ params: WebNotificationParamsBase;
14
+ }
8
15
  /** Notification triggered by another user (e.g. shared a resource). */
9
16
  export type UserWebNotification = WebNotificationBase & {
10
17
  type: 'user';
11
- params: {
12
- appCode: string;
18
+ params: WebNotificationParamsBase & {
13
19
  username: string;
14
20
  userId: string;
15
21
  };
@@ -17,11 +23,19 @@ export type UserWebNotification = WebNotificationBase & {
17
23
  /** Notification triggered by an application event (no sender). */
18
24
  export type SystemWebNotification = WebNotificationBase & {
19
25
  type: 'system';
20
- params: {
21
- appCode: string;
22
- };
23
26
  };
24
27
  /** Discriminated union — narrow on `type` to get the specific variant. */
25
28
  export type WebNotification = UserWebNotification | SystemWebNotification;
29
+ /**
30
+ * Transforms a raw `NotificationModel` (API shape) into a `WebNotification`
31
+ * ready for rendering.
32
+ *
33
+ * Responsibilities:
34
+ * - Determines the variant: **user** when a `sender` is present, **system** otherwise.
35
+ * - Resolves the target URI from the model's `params` (handles both user and system naming conventions).
36
+ * - Converts the MongoDB `$date` timestamp to a JS `Date`.
37
+ * - Normalises the `type` field into a kebab-case `appCode` (e.g. `"BLOG_POST"` → `"blog-post"`).
38
+ * - Strips anchor tags from the message, keeping only the inner text as `<strong>`.
39
+ */
26
40
  export declare const notificationAdapter: (notification: NotificationModel) => WebNotification;
27
41
  export {};
@@ -1,30 +1,41 @@
1
- const resolveNotificationResourceUri = (params, type) => {
1
+ const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
2
+ if (appCode === "timeline" && eventType === "NOTIFY-REPORT")
3
+ return "/admin";
2
4
  if (type === "user")
3
5
  return params.resourceUri || params.uri;
4
6
  for (const [key, value] of Object.entries(params))
5
7
  if (typeof value == "string" && value.length > 0 && key.endsWith("Uri") && key !== "profilUri" && key !== "resourceFolderUri")
6
8
  return value;
7
- }, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCode = (appCode) => {
8
- switch (appCode = appCode.toLowerCase(), appCode) {
9
+ }, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCodeAndI18nKey = (appCode) => {
10
+ appCode = appCode.toLowerCase();
11
+ let appI18nKey = appCode;
12
+ switch (appCode) {
9
13
  case "collaborativewall":
10
- return "collaborative-wall";
14
+ appCode = "collaborative-wall";
15
+ break;
11
16
  case "formulaire":
12
- return "forms";
17
+ appI18nKey = appCode = "forms";
18
+ break;
13
19
  case "messagerie":
14
- return "conversation";
20
+ appI18nKey = appCode = "conversation";
21
+ break;
15
22
  case "news":
16
- return "actualites";
23
+ appI18nKey = appCode = "actualites";
24
+ break;
17
25
  case "homeworks":
18
- return "cahier-de-texte";
26
+ appCode = "cahier-de-texte";
27
+ break;
19
28
  case "userbook_motto":
20
29
  case "userbook_mood":
21
30
  case "userbook_discovervisiblegroups":
22
- return "userbook";
31
+ appCode = "userbook";
32
+ break;
23
33
  default:
24
- return appCode.replace(/_/g, "-");
34
+ appI18nKey = appCode = appCode.replace(/_/g, "-");
25
35
  }
36
+ return [appCode, appI18nKey];
26
37
  }, notificationAdapter = (notification) => {
27
- const type = notification.sender ? "user" : "system", uri = resolveNotificationResourceUri(notification.params, type), date = new Date(notification.date.$date), appCode = getAppCode(notification.type), message = parseNotificationMessage(notification.message), base = {
38
+ const type = notification.sender ? "user" : "system", [appCode, appI18nKey] = getAppCodeAndI18nKey(notification.type), uri = resolveNotificationResourceUri(notification.params, type, appCode, notification["event-type"] || notification.eventType), date = new Date(notification.date.$date), message = parseNotificationMessage(notification.message), base = {
28
39
  id: notification._id,
29
40
  uri,
30
41
  message,
@@ -38,13 +49,15 @@ const resolveNotificationResourceUri = (params, type) => {
38
49
  // cannot be undefined if sender is present (user type)
39
50
  userId: notification.sender,
40
51
  // cannot be undefined if sender is present (user type)
41
- appCode
52
+ appCode,
53
+ appI18nKey
42
54
  }
43
55
  } : {
44
56
  ...base,
45
57
  type: "system",
46
58
  params: {
47
- appCode
59
+ appCode,
60
+ appI18nKey
48
61
  }
49
62
  };
50
63
  };
@@ -1,10 +1,12 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import SvgIconRafterUp from "../../../icons/components/IconRafterUp.js";
4
+ import SvgIconUserSearch from "../../../icons/components/IconUserSearch.js";
4
5
  import useToggle from "../../../../hooks/useToggle/useToggle.js";
5
6
  import Flex from "../../../../components/Flex/Flex.js";
6
7
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
7
8
  import IconButton from "../../../../components/Button/IconButton.js";
9
+ import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
8
10
  import { getRotateTransitionStyle } from "../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";
9
11
  const SchoolSpace = ({
10
12
  schools,
@@ -13,16 +15,23 @@ const SchoolSpace = ({
13
15
  }) => {
14
16
  const [isExpanded, toggleExpanded] = useToggle(!1), {
15
17
  t
16
- } = useTranslation(), hasManySchools = schools && schools.length > 1;
17
- return selectedSchool ? /* @__PURE__ */ jsx("div", { className: "school-space", children: /* @__PURE__ */ jsxs(Flex, { className: "school-space-container", justify: "center", gap: "4", align: "center", children: [
18
- /* @__PURE__ */ jsx("b", { children: selectedSchool.name }),
19
- hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-end", onToggle: toggleExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
20
- /* @__PURE__ */ jsx(IconButton, { ...triggerProps, "aria-label": t("show"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconRafterUp, { className: "w-16 min-w-0", style: getRotateTransitionStyle(isExpanded, {
21
- degrees: 180
22
- }) }) }),
23
- /* @__PURE__ */ jsx(Dropdown.Menu, { children: schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: /* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx("p", { children: school.name }) }) }, school.id)) })
24
- ] }) })
25
- ] }) }) : null;
18
+ } = useTranslation();
19
+ if (!selectedSchool) return null;
20
+ const hasManySchools = schools && schools.length > 1, directoryUrl = `/userbook/annuaire#/search?${new URLSearchParams({
21
+ structure: selectedSchool.id
22
+ }).toString()}`;
23
+ return /* @__PURE__ */ jsxs(Flex, { gap: "4", direction: "column", className: "school-space", children: [
24
+ /* @__PURE__ */ jsxs(Flex, { className: "school-space-container", justify: "center", gap: "4", align: "center", children: [
25
+ /* @__PURE__ */ jsx("b", { children: selectedSchool.name }),
26
+ hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-end", onToggle: toggleExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
27
+ /* @__PURE__ */ jsx(IconButton, { ...triggerProps, "aria-label": t("show"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconRafterUp, { className: "w-16 min-w-0", style: getRotateTransitionStyle(isExpanded, {
28
+ degrees: 180
29
+ }) }) }),
30
+ /* @__PURE__ */ jsx(Dropdown.Menu, { children: schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: /* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx("p", { children: school.name }) }) }, school.id)) })
31
+ ] }) })
32
+ ] }),
33
+ /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", className: "school-space-directory-button", leftIcon: /* @__PURE__ */ jsx(SvgIconUserSearch, {}), onClick: () => window.location.href = directoryUrl, children: t("homepage.school-space.directory") })
34
+ ] });
26
35
  };
27
36
  export {
28
37
  SchoolSpace as default
@@ -1,8 +1,11 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
+ import SvgIconClass from "../../../icons/components/IconClass.js";
4
+ import { useProfileLinks } from "./hooks/useProfileLinks.js";
3
5
  import HomeCard from "../HomeCard/HomeCard.js";
4
6
  import Flex from "../../../../components/Flex/Flex.js";
5
7
  import Avatar from "../../../../components/Avatar/Avatar.js";
8
+ import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
6
9
  function UserSpace({
7
10
  name,
8
11
  avatar,
@@ -11,8 +14,8 @@ function UserSpace({
11
14
  }) {
12
15
  const {
13
16
  t
14
- } = useTranslation();
15
- return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", children: [
17
+ } = useTranslation(), links = useProfileLinks(profile);
18
+ return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", footer: !!links && /* @__PURE__ */ jsx(Flex, { children: links.map((link, index) => /* @__PURE__ */ jsx(ButtonBeta, { size: "sm", variant: "ghost", leftIcon: /* @__PURE__ */ jsx(SvgIconClass, {}), onClick: () => window.location.href = link.url, children: link.text }, `${link.url}-${index}`)) }), children: [
16
19
  /* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
17
20
  /* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
18
21
  /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
@@ -0,0 +1,14 @@
1
+ import { Child, StructureChildren } from '@edifice.io/client';
2
+ export declare const childrenQueryKeys: {
3
+ all: (userId: string) => readonly ["children", string];
4
+ };
5
+ export declare const childrenQueryOptions: (userId: string | undefined, enabled: boolean) => import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<StructureChildren[], Error, Child[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
6
+ queryFn?: import('@tanstack/react-query').QueryFunction<StructureChildren[], import('@tanstack/react-query').QueryKey, never> | undefined;
7
+ } & {
8
+ queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, StructureChildren[]>;
9
+ };
10
+ /**
11
+ * Fetches the children of a "Relative" user across all their structures,
12
+ * merged into a single list.
13
+ */
14
+ export declare function useChildren(userId: string | undefined, enabled: boolean): import('@tanstack/react-query').UseQueryResult<Child[], Error>;
@@ -0,0 +1,23 @@
1
+ import { odeServices } from "@edifice.io/client";
2
+ import { useQuery, queryOptions } from "@tanstack/react-query";
3
+ const childrenQueryKeys = {
4
+ all: (userId) => ["children", userId]
5
+ };
6
+ function flattenChildrenByStructure(structures) {
7
+ const seenIds = /* @__PURE__ */ new Set();
8
+ return structures.flatMap((structure) => structure.children).filter((child) => seenIds.has(child.id) ? !1 : (seenIds.add(child.id), !0));
9
+ }
10
+ const childrenQueryOptions = (userId, enabled) => queryOptions({
11
+ queryKey: childrenQueryKeys.all(userId ?? ""),
12
+ queryFn: () => odeServices.directory().getChildren(userId),
13
+ enabled: enabled && !!userId,
14
+ select: flattenChildrenByStructure
15
+ });
16
+ function useChildren(userId, enabled) {
17
+ return useQuery(childrenQueryOptions(userId, enabled));
18
+ }
19
+ export {
20
+ childrenQueryKeys,
21
+ childrenQueryOptions,
22
+ useChildren
23
+ };
@@ -0,0 +1,8 @@
1
+ import { UserProfile } from '@edifice.io/client';
2
+ type ProfileLink = {
3
+ url: string;
4
+ text: string;
5
+ };
6
+ /** Generates user's links to show in the UserSpace home component. */
7
+ export declare function useProfileLinks(profile: UserProfile[number]): Array<ProfileLink> | undefined;
8
+ export {};
@@ -0,0 +1,65 @@
1
+ import { useTranslation } from "react-i18next";
2
+ import { useEdificeClient } from "../../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
3
+ import { useChildren } from "./useChildren.js";
4
+ function useProfileLinks(profile) {
5
+ var _a;
6
+ const {
7
+ user
8
+ } = useEdificeClient(), {
9
+ t
10
+ } = useTranslation(), isRelative = profile === "Relative", {
11
+ data: children
12
+ } = useChildren(user == null ? void 0 : user.userId, isRelative), structureId = (_a = user == null ? void 0 : user.structures) == null ? void 0 : _a[0];
13
+ if (structureId && profile) {
14
+ const baseUrl = "/userbook/annuaire#/search", buildStructureGroupsUrl = () => {
15
+ const params = new URLSearchParams({
16
+ filters: "groups",
17
+ structure: structureId
18
+ });
19
+ return `${baseUrl}?${params.toString()}`;
20
+ }, buildClassesUrl = (classIds = []) => {
21
+ const params = new URLSearchParams({
22
+ filters: "groups",
23
+ structure: structureId
24
+ });
25
+ return classIds.forEach((c) => params.append("class", String(c))), `${baseUrl}?${params.toString()}`;
26
+ };
27
+ switch (profile) {
28
+ case "Teacher":
29
+ return [{
30
+ text: t("homepage.userspace.teacher.link.classes"),
31
+ url: buildClassesUrl(user.classes)
32
+ }];
33
+ case "Student":
34
+ return [{
35
+ text: t("homepage.userspace.student.link.teachers"),
36
+ url: "/userbook/annuaire#/search?filters=groups&profile=Teacher"
37
+ }, {
38
+ text: t("homepage.userspace.student.link.classes"),
39
+ url: buildClassesUrl(user.classes)
40
+ }];
41
+ case "Relative":
42
+ return children != null && children.length ? children.map((child) => {
43
+ var _a2;
44
+ return {
45
+ text: t("homepage.userspace.relative.link.classes", {
46
+ childName: child.firstName
47
+ }),
48
+ url: buildClassesUrl((_a2 = child.classes) == null ? void 0 : _a2.map(({
49
+ id
50
+ }) => id))
51
+ };
52
+ }) : void 0;
53
+ case "Personnel":
54
+ return [{
55
+ text: t("homepage.userspace.personnel.link.classesAndGroups"),
56
+ url: buildStructureGroupsUrl()
57
+ }];
58
+ case "Guest":
59
+ return;
60
+ }
61
+ }
62
+ }
63
+ export {
64
+ useProfileLinks
65
+ };
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ declare const SvgIconClass: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default SvgIconClass;
@@ -0,0 +1,13 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const SvgIconClass = ({
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 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
7
+ title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
8
+ /* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M2.074 17.258c.707-.837 1.705-1.349 2.79-1.349h5.727c1.085 0 2.083.512 2.79 1.35.701.831 1.073 1.928 1.073 3.044V22a1 1 0 1 1-2 0v-1.697c0-.684-.23-1.314-.603-1.755-.367-.436-.826-.639-1.26-.639H4.864c-.434 0-.893.203-1.261.64-.372.44-.603 1.07-.603 1.754V22a1 1 0 1 1-2 0v-1.697c0-1.116.372-2.213 1.074-3.045M7.728 8.5a2.182 2.182 0 1 0 0 4.364 2.182 2.182 0 0 0 0-4.364m-4.182 2.182a4.182 4.182 0 1 1 8.364 0 4.182 4.182 0 0 1-8.364 0", clipRule: "evenodd" }),
9
+ /* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 5a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3h-5a1 1 0 1 1 0-2h5a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v10a1 1 0 1 1-2 0z", clipRule: "evenodd" })
10
+ ] });
11
+ export {
12
+ SvgIconClass as default
13
+ };
@@ -30,6 +30,7 @@ export { default as IconCantoo } from './IconCantoo';
30
30
  export { default as IconCenter } from './IconCenter';
31
31
  export { default as IconCheck } from './IconCheck';
32
32
  export { default as IconChecklist } from './IconChecklist';
33
+ export { default as IconClass } from './IconClass';
33
34
  export { default as IconClockAlert } from './IconClockAlert';
34
35
  export { default as IconClock } from './IconClock';
35
36
  export { default as IconCloseFullScreen } from './IconCloseFullScreen';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.2-develop-pedago.20260810101026",
3
+ "version": "2.6.2-develop-b2school.20260814142937",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -140,9 +140,9 @@
140
140
  "swiper": "10.1.0",
141
141
  "ua-parser-js": "1.0.36",
142
142
  "zustand": "4.5.7",
143
- "@edifice.io/bootstrap": "2.6.2-develop-pedago.20260810101026",
144
- "@edifice.io/tiptap-extensions": "2.6.2-develop-pedago.20260810101026",
145
- "@edifice.io/utilities": "2.6.2-develop-pedago.20260810101026"
143
+ "@edifice.io/bootstrap": "2.6.2-develop-b2school.20260814142937",
144
+ "@edifice.io/tiptap-extensions": "2.6.2-develop-b2school.20260814142937",
145
+ "@edifice.io/utilities": "2.6.2-develop-b2school.20260814142937"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -173,8 +173,8 @@
173
173
  "vite": "5.4.14",
174
174
  "vite-plugin-dts": "4.5.4",
175
175
  "vite-tsconfig-paths": "5.1.4",
176
- "@edifice.io/client": "2.6.2-develop-pedago.20260810101026",
177
- "@edifice.io/config": "2.6.2-develop-pedago.20260810101026"
176
+ "@edifice.io/client": "2.6.2-develop-b2school.20260814142937",
177
+ "@edifice.io/config": "2.6.2-develop-b2school.20260814142937"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "@react-spring/web": "9.7.5",