@red-hat-developer-hub/backstage-plugin-dynamic-home-page 1.1.0 → 1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-dynamic-home-page
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a75760c: add the ability to let users customize their homepage grid layout using the [Backstage Customizable homepage component](https://github.com/backstage/backstage/blob/master/plugins/home/README.md#customizable-home-page).
8
+
9
+ This change does not affect the original `HomePage` as it introduces this new capability through new components. So, the user has a choice of choosing its HomePage implementation via the plugin configuration (dynamic routes).
10
+
11
+ ### Patch Changes
12
+
13
+ - 1a25bba: Updated dependency `react-router-dom` to `6.30.0`.
14
+ - 3dce00f: Updated dependency `react-router-dom` to `6.29.0`.
15
+ - 680ede5: Updated dependency `@mui/icons-material` to `5.16.14`.
16
+ Updated dependency `@mui/styles` to `5.16.14`.
17
+ Updated dependency `@mui/material` to `5.16.14`.
18
+ Updated dependency `@mui/styled-engine` to `5.16.14`.
19
+
3
20
  ## 1.1.0
4
21
 
5
22
  ### Minor Changes
@@ -0,0 +1,77 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ErrorBoundary } from '@backstage/core-components';
3
+ import { CustomHomepageGrid } from '@backstage/plugin-home';
4
+ import { makeStyles } from 'tss-react/mui';
5
+ import 'react-grid-layout/css/styles.css';
6
+
7
+ const useStyles = makeStyles()({
8
+ // Make card content scrollable (so that cards don't overlap)
9
+ cardWrapper: {
10
+ '& > div[class*="MuiCard-root"]': {
11
+ width: "100%",
12
+ height: "100%"
13
+ },
14
+ '& div[class*="MuiCardContent-root"]': {
15
+ overflow: "auto"
16
+ }
17
+ }
18
+ });
19
+ const CustomizableGrid = (props) => {
20
+ const { classes } = useStyles();
21
+ const cards = useMemo(() => {
22
+ return props.mountPoints.map((mountPoint, index) => {
23
+ const id = (index + 1).toString();
24
+ const layouts = {};
25
+ if (mountPoint.config?.layouts) {
26
+ for (const [breakpoint, layout] of Object.entries(
27
+ mountPoint.config.layouts
28
+ )) {
29
+ layouts[breakpoint] = {
30
+ i: id,
31
+ x: layout.x ?? 0,
32
+ y: layout.y ?? 0,
33
+ w: layout.w ?? 12,
34
+ h: layout.h ?? 4,
35
+ isDraggable: false,
36
+ isResizable: false
37
+ };
38
+ }
39
+ } else {
40
+ ["xl", "lg", "md", "sm", "xs", "xxs"].forEach((breakpoint) => {
41
+ layouts[breakpoint] = {
42
+ i: id,
43
+ x: 0,
44
+ y: 0,
45
+ w: 12,
46
+ h: 4,
47
+ isDraggable: false,
48
+ isResizable: false
49
+ };
50
+ });
51
+ }
52
+ return {
53
+ id,
54
+ Component: mountPoint.Component,
55
+ props: mountPoint.config?.props,
56
+ layouts
57
+ };
58
+ });
59
+ }, [props.mountPoints]);
60
+ const children = useMemo(() => {
61
+ return cards.map((card) => /* @__PURE__ */ React.createElement(
62
+ "div",
63
+ {
64
+ key: card.id,
65
+ "data-cardid": card.id,
66
+ "data-testid": `home-page card ${card.id}`,
67
+ "data-layout": JSON.stringify(card.layouts),
68
+ className: classes.cardWrapper
69
+ },
70
+ /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(card.Component, { ...card.props }))
71
+ ));
72
+ }, [cards, classes.cardWrapper]);
73
+ return /* @__PURE__ */ React.createElement(CustomHomepageGrid, null, children);
74
+ };
75
+
76
+ export { CustomizableGrid };
77
+ //# sourceMappingURL=CustomizableGrid.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomizableGrid.esm.js","sources":["../../src/components/CustomizableGrid.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// This complete read-only home page grid picks up the idea and styles from\n// https://github.com/backstage/backstage/blob/master/plugins/home\n// Esp. from the CustomHomepageGrid component:\n// https://github.com/backstage/backstage/blob/master/plugins/home/src/components/CustomHomepage/CustomHomepageGrid.tsx\n// but without the drag and drop functionality.\n\nimport React, { useMemo } from 'react';\nimport { Layout } from 'react-grid-layout';\n\nimport { ErrorBoundary } from '@backstage/core-components';\nimport { CustomHomepageGrid } from '@backstage/plugin-home';\n\nimport { makeStyles } from 'tss-react/mui';\n\n// Removes the doubled scrollbar\nimport 'react-grid-layout/css/styles.css';\n\nimport { HomePageCardMountPoint } from '../types';\n\ninterface Card {\n id: string;\n Component: React.ComponentType<any>;\n props?: Record<string, any>;\n layouts: Record<string, Layout>;\n}\n\nconst useStyles = makeStyles()({\n // Make card content scrollable (so that cards don't overlap)\n cardWrapper: {\n '& > div[class*=\"MuiCard-root\"]': {\n width: '100%',\n height: '100%',\n },\n '& div[class*=\"MuiCardContent-root\"]': {\n overflow: 'auto',\n },\n },\n});\n\n/**\n * @public\n */\nexport interface CustomizableGridProps {\n mountPoints: HomePageCardMountPoint[];\n breakpoints?: Record<string, number>;\n cols?: Record<string, number>;\n}\n\n/**\n * @public\n */\nexport const CustomizableGrid = (props: CustomizableGridProps) => {\n const { classes } = useStyles();\n\n const cards = useMemo<Card[]>(() => {\n return props.mountPoints.map<Card>((mountPoint, index) => {\n const id = (index + 1).toString();\n const layouts: Record<string, Layout> = {};\n\n if (mountPoint.config?.layouts) {\n for (const [breakpoint, layout] of Object.entries(\n mountPoint.config.layouts,\n )) {\n layouts[breakpoint] = {\n i: id,\n x: layout.x ?? 0,\n y: layout.y ?? 0,\n w: layout.w ?? 12,\n h: layout.h ?? 4,\n isDraggable: false,\n isResizable: false,\n };\n }\n } else {\n // Default layout for cards without a layout configuration\n ['xl', 'lg', 'md', 'sm', 'xs', 'xxs'].forEach(breakpoint => {\n layouts[breakpoint] = {\n i: id,\n x: 0,\n y: 0,\n w: 12,\n h: 4,\n isDraggable: false,\n isResizable: false,\n };\n });\n }\n\n return {\n id,\n Component: mountPoint.Component,\n props: mountPoint.config?.props,\n layouts,\n };\n });\n }, [props.mountPoints]);\n\n const children = useMemo(() => {\n return cards.map(card => (\n <div\n key={card.id}\n data-cardid={card.id}\n data-testid={`home-page card ${card.id}`}\n data-layout={JSON.stringify(card.layouts)}\n className={classes.cardWrapper}\n >\n <ErrorBoundary>\n <card.Component {...card.props} />\n </ErrorBoundary>\n </div>\n ));\n }, [cards, classes.cardWrapper]);\n\n return <CustomHomepageGrid>{children}</CustomHomepageGrid>;\n};\n"],"names":[],"mappings":";;;;;;AA0CA,MAAM,SAAA,GAAY,YAAa,CAAA;AAAA;AAAA,EAE7B,WAAa,EAAA;AAAA,IACX,gCAAkC,EAAA;AAAA,MAChC,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,qCAAuC,EAAA;AAAA,MACrC,QAAU,EAAA;AAAA;AACZ;AAEJ,CAAC,CAAA;AAcY,MAAA,gBAAA,GAAmB,CAAC,KAAiC,KAAA;AAChE,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,SAAU,EAAA;AAE9B,EAAM,MAAA,KAAA,GAAQ,QAAgB,MAAM;AAClC,IAAA,OAAO,KAAM,CAAA,WAAA,CAAY,GAAU,CAAA,CAAC,YAAY,KAAU,KAAA;AACxD,MAAM,MAAA,EAAA,GAAA,CAAM,KAAQ,GAAA,CAAA,EAAG,QAAS,EAAA;AAChC,MAAA,MAAM,UAAkC,EAAC;AAEzC,MAAI,IAAA,UAAA,CAAW,QAAQ,OAAS,EAAA;AAC9B,QAAA,KAAA,MAAW,CAAC,UAAA,EAAY,MAAM,CAAA,IAAK,MAAO,CAAA,OAAA;AAAA,UACxC,WAAW,MAAO,CAAA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K,EAAE,CAAA,CAAA;AAAA,QACtC,aAAa,EAAA,IAAA,CAAK,SAAU,CAAA,IAAA,CAAK,OAAO,CAAA;AAAA,QACxC,WAAW,OAAQ,CAAA;AAAA,OAAA;AAAA,sBAEnB,KAAA,CAAA,aAAA,CAAC,qCACE,KAAA,CAAA,aAAA,CAAA,IAAA,CAAK,WAAL,EAAgB,GAAG,IAAK,CAAA,KAAA,EAAO,CAClC;AAAA,KAEH,CAAA;AAAA,GACA,EAAA,CAAC,KAAO,EAAA,OAAA,CAAQ,WAAW,CAAC,CAAA;AAE/B,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,0BAAoB,QAAS,CAAA;AACvC;;;;"}
@@ -0,0 +1,29 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Page, Content, EmptyState } from '@backstage/core-components';
3
+ import { Header } from './Header.esm.js';
4
+ import { CustomizableGrid } from './CustomizableGrid.esm.js';
5
+
6
+ const CustomizableHomePage = (props) => {
7
+ const filteredAndSortedHomePageCards = useMemo(() => {
8
+ if (!props.cards) {
9
+ return [];
10
+ }
11
+ const filteredAndSorted = props.cards.filter(
12
+ (card) => card.enabled !== false && (!card.config?.priority || card.config.priority >= 0)
13
+ );
14
+ filteredAndSorted.sort(
15
+ (a, b) => (b.config?.priority ?? 0) - (a.config?.priority ?? 0)
16
+ );
17
+ return filteredAndSorted;
18
+ }, [props.cards]);
19
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Header, { ...props }), /* @__PURE__ */ React.createElement(Content, null, filteredAndSortedHomePageCards.length === 0 ? /* @__PURE__ */ React.createElement(
20
+ EmptyState,
21
+ {
22
+ title: "No home page cards (mount points) configured or found.",
23
+ missing: "content"
24
+ }
25
+ ) : /* @__PURE__ */ React.createElement(CustomizableGrid, { mountPoints: filteredAndSortedHomePageCards })));
26
+ };
27
+
28
+ export { CustomizableHomePage };
29
+ //# sourceMappingURL=CustomizableHomePage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomizableHomePage.esm.js","sources":["../../src/components/CustomizableHomePage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\n\nimport { Content, EmptyState, Page } from '@backstage/core-components';\n\nimport { HomePageCardMountPoint } from '../types';\n\nimport { Header, HeaderProps } from './Header';\nimport { CustomizableGrid } from './CustomizableGrid';\n\nexport interface HomePageProps extends HeaderProps {\n cards?: HomePageCardMountPoint[];\n}\n\nexport const CustomizableHomePage = (props: HomePageProps) => {\n const filteredAndSortedHomePageCards = useMemo(() => {\n if (!props.cards) {\n return [];\n }\n\n const filteredAndSorted = props.cards.filter(\n card =>\n card.enabled !== false &&\n (!card.config?.priority || card.config.priority >= 0),\n );\n\n filteredAndSorted.sort(\n (a, b) => (b.config?.priority ?? 0) - (a.config?.priority ?? 0),\n );\n\n return filteredAndSorted;\n }, [props.cards]);\n\n return (\n <Page themeId=\"home\">\n <Header {...props} />\n <Content>\n {filteredAndSortedHomePageCards.length === 0 ? (\n <EmptyState\n title=\"No home page cards (mount points) configured or found.\"\n missing=\"content\"\n />\n ) : (\n <CustomizableGrid mountPoints={filteredAndSortedHomePageCards} />\n )}\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;AA6Ba,MAAA,oBAAA,GAAuB,CAAC,KAAyB,KAAA;AAC5D,EAAM,MAAA,8BAAA,GAAiC,QAAQ,MAAM;AACnD,IAAI,IAAA,CAAC,MAAM,KAAO,EAAA;AAChB,MAAA,OAAO,EAAC;AAAA;AAGV,IAAM,MAAA,iBAAA,GAAoB,MAAM,KAAM,CAAA,MAAA;AAAA,MACpC,CAAA,IAAA,KACE,IAAK,CAAA,OAAA,KAAY,KAChB,KAAA,CAAC,KAAK,MAAQ,EAAA,QAAA,IAAY,IAAK,CAAA,MAAA,CAAO,QAAY,IAAA,CAAA;AAAA,KACvD;AAEA,IAAkB,iBAAA,CAAA,IAAA;AAAA,MAChB,CAAC,GAAG,CAAO,KAAA,CAAA,CAAA,CAAE,QAAQ,QAAY,IAAA,CAAA,KAAM,CAAE,CAAA,MAAA,EAAQ,QAAY,IAAA,CAAA;AAAA,KAC/D;AAEA,IAAO,OAAA,iBAAA;AAAA,GACN,EAAA,CAAC,KAAM,CAAA,KAAK,CAAC,CAAA;AAEhB,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,kBACX,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAQ,GAAG,KAAA,EAAO,CACnB,kBAAA,KAAA,CAAA,aAAA,CAAC,OACE,EAAA,IAAA,EAAA,8BAAA,CAA+B,WAAW,CACzC,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,wDAAA;AAAA,MACN,OAAQ,EAAA;AAAA;AAAA,sBAGT,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,WAAa,EAAA,8BAAA,EAAgC,CAEnE,CACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { useDynamicHomePageCards } from '../hooks/useDynamicHomePageCards.esm.js';
3
+ import { CustomizableHomePage } from './CustomizableHomePage.esm.js';
4
+
5
+ const DynamicCustomizableHomePage = (props) => {
6
+ const cards = useDynamicHomePageCards();
7
+ return /* @__PURE__ */ React.createElement(CustomizableHomePage, { ...props, cards });
8
+ };
9
+
10
+ export { DynamicCustomizableHomePage };
11
+ //# sourceMappingURL=DynamicCustomizableHomePage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicCustomizableHomePage.esm.js","sources":["../../src/components/DynamicCustomizableHomePage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport type { ClockConfig } from '@backstage/plugin-home';\n\nimport { useDynamicHomePageCards } from '../hooks/useDynamicHomePageCards';\nimport { CustomizableHomePage } from './CustomizableHomePage';\nimport type { LocalClockProps } from './LocalClock';\n\n/**\n * This type is similar to Omit&lt;HomePageProps, 'cards'&gt;.\n * We redefine it here to avoid the need to export HomePageProps to the API export!\n * @public\n */\nexport interface DynamicCustomizableHomePageProps {\n title?: string;\n personalizedTitle?: string;\n pageTitle?: string;\n subtitle?: string;\n localClock?: LocalClockProps;\n worldClocks?: ClockConfig[];\n}\n\n/**\n * @public\n */\nexport const DynamicCustomizableHomePage = (\n props: DynamicCustomizableHomePageProps,\n) => {\n const cards = useDynamicHomePageCards();\n\n return <CustomizableHomePage {...props} cards={cards} />;\n};\n"],"names":[],"mappings":";;;;AAyCa,MAAA,2BAAA,GAA8B,CACzC,KACG,KAAA;AACH,EAAA,MAAM,QAAQ,uBAAwB,EAAA;AAEtC,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,oBAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,KAAc,EAAA,CAAA;AACxD;;;;"}
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { useApi, identityApiRef } from '@backstage/core-plugin-api';
3
+ import { Header as Header$1 } from '@backstage/core-components';
4
+ import { HeaderWorldClock } from '@backstage/plugin-home';
5
+ import useAsync from 'react-use/esm/useAsync';
6
+ import { LocalClock } from './LocalClock.esm.js';
7
+
8
+ const getPersonalizedTitle = (title, displayName) => {
9
+ const firstName = displayName?.split(" ")[0];
10
+ const replacedTitle = title.replace("{{firstName}}", firstName ?? "").replace("{{displayName}}", displayName ?? "");
11
+ return replacedTitle;
12
+ };
13
+ const Header = (props) => {
14
+ const identityApi = useApi(identityApiRef);
15
+ const { value: profile } = useAsync(() => identityApi.getProfileInfo());
16
+ const title = React.useMemo(() => {
17
+ if (profile?.displayName && props.personalizedTitle) {
18
+ return getPersonalizedTitle(props.personalizedTitle, profile.displayName);
19
+ } else if (props.title) {
20
+ return getPersonalizedTitle(props.title, profile?.displayName);
21
+ }
22
+ return getPersonalizedTitle("Welcome back!", profile?.displayName);
23
+ }, [profile?.displayName, props.personalizedTitle, props.title]);
24
+ const subtitle = React.useMemo(() => {
25
+ return props.subtitle ? getPersonalizedTitle(props.subtitle, profile?.displayName) : undefined;
26
+ }, [props.subtitle, profile?.displayName]);
27
+ return /* @__PURE__ */ React.createElement(
28
+ Header$1,
29
+ {
30
+ title,
31
+ subtitle,
32
+ pageTitleOverride: props.pageTitle
33
+ },
34
+ props.localClock?.format && props.localClock?.format !== "none" ? /* @__PURE__ */ React.createElement(
35
+ LocalClock,
36
+ {
37
+ label: props.localClock?.label ?? (props.worldClocks && props.worldClocks.length > 0 ? "Local" : undefined),
38
+ format: props.localClock?.format ?? (props.worldClocks && props.worldClocks.length > 0 ? "time" : undefined),
39
+ lang: props.localClock?.lang
40
+ }
41
+ ) : null,
42
+ props.worldClocks && props.worldClocks.length > 0 ? /* @__PURE__ */ React.createElement(HeaderWorldClock, { clockConfigs: props.worldClocks }) : null
43
+ );
44
+ };
45
+
46
+ export { Header, getPersonalizedTitle };
47
+ //# sourceMappingURL=Header.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Header.esm.js","sources":["../../src/components/Header.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Header as BackstageHeader } from '@backstage/core-components';\nimport { ClockConfig, HeaderWorldClock } from '@backstage/plugin-home';\n\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { LocalClock, LocalClockProps } from './LocalClock';\n\nexport interface HeaderProps {\n title?: string;\n personalizedTitle?: string;\n pageTitle?: string;\n subtitle?: string;\n localClock?: LocalClockProps;\n worldClocks?: ClockConfig[];\n}\n\n// I kept this because I hope that we will add this soon or at least in Dynamic Home Page plugin 1.2 ~ RHDH 1.6.\n// const getTimeBasedTitle = (): string => {\n// const currentHour = new Date(Date.now()).getHours();\n// if (currentHour < 12) {\n// return 'Good morning {{firstName}}';\n// } else if (currentHour < 17) {\n// return 'Good afternoon {{firstName}}';\n// }\n// return 'Good evening {{firstName}}';\n// };\n\nexport const getPersonalizedTitle = (\n title: string,\n displayName: string | undefined,\n) => {\n const firstName = displayName?.split(' ')[0];\n const replacedTitle = title\n .replace('{{firstName}}', firstName ?? '')\n .replace('{{displayName}}', displayName ?? '');\n return replacedTitle;\n};\n\nexport const Header = (props: HeaderProps) => {\n const identityApi = useApi(identityApiRef);\n const { value: profile } = useAsync(() => identityApi.getProfileInfo());\n\n const title = React.useMemo<string>(() => {\n if (profile?.displayName && props.personalizedTitle) {\n return getPersonalizedTitle(props.personalizedTitle, profile.displayName);\n } else if (props.title) {\n return getPersonalizedTitle(props.title, profile?.displayName);\n }\n // return getPersonalizedTitle(getTimeBasedTitle(), profile?.displayName);\n return getPersonalizedTitle('Welcome back!', profile?.displayName);\n }, [profile?.displayName, props.personalizedTitle, props.title]);\n\n const subtitle = React.useMemo<string | undefined>(() => {\n return props.subtitle\n ? getPersonalizedTitle(props.subtitle, profile?.displayName)\n : undefined;\n }, [props.subtitle, profile?.displayName]);\n\n return (\n <BackstageHeader\n title={title}\n subtitle={subtitle}\n pageTitleOverride={props.pageTitle}\n >\n {props.localClock?.format && props.localClock?.format !== 'none' ? (\n <LocalClock\n label={\n props.localClock?.label ??\n (props.worldClocks && props.worldClocks.length > 0\n ? 'Local'\n : undefined)\n }\n format={\n props.localClock?.format ??\n (props.worldClocks && props.worldClocks.length > 0\n ? 'time'\n : undefined)\n }\n lang={props.localClock?.lang}\n />\n ) : null}\n\n {props.worldClocks && props.worldClocks.length > 0 ? (\n <HeaderWorldClock clockConfigs={props.worldClocks} />\n ) : null}\n </BackstageHeader>\n );\n};\n"],"names":["BackstageHeader"],"mappings":";;;;;;;AA8Ca,MAAA,oBAAA,GAAuB,CAClC,KAAA,EACA,WACG,KAAA;AACH,EAAA,MAAM,SAAY,GAAA,WAAA,EAAa,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAC3C,EAAM,MAAA,aAAA,GAAgB,KACnB,CAAA,OAAA,CAAQ,eAAiB,EAAA,SAAA,IAAa,EAAE,CACxC,CAAA,OAAA,CAAQ,iBAAmB,EAAA,WAAA,IAAe,EAAE,CAAA;AAC/C,EAAO,OAAA,aAAA;AACT;AAEa,MAAA,MAAA,GAAS,CAAC,KAAuB,KAAA;AAC5C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,EAAE,OAAO,OAAQ,EAAA,GAAI,SAAS,MAAM,WAAA,CAAY,gBAAgB,CAAA;AAEtE,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,CAAgB,MAAM;AACxC,IAAI,IAAA,OAAA,EAAS,WAAe,IAAA,KAAA,CAAM,iBAAmB,EAAA;AACnD,MAAA,OAAO,oBA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B,GAAA,IAAA;AAAA,IAEH,KAAA,CAAM,WAAe,IAAA,KAAA,CAAM,WAAY,CAAA,MAAA,GAAS,CAC/C,mBAAA,KAAA,CAAA,aAAA,CAAC,gBAAiB,EAAA,EAAA,YAAA,EAAc,KAAM,CAAA,WAAA,EAAa,CACjD,GAAA;AAAA,GACN;AAEJ;;;;"}
@@ -1,30 +1,9 @@
1
1
  import React, { useMemo } from 'react';
2
- import { useApi, identityApiRef } from '@backstage/core-plugin-api';
3
- import { Page, Header, Content, EmptyState } from '@backstage/core-components';
4
- import { HeaderWorldClock } from '@backstage/plugin-home';
5
- import useAsync from 'react-use/esm/useAsync';
2
+ import { Page, Content, EmptyState } from '@backstage/core-components';
3
+ import { Header } from './Header.esm.js';
6
4
  import { ReadOnlyGrid } from './ReadOnlyGrid.esm.js';
7
- import { LocalClock } from './LocalClock.esm.js';
8
5
 
9
- const getPersonalizedTitle = (title, displayName) => {
10
- const firstName = displayName?.split(" ")[0];
11
- const replacedTitle = title.replace("{{firstName}}", firstName ?? "").replace("{{displayName}}", displayName ?? "");
12
- return replacedTitle;
13
- };
14
6
  const HomePage = (props) => {
15
- const identityApi = useApi(identityApiRef);
16
- const { value: profile } = useAsync(() => identityApi.getProfileInfo());
17
- const title = React.useMemo(() => {
18
- if (profile?.displayName && props.personalizedTitle) {
19
- return getPersonalizedTitle(props.personalizedTitle, profile.displayName);
20
- } else if (props.title) {
21
- return getPersonalizedTitle(props.title, profile?.displayName);
22
- }
23
- return getPersonalizedTitle("Welcome back!", profile?.displayName);
24
- }, [profile?.displayName, props.personalizedTitle, props.title]);
25
- const subtitle = React.useMemo(() => {
26
- return props.subtitle ? getPersonalizedTitle(props.subtitle, profile?.displayName) : undefined;
27
- }, [props.subtitle, profile?.displayName]);
28
7
  const filteredAndSortedHomePageCards = useMemo(() => {
29
8
  if (!props.cards) {
30
9
  return [];
@@ -37,23 +16,7 @@ const HomePage = (props) => {
37
16
  );
38
17
  return filteredAndSorted;
39
18
  }, [props.cards]);
40
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
41
- Header,
42
- {
43
- title,
44
- subtitle,
45
- pageTitleOverride: props.pageTitle
46
- },
47
- props.localClock?.format && props.localClock?.format !== "none" ? /* @__PURE__ */ React.createElement(
48
- LocalClock,
49
- {
50
- label: props.localClock?.label ?? (props.worldClocks && props.worldClocks.length > 0 ? "Local" : undefined),
51
- format: props.localClock?.format ?? (props.worldClocks && props.worldClocks.length > 0 ? "time" : undefined),
52
- lang: props.localClock?.lang
53
- }
54
- ) : null,
55
- props.worldClocks && props.worldClocks.length > 0 ? /* @__PURE__ */ React.createElement(HeaderWorldClock, { clockConfigs: props.worldClocks }) : null
56
- ), /* @__PURE__ */ React.createElement(Content, null, filteredAndSortedHomePageCards.length === 0 ? /* @__PURE__ */ React.createElement(
19
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(Header, { ...props }), /* @__PURE__ */ React.createElement(Content, null, filteredAndSortedHomePageCards.length === 0 ? /* @__PURE__ */ React.createElement(
57
20
  EmptyState,
58
21
  {
59
22
  title: "No home page cards (mount points) configured or found.",
@@ -1 +1 @@
1
- {"version":3,"file":"HomePage.esm.js","sources":["../../src/components/HomePage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\n\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Content, EmptyState, Header, Page } from '@backstage/core-components';\nimport { ClockConfig, HeaderWorldClock } from '@backstage/plugin-home';\n\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { HomePageCardMountPoint } from '../types';\nimport { ReadOnlyGrid } from './ReadOnlyGrid';\nimport { LocalClock, LocalClockProps } from './LocalClock';\n\nexport interface HomePageProps {\n title?: string;\n personalizedTitle?: string;\n pageTitle?: string;\n subtitle?: string;\n localClock?: LocalClockProps;\n worldClocks?: ClockConfig[];\n cards?: HomePageCardMountPoint[];\n}\n\n// I kept this because I hope that we will add this soon or at least in Dynamic Home Page plugin 1.2 ~ RHDH 1.6.\n// const getTimeBasedTitle = (): string => {\n// const currentHour = new Date(Date.now()).getHours();\n// if (currentHour < 12) {\n// return 'Good morning {{firstName}}';\n// } else if (currentHour < 17) {\n// return 'Good afternoon {{firstName}}';\n// }\n// return 'Good evening {{firstName}}';\n// };\n\nconst getPersonalizedTitle = (\n title: string,\n displayName: string | undefined,\n) => {\n const firstName = displayName?.split(' ')[0];\n const replacedTitle = title\n .replace('{{firstName}}', firstName ?? '')\n .replace('{{displayName}}', displayName ?? '');\n return replacedTitle;\n};\n\nexport const HomePage = (props: HomePageProps) => {\n const identityApi = useApi(identityApiRef);\n const { value: profile } = useAsync(() => identityApi.getProfileInfo());\n\n const title = React.useMemo<string>(() => {\n if (profile?.displayName && props.personalizedTitle) {\n return getPersonalizedTitle(props.personalizedTitle, profile.displayName);\n } else if (props.title) {\n return getPersonalizedTitle(props.title, profile?.displayName);\n }\n // return getPersonalizedTitle(getTimeBasedTitle(), profile?.displayName);\n return getPersonalizedTitle('Welcome back!', profile?.displayName);\n }, [profile?.displayName, props.personalizedTitle, props.title]);\n\n const subtitle = React.useMemo<string | undefined>(() => {\n return props.subtitle\n ? getPersonalizedTitle(props.subtitle, profile?.displayName)\n : undefined;\n }, [props.subtitle, profile?.displayName]);\n\n const filteredAndSortedHomePageCards = useMemo(() => {\n if (!props.cards) {\n return [];\n }\n\n const filteredAndSorted = props.cards.filter(\n card =>\n card.enabled !== false &&\n (!card.config?.priority || card.config.priority >= 0),\n );\n\n filteredAndSorted.sort(\n (a, b) => (b.config?.priority ?? 0) - (a.config?.priority ?? 0),\n );\n\n return filteredAndSorted;\n }, [props.cards]);\n\n return (\n <Page themeId=\"home\">\n <Header\n title={title}\n subtitle={subtitle}\n pageTitleOverride={props.pageTitle}\n >\n {props.localClock?.format && props.localClock?.format !== 'none' ? (\n <LocalClock\n label={\n props.localClock?.label ??\n (props.worldClocks && props.worldClocks.length > 0\n ? 'Local'\n : undefined)\n }\n format={\n props.localClock?.format ??\n (props.worldClocks && props.worldClocks.length > 0\n ? 'time'\n : undefined)\n }\n lang={props.localClock?.lang}\n />\n ) : null}\n\n {props.worldClocks && props.worldClocks.length > 0 ? (\n <HeaderWorldClock clockConfigs={props.worldClocks} />\n ) : null}\n </Header>\n <Content>\n {filteredAndSortedHomePageCards.length === 0 ? (\n <EmptyState\n title=\"No home page cards (mount points) configured or found.\"\n missing=\"content\"\n />\n ) : (\n <ReadOnlyGrid mountPoints={filteredAndSortedHomePageCards} />\n )}\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAiDA,MAAM,oBAAA,GAAuB,CAC3B,KAAA,EACA,WACG,KAAA;AACH,EAAA,MAAM,SAAY,GAAA,WAAA,EAAa,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;AAC3C,EAAM,MAAA,aAAA,GAAgB,KACnB,CAAA,OAAA,CAAQ,eAAiB,EAAA,SAAA,IAAa,EAAE,CACxC,CAAA,OAAA,CAAQ,iBAAmB,EAAA,WAAA,IAAe,EAAE,CAAA;AAC/C,EAAO,OAAA,aAAA;AACT,CAAA;AAEa,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAChD,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,EAAE,OAAO,OAAQ,EAAA,GAAI,SAAS,MAAM,WAAA,CAAY,gBAAgB,CAAA;AAEtE,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,CAAgB,MAAM;AACxC,IAAI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F,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HomePage.esm.js","sources":["../../src/components/HomePage.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\n\nimport { Content, EmptyState, Page } from '@backstage/core-components';\n\nimport { HomePageCardMountPoint } from '../types';\n\nimport { Header, HeaderProps } from './Header';\nimport { ReadOnlyGrid } from './ReadOnlyGrid';\n\nexport interface HomePageProps extends HeaderProps {\n cards?: HomePageCardMountPoint[];\n}\n\nexport const HomePage = (props: HomePageProps) => {\n const filteredAndSortedHomePageCards = useMemo(() => {\n if (!props.cards) {\n return [];\n }\n\n const filteredAndSorted = props.cards.filter(\n card =>\n card.enabled !== false &&\n (!card.config?.priority || card.config.priority >= 0),\n );\n\n filteredAndSorted.sort(\n (a, b) => (b.config?.priority ?? 0) - (a.config?.priority ?? 0),\n );\n\n return filteredAndSorted;\n }, [props.cards]);\n\n return (\n <Page themeId=\"home\">\n <Header {...props} />\n <Content>\n {filteredAndSortedHomePageCards.length === 0 ? (\n <EmptyState\n title=\"No home page cards (mount points) configured or found.\"\n missing=\"content\"\n />\n ) : (\n <ReadOnlyGrid mountPoints={filteredAndSortedHomePageCards} />\n )}\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;AA6Ba,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAChD,EAAM,MAAA,8BAAA,GAAiC,QAAQ,MAAM;AACnD,IAAI,IAAA,CAAC,MAAM,KAAO,EAAA;AAChB,MAAA,OAAO,EAAC;AAAA;AAGV,IAAM,MAAA,iBAAA,GAAoB,MAAM,KAAM,CAAA,MAAA;AAAA,MACpC,CAAA,IAAA,KACE,IAAK,CAAA,OAAA,KAAY,KAChB,KAAA,CAAC,KAAK,MAAQ,EAAA,QAAA,IAAY,IAAK,CAAA,MAAA,CAAO,QAAY,IAAA,CAAA;AAAA,KACvD;AAEA,IAAkB,iBAAA,CAAA,IAAA;AAAA,MAChB,CAAC,GAAG,CAAO,KAAA,CAAA,CAAA,CAAE,QAAQ,QAAY,IAAA,CAAA,KAAM,CAAE,CAAA,MAAA,EAAQ,QAAY,IAAA,CAAA;AAAA,KAC/D;AAEA,IAAO,OAAA,iBAAA;AAAA,GACN,EAAA,CAAC,KAAM,CAAA,KAAK,CAAC,CAAA;AAEhB,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,kBACX,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAQ,GAAG,KAAA,EAAO,CACnB,kBAAA,KAAA,CAAA,aAAA,CAAC,OACE,EAAA,IAAA,EAAA,8BAAA,CAA+B,WAAW,CACzC,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,wDAAA;AAAA,MACN,OAAQ,EAAA;AAAA;AAAA,sBAGT,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,WAAa,EAAA,8BAAA,EAAgC,CAE/D,CACF,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -34,6 +34,20 @@ interface DynamicHomePageProps {
34
34
  worldClocks?: ClockConfig[];
35
35
  }
36
36
 
37
+ /**
38
+ * This type is similar to Omit&lt;HomePageProps, 'cards'&gt;.
39
+ * We redefine it here to avoid the need to export HomePageProps to the API export!
40
+ * @public
41
+ */
42
+ interface DynamicCustomizableHomePageProps {
43
+ title?: string;
44
+ personalizedTitle?: string;
45
+ pageTitle?: string;
46
+ subtitle?: string;
47
+ localClock?: LocalClockProps;
48
+ worldClocks?: ClockConfig[];
49
+ }
50
+
37
51
  /**
38
52
  * @public
39
53
  */
@@ -94,6 +108,11 @@ declare const dynamicHomePagePlugin: _backstage_core_plugin_api.BackstagePlugin<
94
108
  * @public
95
109
  */
96
110
  declare const DynamicHomePage: React.ComponentType<DynamicHomePageProps>;
111
+ /**
112
+ * Customizable Dynamic Home Page
113
+ * @public
114
+ */
115
+ declare const DynamicCustomizableHomePage: React.ComponentType<DynamicCustomizableHomePageProps>;
97
116
  /**
98
117
  * @public
99
118
  */
@@ -149,4 +168,4 @@ declare const VisitListener: () => React.JSX.Element | null;
149
168
  */
150
169
  declare const WorldClock: ({ worldClocks, timeFormat, justifyContent, }: WorldClockProps) => React.JSX.Element;
151
170
 
152
- export { CatalogStarredEntitiesCard, DynamicHomePage, type DynamicHomePageProps, FeaturedDocsCard, Headline, type HeadlineProps, JokeCard, type LocalClockProps, Markdown, MarkdownCard, type MarkdownCardProps, type MarkdownProps, Placeholder, type PlaceholderProps, QuickAccessCard, type QuickAccessCardProps, RecentlyVisitedCard, SearchBar, type SearchBarProps, TopVisitedCard, VisitListener, WorldClock, type WorldClockProps, dynamicHomePagePlugin };
171
+ export { CatalogStarredEntitiesCard, DynamicCustomizableHomePage, type DynamicCustomizableHomePageProps, DynamicHomePage, type DynamicHomePageProps, FeaturedDocsCard, Headline, type HeadlineProps, JokeCard, type LocalClockProps, Markdown, MarkdownCard, type MarkdownCardProps, type MarkdownProps, Placeholder, type PlaceholderProps, QuickAccessCard, type QuickAccessCardProps, RecentlyVisitedCard, SearchBar, type SearchBarProps, TopVisitedCard, VisitListener, WorldClock, type WorldClockProps, dynamicHomePagePlugin };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- export { CatalogStarredEntitiesCard, DynamicHomePage, FeaturedDocsCard, Headline, JokeCard, Markdown, MarkdownCard, Placeholder, QuickAccessCard, RecentlyVisitedCard, SearchBar, TopVisitedCard, VisitListener, WorldClock, dynamicHomePagePlugin } from './plugin.esm.js';
1
+ export { CatalogStarredEntitiesCard, DynamicCustomizableHomePage, DynamicHomePage, FeaturedDocsCard, Headline, JokeCard, Markdown, MarkdownCard, Placeholder, QuickAccessCard, RecentlyVisitedCard, SearchBar, TopVisitedCard, VisitListener, WorldClock, dynamicHomePagePlugin } from './plugin.esm.js';
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -35,6 +35,15 @@ const DynamicHomePage = dynamicHomePagePlugin.provide(
35
35
  mountPoint: rootRouteRef
36
36
  })
37
37
  );
38
+ const DynamicCustomizableHomePage = dynamicHomePagePlugin.provide(
39
+ createRoutableExtension({
40
+ name: "DynamicCustomizableHomePage",
41
+ component: () => import('./components/DynamicCustomizableHomePage.esm.js').then(
42
+ (m) => m.DynamicCustomizableHomePage
43
+ ),
44
+ mountPoint: rootRouteRef
45
+ })
46
+ );
38
47
  const SearchBar = dynamicHomePagePlugin.provide(
39
48
  createComponentExtension({
40
49
  name: "SearchBar",
@@ -140,5 +149,5 @@ const WorldClock = dynamicHomePagePlugin.provide(
140
149
  })
141
150
  );
142
151
 
143
- export { CatalogStarredEntitiesCard, DynamicHomePage, FeaturedDocsCard, Headline, JokeCard, Markdown, MarkdownCard, Placeholder, QuickAccessCard, RecentlyVisitedCard, SearchBar, TopVisitedCard, VisitListener, WorldClock, dynamicHomePagePlugin };
152
+ export { CatalogStarredEntitiesCard, DynamicCustomizableHomePage, DynamicHomePage, FeaturedDocsCard, Headline, JokeCard, Markdown, MarkdownCard, Placeholder, QuickAccessCard, RecentlyVisitedCard, SearchBar, TopVisitedCard, VisitListener, WorldClock, dynamicHomePagePlugin };
144
153
  //# sourceMappingURL=plugin.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n identityApiRef,\n storageApiRef,\n} from '@backstage/core-plugin-api';\n\nimport {\n type StarredEntitiesProps,\n type VisitedByTypeProps,\n type FeaturedDocsCardProps,\n visitsApiRef,\n VisitsStorageApi,\n} from '@backstage/plugin-home';\n\nimport { QuickAccessApiClient, quickAccessApiRef } from './api';\nimport { rootRouteRef } from './routes';\n\nimport type { DynamicHomePageProps } from './components/DynamicHomePage';\nimport type { SearchBarProps } from './components/SearchBar';\nimport type { QuickAccessCardProps } from './components/QuickAccessCard';\nimport type { HeadlineProps } from './components/Headline';\nimport type { MarkdownProps } from './components/Markdown';\nimport type { MarkdownCardProps } from './components/MarkdownCard';\nimport type { PlaceholderProps } from './components/Placeholder';\n\nexport type { DynamicHomePageProps } from './components/DynamicHomePage';\nexport type { SearchBarProps } from './components/SearchBar';\nexport type { QuickAccessCardProps } from './components/QuickAccessCard';\nexport type { HeadlineProps } from './components/Headline';\nexport type { MarkdownProps } from './components/Markdown';\nexport type { MarkdownCardProps } from './components/MarkdownCard';\nexport type { PlaceholderProps } from './components/Placeholder';\nexport type { LocalClockProps } from './components/LocalClock';\nexport type { WorldClockProps } from './components/WorldClock';\n\n/**\n * Dynamic Home Page Plugin\n * @public\n */\nexport const dynamicHomePagePlugin = createPlugin({\n id: 'dynamic-home-page',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: quickAccessApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, configApi, identityApi }) =>\n new QuickAccessApiClient({ discoveryApi, configApi, identityApi }),\n }),\n createApiFactory({\n api: visitsApiRef,\n deps: {\n storageApi: storageApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ storageApi, identityApi }) =>\n VisitsStorageApi.create({ storageApi, identityApi }),\n }),\n ],\n});\n\n/**\n * Dynamic Home Page\n * @public\n */\nexport const DynamicHomePage: React.ComponentType<DynamicHomePageProps> =\n dynamicHomePagePlugin.provide(\n createRoutableExtension({\n name: 'DynamicHomePage',\n component: () =>\n import('./components/DynamicHomePage').then(m => m.DynamicHomePage),\n mountPoint: rootRouteRef,\n }),\n );\n\n/**\n * @public\n */\nexport const SearchBar: React.ComponentType<SearchBarProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'SearchBar',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const QuickAccessCard: React.ComponentType<QuickAccessCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'QuickAccessCard',\n component: {\n lazy: () =>\n import('./components/QuickAccessCard').then(m => m.QuickAccessCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Headline: React.ComponentType<HeadlineProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'Headline',\n component: {\n lazy: () => import('./components/Headline').then(m => m.Headline),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Markdown: React.ComponentType<MarkdownProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'Markdown',\n component: {\n lazy: () => import('./components/Markdown').then(m => m.Markdown),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const MarkdownCard: React.ComponentType<MarkdownCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'MarkdownCard',\n component: {\n lazy: () =>\n import('./components/MarkdownCard').then(m => m.MarkdownCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Placeholder: React.ComponentType<PlaceholderProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'MarkdownCard',\n component: {\n lazy: () => import('./components/Placeholder').then(m => m.Placeholder),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const CatalogStarredEntitiesCard: React.ComponentType<StarredEntitiesProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'CatalogStarredEntitiesCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageStarredEntities),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const RecentlyVisitedCard: React.ComponentType<VisitedByTypeProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'RecentlyVisitedCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageRecentlyVisited),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const TopVisitedCard: React.ComponentType<VisitedByTypeProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'TopVisitedCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageTopVisited),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const FeaturedDocsCard: React.ComponentType<FeaturedDocsCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'FeaturedDocsCard',\n component: {\n lazy: () =>\n import('./components/FeaturedDocsCard').then(m => m.FeaturedDocsCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const JokeCard: React.ComponentType<{\n defaultCategory?: 'any' | 'programming';\n}> = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'JokeCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageRandomJoke),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const VisitListener = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'VisitListener',\n component: {\n lazy: () =>\n import('./components/VisitListener').then(m => m.VisitListener),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const WorldClock = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'WorldClock',\n component: {\n lazy: () => import('./components/WorldClock').then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AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,mCAA4B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAClE,GACD;AACH;AAKO,MAAM,aAAa,qBAAsB,CAAA,OAAA;AAAA,EAC9C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,YAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MAAM,OAAO,gCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU;AAAA;AACtE,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n identityApiRef,\n storageApiRef,\n} from '@backstage/core-plugin-api';\n\nimport {\n type StarredEntitiesProps,\n type VisitedByTypeProps,\n type FeaturedDocsCardProps,\n visitsApiRef,\n VisitsStorageApi,\n} from '@backstage/plugin-home';\n\nimport { QuickAccessApiClient, quickAccessApiRef } from './api';\nimport { rootRouteRef } from './routes';\n\nimport type { DynamicHomePageProps } from './components/DynamicHomePage';\nimport type { DynamicCustomizableHomePageProps } from './components/DynamicCustomizableHomePage';\nimport type { SearchBarProps } from './components/SearchBar';\nimport type { QuickAccessCardProps } from './components/QuickAccessCard';\nimport type { HeadlineProps } from './components/Headline';\nimport type { MarkdownProps } from './components/Markdown';\nimport type { MarkdownCardProps } from './components/MarkdownCard';\nimport type { PlaceholderProps } from './components/Placeholder';\n\nexport type { DynamicHomePageProps } from './components/DynamicHomePage';\nexport type { DynamicCustomizableHomePageProps } from './components/DynamicCustomizableHomePage';\nexport type { SearchBarProps } from './components/SearchBar';\nexport type { QuickAccessCardProps } from './components/QuickAccessCard';\nexport type { HeadlineProps } from './components/Headline';\nexport type { MarkdownProps } from './components/Markdown';\nexport type { MarkdownCardProps } from './components/MarkdownCard';\nexport type { PlaceholderProps } from './components/Placeholder';\nexport type { LocalClockProps } from './components/LocalClock';\nexport type { WorldClockProps } from './components/WorldClock';\n\n/**\n * Dynamic Home Page Plugin\n * @public\n */\nexport const dynamicHomePagePlugin = createPlugin({\n id: 'dynamic-home-page',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: quickAccessApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n configApi: configApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, configApi, identityApi }) =>\n new QuickAccessApiClient({ discoveryApi, configApi, identityApi }),\n }),\n createApiFactory({\n api: visitsApiRef,\n deps: {\n storageApi: storageApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ storageApi, identityApi }) =>\n VisitsStorageApi.create({ storageApi, identityApi }),\n }),\n ],\n});\n\n/**\n * Dynamic Home Page\n * @public\n */\nexport const DynamicHomePage: React.ComponentType<DynamicHomePageProps> =\n dynamicHomePagePlugin.provide(\n createRoutableExtension({\n name: 'DynamicHomePage',\n component: () =>\n import('./components/DynamicHomePage').then(m => m.DynamicHomePage),\n mountPoint: rootRouteRef,\n }),\n );\n\n/**\n * Customizable Dynamic Home Page\n * @public\n */\nexport const DynamicCustomizableHomePage: React.ComponentType<DynamicCustomizableHomePageProps> =\n dynamicHomePagePlugin.provide(\n createRoutableExtension({\n name: 'DynamicCustomizableHomePage',\n component: () =>\n import('./components/DynamicCustomizableHomePage').then(\n m => m.DynamicCustomizableHomePage,\n ),\n mountPoint: rootRouteRef,\n }),\n );\n\n/**\n * @public\n */\nexport const SearchBar: React.ComponentType<SearchBarProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'SearchBar',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const QuickAccessCard: React.ComponentType<QuickAccessCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'QuickAccessCard',\n component: {\n lazy: () =>\n import('./components/QuickAccessCard').then(m => m.QuickAccessCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Headline: React.ComponentType<HeadlineProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'Headline',\n component: {\n lazy: () => import('./components/Headline').then(m => m.Headline),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Markdown: React.ComponentType<MarkdownProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'Markdown',\n component: {\n lazy: () => import('./components/Markdown').then(m => m.Markdown),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const MarkdownCard: React.ComponentType<MarkdownCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'MarkdownCard',\n component: {\n lazy: () =>\n import('./components/MarkdownCard').then(m => m.MarkdownCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const Placeholder: React.ComponentType<PlaceholderProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'MarkdownCard',\n component: {\n lazy: () => import('./components/Placeholder').then(m => m.Placeholder),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const CatalogStarredEntitiesCard: React.ComponentType<StarredEntitiesProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'CatalogStarredEntitiesCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageStarredEntities),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const RecentlyVisitedCard: React.ComponentType<VisitedByTypeProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'RecentlyVisitedCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageRecentlyVisited),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const TopVisitedCard: React.ComponentType<VisitedByTypeProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'TopVisitedCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageTopVisited),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const FeaturedDocsCard: React.ComponentType<FeaturedDocsCardProps> =\n dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'FeaturedDocsCard',\n component: {\n lazy: () =>\n import('./components/FeaturedDocsCard').then(m => m.FeaturedDocsCard),\n },\n }),\n );\n\n/**\n * @public\n */\nexport const JokeCard: React.ComponentType<{\n defaultCategory?: 'any' | 'programming';\n}> = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'JokeCard',\n component: {\n lazy: () =>\n import('@backstage/plugin-home').then(m => m.HomePageRandomJoke),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const VisitListener = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'VisitListener',\n component: {\n lazy: () =>\n import('./components/VisitListener').then(m => m.VisitListener),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const WorldClock = dynamicHomePagePlugin.provide(\n createComponentExtension({\n name: 'WorldClock',\n component: {\n lazy: () => import('./components/WorldClock').then(m => m.WorldClock),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;AAgEO,MAAM,wBAAwB,YAAa,CAAA;AAAA,EAChD,EAAI,EAAA,mBAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA,GACR;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,iBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,SAAW,EAAA,YAAA;AAAA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EAAE,aAAa;AAAA;AAClE,GACD;AACH;AAKO,MAAM,aAAa,qBAAsB,CAAA,OAAA;AAAA,EAC9C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,YAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MAAM,OAAO,gCAAyB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,UAAU;AAAA;AACtE,GACD;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-dynamic-home-page",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -39,8 +39,8 @@
39
39
  "@backstage/plugin-home-react": "^0.1.22",
40
40
  "@backstage/plugin-search-react": "^1.8.5",
41
41
  "@backstage/theme": "^0.6.3",
42
- "@mui/material": "5.16.13",
43
- "@mui/styles": "5.16.13",
42
+ "@mui/material": "5.16.14",
43
+ "@mui/styles": "5.16.14",
44
44
  "@scalprum/react-core": "0.9.3",
45
45
  "react-grid-layout": "1.5.0",
46
46
  "react-use": "17.6.0",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "react": "16.13.1 || ^17.0.0 || ^18.2.0",
51
- "react-router-dom": "6.28.2"
51
+ "react-router-dom": "6.30.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@backstage/cli": "^0.29.5",