@red-hat-developer-hub/backstage-plugin-quickstart 1.2.0 → 1.4.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 (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +57 -0
  3. package/dist/components/Quickstart.esm.js +4 -2
  4. package/dist/components/Quickstart.esm.js.map +1 -1
  5. package/dist/components/QuickstartButton/QuickstartButton.esm.js +18 -6
  6. package/dist/components/QuickstartButton/QuickstartButton.esm.js.map +1 -1
  7. package/dist/components/QuickstartContent/QuickstartContent.esm.js +24 -11
  8. package/dist/components/QuickstartContent/QuickstartContent.esm.js.map +1 -1
  9. package/dist/components/QuickstartContent/QuickstartItem.esm.js +4 -2
  10. package/dist/components/QuickstartContent/QuickstartItem.esm.js.map +1 -1
  11. package/dist/components/QuickstartDrawer.esm.js +24 -4
  12. package/dist/components/QuickstartDrawer.esm.js.map +1 -1
  13. package/dist/components/QuickstartDrawerProvider.esm.js +7 -11
  14. package/dist/components/QuickstartDrawerProvider.esm.js.map +1 -1
  15. package/dist/components/QuickstartFooter.esm.js +4 -2
  16. package/dist/components/QuickstartFooter.esm.js.map +1 -1
  17. package/dist/components/QuickstartHeader.esm.js +4 -2
  18. package/dist/components/QuickstartHeader.esm.js.map +1 -1
  19. package/dist/hooks/useQuickstartRole.esm.js +38 -0
  20. package/dist/hooks/useQuickstartRole.esm.js.map +1 -0
  21. package/dist/hooks/useTranslation.esm.js +8 -0
  22. package/dist/hooks/useTranslation.esm.js.map +1 -0
  23. package/dist/index.d.ts +8 -1
  24. package/dist/index.esm.js +1 -0
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/plugin.esm.js +7 -1
  27. package/dist/plugin.esm.js.map +1 -1
  28. package/dist/translations/de.esm.js +36 -0
  29. package/dist/translations/de.esm.js.map +1 -0
  30. package/dist/translations/es.esm.js +36 -0
  31. package/dist/translations/es.esm.js.map +1 -0
  32. package/dist/translations/fr.esm.js +36 -0
  33. package/dist/translations/fr.esm.js.map +1 -0
  34. package/dist/translations/index.esm.js +14 -0
  35. package/dist/translations/index.esm.js.map +1 -0
  36. package/dist/translations/ref.esm.js +50 -0
  37. package/dist/translations/ref.esm.js.map +1 -0
  38. package/package.json +5 -2
  39. package/dist/hooks/useQuickstartPermission.esm.js +0 -27
  40. package/dist/hooks/useQuickstartPermission.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-quickstart
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 47fd25f: Enabled Quickstart items for developer role.
8
+
9
+ ## 1.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bc88e5f: Add internationalization (i18n) support with German, French and Spanish translations in quickstart.
14
+
3
15
  ## 1.2.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -9,6 +9,7 @@ The Quickstart plugin provides a guided onboarding experience for new users of R
9
9
  - **Configurable Content**: Define custom quickstart items through app configuration
10
10
  - **Visual Progress Indicator**: Shows overall completion progress with a progress bar
11
11
  - **Call-to-Action Support**: Each step can include clickable action buttons
12
+ - **Role-Based Access Control**: Show different quickstart items based on user roles (admin/developer)
12
13
 
13
14
  ## Installation
14
15
 
@@ -44,18 +45,28 @@ app:
44
45
  - title: 'Welcome to Developer Hub'
45
46
  description: 'Learn the basics of navigating the Developer Hub interface'
46
47
  icon: 'home'
48
+ roles: ['admin', 'developer'] # Show to both roles
47
49
  cta:
48
50
  text: 'Get Started'
49
51
  link: '/catalog'
52
+ - title: 'Configure RBAC Policies'
53
+ description: 'Set up role-based access control for your organization'
54
+ icon: 'security'
55
+ roles: ['admin'] # Admin-only quickstart item
56
+ cta:
57
+ text: 'Configure RBAC'
58
+ link: '/rbac'
50
59
  - title: 'Create Your First Component'
51
60
  description: 'Follow our guide to register your first software component'
52
61
  icon: 'code'
62
+ # No roles specified - defaults to 'admin'
53
63
  cta:
54
64
  text: 'Create Component'
55
65
  link: '/catalog-import'
56
66
  - title: 'Explore Templates'
57
67
  description: 'Discover available software templates to bootstrap new projects'
58
68
  icon: 'template'
69
+ roles: ['developer'] # Developer-only quickstart item
59
70
  cta:
60
71
  text: 'Browse Templates'
61
72
  link: '/create'
@@ -68,10 +79,56 @@ Each quickstart item supports the following properties:
68
79
  - `title` (required): The display title for the quickstart step
69
80
  - `description` (required): A brief description of what the step covers
70
81
  - `icon` (optional): Icon identifier (supports Material UI icons)
82
+ - `roles` (optional): Array of user roles that should see this quickstart item. Supported values: `['admin', 'developer']`. If not specified, defaults to `['admin']`
71
83
  - `cta` (optional): Call-to-action object with:
72
84
  - `text`: Button text
73
85
  - `link`: Target URL or route
74
86
 
87
+ ## Role-Based Access Control (RBAC)
88
+
89
+ The quickstart plugin integrates with Backstage's RBAC system to show different quickstart items based on user roles.
90
+
91
+ ### User Role Determination
92
+
93
+ The plugin determines user roles using the following logic:
94
+
95
+ - **When RBAC is disabled** (`permission.enabled: false` or not configured): Users are assumed to be platform engineers setting up RHDH and are assigned the `admin` role
96
+ - **When RBAC is enabled** (`permission.enabled: true`): User roles are determined based on permissions:
97
+ - Users with `policy.entity.create` permission are assigned the `admin` role
98
+ - Users without this permission are assigned the `developer` role
99
+
100
+ ### Supported Roles
101
+
102
+ - **`admin`**: Platform engineers, administrators, and users with elevated permissions
103
+ - **`developer`**: Regular developers and users with standard permissions
104
+
105
+ ### Role Assignment Behavior
106
+
107
+ - Quickstart items without a `roles` property default to `['admin']`
108
+ - Items can specify multiple roles: `roles: ['admin', 'developer']`
109
+ - Users only see quickstart items that match their assigned role
110
+
111
+ ### Configuration Example
112
+
113
+ Enable RBAC in your `app-config.yaml`:
114
+
115
+ ```yaml
116
+ permission:
117
+ enabled: true
118
+
119
+ app:
120
+ quickstart:
121
+ - title: 'Platform Configuration'
122
+ roles: ['admin']
123
+ # Only admins see this
124
+ - title: 'Getting Started as Developer'
125
+ roles: ['developer']
126
+ # Only developers see this
127
+ - title: 'Universal Welcome Guide'
128
+ roles: ['admin', 'developer']
129
+ # Both roles see this
130
+ ```
131
+
75
132
  ## Usage
76
133
 
77
134
  ### Using the Context Hook
@@ -8,7 +8,8 @@ import { useState, useCallback, useEffect } from 'react';
8
8
 
9
9
  const Quickstart = ({
10
10
  quickstartItems,
11
- handleDrawerClose
11
+ handleDrawerClose,
12
+ isLoading
12
13
  }) => {
13
14
  const itemCount = quickstartItems.length;
14
15
  const [progress, setProgress] = useState(0);
@@ -54,7 +55,8 @@ const Quickstart = ({
54
55
  setProgress: () => {
55
56
  const newProgress = calculateProgress();
56
57
  setProgress(newProgress);
57
- }
58
+ },
59
+ isLoading
58
60
  }
59
61
  )
60
62
  ]
@@ -1 +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 <Box\n sx={{\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <Box\n sx={{\n flex: 1,\n padding: theme => theme.spacing(3),\n overflowY: 'auto',\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 </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6BO,MAAM,aAAa,CAAC;AAAA,EACzB,eAAA;AAAA,EACA;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,YAAY,eAAgB,CAAA,MAAA;AAClC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAiB,CAAC,CAAA;AAElD,EAAM,MAAA,iBAAA,GAAoB,YAAY,MAAM;AAC1C,IAAA,MAAM,cAAiB,GAAA,eAAA,CAAgB,MAAO,CAAA,CAAC,MAAM,KAAU,KAAA;AAC7D,MAAA,MAAM,OAAU,GAAA,CAAA,EAAG,IAAK,CAAA,KAAK,IAAI,KAAK,CAAA,CAAA;AACtC,MAAM,MAAA,SAAA,GAAY,YAAa,CAAA,OAAA,CAAQ,OAAO,CAAA;AAC9C,MAAA,OAAO,SAAc,KAAA,MAAA;AAAA,KACtB,CAAE,CAAA,MAAA;AAEH,IAAM,MAAA,UAAA,GAAc,iBAAiB,SAAa,GAAA,GAAA;AAClD,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,UAA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
+ {"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 isLoading: boolean;\n};\n\nexport const Quickstart = ({\n quickstartItems,\n handleDrawerClose,\n isLoading,\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 <Box\n sx={{\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <Box\n sx={{\n flex: 1,\n padding: theme => theme.spacing(3),\n overflowY: 'auto',\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 isLoading={isLoading}\n />\n </Box>\n <QuickstartFooter\n handleDrawerClose={handleDrawerClose}\n progress={progress}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA8BO,MAAM,aAAa,CAAC;AAAA,EACzB,eAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,YAAY,eAAgB,CAAA,MAAA;AAClC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAiB,CAAC,CAAA;AAElD,EAAM,MAAA,iBAAA,GAAoB,YAAY,MAAM;AAC1C,IAAA,MAAM,cAAiB,GAAA,eAAA,CAAgB,MAAO,CAAA,CAAC,MAAM,KAAU,KAAA;AAC7D,MAAA,MAAM,OAAU,GAAA,CAAA,EAAG,IAAK,CAAA,KAAK,IAAI,KAAK,CAAA,CAAA;AACtC,MAAM,MAAA,SAAA,GAAY,YAAa,CAAA,OAAA,CAAQ,OAAO,CAAA;AAC9C,MAAA,OAAO,SAAc,KAAA,MAAA;AAAA,KACtB,CAAE,CAAA,MAAA;AAEH,IAAM,MAAA,UAAA,GAAc,iBAAiB,SAAa,GAAA,GAAA;AAClD,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,UAAa,GAAA,GAAG,CAAI,GAAA,GAAA;AAAA,GACrC,EAAA,CAAC,eAAiB,EAAA,SAAS,CAAC,CAAA;AAE/B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,qBAAqB,iBAAkB,EAAA;AAC7C,IAAA,WAAA,CAAY,kBAAkB,CAAA;AAC9B,IAAA,YAAA,CAAa,OAAQ,CAAA,eAAA,EAAiB,kBAAmB,CAAA,QAAA,EAAU,CAAA;AAAA,GAClE,EAAA,CAAC,eAAiB,EAAA,SAAA,EAAW,iBAAiB,CAAC,CAAA;AAElD,EACE,uBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,MAAQ,EAAA,MAAA;AAAA,QACR,OAAS,EAAA,MAAA;AAAA,QACT,aAAe,EAAA;AAAA,OACjB;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,IAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA;AAAA,cACF,IAAM,EAAA,CAAA;AAAA,cACN,OAAS,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,cACjC,SAAW,EAAA;AAAA,aACb;AAAA,YAEA,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,CAAA;AAAA,kCACjB,OAAQ,EAAA,EAAA,CAAA;AAAA,8BACT,GAAA;AAAA,gBAAC,iBAAA;AAAA,gBAAA;AAAA,kBACC,eAAA;AAAA,kBACA,SAAA;AAAA,kBACA,aAAa,MAAM;AACjB,oBAAA,MAAM,cAAc,iBAAkB,EAAA;AACtC,oBAAA,WAAA,CAAY,WAAW,CAAA;AAAA,mBACzB;AAAA,kBACA;AAAA;AAAA;AACF;AAAA;AAAA,SACF;AAAA,wBACA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,iBAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -5,23 +5,35 @@ import Box from '@mui/material/Box';
5
5
  import Typography from '@mui/material/Typography';
6
6
  import { useTheme } from '@mui/material/styles';
7
7
  import WavingHandIcon from '@mui/icons-material/WavingHandOutlined';
8
- import { useQuickstartPermission } from '../../hooks/useQuickstartPermission.esm.js';
9
8
  import { useQuickstartDrawerContext } from '../../hooks/useQuickstartDrawerContext.esm.js';
9
+ import { useTranslation } from '../../hooks/useTranslation.esm.js';
10
+ import { useApiHolder, configApiRef } from '@backstage/core-plugin-api';
11
+ import { filterQuickstartItemsByRole } from '../../utils/filterQuickstartItems.esm.js';
12
+ import { useQuickstartRole } from '../../hooks/useQuickstartRole.esm.js';
10
13
 
11
14
  const QuickstartButton = ({
12
- title = "Quick start",
15
+ title,
13
16
  style,
14
17
  onClick = () => {
15
18
  }
16
19
  }) => {
17
- const isAllowed = useQuickstartPermission();
20
+ const { t } = useTranslation();
18
21
  const { toggleDrawer } = useQuickstartDrawerContext();
19
22
  const theme = useTheme();
23
+ const apiHolder = useApiHolder();
24
+ const config = apiHolder.get(configApiRef);
25
+ const quickstartItems = config?.has("app.quickstart") ? config.get("app.quickstart") : [];
26
+ const { isLoading, userRole } = useQuickstartRole();
27
+ const filteredItems = !isLoading && userRole ? filterQuickstartItemsByRole(quickstartItems, userRole) : [];
28
+ const defaultTitle = t("button.quickstart");
20
29
  const handleClick = useCallback(() => {
21
30
  toggleDrawer();
22
31
  onClick();
23
32
  }, [toggleDrawer, onClick]);
24
- return isAllowed ? /* @__PURE__ */ jsx(
33
+ if (!isLoading && filteredItems.length === 0) {
34
+ return null;
35
+ }
36
+ return /* @__PURE__ */ jsx(
25
37
  MenuItem,
26
38
  {
27
39
  sx: {
@@ -64,14 +76,14 @@ const QuickstartButton = ({
64
76
  flexDirection: "column",
65
77
  justifyContent: "center"
66
78
  },
67
- children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: theme.palette.text.primary, children: title })
79
+ children: /* @__PURE__ */ jsx(Typography, { variant: "body2", color: theme.palette.text.primary, children: title || defaultTitle })
68
80
  }
69
81
  )
70
82
  ] })
71
83
  }
72
84
  )
73
85
  }
74
- ) : null;
86
+ );
75
87
  };
76
88
 
77
89
  export { QuickstartButton };
@@ -1 +1 @@
1
- {"version":3,"file":"QuickstartButton.esm.js","sources":["../../../src/components/QuickstartButton/QuickstartButton.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 { CSSProperties, useCallback } from 'react';\nimport MenuItem from '@mui/material/MenuItem';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\nimport WavingHandIcon from '@mui/icons-material/WavingHandOutlined';\nimport { useQuickstartPermission } from '../../hooks/useQuickstartPermission';\nimport { useQuickstartDrawerContext } from '../../hooks/useQuickstartDrawerContext';\n\n/**\n * Props for the QuickstartButton component\n * @public\n */\nexport interface QuickstartButtonProps {\n /**\n * The title text to display in the button\n * @defaultValue 'Quick start'\n */\n title?: string;\n /**\n * Custom CSS styles to apply to the button\n */\n style?: CSSProperties;\n /**\n * Optional callback function to execute when the button is clicked\n */\n onClick?: () => void;\n}\n\n/**\n * @public\n */\nexport const QuickstartButton = ({\n title = 'Quick start',\n style,\n onClick = () => {},\n}: QuickstartButtonProps) => {\n const isAllowed = useQuickstartPermission();\n const { toggleDrawer } = useQuickstartDrawerContext();\n const theme = useTheme();\n\n const handleClick = useCallback(() => {\n toggleDrawer();\n onClick();\n }, [toggleDrawer, onClick]);\n\n return isAllowed ? (\n <MenuItem\n sx={{\n width: '100%',\n color: 'inherit',\n ...style,\n }}\n data-testid=\"quickstart-button\"\n onClick={handleClick}\n >\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n margin: '8px 0',\n color: 'inherit',\n width: '100%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <WavingHandIcon\n sx={{\n fontSize: 20,\n marginRight: '0.5rem',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center',\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.primary\n : theme.palette.text.disabled,\n }}\n />\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n }}\n >\n <Typography variant=\"body2\" color={theme.palette.text.primary}>\n {title}\n </Typography>\n </Box>\n </Box>\n </Box>\n </MenuItem>\n ) : null;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgDO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAQ,GAAA,aAAA;AAAA,EACR,KAAA;AAAA,EACA,UAAU,MAAM;AAAA;AAClB,CAA6B,KAAA;AAC3B,EAAA,MAAM,YAAY,uBAAwB,EAAA;AAC1C,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,0BAA2B,EAAA;AACpD,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EAAM,MAAA,WAAA,GAAc,YAAY,MAAM;AACpC,IAAa,YAAA,EAAA;AACb,IAAQ,OAAA,EAAA;AAAA,GACP,EAAA,CAAC,YAAc,EAAA,OAAO,CAAC,CAAA;AAE1B,EAAA,OAAO,SACL,mBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,KAAO,EAAA,MAAA;AAAA,QACP,KAAO,EAAA,SAAA;AAAA,QACP,GAAG;AAAA,OACL;AAAA,MACA,aAAY,EAAA,mBAAA;AAAA,MACZ,OAAS,EAAA,WAAA;AAAA,MAET,QAAA,kBAAA,GAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UACC,EAAI,EAAA;AAAA,YACF,OAAS,EAAA,MAAA;AAAA,YACT,UAAY,EAAA,QAAA;AAAA,YACZ,cAAgB,EAAA,eAAA;AAAA,YAChB,MAAQ,EAAA,OAAA;AAAA,YACR,KAAO,EAAA,SAAA;AAAA,YACP,KAAO,EAAA;AAAA,WACT;AAAA,UAEA,QAAA,kBAAA,IAAA,CAAC,OAAI,EAAI,EAAA,EAAE,SAAS,MAAQ,EAAA,UAAA,EAAY,UACtC,EAAA,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,cAAA;AAAA,cAAA;AAAA,gBACC,EAAI,EAAA;AAAA,kBACF,QAAU,EAAA,EAAA;AAAA,kBACV,WAAa,EAAA,QAAA;AAAA,kBACb,UAAY,EAAA,CAAA;AAAA,kBACZ,OAAS,EAAA,MAAA;AAAA,kBACT,UAAY,EAAA,QAAA;AAAA,kBACZ,KAAA,EACE,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA,GACnB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA,GACnB,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAC3B;AAAA,aACF;AAAA,4BACA,GAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,EAAI,EAAA;AAAA,kBACF,OAAS,EAAA,MAAA;AAAA,kBACT,aAAe,EAAA,QAAA;AAAA,kBACf,cAAgB,EAAA;AAAA,iBAClB;AAAA,gBAEA,QAAA,kBAAA,GAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAQ,OAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA,EACnD,QACH,EAAA,KAAA,EAAA;AAAA;AAAA;AACF,WACF,EAAA;AAAA;AAAA;AACF;AAAA,GAEA,GAAA,IAAA;AACN;;;;"}
1
+ {"version":3,"file":"QuickstartButton.esm.js","sources":["../../../src/components/QuickstartButton/QuickstartButton.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 { CSSProperties, useCallback } from 'react';\nimport MenuItem from '@mui/material/MenuItem';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\nimport WavingHandIcon from '@mui/icons-material/WavingHandOutlined';\nimport { useQuickstartDrawerContext } from '../../hooks/useQuickstartDrawerContext';\nimport { useTranslation } from '../../hooks/useTranslation';\nimport { configApiRef, useApiHolder } from '@backstage/core-plugin-api';\nimport { QuickstartItemData } from '../../types';\nimport { filterQuickstartItemsByRole } from '../../utils';\nimport { useQuickstartRole } from '../../hooks/useQuickstartRole';\n\n/**\n * Props for the QuickstartButton component\n * @public\n */\nexport interface QuickstartButtonProps {\n /**\n * The title text to display in the button\n * @defaultValue 'Quick start'\n */\n title?: string;\n /**\n * Custom CSS styles to apply to the button\n */\n style?: CSSProperties;\n /**\n * Optional callback function to execute when the button is clicked\n */\n onClick?: () => void;\n}\n\n/**\n * @public\n */\nexport const QuickstartButton = ({\n title,\n style,\n onClick = () => {},\n}: QuickstartButtonProps) => {\n // All hooks must be called at the top level, before any early returns\n const { t } = useTranslation();\n const { toggleDrawer } = useQuickstartDrawerContext();\n const theme = useTheme();\n\n // Check if there are any quickstart items available for the current user\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\n const { isLoading, userRole } = useQuickstartRole();\n const filteredItems =\n !isLoading && userRole\n ? filterQuickstartItemsByRole(quickstartItems, userRole)\n : [];\n\n const defaultTitle = t('button.quickstart');\n\n const handleClick = useCallback(() => {\n toggleDrawer();\n onClick();\n }, [toggleDrawer, onClick]);\n\n // Hide the button if there are no quickstart items for the user\n if (!isLoading && filteredItems.length === 0) {\n return null;\n }\n\n return (\n <MenuItem\n sx={{\n width: '100%',\n color: 'inherit',\n ...style,\n }}\n data-testid=\"quickstart-button\"\n onClick={handleClick}\n >\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n margin: '8px 0',\n color: 'inherit',\n width: '100%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <WavingHandIcon\n sx={{\n fontSize: 20,\n marginRight: '0.5rem',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center',\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.primary\n : theme.palette.text.disabled,\n }}\n />\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n }}\n >\n <Typography variant=\"body2\" color={theme.palette.text.primary}>\n {title || defaultTitle}\n </Typography>\n </Box>\n </Box>\n </Box>\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoDO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAU,MAAM;AAAA;AAClB,CAA6B,KAAA;AAE3B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,0BAA2B,EAAA;AACpD,EAAA,MAAM,QAAQ,QAAS,EAAA;AAGvB,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;AAEL,EAAA,MAAM,EAAE,SAAA,EAAW,QAAS,EAAA,GAAI,iBAAkB,EAAA;AAClD,EAAM,MAAA,aAAA,GACJ,CAAC,SAAa,IAAA,QAAA,GACV,4BAA4B,eAAiB,EAAA,QAAQ,IACrD,EAAC;AAEP,EAAM,MAAA,YAAA,GAAe,EAAE,mBAAmB,CAAA;AAE1C,EAAM,MAAA,WAAA,GAAc,YAAY,MAAM;AACpC,IAAa,YAAA,EAAA;AACb,IAAQ,OAAA,EAAA;AAAA,GACP,EAAA,CAAC,YAAc,EAAA,OAAO,CAAC,CAAA;AAG1B,EAAA,IAAI,CAAC,SAAA,IAAa,aAAc,CAAA,MAAA,KAAW,CAAG,EAAA;AAC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kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,KAAA,EAAO,MAAM,OAAQ,CAAA,IAAA,CAAK,OACnD,EAAA,QAAA,EAAA,KAAA,IAAS,YACZ,EAAA;AAAA;AAAA;AACF,WACF,EAAA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -1,25 +1,44 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import Box from '@mui/material/Box';
3
3
  import List from '@mui/material/List';
4
+ import CircularProgress from '@mui/material/CircularProgress';
4
5
  import { QuickstartItem } from './QuickstartItem.esm.js';
5
- import { EmptyState } from '@backstage/core-components';
6
- import { useState } from 'react';
6
+ import { useState, useEffect } from 'react';
7
7
 
8
8
  const QuickstartContent = ({
9
9
  quickstartItems,
10
10
  setProgress,
11
- itemCount
11
+ itemCount,
12
+ isLoading
12
13
  }) => {
13
14
  const [openItems, setOpenItems] = useState(
14
15
  new Array(itemCount).fill(false)
15
16
  );
17
+ useEffect(() => {
18
+ setOpenItems(new Array(itemCount).fill(false));
19
+ }, [itemCount]);
20
+ if (isLoading) {
21
+ return /* @__PURE__ */ jsx(
22
+ Box,
23
+ {
24
+ sx: {
25
+ display: "flex",
26
+ alignItems: "center",
27
+ justifyContent: "center",
28
+ minHeight: "50vh",
29
+ width: "100%"
30
+ },
31
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
32
+ }
33
+ );
34
+ }
16
35
  return /* @__PURE__ */ jsx(
17
36
  Box,
18
37
  {
19
38
  sx: {
20
39
  paddingTop: (theme) => `${theme.spacing(3)}`
21
40
  },
22
- children: quickstartItems.length > 0 ? /* @__PURE__ */ jsx(List, { disablePadding: true, children: quickstartItems.map((item, index) => /* @__PURE__ */ jsx(
41
+ children: /* @__PURE__ */ jsx(List, { disablePadding: true, children: quickstartItems.map((item, index) => /* @__PURE__ */ jsx(
23
42
  QuickstartItem,
24
43
  {
25
44
  item,
@@ -33,13 +52,7 @@ const QuickstartContent = ({
33
52
  setProgress: () => setProgress(index)
34
53
  },
35
54
  `${item.title}-${index}`
36
- )) }) : /* @__PURE__ */ jsx(
37
- EmptyState,
38
- {
39
- title: "Quickstart content not available for your role.",
40
- missing: "data"
41
- }
42
- )
55
+ )) })
43
56
  }
44
57
  );
45
58
  };
@@ -1 +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\n title=\"Quickstart content not available for your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AA;AAAA;AAAA;AACV;AAAA,GAEJ;AAEJ;;;;"}
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 CircularProgress from '@mui/material/CircularProgress';\nimport { QuickstartItem } from './QuickstartItem';\nimport { useState, useEffect } from 'react';\nimport { QuickstartItemData } from '../../types';\n\ntype QuickstartContentProps = {\n quickstartItems: QuickstartItemData[];\n setProgress: (index: number) => void;\n itemCount: number;\n isLoading: boolean;\n};\n\nexport const QuickstartContent = ({\n quickstartItems,\n setProgress,\n itemCount,\n isLoading,\n}: QuickstartContentProps) => {\n const [openItems, setOpenItems] = useState<boolean[]>(\n new Array(itemCount).fill(false),\n );\n\n // Re-initialize openItems when itemCount changes (e.g., after loading)\n useEffect(() => {\n setOpenItems(new Array(itemCount).fill(false));\n }, [itemCount]);\n\n // Show loading spinner when user role is still being determined\n if (isLoading) {\n return (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '50vh',\n width: '100%',\n }}\n >\n <CircularProgress />\n </Box>\n );\n }\n\n return (\n <Box\n sx={{\n paddingTop: theme => `${theme.spacing(3)}`,\n }}\n >\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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CAAA;AAAA,UACrB,UAAA,EAAY,MACV,YAAA,CAAa,CAAM,EAAA,KAAA;AACjB,YAAA,OAAO,EAAG,CAAA,GAAA;AAAA,cAAI,CAAC,GAAK,EAAA,QAAA,KAClB,QAAa,KAAA,KAAA,GAAQ,CAAC,GAAM,GAAA;AAAA,aAC9B;AAAA,WACD,CAAA;AAAA,UAEH,WAAA,EAAa,MAAM,WAAA,CAAY,KAAK;AAAA,SAAA;AAAA,QAX/B,CAAG,EAAA,IAAA,CAAK,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,OAa9B,CACH,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -11,6 +11,7 @@ import { useState, useEffect } from 'react';
11
11
  import { QuickstartItemIcon } from './QuickstartItemIcon.esm.js';
12
12
  import { QuickstartCtaLink } from './QuickstartCtaLink.esm.js';
13
13
  import IconButton from '@mui/material/IconButton';
14
+ import { useTranslation } from '../../hooks/useTranslation.esm.js';
14
15
 
15
16
  const QuickstartItem = ({
16
17
  item,
@@ -19,6 +20,7 @@ const QuickstartItem = ({
19
20
  open,
20
21
  handleOpen
21
22
  }) => {
23
+ const { t } = useTranslation();
22
24
  const [stepCompleted, setStepCompleted] = useState(false);
23
25
  const itemKey = `${item.title}-${index}`;
24
26
  useEffect(() => {
@@ -42,7 +44,7 @@ const QuickstartItem = ({
42
44
  onClick: handleOpen,
43
45
  role: "button",
44
46
  "aria-expanded": open,
45
- "aria-label": `${open ? "Collapse" : "Expand"} ${item.title} details`,
47
+ "aria-label": open ? t("item.collapseAriaLabel", { title: item.title }) : t("item.expandAriaLabel", { title: item.title }),
46
48
  tabIndex: 0,
47
49
  onKeyDown: (e) => {
48
50
  if (e.key === "Enter" || e.key === " ") {
@@ -89,7 +91,7 @@ const QuickstartItem = ({
89
91
  /* @__PURE__ */ jsx(
90
92
  IconButton,
91
93
  {
92
- "aria-label": open ? "Collapse item" : "Expand item",
94
+ "aria-label": open ? t("item.collapseButtonAriaLabel") : t("item.expandButtonAriaLabel"),
93
95
  sx: {
94
96
  ...open ? { color: (theme) => theme.palette.text.primary } : { color: (theme) => theme.palette.text.secondary }
95
97
  },
@@ -1 +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 </Coll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ACC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,IAAA,CAAK,aAAa,CAC3C,EAAA,CAAA;AAAA,8BACC,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,iBAAA;AAAA,YAAA;AAAA,cACC,KAAK,IAAK,CAAA,GAAA;AAAA,cACV,SAAS,MAAM;AACb,gBAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA;AACvB;AAAA,WAEJ,EAAA;AAAA;AAAA;AAAA,KAEJ,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
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';\nimport { useTranslation } from '../../hooks/useTranslation';\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 { t } = useTranslation();\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={\n open\n ? t('item.collapseAriaLabel' as any, { title: item.title })\n : t('item.expandAriaLabel' as any, { title: item.title })\n }\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={\n open\n ? t('item.collapseButtonAriaLabel')\n : t('item.expandButtonAriaLabel')\n }\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":";;;;;;;;;;;;;;;AAuCO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,IAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAA2B,KAAA;AACzB,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,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,IAAI,cAAc,MAAQ,EAAA;AACxB,MAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA;AACvB,GACF,EAAG,CAAC,OAAO,CAAC,CAAA;AAEZ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,OAAQ,CAAA,OAAA,EAAS,aAAc,CAAA,QAAA,EAAU,CAAA;AAAA,GACrD,EAAA,CAAC,OAAS,EAAA,aAAa,CAAC,CAAA;AAE3B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,aAAe,EAAA;AACjB,MAAY,WAAA,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;AAAA,KAkEP;AAAA,wBACC,QAAS,EAAA,EAAA,EAAA,EAAI,MAAM,OAAQ,EAAA,MAAA,EAAO,eAAa,IAC9C,EAAA,QAAA,kBAAA,IAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,KAAA;AAAA,QACV,cAAc,EAAA,IAAA;AAAA,QACd,EAAI,EAAA;AAAA,UACF,GAAI,aACA,GAAA;AAAA,YACE,iBAAiB,CACf,KAAA,KAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,UAAU,SAAY,GAAA;AAAA,cAEjD,EAAE,eAAA,EAAiB,WAAS,KAAM,CAAA,OAAA,CAAQ,WAAW,KAAM,EAAA;AAAA,UAC/D,aAAe,EAAA;AAAA,SACjB;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YACC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,IAAA,CAAK,aAAa,CAC3C,EAAA,CAAA;AAAA,8BACC,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,iBAAA;AAAA,YAAA;AAAA,cACC,KAAK,IAAK,CAAA,GAAA;AAAA,cACV,SAAS,MAAM;AACb,gBAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA;AACvB;AAAA,WAEJ,EAAA;AAAA;AAAA;AAAA,KAEJ,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -4,14 +4,33 @@ import { useApiHolder, configApiRef } from '@backstage/core-plugin-api';
4
4
  import { Quickstart } from './Quickstart.esm.js';
5
5
  import { useQuickstartDrawerContext } from '../hooks/useQuickstartDrawerContext.esm.js';
6
6
  import { filterQuickstartItemsByRole } from '../utils/filterQuickstartItems.esm.js';
7
+ import { useQuickstartRole } from '../hooks/useQuickstartRole.esm.js';
8
+ import { useRef, useEffect } from 'react';
7
9
 
8
10
  const QuickstartDrawer = () => {
9
- const { isDrawerOpen, closeDrawer, drawerWidth } = useQuickstartDrawerContext();
11
+ const { isDrawerOpen, closeDrawer, openDrawer, drawerWidth } = useQuickstartDrawerContext();
12
+ const hasAutoOpened = useRef(false);
10
13
  const apiHolder = useApiHolder();
11
14
  const config = apiHolder.get(configApiRef);
12
15
  const quickstartItems = config?.has("app.quickstart") ? config.get("app.quickstart") : [];
13
- const userRole = "developer";
14
- const filteredItems = filterQuickstartItemsByRole(quickstartItems, userRole);
16
+ const { isLoading, userRole } = useQuickstartRole();
17
+ const filteredItems = !isLoading && userRole ? filterQuickstartItemsByRole(quickstartItems, userRole) : [];
18
+ useEffect(() => {
19
+ if (!isLoading && filteredItems.length > 0 && !isDrawerOpen && !hasAutoOpened.current) {
20
+ openDrawer();
21
+ hasAutoOpened.current = true;
22
+ }
23
+ }, [isLoading, filteredItems.length, isDrawerOpen, openDrawer]);
24
+ if (!isLoading && filteredItems.length === 0) {
25
+ if (isDrawerOpen) {
26
+ closeDrawer();
27
+ }
28
+ return null;
29
+ }
30
+ if (isLoading && isDrawerOpen) {
31
+ closeDrawer();
32
+ hasAutoOpened.current = false;
33
+ }
15
34
  return /* @__PURE__ */ jsx(
16
35
  Drawer,
17
36
  {
@@ -37,7 +56,8 @@ const QuickstartDrawer = () => {
37
56
  Quickstart,
38
57
  {
39
58
  quickstartItems: filteredItems,
40
- handleDrawerClose: closeDrawer
59
+ handleDrawerClose: closeDrawer,
60
+ isLoading
41
61
  }
42
62
  )
43
63
  }
@@ -1 +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';\nimport { filterQuickstartItemsByRole } from '../utils';\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\n // This will be dynamically determined based on the logged-in user\n const userRole = 'developer'; // switch to 'admin', 'developer', or other roles for testing purposes\n\n const filteredItems = filterQuickstartItemsByRole(quickstartItems, userRole);\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 // Only apply header offset when global header exists\n 'body:has(#global-header) &': {\n '& .v5-MuiDrawer-paper': {\n top: '64px !important',\n height: 'calc(100vh - 64px) !important',\n },\n },\n }}\n variant=\"persistent\"\n anchor=\"right\"\n open={isDrawerOpen}\n >\n <Quickstart\n quickstartItems={filteredItems}\n handleDrawerClose={closeDrawer}\n />\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBO,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;AAGL,EAAA,MAAM,QAAW,GAAA,WAAA;AAEjB,EAAM,MAAA,aAAA,GAAgB,2BAA4B,CAAA,eAAA,EAAiB,QAAQ,CAAA;AAE3E,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,SAClB;AAAA;AAAA,QAEA,4BAA8B,EAAA;AAAA,UAC5B,uBAAyB,EAAA;AAAA,YACvB,GAAK,EAAA,iBAAA;AAAA,YACL,MAAQ,EAAA;AAAA;AACV;AACF,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,eAAiB,EAAA,aAAA;AAAA,UACjB,iBAAmB,EAAA;AAAA;AAAA;AACrB;AAAA,GACF;AAEJ;;;;"}
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';\nimport { filterQuickstartItemsByRole } from '../utils';\nimport { useQuickstartRole } from '../hooks/useQuickstartRole';\nimport { useEffect, useRef } from 'react';\n\nexport const QuickstartDrawer = () => {\n const { isDrawerOpen, closeDrawer, openDrawer, drawerWidth } =\n useQuickstartDrawerContext();\n\n // Track if we've already auto-opened the drawer to prevent re-opening after manual close\n const hasAutoOpened = useRef(false);\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\n const { isLoading, userRole } = useQuickstartRole();\n const filteredItems =\n !isLoading && userRole\n ? filterQuickstartItemsByRole(quickstartItems, userRole)\n : [];\n\n // Auto-open drawer when user logs in and has quickstart items available\n // Only do this once, and respect user's manual close action\n useEffect(() => {\n if (\n !isLoading &&\n filteredItems.length > 0 &&\n !isDrawerOpen &&\n !hasAutoOpened.current\n ) {\n openDrawer();\n hasAutoOpened.current = true;\n }\n }, [isLoading, filteredItems.length, isDrawerOpen, openDrawer]);\n\n // Hide the drawer entirely if there are no quickstart items for the user\n // Do this check first, before any rendering happens\n if (!isLoading && filteredItems.length === 0) {\n // Also close the drawer context if it's currently open to prevent layout issues\n if (isDrawerOpen) {\n closeDrawer();\n }\n return null;\n }\n\n // During loading, if drawer is open but we don't know if user will have items yet,\n // close it preemptively to prevent flash and reset auto-open tracking\n if (isLoading && isDrawerOpen) {\n closeDrawer();\n hasAutoOpened.current = false; // Reset for new user\n }\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 // Only apply header offset when global header exists\n 'body:has(#global-header) &': {\n '& .v5-MuiDrawer-paper': {\n top: '64px !important',\n height: 'calc(100vh - 64px) !important',\n },\n },\n }}\n variant=\"persistent\"\n anchor=\"right\"\n open={isDrawerOpen}\n >\n <Quickstart\n quickstartItems={filteredItems}\n handleDrawerClose={closeDrawer}\n isLoading={isLoading}\n />\n </Drawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,YAAc,EAAA,WAAA,EAAa,UAAY,EAAA,WAAA,KAC7C,0BAA2B,EAAA;AAG7B,EAAM,MAAA,aAAA,GAAgB,OAAO,KAAK,CAAA;AAElC,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;AAEL,EAAA,MAAM,EAAE,SAAA,EAAW,QAAS,EAAA,GAAI,iBAAkB,EAAA;AAClD,EAAM,MAAA,aAAA,GACJ,CAAC,SAAa,IAAA,QAAA,GACV,4BAA4B,eAAiB,EAAA,QAAQ,IACrD,EAAC;AAIP,EAAA,SAAA,CAAU,MAAM;AACd,IACE,IAAA,CAAC,aACD,aAAc,CAAA,MAAA,GAAS,KACvB,CAAC,YAAA,IACD,CAAC,aAAA,CAAc,OACf,EAAA;AACA,MAAW,UAAA,EAAA;AACX,MAAA,aAAA,CAAc,OAAU,GAAA,IAAA;AAAA;AAC1B,KACC,CAAC,SAAA,EAAW,cAAc,MAAQ,EAAA,YAAA,EAAc,UAAU,CAAC,CAAA;AAI9D,EAAA,IAAI,CAAC,SAAA,IAAa,aAAc,CAAA,MAAA,KAAW,CAAG,EAAA;AAE5C,IAAA,IAAI,YAAc,EAAA;AAChB,MAAY,WAAA,EAAA;AAAA;AAEd,IAAO,OAAA,IAAA;AAAA;AAKT,EAAA,IAAI,aAAa,YAAc,EAAA;AAC7B,IAAY,WAAA,EAAA;AACZ,IAAA,aAAA,CAAc,OAAU,GAAA,KAAA;AAAA;AAG1B,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,SAClB;AAAA;AAAA,QAEA,4BAA8B,EAAA;AAAA,UAC5B,uBAAyB,EAAA;AAAA,YACvB,GAAK,EAAA,iBAAA;AAAA,YACL,MAAQ,EAAA;AAAA;AACV;AACF,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,eAAiB,EAAA,aAAA;AAAA,UACjB,iBAAmB,EAAA,WAAA;AAAA,UACnB;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -5,10 +5,8 @@ import CloseIcon from '@mui/icons-material/Close';
5
5
  import IconButton from '@mui/material/IconButton';
6
6
  import { QuickstartDrawerContext } from './QuickstartDrawerContext.esm.js';
7
7
  import { QuickstartDrawer } from './QuickstartDrawer.esm.js';
8
- import { useQuickstartPermission } from '../hooks/useQuickstartPermission.esm.js';
9
8
 
10
9
  const QuickstartDrawerProvider = ({ children }) => {
11
- const isAllowed = useQuickstartPermission();
12
10
  const [isDrawerOpen, setIsDrawerOpen] = useState(false);
13
11
  const [showNotification, setShowNotification] = useState(false);
14
12
  const [hasShownNotification, setHasShownNotification] = useState(false);
@@ -35,17 +33,15 @@ const QuickstartDrawerProvider = ({ children }) => {
35
33
  const notificationShown = localStorage.getItem(
36
34
  "quickstart-notification-shown"
37
35
  );
38
- if (isAllowed) {
39
- if (!hasVisited) {
40
- setIsDrawerOpen(true);
41
- localStorage.setItem("quickstart-visited", "true");
42
- localStorage.setItem("quickstart-open", "true");
43
- } else if (wasOpen === "true") {
44
- setIsDrawerOpen(true);
45
- }
36
+ if (!hasVisited) {
37
+ setIsDrawerOpen(true);
38
+ localStorage.setItem("quickstart-visited", "true");
39
+ localStorage.setItem("quickstart-open", "true");
40
+ } else if (wasOpen === "true") {
41
+ setIsDrawerOpen(true);
46
42
  }
47
43
  setHasShownNotification(notificationShown === "true");
48
- }, [isAllowed]);
44
+ }, []);
49
45
  const openDrawer = () => {
50
46
  setIsDrawerOpen(true);
51
47
  localStorage.setItem("quickstart-open", "true");
@@ -1 +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 { useQuickstartPermission } from '../hooks/useQuickstartPermission';\n\nexport const QuickstartDrawerProvider = ({ children }: PropsWithChildren) => {\n const isAllowed = useQuickstartPermission();\n const [isDrawerOpen, setIsDrawerOpen] = useState<boolean>(false);\n const [showNotification, setShowNotification] = useState(false);\n const [hasShownNotification, setHasShownNotification] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState<number>(500);\n\n // Single useEffect - sets class on document.body\n useEffect(() => {\n if (isDrawerOpen) {\n document.body.classList.add('quickstart-drawer-open');\n document.body.style.setProperty(\n '--quickstart-drawer-width',\n `${drawerWidth}px`,\n );\n } else {\n document.body.classList.remove('quickstart-drawer-open');\n document.body.style.removeProperty('--quickstart-drawer-width');\n }\n\n return () => {\n document.body.classList.remove('quickstart-drawer-open');\n document.body.style.removeProperty('--quickstart-drawer-width');\n };\n }, [isDrawerOpen, drawerWidth]);\n\n useEffect(() => {\n const wasOpen = localStorage.getItem('quickstart-open');\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 localStorage.setItem('quickstart-open', 'true');\n } else if (wasOpen === 'true') {\n setIsDrawerOpen(true);\n }\n }\n\n setHasShownNotification(notificationShown === 'true');\n }, [isAllowed]);\n\n const openDrawer = () => {\n setIsDrawerOpen(true);\n localStorage.setItem('quickstart-open', 'true');\n };\n\n const closeDrawer = () => {\n setIsDrawerOpen(false);\n if (!hasShownNotification) {\n setShowNotification(true);\n setHasShownNotification(true);\n localStorage.setItem('quickstart-notification-shown', 'true');\n }\n localStorage.setItem('quickstart-open', 'false');\n };\n\n const toggleDrawer = () => {\n setIsDrawerOpen(!isDrawerOpen);\n localStorage.setItem('quickstart-open', (!isDrawerOpen).toString());\n };\n\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 {children}\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":";;;;;;;;;AAwBO,MAAM,wBAA2B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC3E,EAAA,MAAM,YAAY,uBAAwB,EAAA;AAC1C,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,KAAK,CAAA;AAC/D,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA;AAC9D,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAI,SAAS,KAAK,CAAA;AACtE,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAiB,GAAG,CAAA;AAG1D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAc,EAAA;AAChB,MAAS,QAAA,CAAA,IAAA,CAAK,SAAU,CAAA,GAAA,CAAI,wBAAwB,CAAA;AACpD,MAAA,QAAA,CAAS,KAAK,KAAM,CAAA,WAAA;AAAA,QAClB,2BAAA;AAAA,QACA,GAAG,WAAW,CAAA,EAAA;AAAA,OAChB;AAAA,KACK,MAAA;AACL,MAAS,QAAA,CAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,wBAAwB,CAAA;AACvD,MAAS,QAAA,CAAA,IAAA,CAAK,KAAM,CAAA,cAAA,CAAe,2BAA2B,CAAA;AAAA;AAGhE,IAAA,OAAO,MAAM;AACX,MAAS,QAAA,CAAA,IAAA,CAAK,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../../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';\n\nexport const QuickstartDrawerProvider = ({ children }: PropsWithChildren) => {\n const [isDrawerOpen, setIsDrawerOpen] = useState<boolean>(false);\n const [showNotification, setShowNotification] = useState(false);\n const [hasShownNotification, setHasShownNotification] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState<number>(500);\n\n // Single useEffect - sets class on document.body\n useEffect(() => {\n if (isDrawerOpen) {\n document.body.classList.add('quickstart-drawer-open');\n document.body.style.setProperty(\n '--quickstart-drawer-width',\n `${drawerWidth}px`,\n );\n } else {\n document.body.classList.remove('quickstart-drawer-open');\n document.body.style.removeProperty('--quickstart-drawer-width');\n }\n\n return () => {\n document.body.classList.remove('quickstart-drawer-open');\n document.body.style.removeProperty('--quickstart-drawer-width');\n };\n }, [isDrawerOpen, drawerWidth]);\n\n useEffect(() => {\n const wasOpen = localStorage.getItem('quickstart-open');\n const hasVisited = localStorage.getItem('quickstart-visited');\n const notificationShown = localStorage.getItem(\n 'quickstart-notification-shown',\n );\n\n if (!hasVisited) {\n setIsDrawerOpen(true);\n localStorage.setItem('quickstart-visited', 'true');\n localStorage.setItem('quickstart-open', 'true');\n } else if (wasOpen === 'true') {\n setIsDrawerOpen(true);\n }\n\n setHasShownNotification(notificationShown === 'true');\n }, []);\n\n const openDrawer = () => {\n setIsDrawerOpen(true);\n localStorage.setItem('quickstart-open', 'true');\n };\n\n const closeDrawer = () => {\n setIsDrawerOpen(false);\n if (!hasShownNotification) {\n setShowNotification(true);\n setHasShownNotification(true);\n localStorage.setItem('quickstart-notification-shown', 'true');\n }\n localStorage.setItem('quickstart-open', 'false');\n };\n\n const toggleDrawer = () => {\n setIsDrawerOpen(!isDrawerOpen);\n localStorage.setItem('quickstart-open', (!isDrawerOpen).toString());\n };\n\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 {children}\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":";;;;;;;;AAuBO,MAAM,wBAA2B,GAAA,CAAC,EAAE,QAAA,EAAkC,KAAA;AAC3E,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,KAAK,CAAA;AAC/D,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA;AAC9D,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAI,SAAS,KAAK,CAAA;AACtE,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAiB,GAAG,CAAA;AAG1D,EAAA,SAAA,CAAU,MAAM;A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;AAAA,YACrD,OAAQ,EAAA,oFAAA;AAAA,YACR,MACE,kBAAA,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,IAAK,EAAA,OAAA;AAAA,gBACL,YAAW,EAAA,OAAA;AAAA,gBACX,KAAM,EAAA,SAAA;AAAA,gBACN,OAAS,EAAA,uBAAA;AAAA,gBAET,QAAA,kBAAA,GAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA;AAAA;AAAA;AAC9B;AAAA;AAEJ;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -3,11 +3,13 @@ import Box from '@mui/material/Box';
3
3
  import Button from '@mui/material/Button';
4
4
  import LinearProgress from '@mui/material/LinearProgress';
5
5
  import Typography from '@mui/material/Typography';
6
+ import { useTranslation } from '../hooks/useTranslation.esm.js';
6
7
 
7
8
  const QuickstartFooter = ({
8
9
  handleDrawerClose,
9
10
  progress
10
11
  }) => {
12
+ const { t } = useTranslation();
11
13
  return /* @__PURE__ */ jsxs(Box, { children: [
12
14
  /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: progress }),
13
15
  /* @__PURE__ */ jsxs(
@@ -20,8 +22,8 @@ const QuickstartFooter = ({
20
22
  padding: (theme) => `${theme.spacing(2.5)}`
21
23
  },
22
24
  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
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.caption }, children: progress > 0 ? t("footer.progress", { progress: progress.toString() }) : t("footer.notStarted") }),
26
+ /* @__PURE__ */ jsx(Button, { onClick: () => handleDrawerClose(), children: t("footer.hide") })
25
27
  ]
26
28
  }
27
29
  )
@@ -1 +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;;;;"}
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';\nimport { useTranslation } from '../hooks/useTranslation';\n\nexport type QuickstartFooterProps = {\n handleDrawerClose: () => void;\n progress: number;\n};\n\nexport const QuickstartFooter = ({\n handleDrawerClose,\n progress,\n}: QuickstartFooterProps) => {\n const { t } = useTranslation();\n\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\n ? t('footer.progress' as any, { progress: progress.toString() })\n : t('footer.notStarted')}\n </Typography>\n <Button onClick={() => handleDrawerClose()}>{t('footer.hide')}</Button>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,iBAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,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,0BAAC,GAAA,CAAA,UAAA,EAAA,EAAW,IAAI,EAAE,QAAA,EAAU,WAAS,KAAM,CAAA,UAAA,CAAW,OAAQ,EAAA,EAC3D,QAAW,EAAA,QAAA,GAAA,CAAA,GACR,EAAE,iBAA0B,EAAA,EAAE,UAAU,QAAS,CAAA,QAAA,IAAY,CAAA,GAC7D,CAAE,CAAA,mBAAmB,CAC3B,EAAA,CAAA;AAAA,0BACA,GAAA,CAAC,UAAO,OAAS,EAAA,MAAM,mBAAsB,EAAA,QAAA,EAAA,CAAA,CAAE,aAAa,CAAE,EAAA;AAAA;AAAA;AAAA;AAChE,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -3,8 +3,10 @@ import Box from '@mui/material/Box';
3
3
  import Toolbar from '@mui/material/Toolbar';
4
4
  import Typography from '@mui/material/Typography';
5
5
  import quickstartImage from '../assets/quickstart-image.png';
6
+ import { useTranslation } from '../hooks/useTranslation.esm.js';
6
7
 
7
8
  const QuickstartHeader = () => {
9
+ const { t } = useTranslation();
8
10
  return /* @__PURE__ */ jsxs(
9
11
  Toolbar,
10
12
  {
@@ -33,8 +35,8 @@ const QuickstartHeader = () => {
33
35
  padding: (theme) => `${theme.spacing(3)} 0px`
34
36
  },
35
37
  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
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.h6 }, children: t("header.title") }),
39
+ /* @__PURE__ */ jsx(Typography, { sx: { fontSize: (theme) => theme.typography.caption }, children: t("header.subtitle") })
38
40
  ]
39
41
  }
40
42
  )
@@ -1 +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;;;;"}
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';\nimport { useTranslation } from '../hooks/useTranslation';\n\nexport const QuickstartHeader = () => {\n const { t } = useTranslation();\n\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 {t('header.title')}\n </Typography>\n <Typography sx={{ fontSize: theme => theme.typography.caption }}>\n {t('header.subtitle')}\n </Typography>\n </Box>\n </Toolbar>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBO,MAAM,mBAAmB,MAAM;AACpC,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAE7B,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,EAAI,EAAA,EAAE,QAAU,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,UAAA,CAAW,EAAG,EAAA,EACtD,QAAE,EAAA,CAAA,CAAA,cAAc,CACnB,EAAA,CAAA;AAAA,8BACC,GAAA,CAAA,UAAA,EAAA,EAAW,EAAI,EAAA,EAAE,QAAU,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,UAAA,CAAW,OAAQ,EAAA,EAC3D,QAAE,EAAA,CAAA,CAAA,iBAAiB,CACtB,EAAA;AAAA;AAAA;AAAA;AACF;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -0,0 +1,38 @@
1
+ import { usePermission } from '@backstage/plugin-permission-react';
2
+ import { useApi, configApiRef, identityApiRef } from '@backstage/core-plugin-api';
3
+ import { policyEntityCreatePermission } from '@backstage-community/plugin-rbac-common';
4
+ import { useAsync } from 'react-use';
5
+
6
+ const useQuickstartRole = () => {
7
+ const config = useApi(configApiRef);
8
+ const identityApi = useApi(identityApiRef);
9
+ const isRBACEnabled = config.getOptionalBoolean("permission.enabled") ?? false;
10
+ const { loading, allowed } = usePermission({
11
+ permission: policyEntityCreatePermission
12
+ });
13
+ const { value: authResult, loading: authLoading } = useAsync(async () => {
14
+ try {
15
+ const credentials = await identityApi.getCredentials();
16
+ const identity = await identityApi.getBackstageIdentity();
17
+ const hasValidToken = credentials?.token && credentials.token.length > 10;
18
+ const userEntityRef = identity?.userEntityRef || "";
19
+ const ownershipRefs = identity?.ownershipEntityRefs || [];
20
+ const isGuest = userEntityRef.toLowerCase().includes("guest") || userEntityRef === "user:default/guest" || !hasValidToken && ownershipRefs.length === 0;
21
+ const isAuthenticated = !isGuest;
22
+ return { isAuthenticated, identity, credentials };
23
+ } catch (error) {
24
+ return { isAuthenticated: false, identity: null, credentials: null };
25
+ }
26
+ }, [identityApi]);
27
+ if (authLoading || loading) return { isLoading: true, userRole: null };
28
+ const isUserAuthorized = authResult?.isAuthenticated ?? false;
29
+ if (!isUserAuthorized) {
30
+ return { isLoading: false, userRole: "admin" };
31
+ }
32
+ if (!isRBACEnabled) return { isLoading: false, userRole: "admin" };
33
+ if (allowed) return { isLoading: false, userRole: "admin" };
34
+ return { isLoading: false, userRole: "developer" };
35
+ };
36
+
37
+ export { useQuickstartRole };
38
+ //# sourceMappingURL=useQuickstartRole.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuickstartRole.esm.js","sources":["../../src/hooks/useQuickstartRole.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 { usePermission } from '@backstage/plugin-permission-react';\nimport {\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { policyEntityCreatePermission } from '@backstage-community/plugin-rbac-common';\nimport { useAsync } from 'react-use';\nimport { UserRole } from '../types';\n\n/**\n * Determines the user's role for quickstart functionality based on RBAC permissions and user authorization.\n *\n * Business Logic:\n * - Guest user(unauthorized): show admin items\n * - Authorized user + NO RBAC enabled: show admin items\n * - Authorized user + RBAC enabled:\n * - if user has admin permission => show configured admin items\n * - if user doesn't have admin permission => show configured developer items\n *\n * @returns Object with isLoading boolean and userRole ('admin' | 'developer' | null)\n */\nexport const useQuickstartRole = (): {\n isLoading: boolean;\n userRole: UserRole | null;\n} => {\n const config = useApi(configApiRef);\n const identityApi = useApi(identityApiRef);\n const isRBACEnabled =\n config.getOptionalBoolean('permission.enabled') ?? false;\n const { loading, allowed } = usePermission({\n permission: policyEntityCreatePermission,\n });\n\n // Check user authorization status by examining identity and credentials\n const { value: authResult, loading: authLoading } = useAsync(async () => {\n try {\n const credentials = await identityApi.getCredentials();\n const identity = await identityApi.getBackstageIdentity();\n\n // Check multiple indicators to determine if user is authenticated (not a guest)\n const hasValidToken = credentials?.token && credentials.token.length > 10; // Real tokens are longer\n const userEntityRef = identity?.userEntityRef || '';\n const ownershipRefs = identity?.ownershipEntityRefs || [];\n\n const isGuest =\n userEntityRef.toLowerCase().includes('guest') ||\n userEntityRef === 'user:default/guest' ||\n (!hasValidToken && ownershipRefs.length === 0);\n\n const isAuthenticated = !isGuest;\n\n return { isAuthenticated, identity, credentials };\n } catch (error) {\n return { isAuthenticated: false, identity: null, credentials: null };\n }\n }, [identityApi]);\n\n // If still loading authorization or permissions, return loading state\n if (authLoading || loading) return { isLoading: true, userRole: null };\n\n // Check if user is authorized (authenticated, not a guest)\n const isUserAuthorized = authResult?.isAuthenticated ?? false;\n\n // Unauthorized user: show admin items\n if (!isUserAuthorized) {\n return { isLoading: false, userRole: 'admin' };\n }\n\n // Authorized user + NO RBAC enabled: show admin items\n if (!isRBACEnabled) return { isLoading: false, userRole: 'admin' };\n\n // Authorized user + RBAC enabled: check permissions\n // If user has admin permission => show configured admin items\n if (allowed) return { isLoading: false, userRole: 'admin' };\n\n // If user doesn't have admin permission => show configured developer items\n return { isLoading: false, userRole: 'developer' };\n};\n"],"names":[],"mappings":";;;;;AAsCO,MAAM,oBAAoB,MAG5B;AACH,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,aACJ,GAAA,MAAA,CAAO,kBAAmB,CAAA,oBAAoB,CAAK,IAAA,KAAA;AACrD,EAAA,MAAM,EAAE,OAAA,EAAS,OAAQ,EAAA,GAAI,aAAc,CAAA;AAAA,IACzC,UAAY,EAAA;AAAA,GACb,CAAA;AAGD,EAAA,MAAM,EAAE,KAAO,EAAA,UAAA,EAAY,SAAS,WAAY,EAAA,GAAI,SAAS,YAAY;AACvE,IAAI,IAAA;AACF,MAAM,MAAA,WAAA,GAAc,MAAM,WAAA,CAAY,cAAe,EAAA;AACrD,MAAM,MAAA,QAAA,GAAW,MAAM,WAAA,CAAY,oBAAqB,EAAA;AAGxD,MAAA,MAAM,aAAgB,GAAA,WAAA,EAAa,KAAS,IAAA,WAAA,CAAY,MAAM,MAAS,GAAA,EAAA;AACvE,MAAM,MAAA,aAAA,GAAgB,UAAU,aAAiB,IAAA,EAAA;AACjD,MAAM,MAAA,aAAA,GAAgB,QAAU,EAAA,mBAAA,IAAuB,EAAC;AAExD,MAAA,MAAM,OACJ,GAAA,aAAA,CAAc,WAAY,EAAA,CAAE,QAAS,CAAA,OAAO,CAC5C,IAAA,aAAA,KAAkB,oBACjB,IAAA,CAAC,aAAiB,IAAA,aAAA,CAAc,MAAW,KAAA,CAAA;AAE9C,MAAA,MAAM,kBAAkB,CAAC,OAAA;AAEzB,MAAO,OAAA,EAAE,eAAiB,EAAA,QAAA,EAAU,WAAY,EAAA;AAAA,aACzC,KAAO,EAAA;AACd,MAAA,OAAO,EAAE,eAAiB,EAAA,KAAA,EAAO,QAAU,EAAA,IAAA,EAAM,aAAa,IAAK,EAAA;AAAA;AACrE,GACF,EAAG,CAAC,WAAW,CAAC,CAAA;AAGhB,EAAA,IAAI,eAAe,OAAS,EAAA,OAAO,EAAE,SAAW,EAAA,IAAA,EAAM,UAAU,IAAK,EAAA;AAGrE,EAAM,MAAA,gBAAA,GAAmB,YAAY,eAAmB,IAAA,KAAA;AAGxD,EAAA,IAAI,CAAC,gBAAkB,EAAA;AACrB,IAAA,OAAO,EAAE,SAAA,EAAW,KAAO,EAAA,QAAA,EAAU,OAAQ,EAAA;AAAA;AAI/C,EAAA,IAAI,CAAC,aAAe,EAAA,OAAO,EAAE,SAAW,EAAA,KAAA,EAAO,UAAU,OAAQ,EAAA;AAIjE,EAAA,IAAI,SAAgB,OAAA,EAAE,SAAW,EAAA,KAAA,EAAO,UAAU,OAAQ,EAAA;AAG1D,EAAA,OAAO,EAAE,SAAA,EAAW,KAAO,EAAA,QAAA,EAAU,WAAY,EAAA;AACnD;;;;"}
@@ -0,0 +1,8 @@
1
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
2
+ import '../translations/index.esm.js';
3
+ import { quickstartTranslationRef } from '../translations/ref.esm.js';
4
+
5
+ const useTranslation = () => useTranslationRef(quickstartTranslationRef);
6
+
7
+ export { useTranslation };
8
+ //# sourceMappingURL=useTranslation.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTranslation.esm.js","sources":["../../src/hooks/useTranslation.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 useTranslationRef,\n TranslationFunction,\n} from '@backstage/core-plugin-api/alpha';\nimport { quickstartTranslationRef } from '../translations';\n\nexport const useTranslation = (): {\n t: TranslationFunction<typeof quickstartTranslationRef.T>;\n} => useTranslationRef(quickstartTranslationRef);\n"],"names":[],"mappings":";;;;AAsBa,MAAA,cAAA,GAAiB,MAEzB,iBAAA,CAAkB,wBAAwB;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { CSSProperties, PropsWithChildren } from 'react';
4
+ import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
4
5
 
5
6
  /**
6
7
  * Props for the QuickstartButton component
@@ -80,5 +81,11 @@ interface QuickstartDrawerContextType {
80
81
  */
81
82
  declare const useQuickstartDrawerContext: () => QuickstartDrawerContextType;
82
83
 
83
- export { QuickstartButton, QuickstartDrawerProvider, quickstartPlugin, useQuickstartDrawerContext };
84
+ /**
85
+ * Translation Resource for Quickstart
86
+ * @public
87
+ */
88
+ declare const quickstartTranslations: _backstage_core_plugin_api_alpha.TranslationResource<"plugin.quickstart">;
89
+
90
+ export { QuickstartButton, QuickstartDrawerProvider, quickstartPlugin, quickstartTranslations, useQuickstartDrawerContext };
84
91
  export type { QuickstartButtonProps, QuickstartDrawerContextType };
package/dist/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { unstable_ClassNameGenerator } from '@mui/material/className';
2
2
  export { QuickstartButton, QuickstartDrawerProvider, quickstartPlugin } from './plugin.esm.js';
3
3
  export { useQuickstartDrawerContext } from './hooks/useQuickstartDrawerContext.esm.js';
4
+ export { quickstartTranslations } from './translations/index.esm.js';
4
5
 
5
6
  unstable_ClassNameGenerator.configure((componentName) => {
6
7
  return componentName.startsWith("v5-") ? componentName : `v5-${componentName}`;
@@ -1 +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 * from './plugin';\n\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"}
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 * from './plugin';\n\nexport { useQuickstartDrawerContext } from './hooks/useQuickstartDrawerContext';\nexport type { QuickstartDrawerContextType } from './components/QuickstartDrawerContext';\n\nexport { quickstartTranslations } from './translations';\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"}
@@ -1,7 +1,13 @@
1
1
  import { createPlugin, createComponentExtension } from '@backstage/core-plugin-api';
2
+ import './translations/index.esm.js';
3
+ import { quickstartTranslationRef } from './translations/ref.esm.js';
2
4
 
3
5
  const quickstartPlugin = createPlugin({
4
- id: "quickstart"
6
+ id: "quickstart",
7
+ __experimentalTranslations: {
8
+ availableLanguages: ["en", "de", "fr", "es"],
9
+ resources: [quickstartTranslationRef]
10
+ }
5
11
  });
6
12
  const QuickstartDrawerProvider = quickstartPlugin.provide(
7
13
  createComponentExtension({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { PropsWithChildren } from 'react';\nimport { QuickstartButtonProps } from './components/QuickstartButton/QuickstartButton';\n\nexport type { QuickstartButtonProps } from './components/QuickstartButton/QuickstartButton';\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\n/**\n * Quick start button for global header help dropdown\n *\n * @public\n */\nexport const QuickstartButton: React.ComponentType<QuickstartButtonProps> =\n quickstartPlugin.provide(\n createComponentExtension({\n name: 'QuickstartButton',\n component: {\n lazy: () =>\n import('./components/QuickstartButton/QuickstartButton').then(\n m => m.QuickstartButton,\n ),\n },\n }),\n );\n"],"names":[],"mappings":";;AA8BO,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;AAOK,MAAM,mBACX,gBAAiB,CAAA,OAAA;AAAA,EACf,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,kBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,uDAAgD,CAAE,CAAA,IAAA;AAAA,QACvD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createComponentExtension,\n createPlugin,\n} from '@backstage/core-plugin-api';\nimport { PropsWithChildren } from 'react';\nimport { QuickstartButtonProps } from './components/QuickstartButton/QuickstartButton';\nimport { quickstartTranslationRef } from './translations';\n\nexport type { QuickstartButtonProps } from './components/QuickstartButton/QuickstartButton';\n\n/**\n * Quick start plugin\n *\n * @public\n */\nexport const quickstartPlugin = createPlugin({\n id: 'quickstart',\n __experimentalTranslations: {\n availableLanguages: ['en', 'de', 'fr', 'es'],\n resources: [quickstartTranslationRef],\n },\n} as any);\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\n/**\n * Quick start button for global header help dropdown\n *\n * @public\n */\nexport const QuickstartButton: React.ComponentType<QuickstartButtonProps> =\n quickstartPlugin.provide(\n createComponentExtension({\n name: 'QuickstartButton',\n component: {\n lazy: () =>\n import('./components/QuickstartButton/QuickstartButton').then(\n m => m.QuickstartButton,\n ),\n },\n }),\n );\n"],"names":[],"mappings":";;;;AA+BO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,0BAA4B,EAAA;AAAA,IAC1B,kBAAoB,EAAA,CAAC,IAAM,EAAA,IAAA,EAAM,MAAM,IAAI,CAAA;AAAA,IAC3C,SAAA,EAAW,CAAC,wBAAwB;AAAA;AAExC,CAAQ;AAOD,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;AAOK,MAAM,mBACX,gBAAiB,CAAA,OAAA;AAAA,EACf,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,kBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,uDAAgD,CAAE,CAAA,IAAA;AAAA,QACvD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
@@ -0,0 +1,36 @@
1
+ import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
2
+ import { quickstartTranslationRef } from './ref.esm.js';
3
+
4
+ const quickstartTranslationDe = createTranslationMessages({
5
+ ref: quickstartTranslationRef,
6
+ messages: {
7
+ "header.title": "Erste Schritte mit dem Developer Hub",
8
+ "header.subtitle": "Wir f\xFChren Sie durch einige schnelle Schritte",
9
+ "button.quickstart": "Schnellstart",
10
+ "button.openQuickstartGuide": "Schnellstart-Leitfaden \xF6ffnen",
11
+ "button.closeDrawer": "Drawer schlie\xDFen",
12
+ "footer.progress": "{{progress}}% Fortschritt",
13
+ "footer.notStarted": "Nicht begonnen",
14
+ "footer.hide": "Ausblenden",
15
+ "content.emptyState.title": "Schnellstart-Inhalte sind f\xFCr Ihre Rolle nicht verf\xFCgbar.",
16
+ "item.expandAriaLabel": "{{title}} Details erweitern",
17
+ "item.collapseAriaLabel": "{{title}} Details einklappen",
18
+ "item.expandButtonAriaLabel": "Element erweitern",
19
+ "item.collapseButtonAriaLabel": "Element einklappen",
20
+ "dev.pageTitle": "Quickstart Plugin Testseite",
21
+ "dev.pageDescription": "Dies ist eine Testseite f\xFCr das Quickstart-Plugin. Verwenden Sie die Schaltfl\xE4chen unten, um mit dem Quickstart-Drawer zu interagieren.",
22
+ "dev.drawerControls": "Drawer-Steuerungen",
23
+ "dev.currentState": "Aktueller Drawer-Status: {{state}}",
24
+ "dev.stateOpen": "Offen",
25
+ "dev.stateClosed": "Geschlossen",
26
+ "dev.instructions": "Anweisungen",
27
+ "dev.step1": '1. Klicken Sie auf "Schnellstart-Leitfaden \xF6ffnen", um den Drawer zu \xF6ffnen',
28
+ "dev.step2": "2. Navigieren Sie durch die Schnellstart-Schritte",
29
+ "dev.step3": "3. Testen Sie die Fortschrittsverfolgung durch Abschlie\xDFen von Schritten",
30
+ "dev.step4": "4. Der Drawer kann mit der Schlie\xDFen-Schaltfl\xE4che oder den eigenen Steuerelementen des Drawers geschlossen werden",
31
+ "dev.step5": "5. Der Fortschritt wird automatisch in localStorage gespeichert"
32
+ }
33
+ });
34
+
35
+ export { quickstartTranslationDe as default };
36
+ //# sourceMappingURL=de.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"de.esm.js","sources":["../../src/translations/de.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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\nimport { quickstartTranslationRef } from './ref';\n\nconst quickstartTranslationDe = createTranslationMessages({\n ref: quickstartTranslationRef,\n messages: {\n 'header.title': 'Erste Schritte mit dem Developer Hub',\n 'header.subtitle': 'Wir führen Sie durch einige schnelle Schritte',\n 'button.quickstart': 'Schnellstart',\n 'button.openQuickstartGuide': 'Schnellstart-Leitfaden öffnen',\n 'button.closeDrawer': 'Drawer schließen',\n 'footer.progress': '{{progress}}% Fortschritt',\n 'footer.notStarted': 'Nicht begonnen',\n 'footer.hide': 'Ausblenden',\n 'content.emptyState.title':\n 'Schnellstart-Inhalte sind für Ihre Rolle nicht verfügbar.',\n 'item.expandAriaLabel': '{{title}} Details erweitern',\n 'item.collapseAriaLabel': '{{title}} Details einklappen',\n 'item.expandButtonAriaLabel': 'Element erweitern',\n 'item.collapseButtonAriaLabel': 'Element einklappen',\n 'dev.pageTitle': 'Quickstart Plugin Testseite',\n 'dev.pageDescription':\n 'Dies ist eine Testseite für das Quickstart-Plugin. Verwenden Sie die Schaltflächen unten, um mit dem Quickstart-Drawer zu interagieren.',\n 'dev.drawerControls': 'Drawer-Steuerungen',\n 'dev.currentState': 'Aktueller Drawer-Status: {{state}}',\n 'dev.stateOpen': 'Offen',\n 'dev.stateClosed': 'Geschlossen',\n 'dev.instructions': 'Anweisungen',\n 'dev.step1':\n '1. Klicken Sie auf \"Schnellstart-Leitfaden öffnen\", um den Drawer zu öffnen',\n 'dev.step2': '2. Navigieren Sie durch die Schnellstart-Schritte',\n 'dev.step3':\n '3. Testen Sie die Fortschrittsverfolgung durch Abschließen von Schritten',\n 'dev.step4':\n '4. Der Drawer kann mit der Schließen-Schaltfläche oder den eigenen Steuerelementen des Drawers geschlossen werden',\n 'dev.step5':\n '5. Der Fortschritt wird automatisch in localStorage gespeichert',\n },\n});\n\nexport default quickstartTranslationDe;\n"],"names":[],"mappings":";;;AAmBA,MAAM,0BAA0B,yBAA0B,CAAA;AAAA,EACxD,GAAK,EAAA,wBAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,sCAAA;AAAA,IAChB,iBAAmB,EAAA,kDAAA;AAAA,IACnB,mBAAqB,EAAA,cAAA;AAAA,IACrB,4BAA8B,EAAA,kCAAA;AAAA,IAC9B,oBAAsB,EAAA,qBAAA;AAAA,IACtB,iBAAmB,EAAA,2BAAA;AAAA,IACnB,mBAAqB,EAAA,gBAAA;AAAA,IACrB,aAAe,EAAA,YAAA;AAAA,IACf,0BACE,EAAA,iEAAA;AAAA,IACF,sBAAwB,EAAA,6BAAA;AAAA,IACxB,wBAA0B,EAAA,8BAAA;AAAA,IAC1B,4BAA8B,EAAA,mBAAA;AAAA,IAC9B,8BAAgC,EAAA,oBAAA;AAAA,IAChC,eAAiB,EAAA,6BAAA;AAAA,IACjB,qBACE,EAAA,+IAAA;AAAA,IACF,oBAAsB,EAAA,oBAAA;AAAA,IACtB,kBAAoB,EAAA,oCAAA;AAAA,IACpB,eAAiB,EAAA,OAAA;AAAA,IACjB,iBAAmB,EAAA,aAAA;AAAA,IACnB,kBAAoB,EAAA,aAAA;AAAA,IACpB,WACE,EAAA,mFAAA;AAAA,IACF,WAAa,EAAA,mDAAA;AAAA,IACb,WACE,EAAA,6EAAA;AAAA,IACF,WACE,EAAA,yHAAA;AAAA,IACF,WACE,EAAA;AAAA;AAEN,CAAC;;;;"}
@@ -0,0 +1,36 @@
1
+ import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
2
+ import { quickstartTranslationRef } from './ref.esm.js';
3
+
4
+ const quickstartTranslationEs = createTranslationMessages({
5
+ ref: quickstartTranslationRef,
6
+ messages: {
7
+ "header.title": "Comencemos con el Hub del Desarrollador",
8
+ "header.subtitle": "Te guiaremos a trav\xE9s de algunos pasos r\xE1pidos",
9
+ "button.quickstart": "Inicio r\xE1pido",
10
+ "footer.progress": "{{progress}}% de progreso",
11
+ "footer.notStarted": "No iniciado",
12
+ "footer.hide": "Ocultar",
13
+ "content.emptyState.title": "El contenido de inicio r\xE1pido no est\xE1 disponible para tu rol.",
14
+ "item.expandAriaLabel": "Expandir detalles de {{title}}",
15
+ "item.collapseAriaLabel": "Contraer detalles de {{title}}",
16
+ "item.expandButtonAriaLabel": "Expandir elemento",
17
+ "item.collapseButtonAriaLabel": "Contraer elemento",
18
+ "button.openQuickstartGuide": "Abrir gu\xEDa de inicio r\xE1pido",
19
+ "button.closeDrawer": "Cerrar caj\xF3n",
20
+ "dev.pageTitle": "P\xE1gina de prueba del plugin Quickstart",
21
+ "dev.pageDescription": "Esta es una p\xE1gina de prueba para el plugin Quickstart. Use los botones de abajo para interactuar con el caj\xF3n de inicio r\xE1pido.",
22
+ "dev.drawerControls": "Controles del caj\xF3n",
23
+ "dev.currentState": "Estado actual del caj\xF3n: {{state}}",
24
+ "dev.stateOpen": "Abierto",
25
+ "dev.stateClosed": "Cerrado",
26
+ "dev.instructions": "Instrucciones",
27
+ "dev.step1": '1. Haga clic en "Abrir gu\xEDa de inicio r\xE1pido" para abrir el caj\xF3n',
28
+ "dev.step2": "2. Navegue a trav\xE9s de los pasos de inicio r\xE1pido",
29
+ "dev.step3": "3. Pruebe el seguimiento del progreso completando pasos",
30
+ "dev.step4": "4. El caj\xF3n puede cerrarse usando el bot\xF3n de cerrar o los controles propios del caj\xF3n",
31
+ "dev.step5": "5. El progreso se guarda autom\xE1ticamente en localStorage"
32
+ }
33
+ });
34
+
35
+ export { quickstartTranslationEs as default };
36
+ //# sourceMappingURL=es.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es.esm.js","sources":["../../src/translations/es.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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\nimport { quickstartTranslationRef } from './ref';\n\nconst quickstartTranslationEs = createTranslationMessages({\n ref: quickstartTranslationRef,\n messages: {\n 'header.title': 'Comencemos con el Hub del Desarrollador',\n 'header.subtitle': 'Te guiaremos a través de algunos pasos rápidos',\n 'button.quickstart': 'Inicio rápido',\n 'footer.progress': '{{progress}}% de progreso',\n 'footer.notStarted': 'No iniciado',\n 'footer.hide': 'Ocultar',\n 'content.emptyState.title':\n 'El contenido de inicio rápido no está disponible para tu rol.',\n 'item.expandAriaLabel': 'Expandir detalles de {{title}}',\n 'item.collapseAriaLabel': 'Contraer detalles de {{title}}',\n 'item.expandButtonAriaLabel': 'Expandir elemento',\n 'item.collapseButtonAriaLabel': 'Contraer elemento',\n 'button.openQuickstartGuide': 'Abrir guía de inicio rápido',\n 'button.closeDrawer': 'Cerrar cajón',\n 'dev.pageTitle': 'Página de prueba del plugin Quickstart',\n 'dev.pageDescription':\n 'Esta es una página de prueba para el plugin Quickstart. Use los botones de abajo para interactuar con el cajón de inicio rápido.',\n 'dev.drawerControls': 'Controles del cajón',\n 'dev.currentState': 'Estado actual del cajón: {{state}}',\n 'dev.stateOpen': 'Abierto',\n 'dev.stateClosed': 'Cerrado',\n 'dev.instructions': 'Instrucciones',\n 'dev.step1':\n '1. Haga clic en \"Abrir guía de inicio rápido\" para abrir el cajón',\n 'dev.step2': '2. Navegue a través de los pasos de inicio rápido',\n 'dev.step3': '3. Pruebe el seguimiento del progreso completando pasos',\n 'dev.step4':\n '4. El cajón puede cerrarse usando el botón de cerrar o los controles propios del cajón',\n 'dev.step5': '5. El progreso se guarda automáticamente en localStorage',\n },\n});\n\nexport default quickstartTranslationEs;\n"],"names":[],"mappings":";;;AAmBA,MAAM,0BAA0B,yBAA0B,CAAA;AAAA,EACxD,GAAK,EAAA,wBAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,yCAAA;AAAA,IAChB,iBAAmB,EAAA,sDAAA;AAAA,IACnB,mBAAqB,EAAA,kBAAA;AAAA,IACrB,iBAAmB,EAAA,2BAAA;AAAA,IACnB,mBAAqB,EAAA,aAAA;AAAA,IACrB,aAAe,EAAA,SAAA;AAAA,IACf,0BACE,EAAA,qEAAA;AAAA,IACF,sBAAwB,EAAA,gCAAA;AAAA,IACxB,wBAA0B,EAAA,gCAAA;AAAA,IAC1B,4BAA8B,EAAA,mBAAA;AAAA,IAC9B,8BAAgC,EAAA,mBAAA;AAAA,IAChC,4BAA8B,EAAA,mCAAA;AAAA,IAC9B,oBAAsB,EAAA,iBAAA;AAAA,IACtB,eAAiB,EAAA,2CAAA;AAAA,IACjB,qBACE,EAAA,2IAAA;AAAA,IACF,oBAAsB,EAAA,wBAAA;AAAA,IACtB,kBAAoB,EAAA,uCAAA;AAAA,IACpB,eAAiB,EAAA,SAAA;AAAA,IACjB,iBAAmB,EAAA,SAAA;AAAA,IACnB,kBAAoB,EAAA,eAAA;AAAA,IACpB,WACE,EAAA,4EAAA;AAAA,IACF,WAAa,EAAA,yDAAA;AAAA,IACb,WAAa,EAAA,yDAAA;AAAA,IACb,WACE,EAAA,iGAAA;AAAA,IACF,WAAa,EAAA;AAAA;AAEjB,CAAC;;;;"}
@@ -0,0 +1,36 @@
1
+ import { createTranslationMessages } from '@backstage/core-plugin-api/alpha';
2
+ import { quickstartTranslationRef } from './ref.esm.js';
3
+
4
+ const quickstartTranslationFr = createTranslationMessages({
5
+ ref: quickstartTranslationRef,
6
+ messages: {
7
+ "header.title": "Commen\xE7ons avec le Hub D\xE9veloppeur",
8
+ "header.subtitle": "Nous vous guiderons \xE0 travers quelques \xE9tapes rapides",
9
+ "button.quickstart": "D\xE9marrage rapide",
10
+ "footer.progress": "{{progress}}% de progression",
11
+ "footer.notStarted": "Pas encore commenc\xE9",
12
+ "footer.hide": "Masquer",
13
+ "content.emptyState.title": "Le contenu de d\xE9marrage rapide n'est pas disponible pour votre r\xF4le.",
14
+ "item.expandAriaLabel": "D\xE9velopper les d\xE9tails de {{title}}",
15
+ "item.collapseAriaLabel": "R\xE9duire les d\xE9tails de {{title}}",
16
+ "item.expandButtonAriaLabel": "D\xE9velopper l'\xE9l\xE9ment",
17
+ "item.collapseButtonAriaLabel": "R\xE9duire l'\xE9l\xE9ment",
18
+ "button.openQuickstartGuide": "Ouvrir le guide de d\xE9marrage rapide",
19
+ "button.closeDrawer": "Fermer le tiroir",
20
+ "dev.pageTitle": "Page de test du plugin Quickstart",
21
+ "dev.pageDescription": "Ceci est une page de test pour le plugin Quickstart. Utilisez les boutons ci-dessous pour interagir avec le tiroir de d\xE9marrage rapide.",
22
+ "dev.drawerControls": "Contr\xF4les du tiroir",
23
+ "dev.currentState": "\xC9tat actuel du tiroir : {{state}}",
24
+ "dev.stateOpen": "Ouvert",
25
+ "dev.stateClosed": "Ferm\xE9",
26
+ "dev.instructions": "Instructions",
27
+ "dev.step1": '1. Cliquez sur "Ouvrir le guide de d\xE9marrage rapide" pour ouvrir le tiroir',
28
+ "dev.step2": "2. Naviguez \xE0 travers les \xE9tapes de d\xE9marrage rapide",
29
+ "dev.step3": "3. Testez le suivi de progression en compl\xE9tant les \xE9tapes",
30
+ "dev.step4": "4. Le tiroir peut \xEAtre ferm\xE9 en utilisant le bouton de fermeture ou les contr\xF4les propres du tiroir",
31
+ "dev.step5": "5. La progression est automatiquement sauvegard\xE9e dans localStorage"
32
+ }
33
+ });
34
+
35
+ export { quickstartTranslationFr as default };
36
+ //# sourceMappingURL=fr.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fr.esm.js","sources":["../../src/translations/fr.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 { createTranslationMessages } from '@backstage/core-plugin-api/alpha';\nimport { quickstartTranslationRef } from './ref';\n\nconst quickstartTranslationFr = createTranslationMessages({\n ref: quickstartTranslationRef,\n messages: {\n 'header.title': 'Commençons avec le Hub Développeur',\n 'header.subtitle': 'Nous vous guiderons à travers quelques étapes rapides',\n 'button.quickstart': 'Démarrage rapide',\n 'footer.progress': '{{progress}}% de progression',\n 'footer.notStarted': 'Pas encore commencé',\n 'footer.hide': 'Masquer',\n 'content.emptyState.title':\n \"Le contenu de démarrage rapide n'est pas disponible pour votre rôle.\",\n 'item.expandAriaLabel': 'Développer les détails de {{title}}',\n 'item.collapseAriaLabel': 'Réduire les détails de {{title}}',\n 'item.expandButtonAriaLabel': \"Développer l'élément\",\n 'item.collapseButtonAriaLabel': \"Réduire l'élément\",\n 'button.openQuickstartGuide': 'Ouvrir le guide de démarrage rapide',\n 'button.closeDrawer': 'Fermer le tiroir',\n 'dev.pageTitle': 'Page de test du plugin Quickstart',\n 'dev.pageDescription':\n 'Ceci est une page de test pour le plugin Quickstart. Utilisez les boutons ci-dessous pour interagir avec le tiroir de démarrage rapide.',\n 'dev.drawerControls': 'Contrôles du tiroir',\n 'dev.currentState': 'État actuel du tiroir : {{state}}',\n 'dev.stateOpen': 'Ouvert',\n 'dev.stateClosed': 'Fermé',\n 'dev.instructions': 'Instructions',\n 'dev.step1':\n '1. Cliquez sur \"Ouvrir le guide de démarrage rapide\" pour ouvrir le tiroir',\n 'dev.step2': '2. Naviguez à travers les étapes de démarrage rapide',\n 'dev.step3': '3. Testez le suivi de progression en complétant les étapes',\n 'dev.step4':\n '4. Le tiroir peut être fermé en utilisant le bouton de fermeture ou les contrôles propres du tiroir',\n 'dev.step5':\n '5. La progression est automatiquement sauvegardée dans localStorage',\n },\n});\n\nexport default quickstartTranslationFr;\n"],"names":[],"mappings":";;;AAmBA,MAAM,0BAA0B,yBAA0B,CAAA;AAAA,EACxD,GAAK,EAAA,wBAAA;AAAA,EACL,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,0CAAA;AAAA,IAChB,iBAAmB,EAAA,6DAAA;AAAA,IACnB,mBAAqB,EAAA,qBAAA;AAAA,IACrB,iBAAmB,EAAA,8BAAA;AAAA,IACnB,mBAAqB,EAAA,wBAAA;AAAA,IACrB,aAAe,EAAA,SAAA;AAAA,IACf,0BACE,EAAA,4EAAA;AAAA,IACF,sBAAwB,EAAA,2CAAA;AAAA,IACxB,wBAA0B,EAAA,wCAAA;AAAA,IAC1B,4BAA8B,EAAA,+BAAA;AAAA,IAC9B,8BAAgC,EAAA,4BAAA;AAAA,IAChC,4BAA8B,EAAA,wCAAA;AAAA,IAC9B,oBAAsB,EAAA,kBAAA;AAAA,IACtB,eAAiB,EAAA,mCAAA;AAAA,IACjB,qBACE,EAAA,4IAAA;AAAA,IACF,oBAAsB,EAAA,wBAAA;AAAA,IACtB,kBAAoB,EAAA,sCAAA;AAAA,IACpB,eAAiB,EAAA,QAAA;AAAA,IACjB,iBAAmB,EAAA,UAAA;AAAA,IACnB,kBAAoB,EAAA,cAAA;AAAA,IACpB,WACE,EAAA,+EAAA;AAAA,IACF,WAAa,EAAA,+DAAA;AAAA,IACb,WAAa,EAAA,kEAAA;AAAA,IACb,WACE,EAAA,8GAAA;AAAA,IACF,WACE,EAAA;AAAA;AAEN,CAAC;;;;"}
@@ -0,0 +1,14 @@
1
+ import { createTranslationResource } from '@backstage/core-plugin-api/alpha';
2
+ import { quickstartTranslationRef } from './ref.esm.js';
3
+
4
+ const quickstartTranslations = createTranslationResource({
5
+ ref: quickstartTranslationRef,
6
+ translations: {
7
+ de: () => import('./de.esm.js'),
8
+ fr: () => import('./fr.esm.js'),
9
+ es: () => import('./es.esm.js')
10
+ }
11
+ });
12
+
13
+ export { quickstartTranslationRef, quickstartTranslations };
14
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/translations/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 { createTranslationResource } from '@backstage/core-plugin-api/alpha';\nimport { quickstartTranslationRef } from './ref';\n\n/**\n * Translation Resource for Quickstart\n * @public\n */\nexport const quickstartTranslations = createTranslationResource({\n ref: quickstartTranslationRef,\n translations: {\n de: () => import('./de'),\n fr: () => import('./fr'),\n es: () => import('./es'),\n },\n});\n\nexport { quickstartTranslationRef };\n"],"names":[],"mappings":";;;AAuBO,MAAM,yBAAyB,yBAA0B,CAAA;AAAA,EAC9D,GAAK,EAAA,wBAAA;AAAA,EACL,YAAc,EAAA;AAAA,IACZ,EAAA,EAAI,MAAM,OAAO,aAAM,CAAA;AAAA,IACvB,EAAA,EAAI,MAAM,OAAO,aAAM,CAAA;AAAA,IACvB,EAAA,EAAI,MAAM,OAAO,aAAM;AAAA;AAE3B,CAAC;;;;"}
@@ -0,0 +1,50 @@
1
+ import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
2
+
3
+ const quickstartMessages = {
4
+ header: {
5
+ title: "Let's get you started with Developer Hub",
6
+ subtitle: "We'll guide you through a few quick steps"
7
+ },
8
+ button: {
9
+ quickstart: "Quick start",
10
+ openQuickstartGuide: "Open Quickstart Guide",
11
+ closeDrawer: "Close Drawer"
12
+ },
13
+ footer: {
14
+ progress: "{{progress}}% progress",
15
+ notStarted: "Not started",
16
+ hide: "Hide"
17
+ },
18
+ content: {
19
+ emptyState: {
20
+ title: "Quickstart content not available for your role."
21
+ }
22
+ },
23
+ item: {
24
+ expandAriaLabel: "Expand {{title}} details",
25
+ collapseAriaLabel: "Collapse {{title}} details",
26
+ expandButtonAriaLabel: "Expand item",
27
+ collapseButtonAriaLabel: "Collapse item"
28
+ },
29
+ dev: {
30
+ pageTitle: "Quickstart Plugin Test Page",
31
+ pageDescription: "This is a test page for the Quickstart plugin. Use the buttons below to interact with the quickstart drawer.",
32
+ drawerControls: "Drawer Controls",
33
+ currentState: "Current drawer state: {{state}}",
34
+ stateOpen: "Open",
35
+ stateClosed: "Closed",
36
+ instructions: "Instructions",
37
+ step1: '1. Click "Open Quickstart Guide" to open the drawer',
38
+ step2: "2. Navigate through the quickstart steps",
39
+ step3: "3. Test the progress tracking by completing steps",
40
+ step4: "4. The drawer can be closed using the close button or the drawer's own controls",
41
+ step5: "5. Progress is automatically saved to localStorage"
42
+ }
43
+ };
44
+ const quickstartTranslationRef = createTranslationRef({
45
+ id: "plugin.quickstart",
46
+ messages: quickstartMessages
47
+ });
48
+
49
+ export { quickstartMessages, quickstartTranslationRef };
50
+ //# sourceMappingURL=ref.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref.esm.js","sources":["../../src/translations/ref.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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/**\n * Messages object containing all English translations.\n * This is our single source of truth for translations.\n * @public\n */\nexport const quickstartMessages = {\n header: {\n title: \"Let's get you started with Developer Hub\",\n subtitle: \"We'll guide you through a few quick steps\",\n },\n button: {\n quickstart: 'Quick start',\n openQuickstartGuide: 'Open Quickstart Guide',\n closeDrawer: 'Close Drawer',\n },\n footer: {\n progress: '{{progress}}% progress',\n notStarted: 'Not started',\n hide: 'Hide',\n },\n content: {\n emptyState: {\n title: 'Quickstart content not available for your role.',\n },\n },\n item: {\n expandAriaLabel: 'Expand {{title}} details',\n collapseAriaLabel: 'Collapse {{title}} details',\n expandButtonAriaLabel: 'Expand item',\n collapseButtonAriaLabel: 'Collapse item',\n },\n dev: {\n pageTitle: 'Quickstart Plugin Test Page',\n pageDescription:\n 'This is a test page for the Quickstart plugin. Use the buttons below to interact with the quickstart drawer.',\n drawerControls: 'Drawer Controls',\n currentState: 'Current drawer state: {{state}}',\n stateOpen: 'Open',\n stateClosed: 'Closed',\n instructions: 'Instructions',\n step1: '1. Click \"Open Quickstart Guide\" to open the drawer',\n step2: '2. Navigate through the quickstart steps',\n step3: '3. Test the progress tracking by completing steps',\n step4:\n \"4. The drawer can be closed using the close button or the drawer's own controls\",\n step5: '5. Progress is automatically saved to localStorage',\n },\n};\n\n/**\n * Translation reference for Quickstart plugin\n * @public\n */\nexport const quickstartTranslationRef = createTranslationRef({\n id: 'plugin.quickstart',\n messages: quickstartMessages,\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,kBAAqB,GAAA;AAAA,EAChC,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,0CAAA;AAAA,IACP,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,UAAY,EAAA,aAAA;AAAA,IACZ,mBAAqB,EAAA,uBAAA;AAAA,IACrB,WAAa,EAAA;AAAA,GACf;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA,wBAAA;AAAA,IACV,UAAY,EAAA,aAAA;AAAA,IACZ,IAAM,EAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,UAAY,EAAA;AAAA,MACV,KAAO,EAAA;AAAA;AACT,GACF;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA,0BAAA;AAAA,IACjB,iBAAmB,EAAA,4BAAA;AAAA,IACnB,qBAAuB,EAAA,aAAA;AAAA,IACvB,uBAAyB,EAAA;AAAA,GAC3B;AAAA,EACA,GAAK,EAAA;AAAA,IACH,SAAW,EAAA,6BAAA;AAAA,IACX,eACE,EAAA,8GAAA;AAAA,IACF,cAAgB,EAAA,iBAAA;AAAA,IAChB,YAAc,EAAA,iCAAA;AAAA,IACd,SAAW,EAAA,MAAA;AAAA,IACX,WAAa,EAAA,QAAA;AAAA,IACb,YAAc,EAAA,cAAA;AAAA,IACd,KAAO,EAAA,qDAAA;AAAA,IACP,KAAO,EAAA,0CAAA;AAAA,IACP,KAAO,EAAA,mDAAA;AAAA,IACP,KACE,EAAA,iFAAA;AAAA,IACF,KAAO,EAAA;AAAA;AAEX;AAMO,MAAM,2BAA2B,oBAAqB,CAAA;AAAA,EAC3D,EAAI,EAAA,mBAAA;AAAA,EACJ,QAAU,EAAA;AACZ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-quickstart",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,13 +32,15 @@
32
32
  "postpack": "backstage-cli package postpack"
33
33
  },
34
34
  "dependencies": {
35
+ "@backstage-community/plugin-rbac-common": "^1.19.0",
35
36
  "@backstage/core-components": "^0.17.4",
36
37
  "@backstage/core-plugin-api": "^1.10.9",
38
+ "@backstage/plugin-permission-react": "^0.4.36",
37
39
  "@backstage/theme": "^0.6.7",
38
40
  "@mui/icons-material": "5.18.0",
39
41
  "@mui/material": "5.18.0",
40
42
  "@red-hat-developer-hub/backstage-plugin-theme": "^0.9.0",
41
- "react-use": "^17.2.4"
43
+ "react-use": "^17.6.0"
42
44
  },
43
45
  "peerDependencies": {
44
46
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
@@ -47,6 +49,7 @@
47
49
  "@backstage/cli": "^0.33.1",
48
50
  "@backstage/core-app-api": "^1.18.0",
49
51
  "@backstage/dev-utils": "^1.1.12",
52
+ "@backstage/plugin-permission-common": "^0.9.1",
50
53
  "@backstage/test-utils": "^1.7.10",
51
54
  "@testing-library/jest-dom": "^6.0.0",
52
55
  "@testing-library/react": "^14.0.0",
@@ -1,27 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}