@deix/rossini-core 2.1.7 → 2.2.0

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.
@@ -41,6 +41,10 @@ interface StandardLayoutProps {
41
41
  * List of language options
42
42
  */
43
43
  languages?: Language[];
44
+ /**
45
+ * List of React nodes to be rendered in the Topbar
46
+ */
47
+ topbarActions?: ReactNode[];
44
48
  }
45
49
  declare const StandardLayout: React.FC<StandardLayoutProps>;
46
50
  export default StandardLayout;
@@ -1 +1 @@
1
- {"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,UAAU,mBAAmB;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoHjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"StandardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/StandardLayout/StandardLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,UAAU,mBAAmB;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;CAC7B;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkHjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -10,7 +10,8 @@ import TopLine from '../components/Topline/TopLine';
10
10
  import { useLocale, usePersistedState } from '../../../utils';
11
11
  import ServerDown from '../assets/ServerDown';
12
12
  import t from './translations.json';
13
- const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, languages, children, }) => {
13
+ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLinks = [], avatar, languages, children, topbarActions = [], // Aggiungi la gestione di topbarActions
14
+ }) => {
14
15
  const theme = useMUITheme();
15
16
  const locale = useLocale();
16
17
  // Get if we are dealing with mobile client
@@ -18,7 +19,7 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
18
19
  // Persist user preference about the sidebar
19
20
  const [sidebarOpen, setSidebarOpen] = usePersistedState('sidebarOpen', isMobile ? false : true);
20
21
  // Don't show anything until localStorage has been read
21
- if (sidebarOpen == undefined) {
22
+ if (sidebarOpen === undefined) {
22
23
  return null;
23
24
  }
24
25
  return (React.createElement(Box, { sx: { display: 'flex', flexDirection: 'row' } },
@@ -32,13 +33,10 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
32
33
  background: theme.palette.background.default,
33
34
  } },
34
35
  React.createElement(TopLine, null),
35
- React.createElement(Topbar, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, languages: languages, avatar: avatar }),
36
+ React.createElement(Topbar, { hasSidebar: sidebarLinks && sidebarLinks.length > 0, onSidebarClose: () => setSidebarOpen(false), onSidebarOpen: () => setSidebarOpen(true), open: sidebarOpen, locale: locale, languages: languages, avatar: avatar, additionalNodes: topbarActions }),
36
37
  isLoading && React.createElement(CircularLoading, { locale: locale }),
37
38
  !isLoading && isError && (React.createElement(Box, { sx: {
38
39
  flexGrow: 1,
39
- // display: 'flex',
40
- // flexDirection: 'column',
41
- // height: '100%',
42
40
  maxWidth: '100%',
43
41
  overflowX: 'hidden',
44
42
  paddingTop: 2,
@@ -59,7 +57,6 @@ const StandardLayout = ({ isLoading, isError, error, appLogo, footer, sidebarLin
59
57
  "Error: ",
60
58
  error.message))))),
61
59
  !isLoading && (React.createElement(Box, { sx: {
62
- // flexGrow: 1,
63
60
  maxWidth: '100%',
64
61
  overflowX: 'hidden',
65
62
  paddingTop: 2,
@@ -20,10 +20,6 @@ export interface FooterProps {
20
20
  * The UI info (name and version)
21
21
  */
22
22
  uiInfo?: ApplicationInfo;
23
- /**
24
- * The URL for the backend API. This will send a request to /info for the name and version of the API and show this information. If this is not provided or if the fetch fails nothing is shown in the footer.
25
- */
26
- apiURL?: string;
27
23
  /**
28
24
  * A React component to be shown underneath the main footer.
29
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Footer/Footer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQzC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6EjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Footer/Footer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgEjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,25 +1,9 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
  import { Box, Typography, useTheme } from '@mui/material';
4
- import { useQuery } from '@tanstack/react-query';
5
- import { useOptionalAPI } from '../../../../utils/index';
6
4
  import DeixLogo from '../../assets/DeixLogo';
7
- const Footer = ({ logo = React.createElement(DeixLogo, null), text = 'Deix Srl', textURL = 'https://deixsrl.com', uiInfo = { name: '', version: '' }, apiURL, children, }) => {
5
+ const Footer = ({ logo = React.createElement(DeixLogo, null), text = 'Deix Srl', textURL = 'https://deix.ai', uiInfo = { name: '', version: '' }, children, }) => {
8
6
  const muiTheme = useTheme();
9
- // Get App Info (name and version)
10
- // Get API info (name and version) from backend
11
- const apiClient = useOptionalAPI(apiURL);
12
- const getAPIInfo = async () => {
13
- if (apiClient) {
14
- const { data } = await apiClient.get('info');
15
- return data;
16
- }
17
- };
18
- const { data: apiInfo } = useQuery({
19
- queryKey: ['api-info'],
20
- queryFn: getAPIInfo,
21
- staleTime: Infinity,
22
- });
23
7
  return (React.createElement("footer", { style: { marginTop: 'auto' } },
24
8
  React.createElement(Box, { sx: {
25
9
  display: 'flex',
@@ -47,13 +31,11 @@ const Footer = ({ logo = React.createElement(DeixLogo, null), text = 'Deix Srl',
47
31
  textDecoration: 'none',
48
32
  color: muiTheme.palette.text.secondary,
49
33
  } }, text),
50
- ' ',
51
- "| ",
52
- uiInfo.name,
53
- " ",
54
- uiInfo.version,
55
- ' ',
56
- apiInfo ? `(${apiInfo.name} ${apiInfo.version})` : '')),
34
+ uiInfo && uiInfo.name && (React.createElement("span", null,
35
+ ' | ',
36
+ uiInfo.name,
37
+ " ",
38
+ uiInfo.version)))),
57
39
  children))));
58
40
  };
59
41
  export default Footer;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { Language, Locale } from '../../../../types/languages';
3
3
  import { AvatarProps } from '../../../buttons/Avatar/Avatar';
4
4
  interface TopbarProps {
@@ -30,6 +30,10 @@ interface TopbarProps {
30
30
  * The props to be passed to the Avatar button component.
31
31
  */
32
32
  avatar?: AvatarProps;
33
+ /**
34
+ * Array of React nodes to display dynamically in the topbar.
35
+ */
36
+ additionalNodes?: ReactNode[];
33
37
  backgroundColor?: string;
34
38
  iconsColor?: string;
35
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAc1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAIrE,UAAU,WAAW;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAuEjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Topbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Topbar/Topbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAcrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAU,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKrE,UAAU,WAAW;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2EjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -10,7 +10,7 @@ import ElevationScroll from './ElevationScroll';
10
10
  import t from './translations.json';
11
11
  import { ThemeModeContext } from '../../../provider/ThemeProvider';
12
12
  const Topbar = (props) => {
13
- const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, } = props;
13
+ const { hasSidebar = false, onSidebarClose, onSidebarOpen, open, locale, languages, avatar, additionalNodes = [], } = props;
14
14
  const { themeMode, setThemeMode } = useContext(ThemeModeContext);
15
15
  const muiTheme = useMUITheme();
16
16
  const SidebarIcon = open ? (React.createElement(MenuOpenTwoToneIcon, { htmlColor: muiTheme.palette.topbar.contrastText })) : (React.createElement(MenuTwoToneIcon, { htmlColor: muiTheme.palette.topbar.contrastText }));
@@ -26,6 +26,7 @@ const Topbar = (props) => {
26
26
  hasSidebar && (React.createElement(Tooltip, { title: menuMessage, arrow: true },
27
27
  React.createElement(IconButton, { color: 'inherit', "aria-label": 'open drawer', onClick: () => (open ? onSidebarClose() : onSidebarOpen()), edge: 'start' }, SidebarIcon))),
28
28
  React.createElement("div", { style: { flexGrow: 1 } }),
29
+ additionalNodes.map((node, index) => (React.createElement(React.Fragment, { key: index }, node))),
29
30
  React.createElement(LanguageSelect, { locale: locale, languages: languages }),
30
31
  React.createElement(Avatar, { ...avatar }),
31
32
  React.createElement(Tooltip, { title: themeMode === 'light'