@backstage/plugin-home 0.8.1-next.1 → 0.8.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha.esm.js.map +1 -1
  4. package/dist/api/VisitsApi.esm.js.map +1 -1
  5. package/dist/api/VisitsStorageApi.esm.js.map +1 -1
  6. package/dist/api/VisitsWebStorageApi.esm.js.map +1 -1
  7. package/dist/api/config.esm.js.map +1 -1
  8. package/dist/assets/TemplateBackstageLogo.esm.js.map +1 -1
  9. package/dist/assets/TemplateBackstageLogoIcon.esm.js.map +1 -1
  10. package/dist/componentRenderers/ComponentAccordion.esm.js.map +1 -1
  11. package/dist/componentRenderers/ComponentTabs/ComponentTab.esm.js.map +1 -1
  12. package/dist/componentRenderers/ComponentTabs/ComponentTabs.esm.js.map +1 -1
  13. package/dist/components/CustomHomepage/AddWidgetDialog.esm.js.map +1 -1
  14. package/dist/components/CustomHomepage/CustomHomepageButtons.esm.js.map +1 -1
  15. package/dist/components/CustomHomepage/CustomHomepageGrid.esm.js.map +1 -1
  16. package/dist/components/CustomHomepage/WidgetSettingsOverlay.esm.js.map +1 -1
  17. package/dist/components/CustomHomepage/types.esm.js.map +1 -1
  18. package/dist/components/HomepageCompositionRoot.esm.js.map +1 -1
  19. package/dist/components/StarredEntityListItem/StarredEntityListItem.esm.js.map +1 -1
  20. package/dist/components/VisitList/ItemCategory.esm.js.map +1 -1
  21. package/dist/components/VisitList/ItemDetail.esm.js.map +1 -1
  22. package/dist/components/VisitList/ItemName.esm.js.map +1 -1
  23. package/dist/components/VisitList/VisitList.esm.js.map +1 -1
  24. package/dist/components/VisitList/VisitListItem.esm.js.map +1 -1
  25. package/dist/components/VisitList/VisitListSkeleton.esm.js.map +1 -1
  26. package/dist/components/VisitListener.esm.js.map +1 -1
  27. package/dist/deprecated.esm.js.map +1 -1
  28. package/dist/homePageComponents/CompanyLogo/CompanyLogo.esm.js.map +1 -1
  29. package/dist/homePageComponents/FeaturedDocsCard/Content.esm.js.map +1 -1
  30. package/dist/homePageComponents/HeaderWorldClock/HeaderWorldClock.esm.js.map +1 -1
  31. package/dist/homePageComponents/RandomJoke/Actions.esm.js.map +1 -1
  32. package/dist/homePageComponents/RandomJoke/Content.esm.js.map +1 -1
  33. package/dist/homePageComponents/RandomJoke/Context.esm.js.map +1 -1
  34. package/dist/homePageComponents/RandomJoke/Settings.esm.js.map +1 -1
  35. package/dist/homePageComponents/StarredEntities/Content.esm.js.map +1 -1
  36. package/dist/homePageComponents/Toolkit/Content.esm.js.map +1 -1
  37. package/dist/homePageComponents/Toolkit/Context.esm.js.map +1 -1
  38. package/dist/homePageComponents/VisitedByType/Actions.esm.js.map +1 -1
  39. package/dist/homePageComponents/VisitedByType/Content.esm.js.map +1 -1
  40. package/dist/homePageComponents/VisitedByType/Context.esm.js.map +1 -1
  41. package/dist/homePageComponents/VisitedByType/VisitedByType.esm.js.map +1 -1
  42. package/dist/homePageComponents/WelcomeTitle/WelcomeTitle.esm.js.map +1 -1
  43. package/dist/homePageComponents/WelcomeTitle/timeUtil.esm.js.map +1 -1
  44. package/dist/plugin.esm.js.map +1 -1
  45. package/dist/routes.esm.js.map +1 -1
  46. package/package.json +5 -5
@@ -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 React from 'react';\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';\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\n let secondaryText = '';\n if (showKind) {\n secondaryText += entity.kind.toLocaleLowerCase('en-US');\n }\n if (entity.spec && 'type' in entity.spec) {\n if (showKind) {\n secondaryText += ' — ';\n }\n secondaryText += (entity.spec as { type: string }).type.toLocaleLowerCase(\n 'en-US',\n );\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=\"Remove entity from favorites\"\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":";;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,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AA,KAAA;AACZ,UAAA,CAAA,CAAE,cAAe,EAAA,CAAA;AAAA,SACnB;AAAA,OAAA;AAAA,sBAEA,KAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA,CAAA,gBAAA,EAAmB,MAAO,CAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AAAA,UAC1C,KAAM,EAAA,8BAAA;AAAA,UACN,UAAU,EAAA,IAAA;AAAA,UACV,QAAA,EAAU,MAAM,qBAAA,CAAsB,MAAM,CAAA;AAAA,SAAA;AAAA,OAC9C;AAAA,KACF;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,yBAAU,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,QAAQ,EAAA,IAAA,EAAC,WAAW,MAAQ,EAAA,CAAA;AAAA,QACxD,SAAW,EAAA,aAAA;AAAA,OAAA;AAAA,KACb;AAAA,GACF,CAAA;AAEJ;;;;"}
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 React from 'react';\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';\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\n let secondaryText = '';\n if (showKind) {\n secondaryText += entity.kind.toLocaleLowerCase('en-US');\n }\n if (entity.spec && 'type' in entity.spec) {\n if (showKind) {\n secondaryText += ' — ';\n }\n secondaryText += (entity.spec as { type: string }).type.toLocaleLowerCase(\n 'en-US',\n );\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=\"Remove entity from favorites\"\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":";;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,QAAU,EAAA;AAAA,IACR,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC9B,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC7B;AAAA,EACA,SAAW,EAAA;AAAA,IACT,aAAe,EAAA;AAAA;AAEnB,CA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U,MAAM,qBAAA,CAAsB,MAAM;AAAA;AAAA;AAC9C,KACF;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,yBAAU,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,QAAQ,EAAA,IAAA,EAAC,WAAW,MAAQ,EAAA,CAAA;AAAA,QACxD,SAAW,EAAA;AAAA;AAAA;AACb,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ItemCategory.esm.js","sources":["../../../src/components/VisitList/ItemCategory.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 React from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(theme => ({\n chip: {\n color: theme.palette.common.white,\n fontWeight: 'bold',\n margin: 0,\n },\n}));\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\nconst getChipColor = (entity: CompoundEntityRef | undefined): string => {\n const defaultColor = getColorByIndex(0);\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(\n entity.kind.toLocaleLowerCase('en-US'),\n );\n return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);\n};\n\nexport const ItemCategory = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n const entity = maybeEntity(visit);\n\n return (\n <Chip\n size=\"small\"\n className={classes.chip}\n label={(entity?.kind ?? 'Other').toLocaleLowerCase('en-US')}\n style={{ background: getChipColor(entity) }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,UAAY,EAAA,MAAA;AAAA,IACZ,MAAQ,EAAA,CAAA;AAAA,GACV;AACF,CAAE,CAAA,CAAA,CAAA;AACF,MAAM,WAAA,GAAc,CAAC,KAAgD,KAAA;AACnE,EAAI,IAAA;AACF,IAAO,OAAA,cAAA,CAAe,KAAO,EAAA,SAAA,IAAa,EAAE,CAAA,CAAA;AAAA,WACrC,CAAG,EAAA;AACV,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACF,CAAA,CAAA;AACA,MAAM,eAAA,GAAkB,CAAC,KAAkB,KAAA;AACzC,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,IAAA,CAAK,aAAa,CAAA,CAAA;AAC1C,EAAM,MAAA,YAAA,GAAe,QAAQ,QAAS,CAAA,MAAA,CAAA;AACtC,EAAA,OAAO,aAAc,CAAA,QAAA,CAAS,YAAY,CAAC,EAAE,CAAC,CAAA,CAAA;AAChD,CAAA,CAAA;AACA,MAAM,YAAA,GAAe,CAAC,MAAkD,KAAA;AACtE,EAAM,MAAA,YAAA,GAAe,gBAAgB,CAAC,CAAA,CAAA;AACtC,EAAI,IAAA,CAAC,QAAe,OAAA,YAAA,CAAA;AAMpB,EAAA,MAAM,WAAc,GAAA;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,UAAA;AAAA,GACF,CAAA;AACA,EAAA,MAAM,aAAa,WAAY,CAAA,OAAA;AAAA,IAC7B,MAAA,CAAO,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,GACvC,CAAA;AACA,EAAA,OAAO,UAAe,KAAA,CAAA,CAAA,GAAK,YAAe,GAAA,eAAA,CAAgB,aAAa,CAAC,CAAA,CAAA;AAC1E,CAAA,CAAA;AAEO,MAAM,YAAe,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,MAAA,GAAS,YAAY,KAAK,CAAA,CAAA;AAEhC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB,KAAQ,EAAA,CAAA,MAAA,EAAQ,IAAQ,IAAA,OAAA,EAAS,kBAAkB,OAAO,CAAA;AAAA,MAC1D,KAAO,EAAA,EAAE,UAAY,EAAA,YAAA,CAAa,MAAM,CAAE,EAAA;AAAA,KAAA;AAAA,GAC5C,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ItemCategory.esm.js","sources":["../../../src/components/VisitList/ItemCategory.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 React from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(theme => ({\n chip: {\n color: theme.palette.common.white,\n fontWeight: 'bold',\n margin: 0,\n },\n}));\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\nconst getChipColor = (entity: CompoundEntityRef | undefined): string => {\n const defaultColor = getColorByIndex(0);\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(\n entity.kind.toLocaleLowerCase('en-US'),\n );\n return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);\n};\n\nexport const ItemCategory = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n const entity = maybeEntity(visit);\n\n return (\n <Chip\n size=\"small\"\n className={classes.chip}\n label={(entity?.kind ?? 'Other').toLocaleLowerCase('en-US')}\n style={{ background: getChipColor(entity) }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,SAAA,GAA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EAA8B,KAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,MAAA,GAAS,YAAY,KAAK,CAAA;AAEhC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB,KAAQ,EAAA,CAAA,MAAA,EAAQ,IAAQ,IAAA,OAAA,EAAS,kBAAkB,OAAO,CAAA;AAAA,MAC1D,KAAO,EAAA,EAAE,UAAY,EAAA,YAAA,CAAa,MAAM,CAAE;AAAA;AAAA,GAC5C;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ItemDetail.esm.js","sources":["../../../src/components/VisitList/ItemDetail.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { Visit } from '../../api/VisitsApi';\nimport { DateTime } from 'luxon';\n\nconst ItemDetailHits = ({ visit }: { visit: Visit }) => (\n <Typography component=\"span\" variant=\"caption\" color=\"textSecondary\">\n {visit.hits} time{visit.hits > 1 ? 's' : ''}\n </Typography>\n);\n\nconst ItemDetailTimeAgo = ({ visit }: { visit: Visit }) => {\n const visitDate = DateTime.fromMillis(visit.timestamp);\n\n return (\n <Typography\n component=\"time\"\n variant=\"caption\"\n color=\"textSecondary\"\n dateTime={visitDate.toISO() ?? undefined}\n >\n {visitDate.toRelative()}\n </Typography>\n );\n};\n\nexport type ItemDetailType = 'time-ago' | 'hits';\n\nexport const ItemDetail = ({\n visit,\n type,\n}: {\n visit: Visit;\n type: ItemDetailType;\n}) =>\n type === 'time-ago' ? (\n <ItemDetailTimeAgo visit={visit} />\n ) : (\n <ItemDetailHits visit={visit} />\n );\n"],"names":[],"mappings":";;;;AAqBA,MAAM,cAAA,GAAiB,CAAC,EAAE,KAAA,uBACvB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAU,MAAO,EAAA,OAAA,EAAQ,WAAU,KAAM,EAAA,eAAA,EAAA,EAClD,MAAM,IAAK,EAAA,OAAA,EAAM,MAAM,IAAO,GAAA,CAAA,GAAI,MAAM,EAC3C,CAAA,CAAA;AAGF,MAAM,iBAAoB,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AACzD,EAAA,MAAM,SAAY,GAAA,QAAA,CAAS,UAAW,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAErD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,OAAQ,EAAA,SAAA;AAAA,MACR,KAAM,EAAA,eAAA;AAAA,MACN,QAAA,EAAU,SAAU,CAAA,KAAA,EAAW,IAAA,KAAA,CAAA;AAAA,KAAA;AAAA,IAE9B,UAAU,UAAW,EAAA;AAAA,GACxB,CAAA;AAEJ,CAAA,CAAA;AAIO,MAAM,aAAa,CAAC;AAAA,EACzB,KAAA;AAAA,EACA,IAAA;AACF,CAIE,KAAA,IAAA,KAAS,6BACN,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,OAAc,CAEjC,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAc,EAAA;;;;"}
1
+ {"version":3,"file":"ItemDetail.esm.js","sources":["../../../src/components/VisitList/ItemDetail.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { Visit } from '../../api/VisitsApi';\nimport { DateTime } from 'luxon';\n\nconst ItemDetailHits = ({ visit }: { visit: Visit }) => (\n <Typography component=\"span\" variant=\"caption\" color=\"textSecondary\">\n {visit.hits} time{visit.hits > 1 ? 's' : ''}\n </Typography>\n);\n\nconst ItemDetailTimeAgo = ({ visit }: { visit: Visit }) => {\n const visitDate = DateTime.fromMillis(visit.timestamp);\n\n return (\n <Typography\n component=\"time\"\n variant=\"caption\"\n color=\"textSecondary\"\n dateTime={visitDate.toISO() ?? undefined}\n >\n {visitDate.toRelative()}\n </Typography>\n );\n};\n\nexport type ItemDetailType = 'time-ago' | 'hits';\n\nexport const ItemDetail = ({\n visit,\n type,\n}: {\n visit: Visit;\n type: ItemDetailType;\n}) =>\n type === 'time-ago' ? (\n <ItemDetailTimeAgo visit={visit} />\n ) : (\n <ItemDetailHits visit={visit} />\n );\n"],"names":[],"mappings":";;;;AAqBA,MAAM,cAAA,GAAiB,CAAC,EAAE,KAAA,uBACvB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAU,MAAO,EAAA,OAAA,EAAQ,WAAU,KAAM,EAAA,eAAA,EAAA,EAClD,MAAM,IAAK,EAAA,OAAA,EAAM,MAAM,IAAO,GAAA,CAAA,GAAI,MAAM,EAC3C,CAAA;AAGF,MAAM,iBAAoB,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AACzD,EAAA,MAAM,SAAY,GAAA,QAAA,CAAS,UAAW,CAAA,KAAA,CAAM,SAAS,CAAA;AAErD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,OAAQ,EAAA,SAAA;AAAA,MACR,KAAM,EAAA,eAAA;AAAA,MACN,QAAA,EAAU,SAAU,CAAA,KAAA,EAAW,IAAA,KAAA;AAAA,KAAA;AAAA,IAE9B,UAAU,UAAW;AAAA,GACxB;AAEJ,CAAA;AAIO,MAAM,aAAa,CAAC;AAAA,EACzB,KAAA;AAAA,EACA;AACF,CAIE,KAAA,IAAA,KAAS,6BACN,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,OAAc,CAEjC,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAc,EAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ItemName.esm.js","sources":["../../../src/components/VisitList/ItemName.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles(_theme => ({\n name: {\n marginLeft: '0.8rem',\n marginRight: '0.8rem',\n },\n}));\nexport const ItemName = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n\n return (\n <Typography\n component={Link}\n to={visit.pathname}\n noWrap\n className={classes.name}\n >\n {visit.name}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,QAAA;AAAA,IACZ,WAAa,EAAA,QAAA;AAAA,GACf;AACF,CAAE,CAAA,CAAA,CAAA;AACK,MAAM,QAAW,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AACvD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,IAAI,KAAM,CAAA,QAAA;AAAA,MACV,MAAM,EAAA,IAAA;AAAA,MACN,WAAW,OAAQ,CAAA,IAAA;AAAA,KAAA;AAAA,IAElB,KAAM,CAAA,IAAA;AAAA,GACT,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ItemName.esm.js","sources":["../../../src/components/VisitList/ItemName.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 React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles(_theme => ({\n name: {\n marginLeft: '0.8rem',\n marginRight: '0.8rem',\n },\n}));\nexport const ItemName = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n\n return (\n <Typography\n component={Link}\n to={visit.pathname}\n noWrap\n className={classes.name}\n >\n {visit.name}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,QAAA;AAAA,IACZ,WAAa,EAAA;AAAA;AAEjB,CAAE,CAAA,CAAA;AACK,MAAM,QAAW,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AACvD,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,IAAI,KAAM,CAAA,QAAA;AAAA,MACV,MAAM,EAAA,IAAA;AAAA,MACN,WAAW,OAAQ,CAAA;AAAA,KAAA;AAAA,IAElB,KAAM,CAAA;AAAA,GACT;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisitList.esm.js","sources":["../../../src/components/VisitList/VisitList.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 React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport List from '@material-ui/core/List';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitListItem } from './VisitListItem';\nimport { ItemDetailType } from './ItemDetail';\nimport { VisitListEmpty } from './VisitListEmpty';\nimport { VisitListFew } from './VisitListFew';\nimport { VisitListSkeleton } from './VisitListSkeleton';\n\nexport const VisitList = ({\n detailType,\n visits = [],\n numVisitsOpen = 3,\n numVisitsTotal = 8,\n collapsed = true,\n loading = false,\n title = '',\n}: {\n detailType: ItemDetailType;\n visits?: Visit[];\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n collapsed?: boolean;\n loading?: boolean;\n title?: string;\n}) => {\n let listBody: React.ReactElement = <></>;\n if (loading) {\n listBody = (\n <VisitListSkeleton\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n collapsed={collapsed}\n />\n );\n } else if (visits.length === 0) {\n listBody = <VisitListEmpty />;\n } else if (visits.length < numVisitsOpen) {\n listBody = (\n <>\n {visits.map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n <VisitListFew />\n </>\n );\n } else {\n listBody = (\n <>\n {visits.slice(0, numVisitsOpen).map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n {visits.length > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => (\n <VisitListItem\n visit={visit}\n key={index}\n detailType={detailType}\n />\n ))}\n </Collapse>\n )}\n </>\n );\n }\n\n return (\n <>\n {title && <h5>{title}</h5>}\n <List dense disablePadding>\n {listBody}\n </List>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,YAAY,CAAC;AAAA,EACxB,UAAA;AAAA,EACA,SAAS,EAAC;AAAA,EACV,aAAgB,GAAA,CAAA;AAAA,EAChB,cAAiB,GAAA,CAAA;AAAA,EACjB,SAAY,GAAA,IAAA;AAAA,EACZ,OAAU,GAAA,KAAA;AAAA,EACV,KAAQ,GAAA,EAAA;AACV,CAQM,KAAA;AACJ,EAAA,IAAI,2BAAiC,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA,CAAA;AACrC,EAAA,IAAI,OAAS,EAAA;AACX,IACE,QAAA,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,aAAA;AAAA,QACA,cAAA;AAAA,QACA,SAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ,MAAA,IAAW,MAAO,CAAA,MAAA,KAAW,CAAG,EAAA;AAC9B,IAAA,QAAA,uCAAY,cAAe,EAA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CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"VisitList.esm.js","sources":["../../../src/components/VisitList/VisitList.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 React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport List from '@material-ui/core/List';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitListItem } from './VisitListItem';\nimport { ItemDetailType } from './ItemDetail';\nimport { VisitListEmpty } from './VisitListEmpty';\nimport { VisitListFew } from './VisitListFew';\nimport { VisitListSkeleton } from './VisitListSkeleton';\n\nexport const VisitList = ({\n detailType,\n visits = [],\n numVisitsOpen = 3,\n numVisitsTotal = 8,\n collapsed = true,\n loading = false,\n title = '',\n}: {\n detailType: ItemDetailType;\n visits?: Visit[];\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n collapsed?: boolean;\n loading?: boolean;\n title?: string;\n}) => {\n let listBody: React.ReactElement = <></>;\n if (loading) {\n listBody = (\n <VisitListSkeleton\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n collapsed={collapsed}\n />\n );\n } else if (visits.length === 0) {\n listBody = <VisitListEmpty />;\n } else if (visits.length < numVisitsOpen) {\n listBody = (\n <>\n {visits.map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n <VisitListFew />\n </>\n );\n } else {\n listBody = (\n <>\n {visits.slice(0, numVisitsOpen).map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n {visits.length > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => (\n <VisitListItem\n visit={visit}\n key={index}\n detailType={detailType}\n />\n ))}\n </Collapse>\n )}\n </>\n );\n }\n\n return (\n <>\n {title && <h5>{title}</h5>}\n <List dense disablePadding>\n {listBody}\n </List>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,YAAY,CAAC;AAAA,EACxB,UAAA;AAAA,EACA,SAAS,EAAC;AAAA,EACV,aAAgB,GAAA,CAAA;AAAA,EAChB,cAAiB,GAAA,CAAA;AAAA,EACjB,SAAY,GAAA,IAAA;AAAA,EACZ,OAAU,GAAA,KAAA;AAAA,EACV,KAAQ,GAAA;AACV,CAQM,KAAA;AACJ,EAAA,IAAI,2BAAiC,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA;AACrC,EAAA,IAAI,OAAS,EAAA;AACX,IACE,QAAA,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,aAAA;AAAA,QACA,cAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,GAEJ,MAAA,IAAW,MAAO,CAAA,MAAA,KAAW,CAAG,EAAA;AAC9B,IAAA,QAAA,uCAAY,cAAe,EAAA,IAAA,CAAA;AAAA,GAC7B,MAAA,IAAW,MAAO,CAAA,MAAA,GAAS,aAAe,EAAA;AACxC,IAAA,QAAA,6DAEK,MAAO,CAAA,GAAA,CAAI,CAAC,KAAA,EAAO,0BACjB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,KAAc,EAAA,GAAA,EAAK,OAAO,UAAwB,EAAA,CAClE,CACD,kBAAA,KAAA,CAAA,aAAA,CAAC,kBAAa,CAChB,CAAA;AAAA,GAEG,MAAA;AACL,IAAA,QAAA,mBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAA,CAAO,KAAM,CAAA,CAAA,EAAG,aAAa,CAAE,CAAA,GAAA,CAAI,CAAC,KAAA,EAAO,0BACzC,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,KAAc,EAAA,GAAA,EAAK,OAAO,UAAwB,EAAA,CAClE,CACA,EAAA,MAAA,CAAO,MAAS,GAAA,aAAA,oBACd,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,IAAI,CAAC,SAAA,EAAA,EACZ,MAAO,CAAA,KAAA,CAAM,eAAe,cAAc,CAAA,CAAE,GAAI,CAAA,CAAC,OAAO,KACvD,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,GAAK,EAAA,KAAA;AAAA,QACL;AAAA;AAAA,KAEH,CACH,CAEJ,CAAA;AAAA;AAIJ,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,KAAA,oBAAU,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAI,KAAM,CAAA,kBACpB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,KAAK,EAAA,IAAA,EAAC,cAAc,EAAA,IAAA,EAAA,EACvB,QACH,CACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisitListItem.esm.js","sources":["../../../src/components/VisitList/VisitListItem.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 React from 'react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { ItemName } from './ItemName';\nimport { ItemDetail, ItemDetailType } from './ItemDetail';\nimport { ItemCategory } from './ItemCategory';\n\nconst useStyles = makeStyles(_theme => ({\n avatar: {\n minWidth: 0,\n },\n}));\nexport const VisitListItem = ({\n visit,\n detailType,\n}: {\n visit: Visit;\n detailType: ItemDetailType;\n}) => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar className={classes.avatar}>\n <ItemCategory visit={visit} />\n </ListItemAvatar>\n <ListItemText\n primary={<ItemName visit={visit} />}\n secondary={<ItemDetail visit={visit} type={detailType} />}\n disableTypography\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAE,CAAA,CAAA,CAAA;AACK,MAAM,gBAAgB,CAAC;AAAA,EAC5B,KAAA;AAAA,EACA,UAAA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,SAAW,EAAA,OAAA,CAAQ,MACjC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAc,CAC9B,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAc,EAAA,CAAA;AAAA,MACjC,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAc,MAAM,UAAY,EAAA,CAAA;AAAA,MACvD,iBAAiB,EAAA,IAAA;AAAA,KAAA;AAAA,GAErB,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"VisitListItem.esm.js","sources":["../../../src/components/VisitList/VisitListItem.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 React from 'react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { ItemName } from './ItemName';\nimport { ItemDetail, ItemDetailType } from './ItemDetail';\nimport { ItemCategory } from './ItemCategory';\n\nconst useStyles = makeStyles(_theme => ({\n avatar: {\n minWidth: 0,\n },\n}));\nexport const VisitListItem = ({\n visit,\n detailType,\n}: {\n visit: Visit;\n detailType: ItemDetailType;\n}) => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar className={classes.avatar}>\n <ItemCategory visit={visit} />\n </ListItemAvatar>\n <ListItemText\n primary={<ItemName visit={visit} />}\n secondary={<ItemDetail visit={visit} type={detailType} />}\n disableTypography\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA;AAAA;AAEd,CAAE,CAAA,CAAA;AACK,MAAM,gBAAgB,CAAC;AAAA,EAC5B,KAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,SAAW,EAAA,OAAA,CAAQ,MACjC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAc,CAC9B,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAc,EAAA,CAAA;AAAA,MACjC,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAc,MAAM,UAAY,EAAA,CAAA;AAAA,MACvD,iBAAiB,EAAA;AAAA;AAAA,GAErB,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisitListSkeleton.esm.js","sources":["../../../src/components/VisitList/VisitListSkeleton.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 React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nconst useStyles = makeStyles(_theme => ({\n skeleton: {\n borderRadius: 30,\n },\n}));\n\nconst VisitListItemSkeleton = () => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar>\n <Skeleton\n className={classes.skeleton}\n variant=\"rect\"\n width={50}\n height={24}\n />\n </ListItemAvatar>\n <ListItemText\n primary={<Skeleton variant=\"text\" width=\"100%\" height={28} />}\n disableTypography\n />\n </ListItem>\n );\n};\n\nexport const VisitListSkeleton = ({\n numVisitsOpen,\n numVisitsTotal,\n collapsed,\n}: {\n numVisitsOpen: number;\n numVisitsTotal: number;\n collapsed: boolean;\n}) => (\n <>\n {Array(numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n {numVisitsTotal > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {Array(numVisitsTotal - numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n </Collapse>\n )}\n </>\n);\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,QAAU,EAAA;AAAA,IACR,YAAc,EAAA,EAAA;AAAA,GAChB;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,MAAM,wBAAwB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,sCACrB,cACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,QAAA;AAAA,MACnB,OAAQ,EAAA,MAAA;AAAA,MACR,KAAO,EAAA,EAAA;AAAA,MACP,MAAQ,EAAA,EAAA;AAAA,KAAA;AAAA,GAEZ,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,sCAAU,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAQ,EAAI,EAAA,CAAA;AAAA,MAC3D,iBAAiB,EAAA,IAAA;AAAA,KAAA;AAAA,GAErB,CAAA,CAAA;AAEJ,CAAA,CAAA;AAEO,MAAM,oBAAoB,CAAC;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AACF,CAAA,+DAMK,KAAM,CAAA,aAAa,EACjB,IAAK,CAAA,IAAI,EACT,GAAI,CAAA,CAAC,EAAI,EAAA,KAAA,yCACP,qBAAsB,EAAA,EAAA,GAAA,EAAK,OAAO,CACpC,CAAA,EACF,iBAAiB,aAChB,oBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,EAAA,EAAI,CAAC,SACZ,EAAA,EAAA,KAAA,CAAM,iBAAiB,aAAa,CAAA,CAClC,KAAK,IAAI,CAAA,CACT,IAAI,CAAC,EAAA,EAAI,0BACP,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAsB,KAAK,KAAO,EAAA,CACpC,CACL,CAEJ;;;;"}
1
+ {"version":3,"file":"VisitListSkeleton.esm.js","sources":["../../../src/components/VisitList/VisitListSkeleton.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 React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nconst useStyles = makeStyles(_theme => ({\n skeleton: {\n borderRadius: 30,\n },\n}));\n\nconst VisitListItemSkeleton = () => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar>\n <Skeleton\n className={classes.skeleton}\n variant=\"rect\"\n width={50}\n height={24}\n />\n </ListItemAvatar>\n <ListItemText\n primary={<Skeleton variant=\"text\" width=\"100%\" height={28} />}\n disableTypography\n />\n </ListItem>\n );\n};\n\nexport const VisitListSkeleton = ({\n numVisitsOpen,\n numVisitsTotal,\n collapsed,\n}: {\n numVisitsOpen: number;\n numVisitsTotal: number;\n collapsed: boolean;\n}) => (\n <>\n {Array(numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n {numVisitsTotal > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {Array(numVisitsTotal - numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n </Collapse>\n )}\n </>\n);\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,QAAU,EAAA;AAAA,IACR,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEF,MAAM,wBAAwB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,sCACrB,cACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,QAAA;AAAA,MACnB,OAAQ,EAAA,MAAA;AAAA,MACR,KAAO,EAAA,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA;AAAA,GAEZ,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,sCAAU,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAQ,EAAI,EAAA,CAAA;AAAA,MAC3D,iBAAiB,EAAA;AAAA;AAAA,GAErB,CAAA;AAEJ,CAAA;AAEO,MAAM,oBAAoB,CAAC;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,+DAMK,KAAM,CAAA,aAAa,EACjB,IAAK,CAAA,IAAI,EACT,GAAI,CAAA,CAAC,EAAI,EAAA,KAAA,yCACP,qBAAsB,EAAA,EAAA,GAAA,EAAK,OAAO,CACpC,CAAA,EACF,iBAAiB,aAChB,oBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,EAAA,EAAI,CAAC,SACZ,EAAA,EAAA,KAAA,CAAM,iBAAiB,aAAa,CAAA,CAClC,KAAK,IAAI,CAAA,CACT,IAAI,CAAC,EAAA,EAAI,0BACP,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAsB,KAAK,KAAO,EAAA,CACpC,CACL,CAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisitListener.esm.js","sources":["../../src/components/VisitListener.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 React, { useEffect } from 'react';\n\nimport { useLocation } from 'react-router-dom';\n\nimport { visitsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * This function returns an implementation of toEntityRef which is responsible\n * for receiving a pathname and maybe returning an entityRef compatible with the\n * catalog-model.\n * By default this function uses the url root \"/catalog\" and the\n * stringifyEntityRef implementation from catalog-model.\n * Example:\n * const toEntityRef = getToEntityRef();\n * toEntityRef(\\{ pathname: \"/catalog/default/component/playback-order\" \\})\n * // returns \"component:default/playback-order\"\n */\nconst getToEntityRef =\n ({\n rootPath = 'catalog',\n stringifyEntityRefImpl = stringifyEntityRef,\n } = {}) =>\n ({ pathname }: { pathname: string }): string | undefined => {\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n const result = regex.exec(pathname);\n if (!result || !result?.groups) return undefined;\n const entity = {\n namespace: result.groups.namespace,\n kind: result.groups.kind,\n name: result.groups.name,\n };\n return stringifyEntityRefImpl(entity);\n };\n\n/**\n * @internal\n * This function returns an implementation of visitName which is responsible\n * for receiving a pathname and returning a string (name).\n */\nconst getVisitName =\n ({ rootPath = 'catalog', document = global.document } = {}) =>\n ({ pathname }: { pathname: string }) => {\n // If it is a catalog entity, get the name from the path\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n let result = regex.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // If it is a root pathname, get the name from there\n result = /^\\/(?<name>[^\\/]+)$/.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // Fallback to document title\n return document.title;\n };\n\n/**\n * @public\n * Component responsible for listening to location changes and calling\n * the visitsApi to save visits.\n */\nexport const VisitListener = ({\n children,\n toEntityRef,\n visitName,\n}: {\n children?: React.ReactNode;\n toEntityRef?: ({ pathname }: { pathname: string }) => string | undefined;\n visitName?: ({ pathname }: { pathname: string }) => string;\n}): JSX.Element => {\n const visitsApi = useApi(visitsApiRef);\n const { pathname } = useLocation();\n const toEntityRefImpl = toEntityRef ?? getToEntityRef();\n const visitNameImpl = visitName ?? getVisitName();\n useEffect(() => {\n // Wait for the browser to finish with paint with the assumption react\n // has finished with dom reconciliation.\n const requestId = requestAnimationFrame(() => {\n visitsApi.save({\n visit: {\n name: visitNameImpl({ pathname }),\n pathname,\n entityRef: toEntityRefImpl({ pathname }),\n },\n });\n });\n return () => cancelAnimationFrame(requestId);\n }, [visitsApi, pathname, toEntityRefImpl, visitNameImpl]);\n\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;AAkCA,MAAM,iBACJ,CAAC;AAAA,EACC,QAAW,GAAA,SAAA;AAAA,EACX,sBAAyB,GAAA,kBAAA;AAC3B,CAAA,GAAI,EAAC,KACL,CAAC,EAAE,UAAyD,KAAA;AAC1D,EAAA,MAAM,QAAQ,IAAI,MAAA;AAAA,IAChB,KAAM,QAAQ,CAAA,kDAAA,CAAA;AAAA,GAChB,CAAA;AACA,EAAM,MAAA,MAAA,GAAS,KAAM,CAAA,IAAA,CAAK,QAAQ,CAAA,CAAA;AAClC,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,MAAA,EAAQ,QAAe,OAAA,KAAA,CAAA,CAAA;AACvC,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,SAAA,EAAW,OAAO,MAAO,CAAA,SAAA;AAAA,IACzB,IAAA,EAAM,OAAO,MAAO,CAAA,IAAA;AAAA,IACpB,IAAA,EAAM,OAAO,MAAO,CAAA,IAAA;AAAA,GACtB,CAAA;AACA,EAAA,OAAO,uBAAuB,MAAM,CAAA,CAAA;AACtC,CAAA,CAAA;AAOF,MAAM,YACJ,GAAA,CAAC,EAAE,QAAA,GAAW,WAAW,QAAW,GAAA,MAAA,CAAO,QAAS,EAAA,GAAI,EAAC,KACzD,CAAC,EAAE,UAAqC,KAAA;AAEtC,EAAA,MAAM,QAAQ,IAAI,MAAA;AAAA,IAChB,KAAM,QAAQ,CAAA,kDAAA,CAAA;AAAA,GAChB,CAAA;AACA,EAAI,IAAA,MAAA,GAAS,KAAM,CAAA,IAAA,CAAK,QAAQ,CAA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023 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 React, { useEffect } from 'react';\n\nimport { useLocation } from 'react-router-dom';\n\nimport { visitsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * This function returns an implementation of toEntityRef which is responsible\n * for receiving a pathname and maybe returning an entityRef compatible with the\n * catalog-model.\n * By default this function uses the url root \"/catalog\" and the\n * stringifyEntityRef implementation from catalog-model.\n * Example:\n * const toEntityRef = getToEntityRef();\n * toEntityRef(\\{ pathname: \"/catalog/default/component/playback-order\" \\})\n * // returns \"component:default/playback-order\"\n */\nconst getToEntityRef =\n ({\n rootPath = 'catalog',\n stringifyEntityRefImpl = stringifyEntityRef,\n } = {}) =>\n ({ pathname }: { pathname: string }): string | undefined => {\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n const result = regex.exec(pathname);\n if (!result || !result?.groups) return undefined;\n const entity = {\n namespace: result.groups.namespace,\n kind: result.groups.kind,\n name: result.groups.name,\n };\n return stringifyEntityRefImpl(entity);\n };\n\n/**\n * @internal\n * This function returns an implementation of visitName which is responsible\n * for receiving a pathname and returning a string (name).\n */\nconst getVisitName =\n ({ rootPath = 'catalog', document = global.document } = {}) =>\n ({ pathname }: { pathname: string }) => {\n // If it is a catalog entity, get the name from the path\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n let result = regex.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // If it is a root pathname, get the name from there\n result = /^\\/(?<name>[^\\/]+)$/.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // Fallback to document title\n return document.title;\n };\n\n/**\n * @public\n * Component responsible for listening to location changes and calling\n * the visitsApi to save visits.\n */\nexport const VisitListener = ({\n children,\n toEntityRef,\n visitName,\n}: {\n children?: React.ReactNode;\n toEntityRef?: ({ pathname }: { pathname: string }) => string | undefined;\n visitName?: ({ pathname }: { pathname: string }) => string;\n}): JSX.Element => {\n const visitsApi = useApi(visitsApiRef);\n const { pathname } = useLocation();\n const toEntityRefImpl = toEntityRef ?? getToEntityRef();\n const visitNameImpl = visitName ?? getVisitName();\n useEffect(() => {\n // Wait for the browser to finish with paint with the assumption react\n // has finished with dom reconciliation.\n const requestId = requestAnimationFrame(() => {\n visitsApi.save({\n visit: {\n name: visitNameImpl({ pathname }),\n pathname,\n entityRef: toEntityRefImpl({ pathname }),\n },\n });\n });\n return () => cancelAnimationFrame(requestId);\n }, [visitsApi, pathname, toEntityRefImpl, visitNameImpl]);\n\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;AAkCA,MAAM,iBACJ,CAAC;AAAA,EACC,QAAW,GAAA,SAAA;AAAA,EACX,sBAAyB,GAAA;AAC3B,CAAA,GAAI,EAAC,KACL,CAAC,EAAE,UAAyD,KAAA;AAC1D,EAAA,MAAM,QAAQ,IAAI,MAAA;AAAA,IAChB,KAAM,QAAQ,CAAA,kDAAA;AAAA,GAChB;AACA,EAAM,MAAA,MAAA,GAAS,KAAM,CAAA,IAAA,CAAK,QAAQ,CAAA;AAClC,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,MAAA,EAAQ,QAAe,OAAA,KAAA,CAAA;AACvC,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,SAAA,EAAW,OAAO,MAAO,CAAA,SAAA;AAAA,IACzB,IAAA,EAAM,OAAO,MAAO,CAAA,IAAA;AAAA,IACp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C,OACD,CAAA;AAAA,KACF,CAAA;AACD,IAAO,OAAA,MAAM,qBAAqB,SAAS,CAAA;AAAA,KAC1C,CAAC,SAAA,EAAW,QAAU,EAAA,eAAA,EAAiB,aAAa,CAAC,CAAA;AAExD,EAAA,iEAAU,QAAS,CAAA;AACrB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n createCardExtension as homeReactCreateCardExtension,\n CardConfig as homeReactCardConfig,\n CardExtensionProps as homeReactCardExtensionProps,\n CardLayout as homeReactCardLayout,\n CardSettings as homeReactCardSettings,\n ComponentParts as homeReactComponentParts,\n ComponentRenderer as homeReactComponentRenderer,\n RendererProps as homeReactRendererProps,\n SettingsModal as homeReactSettingsModal,\n} from '@backstage/plugin-home-react';\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const createCardExtension = homeReactCreateCardExtension;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardExtensionProps<T> = homeReactCardExtensionProps<T>;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardLayout = homeReactCardLayout;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardSettings = homeReactCardSettings;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardConfig = homeReactCardConfig;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentParts = homeReactComponentParts;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentRenderer = homeReactComponentRenderer;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type RendererProps = homeReactRendererProps;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const SettingsModal = homeReactSettingsModal;\n"],"names":["homeReactCreateCardExtension","homeReactSettingsModal"],"mappings":";;AAgCO,MAAM,mBAAsB,GAAAA,sBAAA;AAgD5B,MAAM,aAAgB,GAAAC;;;;"}
1
+ {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n createCardExtension as homeReactCreateCardExtension,\n CardConfig as homeReactCardConfig,\n CardExtensionProps as homeReactCardExtensionProps,\n CardLayout as homeReactCardLayout,\n CardSettings as homeReactCardSettings,\n ComponentParts as homeReactComponentParts,\n ComponentRenderer as homeReactComponentRenderer,\n RendererProps as homeReactRendererProps,\n SettingsModal as homeReactSettingsModal,\n} from '@backstage/plugin-home-react';\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const createCardExtension = homeReactCreateCardExtension;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardExtensionProps<T> = homeReactCardExtensionProps<T>;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardLayout = homeReactCardLayout;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardSettings = homeReactCardSettings;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardConfig = homeReactCardConfig;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentParts = homeReactComponentParts;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentRenderer = homeReactComponentRenderer;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type RendererProps = homeReactRendererProps;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const SettingsModal = homeReactSettingsModal;\n"],"names":["homeReactCreateCardExtension","homeReactSettingsModal"],"mappings":";;AAgCO,MAAM,mBAAsB,GAAAA;AAgD5B,MAAM,aAAgB,GAAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CompanyLogo.esm.js","sources":["../../../src/homePageComponents/CompanyLogo/CompanyLogo.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Typography from '@material-ui/core/Typography';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\n\ntype CompanyLogoProps = {\n logo?: React.ReactNode;\n className?: string;\n};\n\n/**\n * A component to display a company logo for the user.\n *\n * @public\n */\nexport const CompanyLogo = (props: CompanyLogoProps) => {\n const { logo, className } = props;\n const configApi = useApi(configApiRef);\n\n return (\n <div className={className}>\n {logo ? (\n <>{logo}</>\n ) : (\n <Typography variant=\"h1\">{configApi.getString('app.title')}</Typography>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA6Ba,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAM,MAAA,EAAE,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AAErC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SACF,EAAA,EAAA,IAAA,6DACI,IAAK,CAAA,mBAEP,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IAAM,EAAA,EAAA,SAAA,CAAU,SAAU,CAAA,WAAW,CAAE,CAE/D,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"CompanyLogo.esm.js","sources":["../../../src/homePageComponents/CompanyLogo/CompanyLogo.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Typography from '@material-ui/core/Typography';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\n\ntype CompanyLogoProps = {\n logo?: React.ReactNode;\n className?: string;\n};\n\n/**\n * A component to display a company logo for the user.\n *\n * @public\n */\nexport const CompanyLogo = (props: CompanyLogoProps) => {\n const { logo, className } = props;\n const configApi = useApi(configApiRef);\n\n return (\n <div className={className}>\n {logo ? (\n <>{logo}</>\n ) : (\n <Typography variant=\"h1\">{configApi.getString('app.title')}</Typography>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA6Ba,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAM,MAAA,EAAE,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SACF,EAAA,EAAA,IAAA,6DACI,IAAK,CAAA,mBAEP,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IAAM,EAAA,EAAA,SAAA,CAAU,SAAU,CAAA,WAAW,CAAE,CAE/D,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/FeaturedDocsCard/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n LinkButton,\n EmptyState,\n Link,\n Progress,\n ErrorPanel,\n} from '@backstage/core-components';\nimport {\n catalogApiRef,\n CatalogApi,\n EntityDisplayName,\n} from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * Props customizing the <FeaturedDocsCard/> component.\n *\n * @public\n */\nexport type FeaturedDocsCardProps = {\n /** The entity filter used to display only the intended item/s */\n filter: EntityFilterQuery;\n /** An optional ReactNode for empty states */\n emptyState?: React.JSX.Element;\n /** An optional linkDestination to set for the Featured Doc */\n linkDestination?: string;\n /** An optional limit to set for link destination */\n responseLimit?: number;\n /** An optional string to customize sublink text */\n subLinkText?: string;\n};\n\n/** @public */\nexport type FeaturedDocsCardClassKey =\n | 'docDescription'\n | 'docSubLink'\n | 'docsTitleLink';\n\nconst useStyles = makeStyles(\n theme => ({\n docDescription: {\n fontSize: theme.typography.body1.fontSize,\n fontWeight: theme.typography.body1.fontWeight,\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n },\n docSubLink: {\n fontSize: theme.typography.subtitle1.fontSize,\n fontWeight: theme.typography.subtitle1.fontWeight,\n lineHeight: theme.typography.subtitle1.lineHeight,\n },\n docsTitleLink: {\n fontSize: theme.typography.h6.fontSize,\n fontWeight: theme.typography.h6.fontWeight,\n lineHeight: theme.typography.h6.lineHeight,\n },\n }),\n { name: 'HomeFeaturedDocsCard' },\n);\n\n/**\n * A component to display specific Featured Docs.\n *\n * @public\n */\nexport const Content = (props: FeaturedDocsCardProps): JSX.Element => {\n const { emptyState, filter, linkDestination, responseLimit, subLinkText } =\n props;\n const linkText = subLinkText || 'LEARN MORE';\n const styles = useStyles();\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: filter,\n limit: responseLimit || 10,\n });\n return response.items;\n });\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return entities?.length ? (\n <>\n {entities.map(d => (\n <div\n key={`${d.metadata.name}-${d.kind}-${d.metadata.namespace}`}\n data-testid=\"docs-card-content\"\n >\n <Link\n className={styles.docsTitleLink}\n data-testid=\"docs-card-title\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n <EntityDisplayName entityRef={stringifyEntityRef(d)} />\n </Link>\n {d.metadata.description && (\n <Typography className={styles.docDescription}>\n {d.metadata.description}\n </Typography>\n )}\n <Link\n className={styles.docSubLink}\n data-testid=\"docs-card-sub-link\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n {linkText}\n </Link>\n </div>\n ))}\n </>\n ) : (\n emptyState || (\n <EmptyState\n missing=\"data\"\n title=\"No documents to show\"\n description=\"Create your own document. Check out our Getting Started Information\"\n action={\n <LinkButton\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n DOCS\n </LinkButton>\n }\n />\n )\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA6DA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,QAAA;AAAA,MACjC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,UAAA;AAAA,MACnC,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC7B,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAC5B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,QAAA;AAAA,MACrC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,UAAA;AAAA,MACvC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,UAAA;AAAA,KACzC;AAAA,IACA,aAAe,EAAA;AAAA,MACb,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA,QAAA;AAAA,MAC9B,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA,UAAA;AAAA,MAChC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA,UAAA;AAAA,KAClC;AAAA,GACF,CAAA;AAAA,EACA,EAA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AA,UACC,EAAG,EAAA,6DAAA;AAAA,UACH,OAAQ,EAAA,WAAA;AAAA,SAAA;AAAA,QACT,MAAA;AAAA,OAED;AAAA,KAAA;AAAA,GAEJ,CAAA;AAGN;;;;"}
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/FeaturedDocsCard/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n LinkButton,\n EmptyState,\n Link,\n Progress,\n ErrorPanel,\n} from '@backstage/core-components';\nimport {\n catalogApiRef,\n CatalogApi,\n EntityDisplayName,\n} from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * Props customizing the <FeaturedDocsCard/> component.\n *\n * @public\n */\nexport type FeaturedDocsCardProps = {\n /** The entity filter used to display only the intended item/s */\n filter: EntityFilterQuery;\n /** An optional ReactNode for empty states */\n emptyState?: React.JSX.Element;\n /** An optional linkDestination to set for the Featured Doc */\n linkDestination?: string;\n /** An optional limit to set for link destination */\n responseLimit?: number;\n /** An optional string to customize sublink text */\n subLinkText?: string;\n};\n\n/** @public */\nexport type FeaturedDocsCardClassKey =\n | 'docDescription'\n | 'docSubLink'\n | 'docsTitleLink';\n\nconst useStyles = makeStyles(\n theme => ({\n docDescription: {\n fontSize: theme.typography.body1.fontSize,\n fontWeight: theme.typography.body1.fontWeight,\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n },\n docSubLink: {\n fontSize: theme.typography.subtitle1.fontSize,\n fontWeight: theme.typography.subtitle1.fontWeight,\n lineHeight: theme.typography.subtitle1.lineHeight,\n },\n docsTitleLink: {\n fontSize: theme.typography.h6.fontSize,\n fontWeight: theme.typography.h6.fontWeight,\n lineHeight: theme.typography.h6.lineHeight,\n },\n }),\n { name: 'HomeFeaturedDocsCard' },\n);\n\n/**\n * A component to display specific Featured Docs.\n *\n * @public\n */\nexport const Content = (props: FeaturedDocsCardProps): JSX.Element => {\n const { emptyState, filter, linkDestination, responseLimit, subLinkText } =\n props;\n const linkText = subLinkText || 'LEARN MORE';\n const styles = useStyles();\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: filter,\n limit: responseLimit || 10,\n });\n return response.items;\n });\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return entities?.length ? (\n <>\n {entities.map(d => (\n <div\n key={`${d.metadata.name}-${d.kind}-${d.metadata.namespace}`}\n data-testid=\"docs-card-content\"\n >\n <Link\n className={styles.docsTitleLink}\n data-testid=\"docs-card-title\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n <EntityDisplayName entityRef={stringifyEntityRef(d)} />\n </Link>\n {d.metadata.description && (\n <Typography className={styles.docDescription}>\n {d.metadata.description}\n </Typography>\n )}\n <Link\n className={styles.docSubLink}\n data-testid=\"docs-card-sub-link\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n {linkText}\n </Link>\n </div>\n ))}\n </>\n ) : (\n emptyState || (\n <EmptyState\n missing=\"data\"\n title=\"No documents to show\"\n description=\"Create your own document. Check out our Getting Started Information\"\n action={\n <LinkButton\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n DOCS\n </LinkButton>\n }\n />\n )\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA6DA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,QAAA;AAAA,MACjC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,UAAA;AAAA,MACnC,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC7B,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KAC5B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,QAAA;AAAA,MACrC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,UAAA;AAAA,MACvC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA;AAAA,KACzC;AAAA,IACA,aAAe,EAAA;AAAA,MACb,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA,QAAA;AAAA,MAC9B,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA,UAAA;AAAA,MAChC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,EAAG,CAAA;AAAA;AAClC,GACF,CAAA;AAAA,EACA,EAAE,MAAM,sBAAuB;AACjC,CAAA;AAOa,MAAA,OAAA,GAAU,CAAC,KAA8C,KAAA;AACpE,EAAA,MAAM,EAAE,UAAY,EAAA,MAAA,EAAQ,eAAiB,EAAA,aAAA,EAAe,aAC1D,GAAA,KAAA;AACF,EAAA,MAAM,WAAW,WAAe,IAAA,YAAA;AAChC,EAAA,MAAM,SAAS,SAAU,EAAA;AACzB,EAAM,MAAA,U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A,aAAA,CAAA,iBAAA,EAAA,EAAkB,SAAW,EAAA,kBAAA,CAAmB,CAAC,CAAG,EAAA;AAAA,KACvD;AAAA,IACC,CAAA,CAAE,QAAS,CAAA,WAAA,oBACT,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAW,MAAO,CAAA,cAAA,EAAA,EAC3B,CAAE,CAAA,QAAA,CAAS,WACd,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAO,CAAA,UAAA;AAAA,QAClB,aAAY,EAAA,oBAAA;AAAA,QACZ,EACE,EAAA,eAAA,IACA,CAAS,MAAA,EAAA,CAAA,CAAE,QAAS,CAAA,SAAA,IAAa,SAAS,CAAA,CAAA,EAAI,CAAE,CAAA,IAAI,CAClD,CAAA,EAAA,CAAA,CAAE,SAAS,IACb,CAAA,CAAA;AAAA,OAAA;AAAA,MAGD;AAAA;AACH,GAEH,CACH,CAAA,GAEA,UACE,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAM,EAAA,sBAAA;AAAA,MACN,WAAY,EAAA,qEAAA;AAAA,MACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,EAAG,EAAA,6DAAA;AAAA,UACH,OAAQ,EAAA;AAAA,SAAA;AAAA,QACT;AAAA;AAED;AAAA,GAEJ;AAGN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderWorldClock.esm.js","sources":["../../../src/homePageComponents/HeaderWorldClock/HeaderWorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 React from 'react';\nimport { HeaderLabel } from '@backstage/core-components';\n\nconst timeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\ntype TimeObj = {\n label: string;\n value: string;\n dateTime: string;\n};\n\n/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nfunction getTimes(\n clockConfigs: ClockConfig[],\n customTimeFormat?: Intl.DateTimeFormatOptions,\n) {\n const d = new Date();\n const lang = window.navigator.language;\n\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 ?? timeFormat),\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\n/**\n * A component to display a configurable list of clocks for various time zones.\n *\n * @example\n * Here's a simple example:\n * ```\n * // This will give you a clock for the time zone that Stockholm is in\n * // you can add more than one but keep in mind space may be limited\n * const clockConfigs: ClockConfig[] = [\n * {\n * label: 'STO',\n * timeZone: 'Europe/Stockholm',\n * },\n * ];\n *\n * // Setting hour12 to false will make all the clocks show in the 24hr format\n * const timeFormat: Intl.DateTimeFormatOptions = {\n * hour: '2-digit',\n * minute: '2-digit',\n * hour12: false,\n * };\n *\n * // Here is the component in use:\n * <HeaderWorldClock\n * clockConfigs={clockConfigs}\n * customTimeFormat={timeFormat}\n * />\n * ```\n *\n * @public\n */\nexport const HeaderWorldClock = (props: {\n clockConfigs: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n\n const defaultTimes: TimeObj[] = [];\n const [clocks, setTimes] = React.useState(defaultTimes);\n\n React.useEffect(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n\n const intervalId = setInterval(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [clockConfigs, customTimeFormat]);\n\n if (clocks.length !== 0) {\n return (\n <>\n {clocks.map(clock => (\n <HeaderLabel\n key={clock.label}\n label={clock.label}\n value={<time dateTime={clock.dateTime}>{clock.value}</time>}\n />\n ))}\n </>\n );\n }\n return null;\n};\n"],"names":[],"mappings":";;;AAmBA,MAAM,UAAyC,GAAA;AAAA,EAC7C,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA,SAAA;AACV,CAAA,CAAA;AAcA,SAAS,QAAA,CACP,cACA,gBACA,EAAA;AACA,EAAM,MAAA,CAAA,uBAAQ,IAAK,EAAA,CAAA;AACnB,EAAM,MAAA,IAAA,GAAO,OAAO,SAAU,CAAA,QAAA,CAAA;AAE9B,EAAA,MAAM,SAAoB,EAAC,CAAA;AAE3B,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AAEA,EAAA,KAAA,MAAW,eAAe,YAAc,EAAA;AACtC,IAAA,IAAI,QAAQ,WAAY,CAAA,KAAA,CAAA;AAExB,IAAA,MAAM,OAAsC,GAAA;AAAA,MAC1C,UAAU,WAAY,CAAA,QAAA;AAAA,MACtB,GAAI,gBAAoB,IAAA,UAAA;AAAA,KAC1B,CAAA;AAEA,IAAI,IAAA;AACF,MAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,cAAe,CAAA,IAAA,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AACX,MAAA,aAAA,CAAc,UAAU,CAAA,CAAA;AAAA,KAC1B,CAAA;AAAA,GACC,EAAA,CAAC,YAAc,EAAA,gBAAgB,CAAC,CAAA,CAAA;AAEnC,EAAI,IAAA,MAAA,CAAO,WAAW,CAAG,EAAA;AACvB,IACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,MAAO,CAAA,GAAA,CAAI,CACV,KAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAK,KAAM,CAAA,KAAA;AAAA,QACX,OAAO,KAAM,CAAA,KAAA;AAAA,QACb,uBAAQ,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,UAAU,KAAM,CAAA,QAAA,EAAA,EAAW,MAAM,KAAM,CAAA;AAAA,OAAA;AAAA,KAEvD,CACH,CAAA,CAAA;AAAA,GAEJ;AACA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"HeaderWorldClock.esm.js","sources":["../../../src/homePageComponents/HeaderWorldClock/HeaderWorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 React from 'react';\nimport { HeaderLabel } from '@backstage/core-components';\n\nconst timeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\ntype TimeObj = {\n label: string;\n value: string;\n dateTime: string;\n};\n\n/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nfunction getTimes(\n clockConfigs: ClockConfig[],\n customTimeFormat?: Intl.DateTimeFormatOptions,\n) {\n const d = new Date();\n const lang = window.navigator.language;\n\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 ?? timeFormat),\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\n/**\n * A component to display a configurable list of clocks for various time zones.\n *\n * @example\n * Here's a simple example:\n * ```\n * // This will give you a clock for the time zone that Stockholm is in\n * // you can add more than one but keep in mind space may be limited\n * const clockConfigs: ClockConfig[] = [\n * {\n * label: 'STO',\n * timeZone: 'Europe/Stockholm',\n * },\n * ];\n *\n * // Setting hour12 to false will make all the clocks show in the 24hr format\n * const timeFormat: Intl.DateTimeFormatOptions = {\n * hour: '2-digit',\n * minute: '2-digit',\n * hour12: false,\n * };\n *\n * // Here is the component in use:\n * <HeaderWorldClock\n * clockConfigs={clockConfigs}\n * customTimeFormat={timeFormat}\n * />\n * ```\n *\n * @public\n */\nexport const HeaderWorldClock = (props: {\n clockConfigs: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n\n const defaultTimes: TimeObj[] = [];\n const [clocks, setTimes] = React.useState(defaultTimes);\n\n React.useEffect(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n\n const intervalId = setInterval(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [clockConfigs, customTimeFormat]);\n\n if (clocks.length !== 0) {\n return (\n <>\n {clocks.map(clock => (\n <HeaderLabel\n key={clock.label}\n label={clock.label}\n value={<time dateTime={clock.dateTime}>{clock.value}</time>}\n />\n ))}\n </>\n );\n }\n return null;\n};\n"],"names":[],"mappings":";;;AAmBA,MAAM,UAAyC,GAAA;AAAA,EAC7C,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA;AACV,CAAA;AAcA,SAAS,QAAA,CACP,cACA,gBACA,EAAA;AACA,EAAM,MAAA,CAAA,uBAAQ,IAAK,EAAA;AACnB,EAAM,MAAA,IAAA,GAAO,OAAO,SAAU,CAAA,QAAA;AAE9B,EAAA,MAAM,SAAoB,EAAC;AAE3B,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAA,KAAA,MAAW,eAAe,YAAc,EAAA;AACtC,IAAA,IAAI,QAAQ,WAAY,CAAA,KAAA;AAExB,IAAA,MAAM,OAAsC,GAAA;AAAA,MAC1C,UAAU,WAAY,CAAA,QAAA;AAAA,MACtB,GAAI,gBAAoB,IAAA;AAAA,KAC1B;AAEA,IAAI,IAAA;AACF,MAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,cAAe,CAAA,IAAA,EAAM,OAAO,CAAA;AAAA,aAChC,CAAG,EAAA;AAEV,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,CAAA,aAAA,EAAgB,QAAQ,QAAQ,CAAA,8BAAA;AAAA,OAClC;AACA,MAAA,OAAA,CAAQ,QAAW,GAAA,KAAA;AACnB,MAAQ,KAAA,GAAA,KAAA;AAAA;AAGV,IAAA,MAAM,KAAQ,GAAA,CAAA,CAAE,kBAAmB,CAAA,IAAA,EAAM,OAAO,CAAA;AAChD,IAAM,MAAA,QAAA,GAAW,CAAE,CAAA,kBAAA,CAAmB,IAAM,EAAA;AAAA,MAC1C,UAAU,OAAQ,CAAA,QAAA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,CAAA;AAAA;AAGJ,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Actions.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport { useRandomJoke } from './Context';\n\nexport const Actions = () => {\n const { rerollJoke } = useRandomJoke();\n return (\n <Button variant=\"contained\" color=\"primary\" onClick={() => rerollJoke()}>\n Reroll\n </Button>\n );\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,aAAc,EAAA,CAAA;AACrC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,WAAY,EAAA,KAAA,EAAM,WAAU,OAAS,EAAA,MAAM,UAAW,EAAA,EAAA,EAAG,QAEzE,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Actions.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Actions.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport { useRandomJoke } from './Context';\n\nexport const Actions = () => {\n const { rerollJoke } = useRandomJoke();\n return (\n <Button variant=\"contained\" color=\"primary\" onClick={() => rerollJoke()}>\n Reroll\n </Button>\n );\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,aAAc,EAAA;AACrC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,WAAY,EAAA,KAAA,EAAM,WAAU,OAAS,EAAA,MAAM,UAAW,EAAA,EAAA,EAAG,QAEzE,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { useRandomJoke } from './Context';\n\nexport const Content = () => {\n const { joke, loading } = useRandomJoke();\n\n if (loading) return <Typography paragraph>Loading...</Typography>;\n\n return (\n <div>\n <Typography paragraph>{joke.setup}</Typography>\n <Typography paragraph>{joke.punchline}</Typography>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,UAAU,MAAM;AAC3B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAQ,EAAA,GAAI,aAAc,EAAA,CAAA;AAExC,EAAA,IAAI,SAAgB,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAS,QAAC,YAAU,CAAA,CAAA;AAEpD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAS,IAAE,EAAA,EAAA,IAAA,CAAK,KAAM,CAAA,sCACjC,UAAW,EAAA,EAAA,SAAA,EAAS,IAAE,EAAA,EAAA,IAAA,CAAK,SAAU,CACxC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { useRandomJoke } from './Context';\n\nexport const Content = () => {\n const { joke, loading } = useRandomJoke();\n\n if (loading) return <Typography paragraph>Loading...</Typography>;\n\n return (\n <div>\n <Typography paragraph>{joke.setup}</Typography>\n <Typography paragraph>{joke.punchline}</Typography>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,UAAU,MAAM;AAC3B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAQ,EAAA,GAAI,aAAc,EAAA;AAExC,EAAA,IAAI,SAAgB,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAS,QAAC,YAAU,CAAA;AAEpD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAS,IAAE,EAAA,EAAA,IAAA,CAAK,KAAM,CAAA,sCACjC,UAAW,EAAA,EAAA,SAAA,EAAS,IAAE,EAAA,EAAA,IAAA,CAAK,SAAU,CACxC,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Context.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React, { createContext } from 'react';\n\nexport type JokeType = 'any' | 'programming';\n\ntype Joke = {\n setup: string;\n punchline: string;\n};\n\ntype RandomJokeContextValue = {\n loading: boolean;\n joke: Joke;\n type: JokeType;\n rerollJoke: Function;\n handleChangeType: Function;\n};\n\nconst Context = createContext<RandomJokeContextValue | undefined>(undefined);\n\nconst getNewJoke = (type: string): Promise<Joke> =>\n fetch(\n `https://official-joke-api.appspot.com/jokes${\n type !== 'any' ? `/${type}` : ''\n }/random`,\n )\n .then(res => res.json())\n .then(data => (Array.isArray(data) ? data[0] : data));\n\nexport const ContextProvider = (props: {\n children: JSX.Element;\n defaultCategory?: JokeType;\n}) => {\n const { children, defaultCategory } = props;\n\n const [loading, setLoading] = React.useState(true);\n const [joke, setJoke] = React.useState<Joke>({\n setup: '',\n punchline: '',\n });\n const [type, setType] = React.useState<JokeType>(\n defaultCategory || ('programming' as JokeType),\n );\n\n const rerollJoke = React.useCallback(() => {\n setLoading(true);\n getNewJoke(type).then(newJoke => setJoke(newJoke));\n }, [type]);\n\n const handleChangeType = (newType: JokeType) => {\n setType(newType);\n };\n\n React.useEffect(() => {\n setLoading(false);\n }, [joke]);\n\n React.useEffect(() => {\n rerollJoke();\n }, [rerollJoke]);\n\n const value: RandomJokeContextValue = {\n loading,\n joke,\n type,\n rerollJoke,\n handleChangeType,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useRandomJoke = () => {\n const value = React.useContext(Context);\n\n if (value === undefined) {\n throw new Error('useRandomJoke must be used within a RandomJokeProvider');\n }\n\n return value;\n};\n\nexport default Context;\n"],"names":[],"mappings":";;AAiCM,MAAA,OAAA,GAAU,cAAkD,KAAS,CAAA,EAAA;AAE3E,MAAM,UAAA,GAAa,CAAC,IAClB,KAAA,KAAA;AAAA,EACE,8CACE,IAAS,KAAA,KAAA,GAAQ,CAAI,CAAA,EAAA,IAAI,KAAK,EAChC,CAAA,OAAA,CAAA;AACF,CAAA,CACG,IAAK,CAAA,CAAA,GAAA,KAAO,GAAI,CAAA,IAAA,EAAM,CACtB,CAAA,IAAA,CAAK,CAAS,IAAA,KAAA,KAAA,CAAM,QAAQ,IAAI,CAAA,GAAI,IAAK,CAAA,CAAC,IAAI,IAAK,CAAA,CAAA;AAE3C,MAAA,eAAA,GAAkB,CAAC,KAG1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAU,EAAA,eAAA,EAAoB,GAAA,KAAA,CAAA;AAEtC,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,KAAA,CAAM,SAAS,IAAI,CAAA,CAAA;AACjD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,MAAM,QAAe,CAAA;AAAA,IAC3C,KAAO,EAAA,EAAA;AAAA,IACP,SAAW,EAAA,EAAA;AAAA,GACZ,CAAA,CAAA;AACD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IAC5B,eAAoB,IAAA,aAAA;AAAA,GACtB,CAAA;AAEA,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,WAAA,CAAY,MAAM;AACzC,IAAA,UAAA,CAAW,IAAI,CAAA,CAAA;AACf,IAAA,UAAA,CAAW,IAAI,CAAE,CAAA,IAAA,CAAK,CAAW,OAAA,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,CAAA;AAAA,GACnD,EAAG,CAAC,IAAI,CAAC,CAAA,CAAA;AAET,EAAM,MAAA,gBAAA,GAAmB,CAAC,OAAsB,KAAA;AAC9C,IAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAAA,GACjB,CAAA;AAEA,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,UAAA,CAAW,KAAK,CAAA,CAAA;AAAA,GAClB,EAAG,CAAC,IAAI,CAAC,CAAA,CAAA;AAET,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAW,UAAA,EAAA,CAAA;AAAA,GACb,EAAG,CAAC,UAAU,CAAC,CAAA,CAAA;AAEf,EAAA,MAAM,KAAgC,GAAA;AAAA,IACpC,OAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,GACF,CAAA;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA,CAAA;AACnD,EAAA;AAEO,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA,CAAA;AAEtC,EAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,IAAM,MAAA,IAAI,MAAM,wDAAwD,CAAA,CAAA;AAAA,GAC1E;AAEA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Context.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React, { createContext } from 'react';\n\nexport type JokeType = 'any' | 'programming';\n\ntype Joke = {\n setup: string;\n punchline: string;\n};\n\ntype RandomJokeContextValue = {\n loading: boolean;\n joke: Joke;\n type: JokeType;\n rerollJoke: Function;\n handleChangeType: Function;\n};\n\nconst Context = createContext<RandomJokeContextValue | undefined>(undefined);\n\nconst getNewJoke = (type: string): Promise<Joke> =>\n fetch(\n `https://official-joke-api.appspot.com/jokes${\n type !== 'any' ? `/${type}` : ''\n }/random`,\n )\n .then(res => res.json())\n .then(data => (Array.isArray(data) ? data[0] : data));\n\nexport const ContextProvider = (props: {\n children: JSX.Element;\n defaultCategory?: JokeType;\n}) => {\n const { children, defaultCategory } = props;\n\n const [loading, setLoading] = React.useState(true);\n const [joke, setJoke] = React.useState<Joke>({\n setup: '',\n punchline: '',\n });\n const [type, setType] = React.useState<JokeType>(\n defaultCategory || ('programming' as JokeType),\n );\n\n const rerollJoke = React.useCallback(() => {\n setLoading(true);\n getNewJoke(type).then(newJoke => setJoke(newJoke));\n }, [type]);\n\n const handleChangeType = (newType: JokeType) => {\n setType(newType);\n };\n\n React.useEffect(() => {\n setLoading(false);\n }, [joke]);\n\n React.useEffect(() => {\n rerollJoke();\n }, [rerollJoke]);\n\n const value: RandomJokeContextValue = {\n loading,\n joke,\n type,\n rerollJoke,\n handleChangeType,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useRandomJoke = () => {\n const value = React.useContext(Context);\n\n if (value === undefined) {\n throw new Error('useRandomJoke must be used within a RandomJokeProvider');\n }\n\n return value;\n};\n\nexport default Context;\n"],"names":[],"mappings":";;AAiCM,MAAA,OAAA,GAAU,cAAkD,KAAS,CAAA;AAE3E,MAAM,UAAA,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AAU,MAAM;AACpB,IAAW,UAAA,EAAA;AAAA,GACb,EAAG,CAAC,UAAU,CAAC,CAAA;AAEf,EAAA,MAAM,KAAgC,GAAA;AAAA,IACpC,OAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA;AACnD;AAEO,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA;AAEtC,EAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,IAAM,MAAA,IAAI,MAAM,wDAAwD,CAAA;AAAA;AAG1E,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Settings.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 FormControl from '@material-ui/core/FormControl';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport RadioGroup from '@material-ui/core/RadioGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Radio from '@material-ui/core/Radio';\nimport React from 'react';\nimport { useRandomJoke, JokeType } from './Context';\nimport upperFirst from 'lodash/upperFirst';\n\nexport const Settings = () => {\n const { type, handleChangeType } = useRandomJoke();\n const JOKE_TYPES: JokeType[] = ['any' as JokeType, 'programming' as JokeType];\n return (\n <FormControl component=\"fieldset\">\n <FormLabel component=\"legend\">Joke Type</FormLabel>\n <RadioGroup\n aria-label=\"joke type\"\n value={type}\n onChange={e => handleChangeType(e.target.value)}\n >\n {JOKE_TYPES.map(t => (\n <FormControlLabel\n key={t}\n value={t}\n control={<Radio />}\n label={upperFirst(t)}\n />\n ))}\n </RadioGroup>\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,WAAW,MAAM;AAC5B,EAAA,MAAM,EAAE,IAAA,EAAM,gBAAiB,EAAA,GAAI,aAAc,EAAA,CAAA;AACjD,EAAM,MAAA,UAAA,GAAyB,CAAC,KAAA,EAAmB,aAAyB,CAAA,CAAA;AAC5E,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,SAAU,EAAA,UAAA,EAAA,sCACpB,SAAU,EAAA,EAAA,SAAA,EAAU,QAAS,EAAA,EAAA,WAAS,CACvC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,WAAA;AAAA,MACX,KAAO,EAAA,IAAA;AAAA,MACP,QAAU,EAAA,CAAA,CAAA,KAAK,gBAAiB,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,KAAA;AAAA,IAE7C,UAAA,CAAW,IAAI,CACd,CAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,CAAA;AAAA,QACL,KAAO,EAAA,CAAA;AAAA,QACP,OAAA,sCAAU,KAAM,EAAA,IAAA,CAAA;AAAA,QAChB,KAAA,EAAO,WAAW,CAAC,CAAA;AAAA,OAAA;AAAA,KAEtB,CAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Settings.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Settings.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 FormControl from '@material-ui/core/FormControl';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport RadioGroup from '@material-ui/core/RadioGroup';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Radio from '@material-ui/core/Radio';\nimport React from 'react';\nimport { useRandomJoke, JokeType } from './Context';\nimport upperFirst from 'lodash/upperFirst';\n\nexport const Settings = () => {\n const { type, handleChangeType } = useRandomJoke();\n const JOKE_TYPES: JokeType[] = ['any' as JokeType, 'programming' as JokeType];\n return (\n <FormControl component=\"fieldset\">\n <FormLabel component=\"legend\">Joke Type</FormLabel>\n <RadioGroup\n aria-label=\"joke type\"\n value={type}\n onChange={e => handleChangeType(e.target.value)}\n >\n {JOKE_TYPES.map(t => (\n <FormControlLabel\n key={t}\n value={t}\n control={<Radio />}\n label={upperFirst(t)}\n />\n ))}\n </RadioGroup>\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,WAAW,MAAM;AAC5B,EAAA,MAAM,EAAE,IAAA,EAAM,gBAAiB,EAAA,GAAI,aAAc,EAAA;AACjD,EAAM,MAAA,UAAA,GAAyB,CAAC,KAAA,EAAmB,aAAyB,CAAA;AAC5E,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,SAAU,EAAA,UAAA,EAAA,sCACpB,SAAU,EAAA,EAAA,SAAA,EAAU,QAAS,EAAA,EAAA,WAAS,CACvC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,YAAW,EAAA,WAAA;AAAA,MACX,KAAO,EAAA,IAAA;AAAA,MACP,QAAU,EAAA,CAAA,CAAA,KAAK,gBAAiB,CAAA,CAAA,CAAE,OAAO,KAAK;AAAA,KAAA;AAAA,IAE7C,UAAA,CAAW,IAAI,CACd,CAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,CAAA;AAAA,QACL,KAAO,EAAA,CAAA;AAAA,QACP,OAAA,sCAAU,KAAM,EAAA,IAAA,CAAA;AAAA,QAChB,KAAA,EAAO,WAAW,CAAC;AAAA;AAAA,KAEtB;AAAA,GAEL,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/StarredEntities/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n catalogApiRef,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport Typography from '@material-ui/core/Typography';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { StarredEntityListItem } from '../../components/StarredEntityListItem/StarredEntityListItem';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n tabs: {\n marginBottom: theme.spacing(1),\n },\n list: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n}));\n\n/**\n * Props for the StarredEntities component\n *\n * @public\n */\nexport type StarredEntitiesProps = {\n noStarredEntitiesMessage?: React.ReactNode | undefined;\n groupByKind?: boolean;\n};\n\n/**\n * A component to display a list of starred entities for the user.\n *\n * @public\n */\nexport const Content = ({\n noStarredEntitiesMessage,\n groupByKind,\n}: StarredEntitiesProps) => {\n const classes = useStyles();\n const catalogApi = useApi(catalogApiRef);\n const { starredEntities, toggleStarredEntity } = useStarredEntities();\n const [activeTab, setActiveTab] = React.useState(0);\n\n // Grab starred entities from catalog to ensure they still exist and also retrieve display titles\n const entities = useAsync(async () => {\n if (!starredEntities.size) {\n return [];\n }\n\n return (\n await catalogApi.getEntitiesByRefs({\n entityRefs: [...starredEntities],\n fields: ['kind', 'metadata.namespace', 'metadata.name', 'spec.type'],\n })\n ).items.filter((e): e is Entity => !!e);\n }, [catalogApi, starredEntities]);\n\n if (starredEntities.size === 0)\n return (\n <Typography variant=\"body1\">\n {noStarredEntitiesMessage ||\n 'Click the star beside an entity name to add it to this list!'}\n </Typography>\n );\n\n if (entities.loading) {\n return <Progress />;\n }\n\n const groupedEntities: { [kind: string]: Entity[] } = {};\n entities.value?.forEach(entity => {\n const kind = entity.kind;\n if (!groupedEntities[kind]) {\n groupedEntities[kind] = [];\n }\n groupedEntities[kind].push(entity);\n });\n\n const groupByKindEntries = Object.entries(groupedEntities);\n\n return entities.error ? (\n <ResponseErrorPanel error={entities.error} />\n ) : (\n <div>\n {!groupByKind && (\n <List className={classes.list}>\n {entities.value\n ?.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n )\n .map(entity => (\n <StarredEntityListItem\n key={stringifyEntityRef(entity)}\n entity={entity}\n onToggleStarredEntity={toggleStarredEntity}\n showKind\n />\n ))}\n </List>\n )}\n\n {groupByKind && (\n <Tabs\n className={classes.tabs}\n value={activeTab}\n onChange={(_, newValue) => setActiveTab(newValue)}\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"entity-tabs\"\n >\n {groupByKindEntries.map(([kind]) => (\n <Tab key={kind} label={kind} />\n ))}\n </Tabs>\n )}\n\n {groupByKind &&\n groupByKindEntries.map(([kind, entitiesByKind], index) => (\n <div key={kind} hidden={groupByKind && activeTab !== index}>\n <List className={classes.list}>\n {entitiesByKind\n ?.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n )\n .map(entity => (\n <StarredEntityListItem\n key={stringifyEntityRef(entity)}\n entity={entity}\n onToggleStarredEntity={toggleStarredEntity}\n showKind={false}\n />\n ))}\n </List>\n </div>\n ))}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC/B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,CAAA;AAAA,IACZ,aAAe,EAAA,CAAA;AAAA,GACjB;AACF,CAAE,CAAA,CAAA,CAAA;AAiBK,MAAM,UAAU,CAAC;AAAA,EACtB,wBAAA;AAAA,EACA,WAAA;AACF,CAA4B,KAAA;AAC1B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAoB,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACpE,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AAGlD,EAAM,MAAA,QAAA,GAAW,SAAS,YAAY;AACpC,IAAI,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACzB,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAEA,IACE,OAAA,CAAA,MAAM,WAAW,iBAAkB,CAAA;AAAA,MACjC,UA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AAA,IAAK,CAAC,GAAG,CACR,KAAA,CAAA,CAAA,CAAE,SAAS,KAAS,IAAA,CAAA,CAAE,SAAS,IAAM,EAAA,aAAA;AAAA,MACpC,CAAE,CAAA,QAAA,CAAS,KAAS,IAAA,CAAA,CAAE,QAAS,CAAA,IAAA;AAAA,KACjC;AAAA,GACF,CACC,IAAI,CACH,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,mBAAmB,MAAM,CAAA;AAAA,MAC9B,MAAA;AAAA,MACA,qBAAuB,EAAA,mBAAA;AAAA,MACvB,QAAU,EAAA,KAAA;AAAA,KAAA;AAAA,GAEb,CACL,CACF,CACD,CACL,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/StarredEntities/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n catalogApiRef,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress, ResponseErrorPanel } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport Typography from '@material-ui/core/Typography';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { StarredEntityListItem } from '../../components/StarredEntityListItem/StarredEntityListItem';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n tabs: {\n marginBottom: theme.spacing(1),\n },\n list: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n}));\n\n/**\n * Props for the StarredEntities component\n *\n * @public\n */\nexport type StarredEntitiesProps = {\n noStarredEntitiesMessage?: React.ReactNode | undefined;\n groupByKind?: boolean;\n};\n\n/**\n * A component to display a list of starred entities for the user.\n *\n * @public\n */\nexport const Content = ({\n noStarredEntitiesMessage,\n groupByKind,\n}: StarredEntitiesProps) => {\n const classes = useStyles();\n const catalogApi = useApi(catalogApiRef);\n const { starredEntities, toggleStarredEntity } = useStarredEntities();\n const [activeTab, setActiveTab] = React.useState(0);\n\n // Grab starred entities from catalog to ensure they still exist and also retrieve display titles\n const entities = useAsync(async () => {\n if (!starredEntities.size) {\n return [];\n }\n\n return (\n await catalogApi.getEntitiesByRefs({\n entityRefs: [...starredEntities],\n fields: ['kind', 'metadata.namespace', 'metadata.name', 'spec.type'],\n })\n ).items.filter((e): e is Entity => !!e);\n }, [catalogApi, starredEntities]);\n\n if (starredEntities.size === 0)\n return (\n <Typography variant=\"body1\">\n {noStarredEntitiesMessage ||\n 'Click the star beside an entity name to add it to this list!'}\n </Typography>\n );\n\n if (entities.loading) {\n return <Progress />;\n }\n\n const groupedEntities: { [kind: string]: Entity[] } = {};\n entities.value?.forEach(entity => {\n const kind = entity.kind;\n if (!groupedEntities[kind]) {\n groupedEntities[kind] = [];\n }\n groupedEntities[kind].push(entity);\n });\n\n const groupByKindEntries = Object.entries(groupedEntities);\n\n return entities.error ? (\n <ResponseErrorPanel error={entities.error} />\n ) : (\n <div>\n {!groupByKind && (\n <List className={classes.list}>\n {entities.value\n ?.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n )\n .map(entity => (\n <StarredEntityListItem\n key={stringifyEntityRef(entity)}\n entity={entity}\n onToggleStarredEntity={toggleStarredEntity}\n showKind\n />\n ))}\n </List>\n )}\n\n {groupByKind && (\n <Tabs\n className={classes.tabs}\n value={activeTab}\n onChange={(_, newValue) => setActiveTab(newValue)}\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"entity-tabs\"\n >\n {groupByKindEntries.map(([kind]) => (\n <Tab key={kind} label={kind} />\n ))}\n </Tabs>\n )}\n\n {groupByKind &&\n groupByKindEntries.map(([kind, entitiesByKind], index) => (\n <div key={kind} hidden={groupByKind && activeTab !== index}>\n <List className={classes.list}>\n {entitiesByKind\n ?.sort((a, b) =>\n (a.metadata.title ?? a.metadata.name).localeCompare(\n b.metadata.title ?? b.metadata.name,\n ),\n )\n .map(entity => (\n <StarredEntityListItem\n key={stringifyEntityRef(entity)}\n entity={entity}\n onToggleStarredEntity={toggleStarredEntity}\n showKind={false}\n />\n ))}\n </List>\n </div>\n ))}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC/B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,CAAA;AAAA,IACZ,aAAe,EAAA;AAAA;AAEnB,CAAE,CAAA,CAAA;AAiBK,MAAM,UAAU,CAAC;AAAA,EACtB,wBAAA;AAAA,EACA;AACF,CAA4B,KAAA;AAC1B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAA,MAAM,EAAE,eAAA,EAAiB,mBAAoB,EAAA,GAAI,kBAAmB,EAAA;AACpE,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAGlD,EAAM,MAAA,QAAA,GAAW,SAAS,YAAY;AACpC,IAAI,IAAA,CAAC,gBAAgB,IAAM,EAAA;AACzB,MAAA,OAAO,EAAC;AAAA;AAGV,I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S,KAAS,IAAA,CAAA,CAAE,SAAS,IAAM,EAAA,aAAA;AAAA,MACpC,CAAE,CAAA,QAAA,CAAS,KAAS,IAAA,CAAA,CAAE,QAAS,CAAA;AAAA;AACjC,GACF,CACC,IAAI,CACH,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,mBAAmB,MAAM,CAAA;AAAA,MAC9B,MAAA;AAAA,MACA,qBAAuB,EAAA,mBAAA;AAAA,MACvB,QAAU,EAAA;AAAA;AAAA,GAEb,CACL,CACF,CACD,CACL,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { Link } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useToolkit, Tool } from './Context';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n width: '72px',\n fontSize: '0.9em',\n lineHeight: '1.25',\n overflowWrap: 'break-word',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n const toolkit = useToolkit();\n const tools = toolkit?.tools ?? props.tools;\n\n return (\n <List className={classes.toolkit}>\n {tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n\n/**\n * Props for Toolkit Content component.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,MAAA;AAAA,IACV,SAAW,EAAA,QAAA;AAAA,GACb;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,GAAA,EAAK,CAAC,CAAA;AAAA,GAC9B;AAAA,EACA,KAAO,EAAA;AAAA,IACL,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC1B,KAAO,EAAA,MAAA;AAAA,IACP,QAAU,EAAA,OAAA;AAAA,IACV,UAAY,EAAA,MAAA;AAAA,IACZ,YAAc,EAAA,YAAA;AAAA,IACd,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA,MAAA;AAAA,IACR,YAAc,EAAA,MAAA;AAAA,IACd,cAAgB,EAAA,QAAA;AAAA,IAChB,UAAY,EAAA,QAAA;AAAA,IACZ,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC1B,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA;AAAA,GAC5C;AACF,CAAE,CAAA,CAAA,CAAA;AAOW,MAAA,OAAA,GAAU,CAAC,KAA+B,KAAA;AACrD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,UAAU,UAAW,EAAA,CAAA;AAC3B,EAAM,MAAA,KAAA,GAAQ,OAAS,EAAA,KAAA,IAAS,KAAM,CAAA,KAAA,CAAA;AAEtC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,OAAA,EAAA,EACtB,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,qBACT,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,GAAK,EAAA,IAAA,CAAK,GAAK,EAAA,EAAA,EAAI,IAAK,CAAA,GAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,IACpD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAA,EAAO,IAAK,CAAA,IAAK,CAClD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,wBAA0B,EAAA,EAAE,SAAW,EAAA,OAAA,CAAQ,KAAM,EAAA;AAAA,MACrD,WAAW,IAAK,CAAA,KAAA;AAAA,KAAA;AAAA,GAEpB,CACD,CACH,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { Link } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React from 'react';\nimport { useToolkit, Tool } from './Context';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n width: '72px',\n fontSize: '0.9em',\n lineHeight: '1.25',\n overflowWrap: 'break-word',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n const toolkit = useToolkit();\n const tools = toolkit?.tools ?? props.tools;\n\n return (\n <List className={classes.toolkit}>\n {tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n\n/**\n * Props for Toolkit Content component.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,MAAA;AAAA,IACV,SAAW,EAAA;AAAA,GACb;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Aa,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAA,EAAO,IAAK,CAAA,IAAK,CAClD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,wBAA0B,EAAA,EAAE,SAAW,EAAA,OAAA,CAAQ,KAAM,EAAA;AAAA,MACrD,WAAW,IAAK,CAAA;AAAA;AAAA,GAEpB,CACD,CACH,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/Toolkit/Context.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React, { createContext } from 'react';\n\n/** @public */\nexport type Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\ntype ToolkitContextValue = {\n tools: Tool[];\n};\n\nconst Context = createContext<ToolkitContextValue | undefined>(undefined);\n\nexport const ContextProvider = (props: {\n children: JSX.Element;\n tools: Tool[];\n}) => {\n const { children, tools } = props;\n\n const [toolsValue, _setTools] = React.useState(tools);\n\n const value: ToolkitContextValue = {\n tools: toolsValue,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useToolkit = () => {\n const value = React.useContext(Context);\n return value;\n};\n\nexport default Context;\n"],"names":[],"mappings":";;AA6BM,MAAA,OAAA,GAAU,cAA+C,KAAS,CAAA,EAAA;AAE3D,MAAA,eAAA,GAAkB,CAAC,KAG1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAE5B,EAAA,MAAM,CAAC,UAAY,EAAA,SAAS,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AAEpD,EAAA,MAAM,KAA6B,GAAA;AAAA,IACjC,KAAO,EAAA,UAAA;AAAA,GACT,CAAA;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA,CAAA;AACnD,EAAA;AAEO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA,CAAA;AACtC,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/Toolkit/Context.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React, { createContext } from 'react';\n\n/** @public */\nexport type Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\ntype ToolkitContextValue = {\n tools: Tool[];\n};\n\nconst Context = createContext<ToolkitContextValue | undefined>(undefined);\n\nexport const ContextProvider = (props: {\n children: JSX.Element;\n tools: Tool[];\n}) => {\n const { children, tools } = props;\n\n const [toolsValue, _setTools] = React.useState(tools);\n\n const value: ToolkitContextValue = {\n tools: toolsValue,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useToolkit = () => {\n const value = React.useContext(Context);\n return value;\n};\n\nexport default Context;\n"],"names":[],"mappings":";;AA6BM,MAAA,OAAA,GAAU,cAA+C,KAAS,CAAA;AAE3D,MAAA,eAAA,GAAkB,CAAC,KAG1B,KAAA;AACJ,EAAM,MAAA,EAAE,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAE5B,EAAA,MAAM,CAAC,UAAY,EAAA,SAAS,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAEpD,EAAA,MAAM,KAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,GACT;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA;AACnD;AAEO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA;AACtC,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.esm.js","sources":["../../../src/homePageComponents/VisitedByType/Actions.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 React, { useCallback } from 'react';\nimport Button from '@material-ui/core/Button';\nimport { useContext } from './Context';\n\nexport const Actions = () => {\n const { collapsed, setCollapsed, visits, numVisitsOpen, loading } =\n useContext();\n const onClick = useCallback(\n () => setCollapsed(prevCollapsed => !prevCollapsed),\n [setCollapsed],\n );\n const label = collapsed ? 'View More' : 'View Less';\n\n if (!loading && visits.length <= numVisitsOpen) return <></>;\n\n return (\n <Button variant=\"text\" onClick={onClick}>\n {label}\n </Button>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,UAAU,MAAM;AAC3B,EAAA,MAAM,EAAE,SAAW,EAAA,YAAA,EAAc,QAAQ,aAAe,EAAA,OAAA,KACtD,UAAW,EAAA,CAAA;AACb,EAAA,MAAM,OAAU,GAAA,WAAA;AAAA,IACd,MAAM,YAAA,CAAa,CAAiB,aAAA,KAAA,CAAC,aAAa,CAAA;AAAA,IAClD,CAAC,YAAY,CAAA;AAAA,GACf,CAAA;AACA,EAAM,MAAA,KAAA,GAAQ,YAAY,WAAc,GAAA,WAAA,CAAA;AAExC,EAAA,IAAI,CAAC,OAAW,IAAA,MAAA,CAAO,MAAU,IAAA,aAAA,yBAAwB,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA,CAAA;AAEzD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,MAAA,EAAO,WACpB,KACH,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Actions.esm.js","sources":["../../../src/homePageComponents/VisitedByType/Actions.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 React, { useCallback } from 'react';\nimport Button from '@material-ui/core/Button';\nimport { useContext } from './Context';\n\nexport const Actions = () => {\n const { collapsed, setCollapsed, visits, numVisitsOpen, loading } =\n useContext();\n const onClick = useCallback(\n () => setCollapsed(prevCollapsed => !prevCollapsed),\n [setCollapsed],\n );\n const label = collapsed ? 'View More' : 'View Less';\n\n if (!loading && visits.length <= numVisitsOpen) return <></>;\n\n return (\n <Button variant=\"text\" onClick={onClick}>\n {label}\n </Button>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,UAAU,MAAM;AAC3B,EAAA,MAAM,EAAE,SAAW,EAAA,YAAA,EAAc,QAAQ,aAAe,EAAA,OAAA,KACtD,UAAW,EAAA;AACb,EAAA,MAAM,OAAU,GAAA,WAAA;AAAA,IACd,MAAM,YAAA,CAAa,CAAiB,aAAA,KAAA,CAAC,aAAa,CAAA;AAAA,IAClD,CAAC,YAAY;AAAA,GACf;AACA,EAAM,MAAA,KAAA,GAAQ,YAAY,WAAc,GAAA,WAAA;AAExC,EAAA,IAAI,CAAC,OAAW,IAAA,MAAA,CAAO,MAAU,IAAA,aAAA,yBAAwB,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA;AAEzD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,MAAA,EAAO,WACpB,KACH,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/VisitedByType/Content.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 React, { useEffect } from 'react';\nimport { createFilterByQueryParamFromConfig } from '../../api/config';\nimport { VisitedByType } from './VisitedByType';\nimport { Visit, visitsApiRef } from '../../api';\nimport { ContextValueOnly, useContext } from './Context';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\n\n/** @public */\nexport type VisitedByTypeKind = 'recent' | 'top';\n\n/** @public */\nexport type VisitedByTypeProps = {\n visits?: Array<Visit>;\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n loading?: boolean;\n kind: VisitedByTypeKind;\n};\n\n/**\n * Display recently visited pages for the homepage\n * @public\n */\nexport const Content = ({\n visits,\n numVisitsOpen,\n numVisitsTotal,\n loading,\n kind,\n}: VisitedByTypeProps) => {\n const { setContext, setVisits, setLoading } = useContext();\n // Allows behavior override from properties\n useEffect(() => {\n const context: Partial<ContextValueOnly> = {};\n context.kind = kind;\n if (visits) {\n context.visits = visits;\n context.loading = false;\n } else if (loading) {\n context.loading = loading;\n }\n if (numVisitsOpen) context.numVisitsOpen = numVisitsOpen;\n if (numVisitsTotal) context.numVisitsTotal = numVisitsTotal;\n setContext(state => ({ ...state, ...context }));\n }, [setContext, kind, visits, loading, numVisitsOpen, numVisitsTotal]);\n\n const config = useApi(configApiRef);\n // Fetches data from visitsApi in case visits and loading are not provided\n const visitsApi = useApi(visitsApiRef);\n const { loading: reqLoading } = useAsync(async () => {\n if (!visits && !loading && kind === 'recent') {\n const filterBy = createFilterByQueryParamFromConfig(\n config.getOptionalConfigArray('home.recentVisits.filterBy') ?? [],\n );\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'timestamp', direction: 'desc' }],\n ...(filterBy && { filterBy }),\n })\n .then(setVisits);\n }\n if (!visits && !loading && kind === 'top') {\n const filterBy = createFilterByQueryParamFromConfig(\n config.getOptionalConfigArray('home.topVisits.filterBy') ?? [],\n );\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'hits', direction: 'desc' }],\n ...(filterBy && { filterBy }),\n })\n .then(setVisits);\n }\n return undefined;\n }, [visitsApi, visits, loading, setVisits]);\n useEffect(() => {\n if (!loading) {\n setLoading(reqLoading);\n }\n }, [loading, setLoading, reqLoading]);\n\n return <VisitedByType />;\n};\n"],"names":[],"mappings":";;;;;;;;;AAwCO,MAAM,UAAU,CAAC;AAAA,EACtB,MAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA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AAE,OAAO,WAAa,EAAA,SAAA,EAAW,QAAQ,CAAA;AAAA,QACnD,GAAI,QAAY,IAAA,EAAE,QAAS,EAAA;AAAA,OAC5B,CACA,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAAA,KACnB;AACA,IAAA,IAAI,CAAC,MAAA,IAAU,CAAC,OAAA,IAAW,SAAS,KAAO,EAAA;AACzC,MAAA,MAAM,QAAW,GAAA,kCAAA;AAAA,QACf,MAAO,CAAA,sBAAA,CAAuB,yBAAyB,CAAA,IAAK,EAAC;AAAA,OAC/D,CAAA;AACA,MAAO,OAAA,MAAM,UACV,IAAK,CAAA;AAAA,QACJ,OAAO,cAAkB,IAAA,CAAA;AAAA,QACzB,SAAS,CAAC,EAAE,OAAO,MAAQ,EAAA,SAAA,EAAW,QAAQ,CAAA;AAAA,QAC9C,GAAI,QAAY,IAAA,EAAE,QAAS,EAAA;AAAA,OAC5B,CACA,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAAA,KACnB;AACA,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACN,CAAC,SAAA,EAAW,MAAQ,EAAA,OAAA,EAAS,SAAS,CAAC,CAAA,CAAA;AAC1C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,OAAS,EAAA;AACZ,MAAA,UAAA,CAAW,UAAU,CAAA,CAAA;AAAA,KACvB;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,UAAA,EAAY,UAAU,CAAC,CAAA,CAAA;AAEpC,EAAA,2CAAQ,aAAc,EAAA,IAAA,CAAA,CAAA;AACxB;;;;"}
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/VisitedByType/Content.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 React, { useEffect } from 'react';\nimport { createFilterByQueryParamFromConfig } from '../../api/config';\nimport { VisitedByType } from './VisitedByType';\nimport { Visit, visitsApiRef } from '../../api';\nimport { ContextValueOnly, useContext } from './Context';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\n\n/** @public */\nexport type VisitedByTypeKind = 'recent' | 'top';\n\n/** @public */\nexport type VisitedByTypeProps = {\n visits?: Array<Visit>;\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n loading?: boolean;\n kind: VisitedByTypeKind;\n};\n\n/**\n * Display recently visited pages for the homepage\n * @public\n */\nexport const Content = ({\n visits,\n numVisitsOpen,\n numVisitsTotal,\n loading,\n kind,\n}: VisitedByTypeProps) => {\n const { setContext, setVisits, setLoading } = useContext();\n // Allows behavior override from properties\n useEffect(() => {\n const context: Partial<ContextValueOnly> = {};\n context.kind = kind;\n if (visits) {\n context.visits = visits;\n context.loading = false;\n } else if (loading) {\n context.loading = loading;\n }\n if (numVisitsOpen) context.numVisitsOpen = numVisitsOpen;\n if (numVisitsTotal) context.numVisitsTotal = numVisitsTotal;\n setContext(state => ({ ...state, ...context }));\n }, [setContext, kind, visits, loading, numVisitsOpen, numVisitsTotal]);\n\n const config = useApi(configApiRef);\n // Fetches data from visitsApi in case visits and loading are not provided\n const visitsApi = useApi(visitsApiRef);\n const { loading: reqLoading } = useAsync(async () => {\n if (!visits && !loading && kind === 'recent') {\n const filterBy = createFilterByQueryParamFromConfig(\n config.getOptionalConfigArray('home.recentVisits.filterBy') ?? [],\n );\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'timestamp', direction: 'desc' }],\n ...(filterBy && { filterBy }),\n })\n .then(setVisits);\n }\n if (!visits && !loading && kind === 'top') {\n const filterBy = createFilterByQueryParamFromConfig(\n config.getOptionalConfigArray('home.topVisits.filterBy') ?? [],\n );\n return await visitsApi\n .list({\n limit: numVisitsTotal ?? 8,\n orderBy: [{ field: 'hits', direction: 'desc' }],\n ...(filterBy && { filterBy }),\n })\n .then(setVisits);\n }\n return undefined;\n }, [visitsApi, visits, loading, setVisits]);\n useEffect(() => {\n if (!loading) {\n setLoading(reqLoading);\n }\n }, [loading, setLoading, reqLoading]);\n\n return <VisitedByType />;\n};\n"],"names":[],"mappings":";;;;;;;;;AAwCO,MAAM,UAAU,CAAC;AAAA,EACtB,MAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,EAAE,UAAA,EAAY,SAAW,EAAA,UAAA,KAAe,UAAW,EAAA;AAEzD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,UAAqC,EAAC;AAC5C,IAAA,OAAA,CAAQ,IAAO,GAAA,IAAA;AACf,IAAA,IAAI,MAAQ,EAAA;AACV,MAAA,OAAA,CAAQ,MAAS,GAAA,MAAA;AACjB,MAAA,OAAA,CAAQ,OAAU,GAAA,KAAA;AAAA,eACT,OAAS,EAAA;AAClB,MAAA,OAAA,CAAQ,OAAU,GAAA,OAAA;AAAA;AAEpB,IAAI,IAAA,aAAA,UAAuB,aAAgB,GAAA,aAAA;AAC3C,IAAI,IAAA,cAAA,UAAwB,cAAiB,GAAA,cAAA;AAC7C,IAAA,UAAA,CAAW,YAAU,EAAE,GAAG,KAAO,EAAA,GAAG,SAAU,CAAA,CAAA;AAAA,GAChD,EAAG,CAAC,UAAY,EAAA,IAAA,EAAM,QAAQ,OAAS,EAAA,aAAA,EAAe,cAAc,CAAC,CAAA;AAErE,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAElC,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,EAAE,OAAA,EAAS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+1 @@
1
- {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/VisitedByType/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 React, { Dispatch, SetStateAction, createContext, useMemo } from 'react';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitedByTypeKind } from './Content';\n\nexport type ContextValueOnly = {\n collapsed: boolean;\n numVisitsOpen: number;\n numVisitsTotal: number;\n visits: Array<Visit>;\n loading: boolean;\n kind: VisitedByTypeKind;\n};\n\nexport type ContextValue = ContextValueOnly & {\n setCollapsed: Dispatch<SetStateAction<boolean>>;\n setNumVisitsOpen: Dispatch<SetStateAction<number>>;\n setNumVisitsTotal: Dispatch<SetStateAction<number>>;\n setVisits: Dispatch<SetStateAction<Array<Visit>>>;\n setLoading: Dispatch<SetStateAction<boolean>>;\n setKind: Dispatch<SetStateAction<VisitedByTypeKind>>;\n setContext: Dispatch<SetStateAction<ContextValueOnly>>;\n};\n\nconst defaultContextValueOnly: ContextValueOnly = {\n collapsed: true,\n numVisitsOpen: 3,\n numVisitsTotal: 8,\n visits: [],\n loading: true,\n kind: 'recent',\n};\n\nexport const defaultContextValue: ContextValue = {\n ...defaultContextValueOnly,\n setCollapsed: () => {},\n setNumVisitsOpen: () => {},\n setNumVisitsTotal: () => {},\n setVisits: () => {},\n setLoading: () => {},\n setKind: () => {},\n setContext: () => {},\n};\n\nexport const Context = createContext<ContextValue>(defaultContextValue);\n\nconst getFilteredSet =\n <T,>(\n setContext: Dispatch<SetStateAction<ContextValueOnly>>,\n contextKey: keyof ContextValueOnly,\n ) =>\n (e: SetStateAction<T>) =>\n setContext(state => ({\n ...state,\n [contextKey]:\n typeof e === 'function' ? (e as Function)(state[contextKey]) : e,\n }));\n\nexport const ContextProvider = ({ children }: { children: JSX.Element }) => {\n const [context, setContext] = React.useState<ContextValueOnly>(\n defaultContextValueOnly,\n );\n const {\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n } = useMemo(\n () => ({\n setCollapsed: getFilteredSet(setContext, 'collapsed'),\n setNumVisitsOpen: getFilteredSet(setContext, 'numVisitsOpen'),\n setNumVisitsTotal: getFilteredSet(setContext, 'numVisitsTotal'),\n setVisits: getFilteredSet(setContext, 'visits'),\n setLoading: getFilteredSet(setContext, 'loading'),\n setKind: getFilteredSet(setContext, 'kind'),\n }),\n [setContext],\n );\n\n const value: ContextValue = {\n ...context,\n setContext,\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useContext = () => {\n const value = React.useContext(Context);\n\n if (value === undefined)\n throw new Error(\n 'VisitedByType useContext found undefined ContextValue, <ContextProvider/> could be missing',\n );\n\n return value;\n};\n\nexport default Context;\n"],"names":[],"mappings":";;AAuCA,MAAM,uBAA4C,GAAA;AAAA,EAChD,SAAW,EAAA,IAAA;AAAA,EACX,aAAe,EAAA,CAAA;AAAA,EACf,cAAgB,EAAA,CAAA;AAAA,EAChB,QAAQ,EAAC;AAAA,EACT,OAAS,EAAA,IAAA;AAAA,EACT,IAAM,EAAA,QAAA;AACR,CAAA,CAAA;AAEO,MAAM,mBAAoC,GAAA;AAAA,EAC/C,GAAG,uBAAA;AAAA,EACH,cAAc,MAAM;AAAA,GAAC;AAAA,EACrB,kBAAkB,MAAM;AAAA,GAAC;AAAA,EACzB,mBAAmB,MAAM;AAAA,GAAC;AAAA,EAC1B,WAAW,MAAM;AAAA,GAAC;AAAA,EAClB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AA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA,CAAA;AACnD,EAAA;AAEO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAU,KAAA,KAAA,CAAA;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,4FAAA;AAAA,KACF,CAAA;AAEF,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"Context.esm.js","sources":["../../../src/homePageComponents/VisitedByType/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 React, { Dispatch, SetStateAction, createContext, useMemo } from 'react';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitedByTypeKind } from './Content';\n\nexport type ContextValueOnly = {\n collapsed: boolean;\n numVisitsOpen: number;\n numVisitsTotal: number;\n visits: Array<Visit>;\n loading: boolean;\n kind: VisitedByTypeKind;\n};\n\nexport type ContextValue = ContextValueOnly & {\n setCollapsed: Dispatch<SetStateAction<boolean>>;\n setNumVisitsOpen: Dispatch<SetStateAction<number>>;\n setNumVisitsTotal: Dispatch<SetStateAction<number>>;\n setVisits: Dispatch<SetStateAction<Array<Visit>>>;\n setLoading: Dispatch<SetStateAction<boolean>>;\n setKind: Dispatch<SetStateAction<VisitedByTypeKind>>;\n setContext: Dispatch<SetStateAction<ContextValueOnly>>;\n};\n\nconst defaultContextValueOnly: ContextValueOnly = {\n collapsed: true,\n numVisitsOpen: 3,\n numVisitsTotal: 8,\n visits: [],\n loading: true,\n kind: 'recent',\n};\n\nexport const defaultContextValue: ContextValue = {\n ...defaultContextValueOnly,\n setCollapsed: () => {},\n setNumVisitsOpen: () => {},\n setNumVisitsTotal: () => {},\n setVisits: () => {},\n setLoading: () => {},\n setKind: () => {},\n setContext: () => {},\n};\n\nexport const Context = createContext<ContextValue>(defaultContextValue);\n\nconst getFilteredSet =\n <T,>(\n setContext: Dispatch<SetStateAction<ContextValueOnly>>,\n contextKey: keyof ContextValueOnly,\n ) =>\n (e: SetStateAction<T>) =>\n setContext(state => ({\n ...state,\n [contextKey]:\n typeof e === 'function' ? (e as Function)(state[contextKey]) : e,\n }));\n\nexport const ContextProvider = ({ children }: { children: JSX.Element }) => {\n const [context, setContext] = React.useState<ContextValueOnly>(\n defaultContextValueOnly,\n );\n const {\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n } = useMemo(\n () => ({\n setCollapsed: getFilteredSet(setContext, 'collapsed'),\n setNumVisitsOpen: getFilteredSet(setContext, 'numVisitsOpen'),\n setNumVisitsTotal: getFilteredSet(setContext, 'numVisitsTotal'),\n setVisits: getFilteredSet(setContext, 'visits'),\n setLoading: getFilteredSet(setContext, 'loading'),\n setKind: getFilteredSet(setContext, 'kind'),\n }),\n [setContext],\n );\n\n const value: ContextValue = {\n ...context,\n setContext,\n setCollapsed,\n setNumVisitsOpen,\n setNumVisitsTotal,\n setVisits,\n setLoading,\n setKind,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useContext = () => {\n const value = React.useContext(Context);\n\n if (value === undefined)\n throw new Error(\n 'VisitedByType useContext found undefined ContextValue, <ContextProvider/> could be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Ae,CAAA,UAAA,EAAY,eAAe,CAAA;AAAA,MAC5D,iBAAA,EAAmB,cAAe,CAAA,UAAA,EAAY,gBAAgB,CAAA;AAAA,MAC9D,SAAA,EAAW,cAAe,CAAA,UAAA,EAAY,QAAQ,CAAA;AAAA,MAC9C,UAAA,EAAY,cAAe,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,MAChD,OAAA,EAAS,cAAe,CAAA,UAAA,EAAY,MAAM;AAAA,KAC5C,CAAA;AAAA,IACA,CAAC,UAAU;AAAA,GACb;AAEA,EAAA,MAAM,KAAsB,GAAA;AAAA,IAC1B,GAAG,OAAA;AAAA,IACH,UAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,OAAA,CAAQ,QAAR,EAAA,EAAiB,SAAe,QAAS,CAAA;AACnD;AAEO,MAAM,aAAa,MAAM;AAC9B,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA;AAEtC,EAAA,IAAI,KAAU,KAAA,KAAA,CAAA;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAEF,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisitedByType.esm.js","sources":["../../../src/homePageComponents/VisitedByType/VisitedByType.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 React from 'react';\nimport { VisitList } from '../../components/VisitList';\nimport { useContext } from './Context';\n\nexport const VisitedByType = () => {\n const { collapsed, numVisitsOpen, numVisitsTotal, visits, loading, kind } =\n useContext();\n\n return (\n <VisitList\n visits={visits}\n detailType={kind === 'top' ? 'hits' : 'time-ago'}\n collapsed={collapsed}\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n loading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,EAAE,WAAW,aAAe,EAAA,cAAA,EAAgB,QAAQ,OAAS,EAAA,IAAA,KACjE,UAAW,EAAA,CAAA;AAEb,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,UAAA,EAAY,IAAS,KAAA,KAAA,GAAQ,MAAS,GAAA,UAAA;AAAA,MACtC,SAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA,OAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"VisitedByType.esm.js","sources":["../../../src/homePageComponents/VisitedByType/VisitedByType.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 React from 'react';\nimport { VisitList } from '../../components/VisitList';\nimport { useContext } from './Context';\n\nexport const VisitedByType = () => {\n const { collapsed, numVisitsOpen, numVisitsTotal, visits, loading, kind } =\n useContext();\n\n return (\n <VisitList\n visits={visits}\n detailType={kind === 'top' ? 'hits' : 'time-ago'}\n collapsed={collapsed}\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n loading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,gBAAgB,MAAM;AACjC,EAAM,MAAA,EAAE,WAAW,aAAe,EAAA,cAAA,EAAgB,QAAQ,OAAS,EAAA,IAAA,KACjE,UAAW,EAAA;AAEb,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,UAAA,EAAY,IAAS,KAAA,KAAA,GAAQ,MAAS,GAAA,UAAA;AAAA,MACtC,SAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WelcomeTitle.esm.js","sources":["../../../src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {\n alertApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport React, { useEffect, useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getTimeBasedGreeting } from './timeUtil';\n\n/** @public */\nexport type WelcomeTitleLanguageProps = {\n language?: string[];\n};\n\nexport const WelcomeTitle = ({ language }: WelcomeTitleLanguageProps) => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n const greeting = useMemo(() => getTimeBasedGreeting(language), [language]);\n\n const { value: profile, error } = useAsync(() =>\n identityApi.getProfileInfo(),\n );\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load user identity: ${error}`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n return (\n <Tooltip title={greeting.language}>\n <Typography component=\"span\" variant=\"inherit\">{`${greeting.greeting}${\n profile?.displayName ? `, ${profile?.displayName}` : ''\n }!`}</Typography>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA+BO,MAAM,YAAe,GAAA,CAAC,EAAE,QAAA,EAA0C,KAAA;AACvE,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,QAAQ,MAAM,oBAAA,CAAqB,QAAQ,CAAG,EAAA,CAAC,QAAQ,CAAC,CAAA,CAAA;AAEzE,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAAS,MACzC,YAAY,cAAe,EAAA;AAAA,GAC7B,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,IAAK,CAAA;AAAA,QACZ,OAAA,EAAS,iCAAiC,KAAK,CAAA,CAAA;AAAA,QAC/C,QAAU,EAAA,OAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACH;AAAA,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA,CAAA;AAEpB,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAO,EAAA,QAAA,CAAS,4BACtB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,MAAA,EAAO,OAAQ,EAAA,SAAA,EAAA,EAAW,GAAG,QAAS,CAAA,QAAQ,CAClE,EAAA,OAAA,EAAS,WAAc,GAAA,CAAA,EAAA,EAAK,SAAS,WAAW,CAAA,CAAA,GAAK,EACvD,CAAA,CAAA,CAAI,CACN,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"WelcomeTitle.esm.js","sources":["../../../src/homePageComponents/WelcomeTitle/WelcomeTitle.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {\n alertApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport React, { useEffect, useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getTimeBasedGreeting } from './timeUtil';\n\n/** @public */\nexport type WelcomeTitleLanguageProps = {\n language?: string[];\n};\n\nexport const WelcomeTitle = ({ language }: WelcomeTitleLanguageProps) => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n const greeting = useMemo(() => getTimeBasedGreeting(language), [language]);\n\n const { value: profile, error } = useAsync(() =>\n identityApi.getProfileInfo(),\n );\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load user identity: ${error}`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n return (\n <Tooltip title={greeting.language}>\n <Typography component=\"span\" variant=\"inherit\">{`${greeting.greeting}${\n profile?.displayName ? `, ${profile?.displayName}` : ''\n }!`}</Typography>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA+BO,MAAM,YAAe,GAAA,CAAC,EAAE,QAAA,EAA0C,KAAA;AACvE,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,QAAA,GAAW,QAAQ,MAAM,oBAAA,CAAqB,QAAQ,CAAG,EAAA,CAAC,QAAQ,CAAC,CAAA;AAEzE,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAAS,MACzC,YAAY,cAAe;AAAA,GAC7B;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,IAAK,CAAA;AAAA,QACZ,OAAA,EAAS,iCAAiC,KAAK,CAAA,CAAA;AAAA,QAC/C,QAAU,EAAA;AAAA,OACX,CAAA;AAAA;AACH,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA;AAEpB,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAO,EAAA,QAAA,CAAS,4BACtB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,MAAA,EAAO,OAAQ,EAAA,SAAA,EAAA,EAAW,GAAG,QAAS,CAAA,QAAQ,CAClE,EAAA,OAAA,EAAS,WAAc,GAAA,CAAA,EAAA,EAAK,SAAS,WAAW,CAAA,CAAA,GAAK,EACvD,CAAA,CAAA,CAAI,CACN,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtil.esm.js","sources":["../../../src/homePageComponents/WelcomeTitle/timeUtil.ts"],"sourcesContent":["/*\n * Copyright 2020 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 goodMorning from './locales/goodMorning.locales.json';\nimport goodAfternoon from './locales/goodAfternoon.locales.json';\nimport goodEvening from './locales/goodEvening.locales.json';\n\n// Select a large random integer at startup, to prevent the greetings to change\n// every time the user navigates.\nconst greetingRandomSeed = Math.floor(Math.random() * 1000000);\n\nexport function getTimeBasedGreeting(language?: string[]): {\n language: string;\n greeting: string;\n} {\n const random = (array: string[]) => array[greetingRandomSeed % array.length];\n\n const currentHour = new Date(Date.now()).getHours();\n if (currentHour >= 23) {\n return {\n language: 'Seriously',\n greeting: 'Get some rest',\n };\n }\n\n const timeOfDay = (hour: number): { [language: string]: string } => {\n if (hour < 12) return goodMorning;\n if (hour < 17) return goodAfternoon;\n return goodEvening;\n };\n\n const greetings = timeOfDay(currentHour);\n\n if (Array.isArray(language) && language.length > 0) {\n const validLanguages = language.filter(lang => lang && greetings[lang]);\n if (validLanguages.length > 0) {\n const greetingsKey = random(validLanguages);\n return {\n language: greetingsKey,\n greeting: greetings[greetingsKey],\n };\n }\n }\n\n const greetingsKey = random(Object.keys(greetings));\n return {\n language: greetingsKey,\n greeting: greetings[greetingsKey],\n };\n}\n"],"names":["greetingsKey"],"mappings":";;;;AAsBA,MAAM,qBAAqB,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,MAAA,KAAW,GAAO,CAAA,CAAA;AAEtD,SAAS,qBAAqB,QAGnC,EAAA;AACA,EAAA,MAAM,SAAS,CAAC,KAAA,KAAoB,KAAM,CAAA,kBAAA,GAAqB,MAAM,MAAM,CAAA,CAAA;AAE3E,EAAA,MAAM,cAAc,IAAI,IAAA,CAAK,KAAK,GAAI,EAAC,EAAE,QAAS,EAAA,CAAA;AAClD,EAAA,IAAI,eAAe,EAAI,EAAA;AACrB,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,WAAA;AAAA,MACV,QAAU,EAAA,eAAA;AAAA,KACZ,CAAA;AAAA,GACF;AAEA,EAAM,MAAA,SAAA,GAAY,CAAC,IAAiD,KAAA;AAClE,IAAI,IAAA,IAAA,GAAO,IAAW,OAAA,WAAA,CAAA;AACtB,IAAI,IAAA,IAAA,GAAO,IAAW,OAAA,aAAA,CAAA;AACtB,IAAO,OAAA,WAAA,CAAA;AAAA,GACT,CAAA;AAEA,EAAM,MAAA,SAAA,GAAY,UAAU,WAAW,CAAA,CAAA;AAEvC,EAAA,IAAI,MAAM,OAAQ,CAAA,QAAQ,CAAK,IAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAClD,IAAA,MAAM,iBAAiB,QAAS,CAAA,MAAA,CAAO,UAAQ,IAAQ,IAAA,SAAA,CAAU,IAAI,CAAC,CAAA,CAAA;AACtE,IAAI,IAAA,cAAA,CAAe,SAAS,CAAG,EAAA;AAC7B,MAAMA,MAAAA,aAAAA,GAAe,OAAO,cAAc,CAAA,CAAA;AAC1C,MAAO,OAAA;AAAA,QACL,QAAUA,EAAAA,aAAAA;AAAA,QACV,QAAA,EAAU,UAAUA,aAAY,CAAA;AAAA,OAClC,CAAA;AAAA,KACF;AAAA,GACF;AAEA,EAAA,MAAM,YAAe,GAAA,MAAA,CAAO,MAAO,CAAA,IAAA,CAAK,SAAS,CAAC,CAAA,CAAA;AAClD,EAAO,OAAA;AAAA,IACL,QAAU,EAAA,YAAA;AAAA,IACV,QAAA,EAAU,UAAU,YAAY,CAAA;AAAA,GAClC,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"timeUtil.esm.js","sources":["../../../src/homePageComponents/WelcomeTitle/timeUtil.ts"],"sourcesContent":["/*\n * Copyright 2020 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 goodMorning from './locales/goodMorning.locales.json';\nimport goodAfternoon from './locales/goodAfternoon.locales.json';\nimport goodEvening from './locales/goodEvening.locales.json';\n\n// Select a large random integer at startup, to prevent the greetings to change\n// every time the user navigates.\nconst greetingRandomSeed = Math.floor(Math.random() * 1000000);\n\nexport function getTimeBasedGreeting(language?: string[]): {\n language: string;\n greeting: string;\n} {\n const random = (array: string[]) => array[greetingRandomSeed % array.length];\n\n const currentHour = new Date(Date.now()).getHours();\n if (currentHour >= 23) {\n return {\n language: 'Seriously',\n greeting: 'Get some rest',\n };\n }\n\n const timeOfDay = (hour: number): { [language: string]: string } => {\n if (hour < 12) return goodMorning;\n if (hour < 17) return goodAfternoon;\n return goodEvening;\n };\n\n const greetings = timeOfDay(currentHour);\n\n if (Array.isArray(language) && language.length > 0) {\n const validLanguages = language.filter(lang => lang && greetings[lang]);\n if (validLanguages.length > 0) {\n const greetingsKey = random(validLanguages);\n return {\n language: greetingsKey,\n greeting: greetings[greetingsKey],\n };\n }\n }\n\n const greetingsKey = random(Object.keys(greetings));\n return {\n language: greetingsKey,\n greeting: greetings[greetingsKey],\n };\n}\n"],"names":["greetingsKey"],"mappings":";;;;AAsBA,MAAM,qBAAqB,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,MAAA,KAAW,GAAO,CAAA;AAEtD,SAAS,qBAAqB,QAGnC,EAAA;AACA,EAAA,MAAM,SAAS,CAAC,KAAA,KAAoB,KAAM,CAAA,kBAAA,GAAqB,MAAM,MAAM,CAAA;AAE3E,EAAA,MAAM,cAAc,IAAI,IAAA,CAAK,KAAK,GAAI,EAAC,EAAE,QAAS,EAAA;AAClD,EAAA,IAAI,eAAe,EAAI,EAAA;AACrB,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,WAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACZ;AAAA;AAGF,EAAM,MAAA,SAAA,GAAY,CAAC,IAAiD,KAAA;AAClE,IAAI,IAAA,IAAA,GAAO,IAAW,OAAA,WAAA;AACtB,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