@backstage/plugin-home 0.9.10-next.2 → 0.9.10
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 +19 -0
- package/dist/components/StarredEntityListItem/StarredEntityListItem.esm.js +2 -4
- package/dist/components/StarredEntityListItem/StarredEntityListItem.esm.js.map +1 -1
- package/dist/components/VisitList/Context.esm.js +2 -4
- package/dist/components/VisitList/Context.esm.js.map +1 -1
- package/dist/homePageComponents/WorldClock/WorldClock.esm.js +1 -1
- package/dist/homePageComponents/WorldClock/WorldClock.esm.js.map +1 -1
- package/dist/homePageComponents/WorldClock/clocks.esm.js.map +1 -1
- package/dist/package.json.esm.js +1 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage/plugin-home
|
|
2
2
|
|
|
3
|
+
## 0.9.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
|
|
8
|
+
- d421187: Reduced the initial app bundle size by loading page and optional UI implementations only when their extensions render.
|
|
9
|
+
- bca8281: Fix clock configuration handling and use lazy initialization for the clocks state.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-components@0.18.14
|
|
12
|
+
- @backstage/catalog-client@1.16.2
|
|
13
|
+
- @backstage/catalog-model@1.10.1
|
|
14
|
+
- @backstage/core-app-api@1.20.5
|
|
15
|
+
- @backstage/plugin-catalog-react@3.2.3
|
|
16
|
+
- @backstage/config@1.3.9
|
|
17
|
+
- @backstage/frontend-plugin-api@0.18.1
|
|
18
|
+
- @backstage/plugin-home-react@0.1.42
|
|
19
|
+
- @backstage/core-compat-api@0.5.15
|
|
20
|
+
- @backstage/core-plugin-api@1.12.10
|
|
21
|
+
|
|
3
22
|
## 0.9.10-next.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -29,15 +29,13 @@ const StarredEntityListItem = ({
|
|
|
29
29
|
const { t } = useTranslationRef(homeTranslationRef);
|
|
30
30
|
let secondaryText = "";
|
|
31
31
|
if (showKind) {
|
|
32
|
-
secondaryText += entity.kind.
|
|
32
|
+
secondaryText += entity.kind.toLowerCase();
|
|
33
33
|
}
|
|
34
34
|
if (entity.spec && "type" in entity.spec) {
|
|
35
35
|
if (showKind) {
|
|
36
36
|
secondaryText += " \u2014 ";
|
|
37
37
|
}
|
|
38
|
-
secondaryText += entity.spec.type.
|
|
39
|
-
"en-US"
|
|
40
|
-
);
|
|
38
|
+
secondaryText += entity.spec.type.toLowerCase();
|
|
41
39
|
}
|
|
42
40
|
return /* @__PURE__ */ jsxs(
|
|
43
41
|
ListItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StarredEntityListItem.esm.js","sources":["../../../src/components/StarredEntityListItem/StarredEntityListItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\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 */\nimport { Entity } from '@backstage/catalog-model';\nimport {\n EntityDisplayName,\n entityRouteParams,\n} from '@backstage/plugin-catalog-react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { Link } from 'react-router-dom';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { FavoriteToggle } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { homeTranslationRef } from '../../translation';\n\ntype EntityListItemProps = {\n entity: Entity;\n onToggleStarredEntity: (entity: Entity) => void;\n showKind?: boolean;\n};\n\nconst useStyles = makeStyles(theme => ({\n listItem: {\n paddingBottom: theme.spacing(0),\n paddingTop: theme.spacing(0),\n },\n secondary: {\n textTransform: 'uppercase',\n },\n}));\n\nexport const StarredEntityListItem = ({\n entity,\n onToggleStarredEntity,\n showKind,\n}: EntityListItemProps) => {\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(homeTranslationRef);\n\n let secondaryText = '';\n if (showKind) {\n secondaryText += entity.kind.
|
|
1
|
+
{"version":3,"file":"StarredEntityListItem.esm.js","sources":["../../../src/components/StarredEntityListItem/StarredEntityListItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\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 */\nimport { Entity } from '@backstage/catalog-model';\nimport {\n EntityDisplayName,\n entityRouteParams,\n} from '@backstage/plugin-catalog-react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { Link } from 'react-router-dom';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { FavoriteToggle } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport { homeTranslationRef } from '../../translation';\n\ntype EntityListItemProps = {\n entity: Entity;\n onToggleStarredEntity: (entity: Entity) => void;\n showKind?: boolean;\n};\n\nconst useStyles = makeStyles(theme => ({\n listItem: {\n paddingBottom: theme.spacing(0),\n paddingTop: theme.spacing(0),\n },\n secondary: {\n textTransform: 'uppercase',\n },\n}));\n\nexport const StarredEntityListItem = ({\n entity,\n onToggleStarredEntity,\n showKind,\n}: EntityListItemProps) => {\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const { t } = useTranslationRef(homeTranslationRef);\n\n let secondaryText = '';\n if (showKind) {\n secondaryText += entity.kind.toLowerCase();\n }\n if (entity.spec && 'type' in entity.spec) {\n if (showKind) {\n secondaryText += ' — ';\n }\n secondaryText += (entity.spec as { type: string }).type.toLowerCase();\n }\n\n return (\n <ListItem\n dense\n className={classes.listItem}\n component={Link}\n button\n to={catalogEntityRoute(entityRouteParams(entity))}\n >\n <ListItemIcon\n // Prevent following the link when clicking on the icon\n onClick={e => {\n e.preventDefault();\n }}\n >\n <FavoriteToggle\n id={`remove-favorite-${entity.metadata.uid}`}\n title={t('starredEntityListItem.removeFavoriteEntityTitle')}\n isFavorite\n onToggle={() => onToggleStarredEntity(entity)}\n />\n </ListItemIcon>\n <ListItemText\n primary={<EntityDisplayName hideIcon entityRef={entity} />}\n secondary={secondaryText}\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAqCA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,QAAA,EAAU;AAAA,IACR,aAAA,EAAe,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC9B,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,GAC7B;AAAA,EACA,SAAA,EAAW;AAAA,IACT,aAAA,EAAe;AAAA;AAEnB,CAAA,CAAE,CAAA;AAEK,MAAM,wBAAwB,CAAC;AAAA,EACpC,MAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA,KAA2B;AACzB,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,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,YAAA;AAAA,UAAA;AAAA,YACC,yBAAS,GAAA,CAAC,iBAAA,EAAA,EAAkB,QAAA,EAAQ,IAAA,EAAC,WAAW,MAAA,EAAQ,CAAA;AAAA,YACxD,SAAA,EAAW;AAAA;AAAA;AACb;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -30,14 +30,12 @@ const defaultGetChipColor = (visit) => {
|
|
|
30
30
|
"domain",
|
|
31
31
|
"location"
|
|
32
32
|
];
|
|
33
|
-
const foundIndex = entityKinds.indexOf(
|
|
34
|
-
entity.kind.toLocaleLowerCase("en-US")
|
|
35
|
-
);
|
|
33
|
+
const foundIndex = entityKinds.indexOf(entity.kind.toLowerCase());
|
|
36
34
|
return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);
|
|
37
35
|
};
|
|
38
36
|
const defaultGetLabel = (visit) => {
|
|
39
37
|
const entity = maybeEntity(visit);
|
|
40
|
-
return (entity?.kind ?? "Other").
|
|
38
|
+
return (entity?.kind ?? "Other").toLowerCase();
|
|
41
39
|
};
|
|
42
40
|
const VisitDisplayContext = createContext({
|
|
43
41
|
getChipColor: defaultGetChipColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.esm.js","sources":["../../../src/components/VisitList/Context.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\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 { createContext, useContext, ReactNode } from 'react';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\n\n/**\n * Type definition for the chip color function\n * @public\n */\nexport type GetChipColorFunction = (visit: Visit) => string;\n\n/**\n * Type definition for the label function\n * @public\n */\nexport type GetLabelFunction = (visit: Visit) => string;\n\n/**\n * Context value interface\n * @public\n */\nexport interface VisitDisplayContextValue {\n getChipColor: GetChipColorFunction;\n getLabel: GetLabelFunction;\n}\n\n/**\n * Props for the VisitDisplayProvider\n * @public\n */\nexport interface VisitDisplayProviderProps {\n children: ReactNode;\n getChipColor?: GetChipColorFunction;\n getLabel?: GetLabelFunction;\n}\n\n// Default implementations\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\n\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\n\nconst defaultGetChipColor: GetChipColorFunction = (visit: Visit): string => {\n const defaultColor = getColorByIndex(0);\n const entity = maybeEntity(visit);\n if (!entity) return defaultColor;\n\n // IDEA: Use or replicate useAllKinds hook thus supporting all software catalog\n // registered kinds. See:\n // plugins/catalog-react/src/components/EntityKindPicker/kindFilterUtils.ts\n // Provide extension point to register your own color code.\n const entityKinds = [\n 'component',\n 'template',\n 'api',\n 'group',\n 'user',\n 'resource',\n 'system',\n 'domain',\n 'location',\n ];\n const foundIndex = entityKinds.indexOf(
|
|
1
|
+
{"version":3,"file":"Context.esm.js","sources":["../../../src/components/VisitList/Context.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\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 { createContext, useContext, ReactNode } from 'react';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\n\n/**\n * Type definition for the chip color function\n * @public\n */\nexport type GetChipColorFunction = (visit: Visit) => string;\n\n/**\n * Type definition for the label function\n * @public\n */\nexport type GetLabelFunction = (visit: Visit) => string;\n\n/**\n * Context value interface\n * @public\n */\nexport interface VisitDisplayContextValue {\n getChipColor: GetChipColorFunction;\n getLabel: GetLabelFunction;\n}\n\n/**\n * Props for the VisitDisplayProvider\n * @public\n */\nexport interface VisitDisplayProviderProps {\n children: ReactNode;\n getChipColor?: GetChipColorFunction;\n getLabel?: GetLabelFunction;\n}\n\n// Default implementations\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\n\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\n\nconst defaultGetChipColor: GetChipColorFunction = (visit: Visit): string => {\n const defaultColor = getColorByIndex(0);\n const entity = maybeEntity(visit);\n if (!entity) return defaultColor;\n\n // IDEA: Use or replicate useAllKinds hook thus supporting all software catalog\n // registered kinds. See:\n // plugins/catalog-react/src/components/EntityKindPicker/kindFilterUtils.ts\n // Provide extension point to register your own color code.\n const entityKinds = [\n 'component',\n 'template',\n 'api',\n 'group',\n 'user',\n 'resource',\n 'system',\n 'domain',\n 'location',\n ];\n const foundIndex = entityKinds.indexOf(entity.kind.toLowerCase());\n return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);\n};\n\nconst defaultGetLabel: GetLabelFunction = (visit: Visit): string => {\n const entity = maybeEntity(visit);\n return (entity?.kind ?? 'Other').toLowerCase();\n};\n\n// Create the context\nconst VisitDisplayContext = createContext<VisitDisplayContextValue>({\n getChipColor: defaultGetChipColor,\n getLabel: defaultGetLabel,\n});\n\n/**\n * Provider component for VisitDisplay customization\n * @public\n */\nexport const VisitDisplayProvider = ({\n children,\n getChipColor = defaultGetChipColor,\n getLabel = defaultGetLabel,\n}: VisitDisplayProviderProps) => {\n const value: VisitDisplayContextValue = {\n getChipColor,\n getLabel,\n };\n\n return (\n <VisitDisplayContext.Provider value={value}>\n {children}\n </VisitDisplayContext.Provider>\n );\n};\n\n/**\n * Hook to use the VisitDisplay context\n * @public\n */\nexport const useVisitDisplay = (): VisitDisplayContextValue => {\n const context = useContext(VisitDisplayContext);\n if (!context) {\n throw new Error(\n 'useVisitDisplay must be used within a VisitDisplayProvider',\n );\n }\n return context;\n};\n"],"names":[],"mappings":";;;;;AAqDA,MAAM,eAAA,GAAkB,CAAC,KAAA,KAAkB;AACzC,EAAA,MAAM,QAAA,GAAW,MAAA,CAAO,IAAA,CAAK,aAAa,CAAA;AAC1C,EAAA,MAAM,YAAA,GAAe,QAAQ,QAAA,CAAS,MAAA;AACtC,EAAA,OAAO,aAAA,CAAc,QAAA,CAAS,YAAY,CAAC,EAAE,CAAC,CAAA;AAChD,CAAA;AAEA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAgD;AACnE,EAAA,IAAI;AACF,IAAA,OAAO,cAAA,CAAe,KAAA,EAAO,SAAA,IAAa,EAAE,CAAA;AAAA,EAC9C,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAA;AAEA,MAAM,mBAAA,GAA4C,CAAC,KAAA,KAAyB;AAC1E,EAAA,MAAM,YAAA,GAAe,gBAAgB,CAAC,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,YAAY,KAAK,CAAA;AAChC,EAAA,IAAI,CAAC,QAAQ,OAAO,YAAA;AAMpB,EAAA,MAAM,WAAA,GAAc;AAAA,IAClB,WAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,aAAa,WAAA,CAAY,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,aAAa,CAAA;AAChE,EAAA,OAAO,UAAA,KAAe,EAAA,GAAK,YAAA,GAAe,eAAA,CAAgB,aAAa,CAAC,CAAA;AAC1E,CAAA;AAEA,MAAM,eAAA,GAAoC,CAAC,KAAA,KAAyB;AAClE,EAAA,MAAM,MAAA,GAAS,YAAY,KAAK,CAAA;AAChC,EAAA,OAAA,CAAQ,MAAA,EAAQ,IAAA,IAAQ,OAAA,EAAS,WAAA,EAAY;AAC/C,CAAA;AAGA,MAAM,sBAAsB,aAAA,CAAwC;AAAA,EAClE,YAAA,EAAc,mBAAA;AAAA,EACd,QAAA,EAAU;AACZ,CAAC,CAAA;AAMM,MAAM,uBAAuB,CAAC;AAAA,EACnC,QAAA;AAAA,EACA,YAAA,GAAe,mBAAA;AAAA,EACf,QAAA,GAAW;AACb,CAAA,KAAiC;AAC/B,EAAA,MAAM,KAAA,GAAkC;AAAA,IACtC,YAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,mBAAA,CAAoB,QAAA,EAApB,EAA6B,OAC3B,QAAA,EACH,CAAA;AAEJ;AAMO,MAAM,kBAAkB,MAAgC;AAC7D,EAAA,MAAM,OAAA,GAAU,WAAW,mBAAmB,CAAA;AAC9C,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;;;"}
|
|
@@ -22,7 +22,7 @@ const WorldClock = (props) => {
|
|
|
22
22
|
const { clockConfigs, customTimeFormat } = props;
|
|
23
23
|
const classes = useStyles();
|
|
24
24
|
const [clocks, setClocks] = useState(
|
|
25
|
-
getTimes(clockConfigs
|
|
25
|
+
() => getTimes(clockConfigs, customTimeFormat)
|
|
26
26
|
);
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (!clockConfigs?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorldClock.esm.js","sources":["../../../src/homePageComponents/WorldClock/WorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 { useState, useEffect } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { getTimes, type ClockConfig } from './clocks';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n fontWeight: theme.typography.fontWeightBold,\n fontSize: theme.typography.fontSize * 1.5,\n marginBottom: theme.spacing(0.5),\n lineHeight: 1,\n },\n value: {\n fontSize: theme.typography.fontSize * 1.5,\n lineHeight: 1,\n color: theme.palette.text.secondary,\n },\n}));\n\nexport const WorldClock = (props: {\n clockConfigs?: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n const classes = useStyles();\n const [clocks, setClocks] = useState(
|
|
1
|
+
{"version":3,"file":"WorldClock.esm.js","sources":["../../../src/homePageComponents/WorldClock/WorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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 { useState, useEffect } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { getTimes, type ClockConfig } from './clocks';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n fontWeight: theme.typography.fontWeightBold,\n fontSize: theme.typography.fontSize * 1.5,\n marginBottom: theme.spacing(0.5),\n lineHeight: 1,\n },\n value: {\n fontSize: theme.typography.fontSize * 1.5,\n lineHeight: 1,\n color: theme.palette.text.secondary,\n },\n}));\n\nexport const WorldClock = (props: {\n clockConfigs?: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n const classes = useStyles();\n const [clocks, setClocks] = useState(() =>\n getTimes(clockConfigs, customTimeFormat),\n );\n\n useEffect(() => {\n if (!clockConfigs?.length) {\n return undefined;\n }\n setClocks(getTimes(clockConfigs, customTimeFormat));\n const id = setInterval(() => {\n setClocks(getTimes(clockConfigs, customTimeFormat));\n }, 1000);\n return () => clearInterval(id);\n }, [clockConfigs, customTimeFormat]);\n\n if (!clockConfigs?.length) {\n return (\n <Typography color=\"textSecondary\">\n No clocks configured. Add clock configurations in your app-config.yaml\n to display world clocks.\n </Typography>\n );\n }\n\n return (\n <Grid container spacing={4}>\n {clocks.map(clock => (\n <Grid\n item\n key={clock.label}\n aria-label={`${clock.label}: ${clock.value}`}\n >\n <Typography className={classes.label}>{clock.label}</Typography>\n <Typography className={classes.value}>\n <time dateTime={clock.dateTime}>{clock.value}</time>\n </Typography>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,KAAA,EAAO;AAAA,IACL,UAAA,EAAY,MAAM,UAAA,CAAW,cAAA;AAAA,IAC7B,QAAA,EAAU,KAAA,CAAM,UAAA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S,IAAA,EAAC,SAAS,CAAA,EACtB,QAAA,EAAA,MAAA,CAAO,IAAI,CAAA,KAAA,qBACV,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAI,IAAA;AAAA,MAEJ,cAAY,CAAA,EAAG,KAAA,CAAM,KAAK,CAAA,EAAA,EAAK,MAAM,KAAK,CAAA,CAAA;AAAA,MAE1C,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,OAAA,CAAQ,KAAA,EAAQ,gBAAM,KAAA,EAAM,CAAA;AAAA,wBACnD,GAAA,CAAC,UAAA,EAAA,EAAW,SAAA,EAAW,OAAA,CAAQ,KAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,QAAA,EAAU,KAAA,CAAM,QAAA,EAAW,QAAA,EAAA,KAAA,CAAM,KAAA,EAAM,CAAA,EAC/C;AAAA;AAAA,KAAA;AAAA,IANK,KAAA,CAAM;AAAA,GAQd,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clocks.esm.js","sources":["../../../src/homePageComponents/WorldClock/clocks.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nexport type TimeObj = {\n label: string;\n value: string;\n dateTime: string;\n};\n\nconst defaultTimeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\nexport function getTimes(\n clockConfigs
|
|
1
|
+
{"version":3,"file":"clocks.esm.js","sources":["../../../src/homePageComponents/WorldClock/clocks.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\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/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nexport type TimeObj = {\n label: string;\n value: string;\n dateTime: string;\n};\n\nconst defaultTimeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\nexport function getTimes(\n clockConfigs?: ClockConfig[],\n customTimeFormat?: Intl.DateTimeFormatOptions,\n): TimeObj[] {\n const d = new Date();\n const lang = window.navigator.language;\n const clocks: TimeObj[] = [];\n\n if (!clockConfigs) {\n return clocks;\n }\n\n for (const clockConfig of clockConfigs) {\n let label = clockConfig.label;\n\n const options: Intl.DateTimeFormatOptions = {\n timeZone: clockConfig.timeZone,\n ...(customTimeFormat ?? defaultTimeFormat),\n };\n\n try {\n new Date().toLocaleString(lang, options);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\n `The timezone ${options.timeZone} is invalid. Defaulting to GMT`,\n );\n options.timeZone = 'GMT';\n label = 'GMT';\n }\n\n const value = d.toLocaleTimeString(lang, options);\n const dateTime = d.toLocaleTimeString(lang, {\n timeZone: options.timeZone,\n hour: '2-digit',\n minute: '2-digit',\n hour12: false,\n });\n clocks.push({ label, value, dateTime });\n }\n\n return clocks;\n}\n"],"names":[],"mappings":"AA4BA,MAAM,iBAAA,GAAgD;AAAA,EACpD,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ;AACV,CAAA;A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|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-home",
|
|
3
|
-
"version": "0.9.10
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"description": "A Backstage plugin that helps you build a home page",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
"test": "backstage-cli package test"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@backstage/catalog-client": "1.16.2
|
|
72
|
-
"@backstage/catalog-model": "1.10.
|
|
73
|
-
"@backstage/config": "1.3.9
|
|
74
|
-
"@backstage/core-app-api": "1.20.5
|
|
75
|
-
"@backstage/core-compat-api": "0.5.15
|
|
76
|
-
"@backstage/core-components": "0.18.14
|
|
77
|
-
"@backstage/core-plugin-api": "1.12.10
|
|
78
|
-
"@backstage/frontend-plugin-api": "0.18.1
|
|
79
|
-
"@backstage/plugin-catalog-react": "3.2.3
|
|
80
|
-
"@backstage/plugin-home-react": "0.1.42
|
|
81
|
-
"@backstage/theme": "0.7.3",
|
|
71
|
+
"@backstage/catalog-client": "^1.16.2",
|
|
72
|
+
"@backstage/catalog-model": "^1.10.1",
|
|
73
|
+
"@backstage/config": "^1.3.9",
|
|
74
|
+
"@backstage/core-app-api": "^1.20.5",
|
|
75
|
+
"@backstage/core-compat-api": "^0.5.15",
|
|
76
|
+
"@backstage/core-components": "^0.18.14",
|
|
77
|
+
"@backstage/core-plugin-api": "^1.12.10",
|
|
78
|
+
"@backstage/frontend-plugin-api": "^0.18.1",
|
|
79
|
+
"@backstage/plugin-catalog-react": "^3.2.3",
|
|
80
|
+
"@backstage/plugin-home-react": "^0.1.42",
|
|
81
|
+
"@backstage/theme": "^0.7.3",
|
|
82
82
|
"@material-ui/core": "^4.12.2",
|
|
83
83
|
"@material-ui/icons": "^4.9.1",
|
|
84
84
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
"zod": "^3.25.76 || ^4.0.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@backstage/cli": "0.36.6
|
|
98
|
-
"@backstage/dev-utils": "1.1.27
|
|
99
|
-
"@backstage/frontend-defaults": "0.5.6
|
|
100
|
-
"@backstage/plugin-catalog": "2.0.9
|
|
101
|
-
"@backstage/test-utils": "1.7.22
|
|
97
|
+
"@backstage/cli": "^0.36.6",
|
|
98
|
+
"@backstage/dev-utils": "^1.1.27",
|
|
99
|
+
"@backstage/frontend-defaults": "^0.5.6",
|
|
100
|
+
"@backstage/plugin-catalog": "^2.0.9",
|
|
101
|
+
"@backstage/test-utils": "^1.7.22",
|
|
102
102
|
"@testing-library/dom": "^10.0.0",
|
|
103
103
|
"@testing-library/jest-dom": "^6.0.0",
|
|
104
104
|
"@testing-library/react": "^16.0.0",
|