@red-hat-developer-hub/backstage-plugin-quickstart 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +123 -0
  3. package/app-config.dynamic.yaml +6 -0
  4. package/config.d.ts +60 -0
  5. package/dist/assets/quickstart-image.png +0 -0
  6. package/dist/components/Quickstart.esm.js +64 -0
  7. package/dist/components/Quickstart.esm.js.map +1 -0
  8. package/dist/components/QuickstartContent/QuickstartContent.esm.js +42 -0
  9. package/dist/components/QuickstartContent/QuickstartContent.esm.js.map +1 -0
  10. package/dist/components/QuickstartContent/QuickstartCtaLink.esm.js +58 -0
  11. package/dist/components/QuickstartContent/QuickstartCtaLink.esm.js.map +1 -0
  12. package/dist/components/QuickstartContent/QuickstartItem.esm.js +132 -0
  13. package/dist/components/QuickstartContent/QuickstartItem.esm.js.map +1 -0
  14. package/dist/components/QuickstartContent/QuickstartItemIcon.esm.js +44 -0
  15. package/dist/components/QuickstartContent/QuickstartItemIcon.esm.js.map +1 -0
  16. package/dist/components/QuickstartDrawer.esm.js +38 -0
  17. package/dist/components/QuickstartDrawer.esm.js.map +1 -0
  18. package/dist/components/QuickstartDrawerContext.esm.js +6 -0
  19. package/dist/components/QuickstartDrawerContext.esm.js.map +1 -0
  20. package/dist/components/QuickstartDrawerProvider.esm.js +95 -0
  21. package/dist/components/QuickstartDrawerProvider.esm.js.map +1 -0
  22. package/dist/components/QuickstartFooter.esm.js +32 -0
  23. package/dist/components/QuickstartFooter.esm.js.map +1 -0
  24. package/dist/components/QuickstartHeader.esm.js +47 -0
  25. package/dist/components/QuickstartHeader.esm.js.map +1 -0
  26. package/dist/hooks/useLocalStorageState.esm.js +28 -0
  27. package/dist/hooks/useLocalStorageState.esm.js.map +1 -0
  28. package/dist/hooks/useQuickstartDrawerContext.esm.js +15 -0
  29. package/dist/hooks/useQuickstartDrawerContext.esm.js.map +1 -0
  30. package/dist/hooks/useQuickstartPermission.esm.js +27 -0
  31. package/dist/hooks/useQuickstartPermission.esm.js.map +1 -0
  32. package/dist/index.d.ts +58 -0
  33. package/dist/index.esm.js +8 -0
  34. package/dist/index.esm.js.map +1 -0
  35. package/dist/plugin.esm.js +18 -0
  36. package/dist/plugin.esm.js.map +1 -0
  37. package/package.json +72 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @red-hat-developer-hub/backstage-plugin-quickstart
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 4f8249b: First version of quickstart plugin
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Quickstart Plugin
2
+
3
+ The Quickstart plugin provides a guided onboarding experience for new users of Red Hat Developer Hub. It displays a customizable drawer interface with interactive quickstart steps that help users get familiar with the platform.
4
+
5
+ ## Features
6
+
7
+ - **Interactive Drawer Interface**: Displays quickstart steps in a slide-out drawer
8
+ - **Progress Tracking**: Tracks completion status of individual steps with persistent storage
9
+ - **Configurable Content**: Define custom quickstart items through app configuration
10
+ - **Visual Progress Indicator**: Shows overall completion progress with a progress bar
11
+ - **Call-to-Action Support**: Each step can include clickable action buttons
12
+
13
+ ## Installation
14
+
15
+ 1. Install the plugin package:
16
+
17
+ ```bash
18
+ # From the root of your app
19
+ yarn add --cwd packages/app @red-hat-developer-hub/backstage-plugin-quickstart
20
+ ```
21
+
22
+ 2. Add the plugin to your Backstage app by modifying `packages/app/src/App.tsx`:
23
+
24
+ ```tsx
25
+ import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart';
26
+
27
+ // Wrap your app with the QuickstartDrawerProvider
28
+ const App = () => (
29
+ <AppProvider>
30
+ <QuickstartDrawerProvider>
31
+ {/* Your existing app components */}
32
+ </QuickstartDrawerProvider>
33
+ </AppProvider>
34
+ );
35
+ ```
36
+
37
+ ## Configuration
38
+
39
+ Configure quickstart items in your `app-config.yaml`:
40
+
41
+ ```yaml
42
+ app:
43
+ quickstart:
44
+ - title: 'Welcome to Developer Hub'
45
+ description: 'Learn the basics of navigating the Developer Hub interface'
46
+ icon: 'home'
47
+ cta:
48
+ text: 'Get Started'
49
+ link: '/catalog'
50
+ - title: 'Create Your First Component'
51
+ description: 'Follow our guide to register your first software component'
52
+ icon: 'code'
53
+ cta:
54
+ text: 'Create Component'
55
+ link: '/catalog-import'
56
+ - title: 'Explore Templates'
57
+ description: 'Discover available software templates to bootstrap new projects'
58
+ icon: 'template'
59
+ cta:
60
+ text: 'Browse Templates'
61
+ link: '/create'
62
+ ```
63
+
64
+ ### Configuration Schema
65
+
66
+ Each quickstart item supports the following properties:
67
+
68
+ - `title` (required): The display title for the quickstart step
69
+ - `description` (required): A brief description of what the step covers
70
+ - `icon` (optional): Icon identifier (supports Material UI icons)
71
+ - `cta` (optional): Call-to-action object with:
72
+ - `text`: Button text
73
+ - `link`: Target URL or route
74
+
75
+ ## Usage
76
+
77
+ ### Using the Context Hook
78
+
79
+ Access quickstart drawer functionality in your components:
80
+
81
+ ```tsx
82
+ import { useQuickstartDrawerContext } from '@red-hat-developer-hub/backstage-plugin-quickstart';
83
+
84
+ const MyComponent = () => {
85
+ const { openDrawer, closeDrawer, isDrawerOpen } =
86
+ useQuickstartDrawerContext();
87
+
88
+ return <button onClick={openDrawer}>Open Quickstart Guide</button>;
89
+ };
90
+ ```
91
+
92
+ ### Progress Persistence
93
+
94
+ The plugin automatically saves progress to local storage, so users can continue where they left off even after refreshing the page or returning later.
95
+
96
+ ## Development
97
+
98
+ ### Local Development
99
+
100
+ To run the plugin in isolation for development:
101
+
102
+ ```bash
103
+ cd plugins/quickstart
104
+ yarn start
105
+ ```
106
+
107
+ This will start the plugin with hot reloading for faster development iteration.
108
+
109
+ ### Testing
110
+
111
+ Run the test suite:
112
+
113
+ ```bash
114
+ yarn test
115
+ ```
116
+
117
+ ### Building
118
+
119
+ Build the plugin for production:
120
+
121
+ ```bash
122
+ yarn build
123
+ ```
@@ -0,0 +1,6 @@
1
+ dynamicPlugins:
2
+ frontend:
3
+ red-hat-developer-hub.backstage-plugin-quickstart:
4
+ mountPoints:
5
+ - mountPoint: application/provider
6
+ importName: QuickstartDrawerProvider
package/config.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright Red Hat, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export interface Config {
18
+ app?: {
19
+ /**
20
+ * Configuration required for adding quickstarts
21
+ * @visibility frontend
22
+ */
23
+ quickstart?: Array</**
24
+ * @visibility frontend
25
+ */
26
+ {
27
+ /**
28
+ * The title of quickstart.
29
+ * @visibility frontend
30
+ */
31
+ title: string;
32
+ /**
33
+ * Optional icon for quickstart.
34
+ * @visibility frontend
35
+ */
36
+ icon?: string;
37
+ /**
38
+ * The description of quickstart.
39
+ * @visibility frontend
40
+ */
41
+ description: string;
42
+ /**
43
+ * Optional action item for quickstart.
44
+ * @visibility frontend
45
+ */
46
+ cta?: {
47
+ /**
48
+ * Action item text.
49
+ * @visibility frontend
50
+ */
51
+ text: string;
52
+ /**
53
+ * Action item link.
54
+ * @visibility frontend
55
+ */
56
+ link: string;
57
+ };
58
+ }>;
59
+ };
60
+ }
Binary file
@@ -0,0 +1,64 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import Box from '@mui/material/Box';
3
+ import { QuickstartHeader } from './QuickstartHeader.esm.js';
4
+ import Divider from '@mui/material/Divider';
5
+ import { QuickstartContent } from './QuickstartContent/QuickstartContent.esm.js';
6
+ import { QuickstartFooter } from './QuickstartFooter.esm.js';
7
+ import { useState, useCallback, useEffect } from 'react';
8
+
9
+ const Quickstart = ({
10
+ quickstartItems,
11
+ handleDrawerClose
12
+ }) => {
13
+ const itemCount = quickstartItems.length;
14
+ const [progress, setProgress] = useState(0);
15
+ const calculateProgress = useCallback(() => {
16
+ const completedCount = quickstartItems.filter((item, index) => {
17
+ const itemKey = `${item.title}-${index}`;
18
+ const stepState = localStorage.getItem(itemKey);
19
+ return stepState === "true";
20
+ }).length;
21
+ const percentage = completedCount / itemCount * 100;
22
+ return Math.round(percentage * 100) / 100;
23
+ }, [quickstartItems, itemCount]);
24
+ useEffect(() => {
25
+ const calculatedProgress = calculateProgress();
26
+ setProgress(calculatedProgress);
27
+ localStorage.setItem("progressState", calculatedProgress.toString());
28
+ }, [quickstartItems, itemCount, calculateProgress]);
29
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ /* @__PURE__ */ jsxs(
31
+ Box,
32
+ {
33
+ sx: {
34
+ padding: (theme) => `${theme.spacing(10.5)} ${theme.spacing(3)} ${theme.spacing(3)}`
35
+ },
36
+ children: [
37
+ /* @__PURE__ */ jsx(QuickstartHeader, {}),
38
+ /* @__PURE__ */ jsx(Divider, {}),
39
+ /* @__PURE__ */ jsx(
40
+ QuickstartContent,
41
+ {
42
+ quickstartItems,
43
+ itemCount,
44
+ setProgress: () => {
45
+ const newProgress = calculateProgress();
46
+ setProgress(newProgress);
47
+ }
48
+ }
49
+ )
50
+ ]
51
+ }
52
+ ),
53
+ /* @__PURE__ */ jsx(
54
+ QuickstartFooter,
55
+ {
56
+ handleDrawerClose,
57
+ progress
58
+ }
59
+ )
60
+ ] });
61
+ };
62
+
63
+ export { Quickstart };
64
+ //# sourceMappingURL=Quickstart.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Quickstart.esm.js","sources":["../../src/components/Quickstart.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport { QuickstartHeader } from './QuickstartHeader';\nimport Divider from '@mui/material/Divider';\nimport { QuickstartContent } from './QuickstartContent/QuickstartContent';\nimport { QuickstartFooter } from './QuickstartFooter';\nimport { useEffect, useState, useCallback } from 'react';\nimport { QuickstartItemData } from '../types';\n\ntype QuickstartProps = {\n quickstartItems: QuickstartItemData[];\n handleDrawerClose: () => void;\n};\n\nexport const Quickstart = ({\n quickstartItems,\n handleDrawerClose,\n}: QuickstartProps) => {\n const itemCount = quickstartItems.length;\n const [progress, setProgress] = useState<number>(0);\n\n const calculateProgress = useCallback(() => {\n const completedCount = quickstartItems.filter((item, index) => {\n const itemKey = `${item.title}-${index}`;\n const stepState = localStorage.getItem(itemKey);\n return stepState === 'true';\n }).length;\n\n const percentage = (completedCount / itemCount) * 100;\n return Math.round(percentage * 100) / 100;\n }, [quickstartItems, itemCount]);\n\n useEffect(() => {\n const calculatedProgress = calculateProgress();\n setProgress(calculatedProgress);\n localStorage.setItem('progressState', calculatedProgress.toString());\n }, [quickstartItems, itemCount, calculateProgress]);\n\n return (\n <>\n <Box\n sx={{\n padding: theme =>\n `${theme.spacing(10.5)} ${theme.spacing(3)} ${theme.spacing(3)}`,\n }}\n >\n <QuickstartHeader />\n <Divider />\n <QuickstartContent\n quickstartItems={quickstartItems}\n itemCount={itemCount}\n setProgress={() => {\n const newProgress = calculateProgress();\n setProgress(newProgress);\n }}\n />\n </Box>\n <QuickstartFooter\n handleDrawerClose={handleDrawerClose}\n progress={progress}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6BO,MAAM,aAAa,CAAC;AAAA,EACzB,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AAA,EAAI,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA;AAAA,SAClE;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,CAAA;AAAA,8BACjB,OAAQ,EAAA,EAAA,CAAA;AAAA,0BACT,GAAA;AAAA,YAAC,iBAAA;AAAA,YAAA;AAAA,cACC,eAAA;AAAA,cACA,SAAA;AAAA,cACA,aAAa,MAAM;AACjB,gBAAA,MAAM,cAAc,iBAAkB,EAAA;AACtC,gBAAA,WAAA,CAAY,WAAW,CAAA;AAAA;AACzB;AAAA;AACF;AAAA;AAAA,KACF;AAAA,oBACA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,iBAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,42 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import Box from '@mui/material/Box';
3
+ import List from '@mui/material/List';
4
+ import { QuickstartItem } from './QuickstartItem.esm.js';
5
+ import { EmptyState } from '@backstage/core-components';
6
+ import { useState } from 'react';
7
+
8
+ const QuickstartContent = ({
9
+ quickstartItems,
10
+ setProgress,
11
+ itemCount
12
+ }) => {
13
+ const [openItems, setOpenItems] = useState(
14
+ new Array(itemCount).fill(false)
15
+ );
16
+ return /* @__PURE__ */ jsx(
17
+ Box,
18
+ {
19
+ sx: {
20
+ paddingTop: (theme) => `${theme.spacing(3)}`
21
+ },
22
+ children: quickstartItems.length > 0 ? /* @__PURE__ */ jsx(List, { disablePadding: true, children: quickstartItems.map((item, index) => /* @__PURE__ */ jsx(
23
+ QuickstartItem,
24
+ {
25
+ item,
26
+ index,
27
+ open: openItems[index],
28
+ handleOpen: () => setOpenItems((oi) => {
29
+ return oi.map(
30
+ (val, valIndex) => valIndex === index ? !val : false
31
+ );
32
+ }),
33
+ setProgress: () => setProgress(index)
34
+ },
35
+ `${item.title}-${index}`
36
+ )) }) : /* @__PURE__ */ jsx(EmptyState, { title: "Quickstart content not available.", missing: "data" })
37
+ }
38
+ );
39
+ };
40
+
41
+ export { QuickstartContent };
42
+ //# sourceMappingURL=QuickstartContent.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartContent.esm.js","sources":["../../../src/components/QuickstartContent/QuickstartContent.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport List from '@mui/material/List';\nimport { QuickstartItem } from './QuickstartItem';\nimport { EmptyState } from '@backstage/core-components';\nimport { useState } from 'react';\nimport { QuickstartItemData } from '../../types';\n\ntype QuickstartContentProps = {\n quickstartItems: QuickstartItemData[];\n setProgress: (index: number) => void;\n itemCount: number;\n};\n\nexport const QuickstartContent = ({\n quickstartItems,\n setProgress,\n itemCount,\n}: QuickstartContentProps) => {\n const [openItems, setOpenItems] = useState<boolean[]>(\n new Array(itemCount).fill(false),\n );\n\n return (\n <Box\n sx={{\n paddingTop: theme => `${theme.spacing(3)}`,\n }}\n >\n {quickstartItems.length > 0 ? (\n <List disablePadding>\n {quickstartItems.map((item: QuickstartItemData, index: number) => (\n <QuickstartItem\n key={`${item.title}-${index}`}\n item={item}\n index={index}\n open={openItems[index]}\n handleOpen={() =>\n setOpenItems(oi => {\n return oi.map((val, valIndex) =>\n valIndex === index ? !val : false,\n );\n })\n }\n setProgress={() => setProgress(index)}\n />\n ))}\n </List>\n ) : (\n <EmptyState title=\"Quickstart content not available.\" missing=\"data\" />\n )}\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;A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
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
3
+ import { LinkButton } from '@backstage/core-components';
4
+
5
+ const QuickstartCtaLink = ({ cta, onClick }) => {
6
+ if (!cta) {
7
+ return /* @__PURE__ */ jsx(
8
+ LinkButton,
9
+ {
10
+ color: "primary",
11
+ variant: "outlined",
12
+ to: "#",
13
+ onClick: (e) => {
14
+ e.preventDefault();
15
+ onClick();
16
+ },
17
+ children: "Got it!"
18
+ }
19
+ );
20
+ }
21
+ const isExternalLink = cta.link.startsWith("http://") || cta.link.startsWith("https://");
22
+ return isExternalLink ? /* @__PURE__ */ jsxs(
23
+ LinkButton,
24
+ {
25
+ color: "primary",
26
+ style: {
27
+ gap: "5px"
28
+ },
29
+ variant: "outlined",
30
+ to: cta.link,
31
+ onClick,
32
+ children: [
33
+ cta.text,
34
+ "\xA0",
35
+ /* @__PURE__ */ jsx(
36
+ OpenInNewIcon,
37
+ {
38
+ sx: {
39
+ fontSize: "15px"
40
+ }
41
+ }
42
+ )
43
+ ]
44
+ }
45
+ ) : /* @__PURE__ */ jsx(
46
+ LinkButton,
47
+ {
48
+ color: "primary",
49
+ variant: "outlined",
50
+ to: cta.link,
51
+ onClick,
52
+ children: cta.text
53
+ }
54
+ );
55
+ };
56
+
57
+ export { QuickstartCtaLink };
58
+ //# sourceMappingURL=QuickstartCtaLink.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartCtaLink.esm.js","sources":["../../../src/components/QuickstartContent/QuickstartCtaLink.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport { QuickstartItemCtaData } from '../../types';\nimport { LinkButton } from '@backstage/core-components';\n\nexport type QuickstartCtaLinkProps = {\n cta?: QuickstartItemCtaData;\n onClick: () => void;\n};\n\nexport const QuickstartCtaLink = ({ cta, onClick }: QuickstartCtaLinkProps) => {\n // If no CTA is provided, show a default \"Got it!\" button\n if (!cta) {\n return (\n <LinkButton\n color=\"primary\"\n variant=\"outlined\"\n to=\"#\"\n onClick={e => {\n e.preventDefault();\n onClick();\n }}\n >\n Got it!\n </LinkButton>\n );\n }\n\n const isExternalLink =\n cta.link.startsWith('http://') || cta.link.startsWith('https://');\n\n return isExternalLink ? (\n <LinkButton\n color=\"primary\"\n style={{\n gap: '5px',\n }}\n variant=\"outlined\"\n to={cta.link}\n onClick={onClick}\n >\n {cta.text}&nbsp;\n <OpenInNewIcon\n sx={{\n fontSize: '15px',\n }}\n />\n </LinkButton>\n ) : (\n <LinkButton\n color=\"primary\"\n variant=\"outlined\"\n to={cta.link}\n onClick={onClick}\n >\n {cta.text}\n </LinkButton>\n );\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,iBAAoB,GAAA,CAAC,EAAE,GAAA,EAAK,SAAsC,KAAA;AAE7E,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IACE,uBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,UAAA;AAAA,QACR,EAAG,EAAA,GAAA;AAAA,QACH,SAAS,CAAK,CAAA,KAAA;AACZ,UAAA,CAAA,CAAE,cAAe,EAAA;AACjB,UAAQ,OAAA,EAAA;AAAA,SACV;AAAA,QACD,QAAA,EAAA;AAAA;AAAA,KAED;AAAA;AAIJ,EAAM,MAAA,cAAA,GACJ,IAAI,IAAK,CAAA,UAAA,CAAW,SAAS,CAAK,IAAA,GAAA,CAAI,IAAK,CAAA,UAAA,CAAW,UAAU,CAAA;AAElE,EAAA,OAAO,cACL,mBAAA,IAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,GAAK,EAAA;AAAA,OACP;AAAA,MACA,OAAQ,EAAA,UAAA;AAAA,MACR,IAAI,GAAI,CAAA,IAAA;AAAA,MACR,OAAA;AAAA,MAEC,QAAA,EAAA;AAAA,QAAI,GAAA,CAAA,IAAA;AAAA,QAAK,MAAA;AAAA,wBACV,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA;AAAA,cACF,QAAU,EAAA;AAAA;AACZ;AAAA;AACF;AAAA;AAAA,GAGF,mBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,OAAQ,EAAA,UAAA;AAAA,MACR,IAAI,GAAI,CAAA,IAAA;AAAA,MACR,OAAA;AAAA,MAEC,QAAI,EAAA,GAAA,CAAA;AAAA;AAAA,GACP;AAEJ;;;;"}
@@ -0,0 +1,132 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import ExpandLess from '@mui/icons-material/ExpandLess';
3
+ import ExpandMore from '@mui/icons-material/ExpandMore';
4
+ import Box from '@mui/material/Box';
5
+ import Collapse from '@mui/material/Collapse';
6
+ import List from '@mui/material/List';
7
+ import ListItem from '@mui/material/ListItem';
8
+ import ListItemIcon from '@mui/material/ListItemIcon';
9
+ import ListItemText from '@mui/material/ListItemText';
10
+ import { useState, useEffect } from 'react';
11
+ import { QuickstartItemIcon } from './QuickstartItemIcon.esm.js';
12
+ import { QuickstartCtaLink } from './QuickstartCtaLink.esm.js';
13
+ import IconButton from '@mui/material/IconButton';
14
+
15
+ const QuickstartItem = ({
16
+ item,
17
+ setProgress,
18
+ index,
19
+ open,
20
+ handleOpen
21
+ }) => {
22
+ const [stepCompleted, setStepCompleted] = useState(false);
23
+ const itemKey = `${item.title}-${index}`;
24
+ useEffect(() => {
25
+ const stepState = localStorage.getItem(itemKey);
26
+ if (stepState === "true") {
27
+ setStepCompleted(true);
28
+ }
29
+ }, [itemKey]);
30
+ useEffect(() => {
31
+ localStorage.setItem(itemKey, stepCompleted.toString());
32
+ }, [itemKey, stepCompleted]);
33
+ useEffect(() => {
34
+ if (stepCompleted) {
35
+ setProgress();
36
+ }
37
+ }, [stepCompleted, setProgress]);
38
+ return /* @__PURE__ */ jsxs(Box, { sx: { marginBottom: (theme) => `${theme.spacing(0.2)}` }, children: [
39
+ /* @__PURE__ */ jsxs(
40
+ ListItem,
41
+ {
42
+ onClick: handleOpen,
43
+ role: "button",
44
+ "aria-expanded": open,
45
+ "aria-label": `${open ? "Collapse" : "Expand"} ${item.title} details`,
46
+ tabIndex: 0,
47
+ onKeyDown: (e) => {
48
+ if (e.key === "Enter" || e.key === " ") {
49
+ e.preventDefault();
50
+ handleOpen();
51
+ }
52
+ },
53
+ sx: {
54
+ cursor: "pointer",
55
+ ...stepCompleted ? {
56
+ backgroundColor: (theme) => theme.palette.mode === "light" ? "#F3FAF2" : "#223D2D"
57
+ } : { backgroundColor: (theme) => theme.palette.background.paper }
58
+ },
59
+ children: [
60
+ /* @__PURE__ */ jsx(
61
+ ListItemIcon,
62
+ {
63
+ sx: {
64
+ minWidth: "40px"
65
+ },
66
+ children: /* @__PURE__ */ jsx(
67
+ QuickstartItemIcon,
68
+ {
69
+ icon: item.icon,
70
+ sx: {
71
+ ...open ? { color: (theme) => theme.palette.text.primary } : { color: (theme) => theme.palette.text.secondary }
72
+ }
73
+ }
74
+ )
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx(
78
+ ListItemText,
79
+ {
80
+ primary: item.title,
81
+ sx: {
82
+ "& .v5-MuiTypography-root": {
83
+ fontWeight: (theme) => `${theme.typography.fontWeightMedium}!important`
84
+ },
85
+ ...open ? { color: (theme) => theme.palette.text.primary } : { color: (theme) => theme.palette.text.secondary }
86
+ }
87
+ }
88
+ ),
89
+ /* @__PURE__ */ jsx(
90
+ IconButton,
91
+ {
92
+ "aria-label": open ? "Collapse item" : "Expand item",
93
+ sx: {
94
+ ...open ? { color: (theme) => theme.palette.text.primary } : { color: (theme) => theme.palette.text.secondary }
95
+ },
96
+ children: open ? /* @__PURE__ */ jsx(ExpandLess, {}) : /* @__PURE__ */ jsx(ExpandMore, {})
97
+ }
98
+ )
99
+ ]
100
+ },
101
+ itemKey
102
+ ),
103
+ /* @__PURE__ */ jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsxs(
104
+ List,
105
+ {
106
+ component: "div",
107
+ disablePadding: true,
108
+ sx: {
109
+ ...stepCompleted ? {
110
+ backgroundColor: (theme) => theme.palette.mode === "light" ? "#F3FAF2" : "#223D2D"
111
+ } : { backgroundColor: (theme) => theme.palette.background.paper },
112
+ paddingBottom: "10px"
113
+ },
114
+ children: [
115
+ /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, { primary: item.description }) }),
116
+ /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(
117
+ QuickstartCtaLink,
118
+ {
119
+ cta: item.cta,
120
+ onClick: () => {
121
+ setStepCompleted(true);
122
+ }
123
+ }
124
+ ) })
125
+ ]
126
+ }
127
+ ) })
128
+ ] });
129
+ };
130
+
131
+ export { QuickstartItem };
132
+ //# sourceMappingURL=QuickstartItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartItem.esm.js","sources":["../../../src/components/QuickstartContent/QuickstartItem.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ExpandLess from '@mui/icons-material/ExpandLess';\nimport ExpandMore from '@mui/icons-material/ExpandMore';\nimport Box from '@mui/material/Box';\nimport Collapse from '@mui/material/Collapse';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemIcon from '@mui/material/ListItemIcon';\nimport ListItemText from '@mui/material/ListItemText';\nimport { useEffect, useState } from 'react';\nimport { QuickstartItemIcon } from './QuickstartItemIcon';\nimport { QuickstartCtaLink } from './QuickstartCtaLink';\nimport IconButton from '@mui/material/IconButton';\nimport { QuickstartItemData } from '../../types';\n\nexport type QuickstartItemProps = {\n item: QuickstartItemData;\n setProgress: () => void;\n index: number;\n open: boolean;\n handleOpen: () => void;\n};\n\nexport const QuickstartItem = ({\n item,\n setProgress,\n index,\n open,\n handleOpen,\n}: QuickstartItemProps) => {\n const [stepCompleted, setStepCompleted] = useState<boolean>(false);\n const itemKey = `${item.title}-${index}`;\n\n useEffect(() => {\n const stepState = localStorage.getItem(itemKey);\n if (stepState === 'true') {\n setStepCompleted(true);\n }\n }, [itemKey]);\n\n useEffect(() => {\n localStorage.setItem(itemKey, stepCompleted.toString());\n }, [itemKey, stepCompleted]);\n\n useEffect(() => {\n if (stepCompleted) {\n setProgress();\n }\n }, [stepCompleted, setProgress]);\n\n return (\n <Box sx={{ marginBottom: theme => `${theme.spacing(0.2)}` }}>\n <ListItem\n key={itemKey}\n onClick={handleOpen}\n role=\"button\"\n aria-expanded={open}\n aria-label={`${open ? 'Collapse' : 'Expand'} ${item.title} details`}\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleOpen();\n }\n }}\n sx={{\n cursor: 'pointer',\n ...(stepCompleted\n ? {\n backgroundColor: theme =>\n theme.palette.mode === 'light' ? '#F3FAF2' : '#223D2D',\n }\n : { backgroundColor: theme => theme.palette.background.paper }),\n }}\n >\n <ListItemIcon\n sx={{\n minWidth: '40px',\n }}\n >\n <QuickstartItemIcon\n icon={item.icon}\n sx={{\n ...(open\n ? { color: theme => theme.palette.text.primary }\n : { color: theme => theme.palette.text.secondary }),\n }}\n />\n </ListItemIcon>\n <ListItemText\n primary={item.title}\n sx={{\n '& .v5-MuiTypography-root': {\n fontWeight: theme =>\n `${theme.typography.fontWeightMedium}!important`,\n },\n ...(open\n ? { color: theme => theme.palette.text.primary }\n : { color: theme => theme.palette.text.secondary }),\n }}\n />\n <IconButton\n aria-label={open ? 'Collapse item' : 'Expand item'}\n sx={{\n ...(open\n ? { color: theme => theme.palette.text.primary }\n : { color: theme => theme.palette.text.secondary }),\n }}\n >\n {open ? <ExpandLess /> : <ExpandMore />}\n </IconButton>\n </ListItem>\n <Collapse in={open} timeout=\"auto\" unmountOnExit>\n <List\n component=\"div\"\n disablePadding\n sx={{\n ...(stepCompleted\n ? {\n backgroundColor: theme =>\n theme.palette.mode === 'light' ? '#F3FAF2' : '#223D2D',\n }\n : { backgroundColor: theme => theme.palette.background.paper }),\n paddingBottom: '10px',\n }}\n >\n <ListItem>\n <ListItemText primary={item.description} />\n </ListItem>\n <ListItem>\n <QuickstartCtaLink\n cta={item.cta}\n onClick={() => {\n setStepCompleted(true);\n }}\n />\n </ListItem>\n </List>\n </Collapse>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsCO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,IAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAA2B,KAAA;AACzB,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,SAAkB,KAAK,CAAA;AACjE,EAAA,MAAM,OAAU,GAAA,CAAA,EAAG,IAAK,CAAA,KAAK,IAAI,KAAK,CAAA,CAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,SAAA,GAAY,YAAa,CAAA,OAAA,CAAQ,OAAO,CAAA;AAC9C,IAAA,IAA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 import AdminPanelSettingsOutlinedIcon from '@mui/icons-material/AdminPanelSettingsOutlined';
4
+ import VpnKeyOutlinedIcon from '@mui/icons-material/VpnKeyOutlined';
5
+ import FileCopyOutlinedIcon from '@mui/icons-material/FileCopyOutlined';
6
+ import PowerOutlinedIcon from '@mui/icons-material/PowerOutlined';
7
+ import { useApp } from '@backstage/core-plugin-api';
8
+ import Box from '@mui/material/Box';
9
+
10
+ const commonIcons = {
11
+ Admin: /* @__PURE__ */ jsx(AdminPanelSettingsOutlinedIcon, {}),
12
+ Rbac: /* @__PURE__ */ jsx(VpnKeyOutlinedIcon, {}),
13
+ Git: /* @__PURE__ */ jsx(FileCopyOutlinedIcon, {}),
14
+ Plugins: /* @__PURE__ */ jsx(PowerOutlinedIcon, {})
15
+ };
16
+ const QuickstartItemIcon = ({ icon, sx }) => {
17
+ const app = useApp();
18
+ if (!icon) {
19
+ return null;
20
+ }
21
+ const SystemIcon = app.getSystemIcon(icon);
22
+ if (SystemIcon) {
23
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", ...sx }, children: /* @__PURE__ */ jsx(SystemIcon, { fontSize: "medium" }) });
24
+ }
25
+ if (icon.startsWith("<svg")) {
26
+ const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;
27
+ return /* @__PURE__ */ jsx(MuiIcon, { fontSize: "medium", sx, children: /* @__PURE__ */ jsx("img", { src: svgDataUri, alt: "" }) });
28
+ }
29
+ if (icon.startsWith("https://") || icon.startsWith("http://") || icon.startsWith("/")) {
30
+ return /* @__PURE__ */ jsx(
31
+ MuiIcon,
32
+ {
33
+ fontSize: "medium",
34
+ baseClassName: "material-icons-outlined",
35
+ sx,
36
+ children: /* @__PURE__ */ jsx("img", { src: icon, alt: "", height: "100%", width: "100%" })
37
+ }
38
+ );
39
+ }
40
+ return /* @__PURE__ */ jsx(MuiIcon, { fontSize: "medium", baseClassName: "material-icons-outlined", sx, children: commonIcons[icon] || icon });
41
+ };
42
+
43
+ export { QuickstartItemIcon };
44
+ //# sourceMappingURL=QuickstartItemIcon.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartItemIcon.esm.js","sources":["../../../src/components/QuickstartContent/QuickstartItemIcon.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport MuiIcon from '@mui/material/Icon';\nimport AdminPanelSettingsOutlinedIcon from '@mui/icons-material/AdminPanelSettingsOutlined';\nimport VpnKeyOutlinedIcon from '@mui/icons-material/VpnKeyOutlined';\nimport FileCopyOutlinedIcon from '@mui/icons-material/FileCopyOutlined';\nimport PowerOutlinedIcon from '@mui/icons-material/PowerOutlined';\nimport { SxProps, Theme } from '@mui/material/styles';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Box from '@mui/material/Box';\n\nexport interface QuickstartItemIconProps {\n icon?: string;\n sx?: SxProps<Theme>;\n}\n\nconst commonIcons: {\n [k: string]: React.ReactNode;\n} = {\n Admin: <AdminPanelSettingsOutlinedIcon />,\n Rbac: <VpnKeyOutlinedIcon />,\n Git: <FileCopyOutlinedIcon />,\n Plugins: <PowerOutlinedIcon />,\n};\n\nexport const QuickstartItemIcon = ({ icon, sx }: QuickstartItemIconProps) => {\n const app = useApp();\n if (!icon) {\n return null;\n }\n\n const SystemIcon = app.getSystemIcon(icon);\n if (SystemIcon) {\n return (\n <Box sx={{ display: 'flex', alignItems: 'center', ...sx }}>\n <SystemIcon fontSize=\"medium\" />\n </Box>\n );\n }\n\n if (icon.startsWith('<svg')) {\n const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;\n return (\n <MuiIcon fontSize=\"medium\" sx={sx}>\n <img src={svgDataUri} alt=\"\" />\n </MuiIcon>\n );\n }\n\n if (\n icon.startsWith('https://') ||\n icon.startsWith('http://') ||\n icon.startsWith('/')\n ) {\n return (\n <MuiIcon\n fontSize=\"medium\"\n baseClassName=\"material-icons-outlined\"\n sx={sx}\n >\n <img src={icon} alt=\"\" height=\"100%\" width=\"100%\" />\n </MuiIcon>\n );\n }\n\n return (\n <MuiIcon fontSize=\"medium\" baseClassName=\"material-icons-outlined\" sx={sx}>\n {commonIcons[icon] || icon}\n </MuiIcon>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA8BA,MAAM,WAEF,GAAA;AAAA,EACF,KAAA,sBAAQ,8BAA+B,EAAA,EAAA,CAAA;AAAA,EACvC,IAAA,sBAAO,kBAAmB,EAAA,EAAA,CAAA;AAAA,EAC1B,GAAA,sBAAM,oBAAqB,EAAA,EAAA,CAAA;AAAA,EAC3B,OAAA,sBAAU,iBAAkB,EAAA,EAAA;AAC9B,CAAA;AAEO,MAAM,kBAAqB,GAAA,CAAC,EAAE,IAAA,EAAM,IAAkC,KAAA;AAC3E,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,UAAA,GAAa,GAAI,CAAA,aAAA,CAAc,IAAI,CAAA;AACzC,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,uBACG,GAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,EAAE,SAAS,MAAQ,EAAA,UAAA,EAAY,QAAU,EAAA,GAAG,IACnD,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAS,UAAS,CAChC,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,IAAA,CAAK,UAAW,CAAA,MAAM,CAAG,EAAA;AAC3B,IAAA,MAAM,UAAa,GAAA,CAAA,0BAAA,EAA6B,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1D,IACE,uBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAS,QAAS,EAAA,EAAA,EACzB,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,GAAK,EAAA,UAAA,EAAY,GAAI,EAAA,EAAA,EAAG,CAC/B,EAAA,CAAA;AAAA;AAIJ,EACE,IAAA,IAAA,CAAK,UAAW,CAAA,UAAU,CAC1B,IAAA,IAAA,CAAK,UAAW,CAAA,SAAS,CACzB,IAAA,IAAA,CAAK,UAAW,CAAA,GAAG,CACnB,EAAA;AACA,IACE,uBAAA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,QAAS,EAAA,QAAA;AAAA,QACT,aAAc,EAAA,yBAAA;AAAA,QACd,EAAA;AAAA,QAEA,QAAA,kBAAA,GAAA,CAAC,SAAI,GAAK,EAAA,IAAA,EAAM,KAAI,EAAG,EAAA,MAAA,EAAO,MAAO,EAAA,KAAA,EAAM,MAAO,EAAA;AAAA;AAAA,KACpD;AAAA;AAIJ,EACE,uBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAS,QAAS,EAAA,aAAA,EAAc,2BAA0B,EAChE,EAAA,QAAA,EAAA,WAAA,CAAY,IAAI,CAAA,IAAK,IACxB,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,38 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import Drawer from '@mui/material/Drawer';
3
+ import { useApiHolder, configApiRef } from '@backstage/core-plugin-api';
4
+ import { Quickstart } from './Quickstart.esm.js';
5
+ import { useQuickstartDrawerContext } from '../hooks/useQuickstartDrawerContext.esm.js';
6
+
7
+ const QuickstartDrawer = () => {
8
+ const { isDrawerOpen, closeDrawer, drawerWidth } = useQuickstartDrawerContext();
9
+ const apiHolder = useApiHolder();
10
+ const config = apiHolder.get(configApiRef);
11
+ const quickstartItems = config?.has("app.quickstart") ? config.get("app.quickstart") : [];
12
+ return /* @__PURE__ */ jsx(
13
+ Drawer,
14
+ {
15
+ sx: {
16
+ "& .v5-MuiDrawer-paper": {
17
+ width: drawerWidth,
18
+ boxSizing: "border-box",
19
+ backgroundColor: (theme) => `${theme.palette?.rhdh?.general.sidebarBackgroundColor}`,
20
+ justifyContent: "space-between"
21
+ }
22
+ },
23
+ variant: "persistent",
24
+ anchor: "right",
25
+ open: isDrawerOpen,
26
+ children: /* @__PURE__ */ jsx(
27
+ Quickstart,
28
+ {
29
+ quickstartItems,
30
+ handleDrawerClose: closeDrawer
31
+ }
32
+ )
33
+ }
34
+ );
35
+ };
36
+
37
+ export { QuickstartDrawer };
38
+ //# sourceMappingURL=QuickstartDrawer.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartDrawer.esm.js","sources":["../../src/components/QuickstartDrawer.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Drawer from '@mui/material/Drawer';\nimport { ThemeConfig } from '@red-hat-developer-hub/backstage-plugin-theme';\nimport { configApiRef, useApiHolder } from '@backstage/core-plugin-api';\nimport { Quickstart } from './Quickstart';\nimport { useQuickstartDrawerContext } from '../hooks/useQuickstartDrawerContext';\nimport { QuickstartItemData } from '../types';\n\nexport const QuickstartDrawer = () => {\n const { isDrawerOpen, closeDrawer, drawerWidth } =\n useQuickstartDrawerContext();\n\n const apiHolder = useApiHolder();\n const config = apiHolder.get(configApiRef);\n const quickstartItems: QuickstartItemData[] = config?.has('app.quickstart')\n ? config.get('app.quickstart')\n : [];\n return (\n <Drawer\n sx={{\n '& .v5-MuiDrawer-paper': {\n width: drawerWidth,\n boxSizing: 'border-box',\n backgroundColor: theme =>\n `${\n (theme as ThemeConfig).palette?.rhdh?.general\n .sidebarBackgroundColor\n }`,\n justifyContent: 'space-between',\n },\n }}\n variant=\"persistent\"\n anchor=\"right\"\n open={isDrawerOpen}\n >\n <Quickstart\n quickstartItems={quickstartItems}\n handleDrawerClose={closeDrawer}\n />\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,YAAA,EAAc,WAAa,EAAA,WAAA,KACjC,0BAA2B,EAAA;AAE7B,EAAA,MAAM,YAAY,YAAa,EAAA;AAC/B,EAAM,MAAA,MAAA,GAAS,SAAU,CAAA,GAAA,CAAI,YAAY,CAAA;AACzC,EAAM,MAAA,eAAA,GAAwC,QAAQ,GAAI,CAAA,gBAAgB,IACtE,MAAO,CAAA,GAAA,CAAI,gBAAgB,CAAA,GAC3B,EAAC;AACL,EACE,uBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,uBAAyB,EAAA;AAAA,UACvB,KAAO,EAAA,WAAA;AAAA,UACP,SAAW,EAAA,YAAA;AAAA,UACX,iBAAiB,CACf,KAAA,KAAA,CAAA,EACG,MAAsB,OAAS,EAAA,IAAA,EAAM,QACnC,sBACL,CAAA,CAAA;AAAA,UACF,cAAgB,EAAA;AAAA;AAClB,OACF;AAAA,MACA,OAAQ,EAAA,YAAA;AAAA,MACR,MAAO,EAAA,OAAA;AAAA,MACP,IAAM,EAAA,YAAA;AAAA,MAEN,QAAA,kBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,eAAA;AAAA,UACA,iBAAmB,EAAA;AAAA;AAAA;AACrB;AAAA,GACF;AAEJ;;;;"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+
3
+ const QuickstartDrawerContext = createContext(void 0);
4
+
5
+ export { QuickstartDrawerContext };
6
+ //# sourceMappingURL=QuickstartDrawerContext.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartDrawerContext.esm.js","sources":["../../src/components/QuickstartDrawerContext.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext } from 'react';\n\n/**\n * Type for QuickstartDrawerContext\n *\n * @public\n */\nexport interface QuickstartDrawerContextType {\n /**\n * The prop to check if the drawer is open\n */\n isDrawerOpen: boolean;\n /**\n * The function to open the drawer\n */\n openDrawer: () => void;\n /**\n * The function to close the drawer\n */\n closeDrawer: () => void;\n /**\n * The function to toggle the drawer state\n */\n toggleDrawer: () => void;\n /**\n * The prop for drawer width\n */\n drawerWidth: number;\n /**\n * The function for setting the drawer width\n */\n setDrawerWidth: React.Dispatch<React.SetStateAction<number>>;\n}\n\n/**\n * @public\n */\nexport const QuickstartDrawerContext = createContext<\n QuickstartDrawerContextType | undefined\n>(undefined);\n"],"names":[],"mappings":";;AAqDa,MAAA,uBAAA,GAA0B,cAErC,MAAS;;;;"}
@@ -0,0 +1,95 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
3
+ import Snackbar from '@mui/material/Snackbar';
4
+ import CloseIcon from '@mui/icons-material/Close';
5
+ import IconButton from '@mui/material/IconButton';
6
+ import { QuickstartDrawerContext } from './QuickstartDrawerContext.esm.js';
7
+ import { QuickstartDrawer } from './QuickstartDrawer.esm.js';
8
+ import Box from '@mui/material/Box';
9
+ import { useQuickstartPermission } from '../hooks/useQuickstartPermission.esm.js';
10
+ import { useLocalStorageState } from '../hooks/useLocalStorageState.esm.js';
11
+
12
+ const QuickstartDrawerProvider = ({ children }) => {
13
+ const isAllowed = useQuickstartPermission();
14
+ const [isDrawerOpen, setIsDrawerOpen] = useLocalStorageState(
15
+ "quickstart-drawer-open",
16
+ false,
17
+ isAllowed
18
+ );
19
+ const [showNotification, setShowNotification] = useState(false);
20
+ const [hasShownNotification, setHasShownNotification] = useState(false);
21
+ const [drawerWidth, setDrawerWidth] = useState(500);
22
+ useEffect(() => {
23
+ const hasVisited = localStorage.getItem("quickstart-visited");
24
+ const notificationShown = localStorage.getItem(
25
+ "quickstart-notification-shown"
26
+ );
27
+ if (isAllowed) {
28
+ if (!hasVisited) {
29
+ setIsDrawerOpen(true);
30
+ localStorage.setItem("quickstart-visited", "true");
31
+ }
32
+ }
33
+ setHasShownNotification(notificationShown === "true");
34
+ }, [isAllowed, setIsDrawerOpen]);
35
+ const openDrawer = () => setIsDrawerOpen(true);
36
+ const closeDrawer = () => {
37
+ setIsDrawerOpen(false);
38
+ if (!hasShownNotification) {
39
+ setShowNotification(true);
40
+ setHasShownNotification(true);
41
+ localStorage.setItem("quickstart-notification-shown", "true");
42
+ }
43
+ };
44
+ const toggleDrawer = () => setIsDrawerOpen(!isDrawerOpen);
45
+ const handleNotificationClose = () => setShowNotification(false);
46
+ return /* @__PURE__ */ jsxs(
47
+ QuickstartDrawerContext.Provider,
48
+ {
49
+ value: {
50
+ isDrawerOpen,
51
+ openDrawer,
52
+ closeDrawer,
53
+ toggleDrawer,
54
+ setDrawerWidth,
55
+ drawerWidth
56
+ },
57
+ children: [
58
+ /* @__PURE__ */ jsx(
59
+ Box,
60
+ {
61
+ sx: {
62
+ ...!isDrawerOpen ? { marginRight: "0px" } : { marginRight: `${drawerWidth}px` }
63
+ },
64
+ children
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(QuickstartDrawer, {}),
68
+ /* @__PURE__ */ jsx(
69
+ Snackbar,
70
+ {
71
+ sx: { top: "80px !important" },
72
+ open: showNotification,
73
+ autoHideDuration: 1e4,
74
+ onClose: handleNotificationClose,
75
+ anchorOrigin: { vertical: "top", horizontal: "right" },
76
+ message: "Need help? Visit the Quick Start Guide by clicking on this (?) icon in the header!",
77
+ action: /* @__PURE__ */ jsx(
78
+ IconButton,
79
+ {
80
+ size: "small",
81
+ "aria-label": "close",
82
+ color: "inherit",
83
+ onClick: handleNotificationClose,
84
+ children: /* @__PURE__ */ jsx(CloseIcon, { fontSize: "small" })
85
+ }
86
+ )
87
+ }
88
+ )
89
+ ]
90
+ }
91
+ );
92
+ };
93
+
94
+ export { QuickstartDrawerProvider };
95
+ //# sourceMappingURL=QuickstartDrawerProvider.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartDrawerProvider.esm.js","sources":["../../src/components/QuickstartDrawerProvider.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, PropsWithChildren, useState } from 'react';\nimport Snackbar from '@mui/material/Snackbar';\nimport CloseIcon from '@mui/icons-material/Close';\nimport IconButton from '@mui/material/IconButton';\nimport { QuickstartDrawerContext } from './QuickstartDrawerContext';\nimport { QuickstartDrawer } from './QuickstartDrawer';\nimport Box from '@mui/material/Box';\nimport { useQuickstartPermission } from '../hooks/useQuickstartPermission';\nimport { useLocalStorageState } from '../hooks/useLocalStorageState';\n\nexport const QuickstartDrawerProvider = ({ children }: PropsWithChildren) => {\n const isAllowed = useQuickstartPermission();\n const [isDrawerOpen, setIsDrawerOpen] = useLocalStorageState<boolean>(\n 'quickstart-drawer-open',\n false,\n isAllowed,\n );\n const [showNotification, setShowNotification] = useState(false);\n const [hasShownNotification, setHasShownNotification] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState<number>(500);\n\n useEffect(() => {\n const hasVisited = localStorage.getItem('quickstart-visited');\n const notificationShown = localStorage.getItem(\n 'quickstart-notification-shown',\n );\n\n if (isAllowed) {\n if (!hasVisited) {\n setIsDrawerOpen(true);\n localStorage.setItem('quickstart-visited', 'true');\n }\n }\n\n setHasShownNotification(notificationShown === 'true');\n }, [isAllowed, setIsDrawerOpen]);\n\n const openDrawer = () => setIsDrawerOpen(true);\n const closeDrawer = () => {\n setIsDrawerOpen(false);\n if (!hasShownNotification) {\n setShowNotification(true);\n setHasShownNotification(true);\n localStorage.setItem('quickstart-notification-shown', 'true');\n }\n };\n const toggleDrawer = () => setIsDrawerOpen(!isDrawerOpen);\n const handleNotificationClose = () => setShowNotification(false);\n\n return (\n <QuickstartDrawerContext.Provider\n value={{\n isDrawerOpen,\n openDrawer,\n closeDrawer,\n toggleDrawer,\n setDrawerWidth,\n drawerWidth,\n }}\n >\n <Box\n sx={{\n ...(!isDrawerOpen\n ? { marginRight: '0px' }\n : { marginRight: `${drawerWidth}px` }),\n }}\n >\n {children}\n </Box>\n <QuickstartDrawer />\n <Snackbar\n sx={{ top: '80px !important' }}\n open={showNotification}\n autoHideDuration={10000}\n onClose={handleNotificationClose}\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n message=\"Need help? Visit the Quick Start Guide by clicking on this (?) icon in the header!\"\n action={\n <IconButton\n size=\"small\"\n aria-label=\"close\"\n color=\"inherit\"\n onClick={handleNotificationClose}\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n }\n />\n </QuickstartDrawerContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA0BO,MAAM,wBAA2B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC3E,EAAA,MAAM,YAAY,uBAAwB,EAAA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/material/Button';
4
+ import LinearProgress from '@mui/material/LinearProgress';
5
+ import Typography from '@mui/material/Typography';
6
+
7
+ const QuickstartFooter = ({
8
+ handleDrawerClose,
9
+ progress
10
+ }) => {
11
+ return /* @__PURE__ */ jsxs(Box, { children: [
12
+ /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: progress }),
13
+ /* @__PURE__ */ jsxs(
14
+ Box,
15
+ {
16
+ sx: {
17
+ display: "flex",
18
+ alignItems: "center",
19
+ justifyContent: "space-between",
20
+ padding: (theme) => `${theme.spacing(2.5)}`
21
+ },
22
+ children: [
23
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.caption }, children: progress > 0 ? `${progress}% progress` : "Not started" }),
24
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleDrawerClose(), children: "Hide" })
25
+ ]
26
+ }
27
+ )
28
+ ] });
29
+ };
30
+
31
+ export { QuickstartFooter };
32
+ //# sourceMappingURL=QuickstartFooter.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartFooter.esm.js","sources":["../../src/components/QuickstartFooter.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Typography from '@mui/material/Typography';\n\nexport type QuickstartFooterProps = {\n handleDrawerClose: () => void;\n progress: number;\n};\n\nexport const QuickstartFooter = ({\n handleDrawerClose,\n progress,\n}: QuickstartFooterProps) => {\n return (\n <Box>\n <LinearProgress variant=\"determinate\" value={progress} />\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: theme => `${theme.spacing(2.5)}`,\n }}\n >\n <Typography sx={{ fontSize: theme => theme.typography.caption }}>\n {progress > 0 ? `${progress}% progress` : 'Not started'}\n </Typography>\n <Button onClick={() => handleDrawerClose()}>Hide</Button>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,iBAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,4BACG,GACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,OAAA,EAAQ,aAAc,EAAA,KAAA,EAAO,QAAU,EAAA,CAAA;AAAA,oBACvD,IAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA;AAAA,UACF,OAAS,EAAA,MAAA;AAAA,UACT,UAAY,EAAA,QAAA;AAAA,UACZ,cAAgB,EAAA,eAAA;AAAA,UAChB,SAAS,CAAS,KAAA,KAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAC,CAAA;AAAA,SACzC;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAI,EAAE,QAAA,EAAU,WAAS,KAAM,CAAA,UAAA,CAAW,OAAQ,EAAA,EAC3D,QAAW,EAAA,QAAA,GAAA,CAAA,GAAI,CAAG,EAAA,QAAQ,eAAe,aAC5C,EAAA,CAAA;AAAA,8BACC,MAAO,EAAA,EAAA,OAAA,EAAS,MAAM,iBAAA,IAAqB,QAAI,EAAA,MAAA,EAAA;AAAA;AAAA;AAAA;AAClD,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,47 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import Box from '@mui/material/Box';
3
+ import Toolbar from '@mui/material/Toolbar';
4
+ import Typography from '@mui/material/Typography';
5
+ import quickstartImage from '../assets/quickstart-image.png';
6
+
7
+ const QuickstartHeader = () => {
8
+ return /* @__PURE__ */ jsxs(
9
+ Toolbar,
10
+ {
11
+ sx: {
12
+ justifyContent: "center",
13
+ display: "flex",
14
+ flexFlow: "column"
15
+ },
16
+ children: [
17
+ /* @__PURE__ */ jsx(
18
+ "img",
19
+ {
20
+ src: quickstartImage,
21
+ alt: "",
22
+ width: "128px",
23
+ style: { backgroundColor: "#f2f2f2" }
24
+ }
25
+ ),
26
+ /* @__PURE__ */ jsxs(
27
+ Box,
28
+ {
29
+ sx: {
30
+ alignItems: "center",
31
+ display: "flex",
32
+ flexFlow: "column",
33
+ padding: (theme) => `${theme.spacing(3)} 0px`
34
+ },
35
+ children: [
36
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.h6 }, children: "Let's get you started with Developer Hub" }),
37
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.caption }, children: "We'll guide you through a few quick steps" })
38
+ ]
39
+ }
40
+ )
41
+ ]
42
+ }
43
+ );
44
+ };
45
+
46
+ export { QuickstartHeader };
47
+ //# sourceMappingURL=QuickstartHeader.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickstartHeader.esm.js","sources":["../../src/components/QuickstartHeader.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@mui/material/Box';\nimport Toolbar from '@mui/material/Toolbar';\nimport Typography from '@mui/material/Typography';\nimport quickstartImage from '../assets/quickstart-image.png';\n\nexport const QuickstartHeader = () => {\n return (\n <Toolbar\n sx={{\n justifyContent: 'center',\n display: 'flex',\n flexFlow: 'column',\n }}\n >\n <img\n src={quickstartImage}\n alt=\"\"\n width=\"128px\"\n style={{ backgroundColor: '#f2f2f2' }}\n />\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n flexFlow: 'column',\n padding: theme => `${theme.spacing(3)} 0px`,\n }}\n >\n <Typography sx={{ fontSize: theme => theme.typography.h6 }}>\n Let's get you started with Developer Hub\n </Typography>\n <Typography sx={{ fontSize: theme => theme.typography.caption }}>\n We'll guide you through a few quick steps\n </Typography>\n </Box>\n </Toolbar>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,mBAAmB,MAAM;AACpC,EACE,uBAAA,IAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,cAAgB,EAAA,QAAA;AAAA,QAChB,OAAS,EAAA,MAAA;AAAA,QACT,QAAU,EAAA;AAAA,OACZ;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,GAAK,EAAA,eAAA;AAAA,YACL,GAAI,EAAA,EAAA;AAAA,YACJ,KAAM,EAAA,OAAA;AAAA,YACN,KAAA,EAAO,EAAE,eAAA,EAAiB,SAAU;AAAA;AAAA,SACtC;AAAA,wBACA,IAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA;AAAA,cACF,UAAY,EAAA,QAAA;AAAA,cACZ,OAAS,EAAA,MAAA;AAAA,cACT,QAAU,EAAA,QAAA;AAAA,cACV,SAAS,CAAS,KAAA,KAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,IAAA;AAAA,aACvC;AAAA,YAEA,QAAA,EAAA;AAAA,8BAAC,GAAA,CAAA,UAAA,EAAA,EAAW,IAAI,EAAE,QAAA,EAAU,WAAS,KAAM,CAAA,UAAA,CAAW,EAAG,EAAA,EAAG,QAE5D,EAAA,0CAAA,EAAA,CAAA;AAAA,8BACA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAI,EAAE,QAAA,EAAU,WAAS,KAAM,CAAA,UAAA,CAAW,OAAQ,EAAA,EAAG,QAEjE,EAAA,2CAAA,EAAA;AAAA;AAAA;AAAA;AACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -0,0 +1,28 @@
1
+ import { useCallback, useState, useEffect } from 'react';
2
+
3
+ function useLocalStorageState(key, defaultValue, isAllowed) {
4
+ const readValue = useCallback(() => {
5
+ try {
6
+ const stored = localStorage.getItem(key);
7
+ return isAllowed && stored !== null ? JSON.parse(stored) : defaultValue;
8
+ } catch {
9
+ return defaultValue;
10
+ }
11
+ }, [defaultValue, isAllowed, key]);
12
+ const [value, setValue] = useState(readValue);
13
+ useEffect(() => {
14
+ const interval = setInterval(() => {
15
+ const local = readValue();
16
+ setValue((prev) => prev !== local ? local : prev);
17
+ }, 500);
18
+ return () => clearInterval(interval);
19
+ }, [readValue]);
20
+ const updateValue = (newValue) => {
21
+ setValue(newValue);
22
+ localStorage.setItem(key, JSON.stringify(newValue));
23
+ };
24
+ return [value, updateValue];
25
+ }
26
+
27
+ export { useLocalStorageState };
28
+ //# sourceMappingURL=useLocalStorageState.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalStorageState.esm.js","sources":["../../src/hooks/useLocalStorageState.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nexport function useLocalStorageState<T extends string | number | boolean>(\n key: string,\n defaultValue: T,\n isAllowed: boolean,\n): [T, (value: T) => void] {\n const readValue = useCallback((): T => {\n try {\n const stored = localStorage.getItem(key);\n return isAllowed && stored !== null ? JSON.parse(stored) : defaultValue;\n } catch {\n return defaultValue;\n }\n }, [defaultValue, isAllowed, key]);\n\n const [value, setValue] = useState<T>(readValue);\n\n useEffect(() => {\n const interval = setInterval(() => {\n const local = readValue();\n setValue(prev => (prev !== local ? local : prev));\n }, 500);\n return () => clearInterval(interval);\n }, [readValue]);\n\n const updateValue = (newValue: T) => {\n setValue(newValue);\n localStorage.setItem(key, JSON.stringify(newValue));\n };\n\n return [value, updateValue];\n}\n"],"names":[],"mappings":";;AAkBgB,SAAA,oBAAA,CACd,GACA,EAAA,YAAA,EACA,SACyB,EAAA;AACzB,EAAM,MAAA,SAAA,GAAY,YAAY,MAAS;AACrC,IAAI,IAAA;AACF,MAAM,MAAA,MAAA,GAAS,YAAa,CAAA,OAAA,CAAQ,GAAG,CAAA;AACvC,MAAA,OAAO,aAAa,MAAW,KAAA,IAAA,GAAO,IAAK,CAAA,KAAA,CAAM,MAAM,CAAI,GAAA,YAAA;AAAA,KACrD,CAAA,MAAA;AACN,MAAO,OAAA,YAAA;AAAA;AACT,GACC,EAAA,CAAC,YAAc,EAAA,SAAA,EAAW,GAAG,CAAC,CAAA;AAEjC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAY,SAAS,CAAA;AAE/C,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,QAAA,GAAW,YAAY,MAAM;AACjC,MAAA,MAAM,QAAQ,SAAU,EAAA;AACxB,MAAA,QAAA,CAAS,CAAS,IAAA,KAAA,IAAA,KAAS,KAAQ,GAAA,KAAA,GAAQ,IAAK,CAAA;AAAA,OAC/C,GAAG,CAAA;AACN,IAAO,OAAA,MAAM,cAAc,QAAQ,CAAA;AAAA,GACrC,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAM,MAAA,WAAA,GAAc,CAAC,QAAgB,KAAA;AACnC,IAAA,QAAA,CAAS,QAAQ,CAAA;AACjB,IAAA,YAAA,CAAa,OAAQ,CAAA,GAAA,EAAK,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC,CAAA;AAAA,GACpD;AAEA,EAAO,OAAA,CAAC,OAAO,WAAW,CAAA;AAC5B;;;;"}
@@ -0,0 +1,15 @@
1
+ import { useContext } from 'react';
2
+ import { QuickstartDrawerContext } from '../components/QuickstartDrawerContext.esm.js';
3
+
4
+ const useQuickstartDrawerContext = () => {
5
+ const context = useContext(QuickstartDrawerContext);
6
+ if (!context) {
7
+ throw new Error(
8
+ "useQuickStartDrawer must be used within a QuickStartDrawerProvider"
9
+ );
10
+ }
11
+ return context;
12
+ };
13
+
14
+ export { useQuickstartDrawerContext };
15
+ //# sourceMappingURL=useQuickstartDrawerContext.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuickstartDrawerContext.esm.js","sources":["../../src/hooks/useQuickstartDrawerContext.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useContext } from 'react';\nimport {\n QuickstartDrawerContext,\n QuickstartDrawerContextType,\n} from '../components/QuickstartDrawerContext';\n\n/**\n * Hook for retrieving the drawer context\n *\n * @public\n */\nexport const useQuickstartDrawerContext = (): QuickstartDrawerContextType => {\n const context = useContext(QuickstartDrawerContext);\n if (!context) {\n throw new Error(\n 'useQuickStartDrawer must be used within a QuickStartDrawerProvider',\n );\n }\n return context;\n};\n"],"names":[],"mappings":";;;AA2BO,MAAM,6BAA6B,MAAmC;AAC3E,EAAM,MAAA,OAAA,GAAU,WAAW,uBAAuB,CAAA;AAClD,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA;AAEF,EAAO,OAAA,OAAA;AACT;;;;"}
@@ -0,0 +1,27 @@
1
+ import { useApi, identityApiRef, configApiRef } from '@backstage/core-plugin-api';
2
+ import { useAsync } from 'react-use';
3
+
4
+ const useQuickstartPermission = () => {
5
+ const identityApi = useApi(identityApiRef);
6
+ const configApi = useApi(configApiRef);
7
+ const getUserAuthorization = async () => {
8
+ const { token: idToken } = await identityApi.getCredentials();
9
+ const backendUrl = configApi.getString("backend.baseUrl");
10
+ const jsonResponse = await fetch(`${backendUrl}/api/permission/`, {
11
+ headers: {
12
+ ...idToken && { Authorization: `Bearer ${idToken}` }
13
+ }
14
+ });
15
+ return jsonResponse.json();
16
+ };
17
+ const { loading: isUserLoading, value: result } = useAsync(
18
+ async () => await getUserAuthorization(),
19
+ []
20
+ );
21
+ const isRBACPluginEnabled = configApi.getOptionalBoolean("permission.enabled");
22
+ if (!isRBACPluginEnabled) return true;
23
+ return !isUserLoading && result.status === "Authorized";
24
+ };
25
+
26
+ export { useQuickstartPermission };
27
+ //# sourceMappingURL=useQuickstartPermission.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuickstartPermission.esm.js","sources":["../../src/hooks/useQuickstartPermission.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync } from 'react-use';\n\nexport const useQuickstartPermission = () => {\n const identityApi = useApi(identityApiRef);\n const configApi = useApi(configApiRef);\n\n const getUserAuthorization = async () => {\n const { token: idToken } = await identityApi.getCredentials();\n const backendUrl = configApi.getString('backend.baseUrl');\n const jsonResponse = await fetch(`${backendUrl}/api/permission/`, {\n headers: {\n ...(idToken && { Authorization: `Bearer ${idToken}` }),\n },\n });\n return jsonResponse.json();\n };\n const { loading: isUserLoading, value: result } = useAsync(\n async () => await getUserAuthorization(),\n [],\n );\n\n const isRBACPluginEnabled =\n configApi.getOptionalBoolean('permission.enabled');\n\n if (!isRBACPluginEnabled) return true;\n\n return !isUserLoading && result.status === 'Authorized';\n};\n"],"names":[],"mappings":";;;AAuBO,MAAM,0BAA0B,MAAM;AAC3C,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAA,MAAM,uBAAuB,YAAY;AACvC,IAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAY,GAAA,MAAM,YAAY,cAAe,EAAA;AAC5D,IAAM,MAAA,UAAA,GAAa,SAAU,CAAA,SAAA,CAAU,iBAAiB,CAAA;AACxD,IAAA,MAAM,YAAe,GAAA,MAAM,KAAM,CAAA,CAAA,EAAG,UAAU,CAAoB,gBAAA,CAAA,EAAA;AAAA,MAChE,OAAS,EAAA;AAAA,QACP,GAAI,OAAW,IAAA,EAAE,aAAe,EAAA,CAAA,OAAA,EAAU,OAAO,CAAG,CAAA;AAAA;AACtD,KACD,CAAA;AACD,IAAA,OAAO,aAAa,IAAK,EAAA;AAAA,GAC3B;AACA,EAAA,MAAM,EAAE,OAAA,EAAS,aAAe,EAAA,KAAA,EAAO,QAAW,GAAA,QAAA;AAAA,IAChD,YAAY,MAAM,oBAAqB,EAAA;AAAA,IACvC;AAAC,GACH;AAEA,EAAM,MAAA,mBAAA,GACJ,SAAU,CAAA,kBAAA,CAAmB,oBAAoB,CAAA;AAEnD,EAAI,IAAA,CAAC,qBAA4B,OAAA,IAAA;AAEjC,EAAO,OAAA,CAAC,aAAiB,IAAA,MAAA,CAAO,MAAW,KAAA,YAAA;AAC7C;;;;"}
@@ -0,0 +1,58 @@
1
+ /// <reference types="react" />
2
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
+ import { PropsWithChildren } from 'react';
4
+
5
+ /**
6
+ * Quick start plugin
7
+ *
8
+ * @public
9
+ */
10
+ declare const quickstartPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
11
+ /**
12
+ * Quick start drawer provider
13
+ *
14
+ * @public
15
+ */
16
+ declare const QuickstartDrawerProvider: React.ComponentType<PropsWithChildren>;
17
+
18
+ /**
19
+ * Type for QuickstartDrawerContext
20
+ *
21
+ * @public
22
+ */
23
+ interface QuickstartDrawerContextType {
24
+ /**
25
+ * The prop to check if the drawer is open
26
+ */
27
+ isDrawerOpen: boolean;
28
+ /**
29
+ * The function to open the drawer
30
+ */
31
+ openDrawer: () => void;
32
+ /**
33
+ * The function to close the drawer
34
+ */
35
+ closeDrawer: () => void;
36
+ /**
37
+ * The function to toggle the drawer state
38
+ */
39
+ toggleDrawer: () => void;
40
+ /**
41
+ * The prop for drawer width
42
+ */
43
+ drawerWidth: number;
44
+ /**
45
+ * The function for setting the drawer width
46
+ */
47
+ setDrawerWidth: React.Dispatch<React.SetStateAction<number>>;
48
+ }
49
+
50
+ /**
51
+ * Hook for retrieving the drawer context
52
+ *
53
+ * @public
54
+ */
55
+ declare const useQuickstartDrawerContext: () => QuickstartDrawerContextType;
56
+
57
+ export { QuickstartDrawerProvider, quickstartPlugin, useQuickstartDrawerContext };
58
+ export type { QuickstartDrawerContextType };
@@ -0,0 +1,8 @@
1
+ import { unstable_ClassNameGenerator } from '@mui/material/className';
2
+ export { QuickstartDrawerProvider, quickstartPlugin } from './plugin.esm.js';
3
+ export { useQuickstartDrawerContext } from './hooks/useQuickstartDrawerContext.esm.js';
4
+
5
+ unstable_ClassNameGenerator.configure((componentName) => {
6
+ return componentName.startsWith("v5-") ? componentName : `v5-${componentName}`;
7
+ });
8
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nClassNameGenerator.configure(componentName => {\n return componentName.startsWith('v5-')\n ? componentName\n : `v5-${componentName}`;\n});\n\nexport { quickstartPlugin, QuickstartDrawerProvider } from './plugin';\nexport { useQuickstartDrawerContext } from './hooks/useQuickstartDrawerContext';\nexport type { QuickstartDrawerContextType } from './components/QuickstartDrawerContext';\n"],"names":["ClassNameGenerator"],"mappings":";;;;AAkBAA,2BAAA,CAAmB,UAAU,CAAiB,aAAA,KAAA;AAC5C,EAAA,OAAO,cAAc,UAAW,CAAA,KAAK,CACjC,GAAA,aAAA,GACA,MAAM,aAAa,CAAA,CAAA;AACzB,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { createPlugin, createComponentExtension } from '@backstage/core-plugin-api';
2
+
3
+ const quickstartPlugin = createPlugin({
4
+ id: "quickstart"
5
+ });
6
+ const QuickstartDrawerProvider = quickstartPlugin.provide(
7
+ createComponentExtension({
8
+ name: "QuickstartDrawerProvider",
9
+ component: {
10
+ lazy: () => import('./components/QuickstartDrawerProvider.esm.js').then(
11
+ (m) => m.QuickstartDrawerProvider
12
+ )
13
+ }
14
+ })
15
+ );
16
+
17
+ export { QuickstartDrawerProvider, quickstartPlugin };
18
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { PropsWithChildren } from 'react';\n\n/**\n * Quick start plugin\n *\n * @public\n */\nexport const quickstartPlugin = createPlugin({\n id: 'quickstart',\n});\n\n/**\n * Quick start drawer provider\n *\n * @public\n */\nexport const QuickstartDrawerProvider: React.ComponentType<PropsWithChildren> =\n quickstartPlugin.provide(\n createComponentExtension({\n name: 'QuickstartDrawerProvider',\n component: {\n lazy: () =>\n import('./components/QuickstartDrawerProvider').then(\n m => m.QuickstartDrawerProvider,\n ),\n },\n }),\n );\n"],"names":[],"mappings":";;AA2BO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA;AACN,CAAC;AAOM,MAAM,2BACX,gBAAiB,CAAA,OAAA;AAAA,EACf,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,0BAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,8CAAuC,CAAE,CAAA,IAAA;AAAA,QAC9C,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@red-hat-developer-hub/backstage-plugin-quickstart",
3
+ "version": "1.0.0",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.esm.js",
6
+ "types": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "main": "dist/index.esm.js",
10
+ "types": "dist/index.d.ts"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/redhat-developer/rhdh-plugins",
15
+ "directory": "workspaces/quickstart/plugins/quickstart"
16
+ },
17
+ "backstage": {
18
+ "role": "frontend-plugin",
19
+ "pluginId": "quickstart",
20
+ "pluginPackages": [
21
+ "@red-hat-developer-hub/backstage-plugin-quickstart"
22
+ ]
23
+ },
24
+ "sideEffects": false,
25
+ "scripts": {
26
+ "start": "backstage-cli package start",
27
+ "build": "backstage-cli package build",
28
+ "lint": "backstage-cli package lint",
29
+ "test": "backstage-cli package test",
30
+ "clean": "backstage-cli package clean",
31
+ "prepack": "backstage-cli package prepack",
32
+ "postpack": "backstage-cli package postpack"
33
+ },
34
+ "dependencies": {
35
+ "@backstage/core-components": "^0.17.2",
36
+ "@backstage/core-plugin-api": "^1.10.7",
37
+ "@backstage/theme": "^0.6.6",
38
+ "@mui/icons-material": "5.17.1",
39
+ "@mui/material": "5.17.1",
40
+ "@red-hat-developer-hub/backstage-plugin-theme": "^0.9.0",
41
+ "react-use": "^17.2.4"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@backstage/cli": "^0.32.1",
48
+ "@backstage/core-app-api": "^1.17.0",
49
+ "@backstage/dev-utils": "^1.1.10",
50
+ "@backstage/test-utils": "^1.7.8",
51
+ "@testing-library/jest-dom": "^6.0.0",
52
+ "@testing-library/react": "^14.0.0",
53
+ "@testing-library/user-event": "^14.0.0",
54
+ "msw": "^1.0.0",
55
+ "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
56
+ },
57
+ "files": [
58
+ "dist",
59
+ "dist-scalprum",
60
+ "config.d.ts",
61
+ "app-config.dynamic.yaml"
62
+ ],
63
+ "configSchema": "config.d.ts",
64
+ "typesVersions": {
65
+ "*": {
66
+ "package.json": [
67
+ "package.json"
68
+ ]
69
+ }
70
+ },
71
+ "module": "./dist/index.esm.js"
72
+ }