@red-hat-developer-hub/backstage-plugin-adoption-insights 0.0.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/components/ActiveUsers/ActiveUsers.esm.js +106 -89
- package/dist/components/ActiveUsers/ActiveUsers.esm.js.map +1 -1
- package/dist/components/ActiveUsers/CustomLegend.esm.js +40 -35
- package/dist/components/ActiveUsers/CustomLegend.esm.js.map +1 -1
- package/dist/components/ActiveUsers/CustomTooltip.esm.js +68 -57
- package/dist/components/ActiveUsers/CustomTooltip.esm.js.map +1 -1
- package/dist/components/ActiveUsers/ExportCSVButton.esm.js +26 -25
- package/dist/components/ActiveUsers/ExportCSVButton.esm.js.map +1 -1
- package/dist/components/AdoptionInsightsPage/AdoptionInsightsPage.esm.js +13 -2
- package/dist/components/AdoptionInsightsPage/AdoptionInsightsPage.esm.js.map +1 -1
- package/dist/components/CardFooter/TableFooterPagination.esm.js +42 -42
- package/dist/components/CardFooter/TableFooterPagination.esm.js.map +1 -1
- package/dist/components/CardWrapper/CardWrapper.esm.js +29 -24
- package/dist/components/CardWrapper/CardWrapper.esm.js.map +1 -1
- package/dist/components/CatalogEntities/CatalogEntities.esm.js +96 -92
- package/dist/components/CatalogEntities/CatalogEntities.esm.js.map +1 -1
- package/dist/components/CatalogEntities/FilterDropdown.esm.js +22 -17
- package/dist/components/CatalogEntities/FilterDropdown.esm.js.map +1 -1
- package/dist/components/Common/CustomCursor.esm.js +2 -2
- package/dist/components/Common/CustomCursor.esm.js.map +1 -1
- package/dist/components/Common/EmptyChartState.esm.js +2 -2
- package/dist/components/Common/EmptyChartState.esm.js.map +1 -1
- package/dist/components/Common/PermissionRequiredIcon.esm.js +2 -2
- package/dist/components/Common/PermissionRequiredIcon.esm.js.map +1 -1
- package/dist/components/Common/PermissionRequiredState.esm.js +29 -23
- package/dist/components/Common/PermissionRequiredState.esm.js.map +1 -1
- package/dist/components/Header/DateRangeContext.esm.js +7 -6
- package/dist/components/Header/DateRangeContext.esm.js.map +1 -1
- package/dist/components/Header/DateRangePicker.esm.js +67 -59
- package/dist/components/Header/DateRangePicker.esm.js.map +1 -1
- package/dist/components/Header/Header.esm.js +116 -106
- package/dist/components/Header/Header.esm.js.map +1 -1
- package/dist/components/Plugins/Plugins.esm.js +74 -64
- package/dist/components/Plugins/Plugins.esm.js.map +1 -1
- package/dist/components/Searches/CustomTooltip.esm.js +41 -36
- package/dist/components/Searches/CustomTooltip.esm.js.map +1 -1
- package/dist/components/Searches/Searches.esm.js +85 -74
- package/dist/components/Searches/Searches.esm.js.map +1 -1
- package/dist/components/Techdocs/Techdocs.esm.js +85 -81
- package/dist/components/Techdocs/Techdocs.esm.js.map +1 -1
- package/dist/components/Templates/Templates.esm.js +74 -70
- package/dist/components/Templates/Templates.esm.js.map +1 -1
- package/dist/components/Users/Info.esm.js +12 -12
- package/dist/components/Users/Info.esm.js.map +1 -1
- package/dist/components/Users/Tooltip.esm.js +27 -23
- package/dist/components/Users/Tooltip.esm.js.map +1 -1
- package/dist/components/Users/Users.esm.js +119 -95
- package/dist/components/Users/Users.esm.js.map +1 -1
- package/dist/hooks/useActiveUsers.esm.js +5 -5
- package/dist/hooks/useActiveUsers.esm.js.map +1 -1
- package/dist/hooks/useCatalogEntities.esm.js +5 -5
- package/dist/hooks/useCatalogEntities.esm.js.map +1 -1
- package/dist/hooks/usePlugins.esm.js +5 -5
- package/dist/hooks/usePlugins.esm.js.map +1 -1
- package/dist/hooks/useSearches.esm.js +5 -5
- package/dist/hooks/useSearches.esm.js.map +1 -1
- package/dist/hooks/useTechdocs.esm.js +5 -5
- package/dist/hooks/useTechdocs.esm.js.map +1 -1
- package/dist/hooks/useTemplates.esm.js +5 -5
- package/dist/hooks/useTemplates.esm.js.map +1 -1
- package/dist/hooks/useUsers.esm.js +5 -5
- package/dist/hooks/useUsers.esm.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# @red-hat-developer-hub/backstage-plugin-adoption-insights
|
2
2
|
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 3a80c30: Backstage version bump to v1.39.1
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- 3f93232: Updated dependency `@mui/icons-material` to `5.17.1`.
|
12
|
+
Updated dependency `@mui/material` to `5.17.1`.
|
13
|
+
Updated dependency `@red-hat-developer-hub/backstage-plugin-theme` to `^0.8.0`.
|
14
|
+
- Updated dependencies [3a80c30]
|
15
|
+
- @red-hat-developer-hub/backstage-plugin-adoption-insights-common@0.3.0
|
16
|
+
|
17
|
+
## 0.1.0
|
18
|
+
|
19
|
+
### Minor Changes
|
20
|
+
|
21
|
+
- a66e0b0: Backstage version bump to v1.36.1
|
22
|
+
|
23
|
+
### Patch Changes
|
24
|
+
|
25
|
+
- Updated dependencies [a66e0b0]
|
26
|
+
- @red-hat-developer-hub/backstage-plugin-adoption-insights-common@0.2.0
|
27
|
+
|
3
28
|
## 0.0.4
|
4
29
|
|
5
30
|
### Patch Changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
2
2
|
import { ResponseErrorPanel } from '@backstage/core-components';
|
3
3
|
import Box from '@mui/material/Box';
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
@@ -20,109 +20,126 @@ const ActiveUsers = () => {
|
|
20
20
|
const { activeUsers, loading, error } = useActiveUsers();
|
21
21
|
const { data, grouping = "daily" } = activeUsers;
|
22
22
|
if (error) {
|
23
|
-
return /* @__PURE__ */
|
23
|
+
return /* @__PURE__ */ jsx(CardWrapper, { title: "Active users", children: /* @__PURE__ */ jsx(ResponseErrorPanel, { error }) });
|
24
24
|
}
|
25
25
|
if (!data || data?.length === 0 || !data?.[0] && !loading) {
|
26
|
-
return /* @__PURE__ */
|
26
|
+
return /* @__PURE__ */ jsx(CardWrapper, { title: "Active users", children: /* @__PURE__ */ jsx(
|
27
27
|
Box,
|
28
28
|
{
|
29
29
|
display: "flex",
|
30
30
|
justifyContent: "center",
|
31
31
|
alignItems: "center",
|
32
|
-
height: 200
|
33
|
-
|
34
|
-
|
35
|
-
));
|
32
|
+
height: 200,
|
33
|
+
children: /* @__PURE__ */ jsx(EmptyChartState, {})
|
34
|
+
}
|
35
|
+
) });
|
36
36
|
}
|
37
|
-
return /* @__PURE__ */
|
37
|
+
return /* @__PURE__ */ jsx(CardWrapper, { title: "Active users", filter: /* @__PURE__ */ jsx(ExportCSVButton, {}), children: loading ? /* @__PURE__ */ jsx(
|
38
38
|
Box,
|
39
39
|
{
|
40
40
|
display: "flex",
|
41
41
|
justifyContent: "center",
|
42
42
|
alignItems: "center",
|
43
|
-
height: 200
|
44
|
-
|
45
|
-
|
46
|
-
) : /* @__PURE__ */
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
},
|
54
|
-
/* @__PURE__ */
|
55
|
-
|
56
|
-
{
|
57
|
-
id: "returning_users",
|
58
|
-
x1: "0",
|
59
|
-
y1: "0",
|
60
|
-
x2: "0",
|
61
|
-
y2: "1"
|
62
|
-
},
|
63
|
-
/* @__PURE__ */ React__default.createElement("stop", { offset: "5%", stopColor: "#B8BBBE", stopOpacity: 0.8 }),
|
64
|
-
/* @__PURE__ */ React__default.createElement("stop", { offset: "95%", stopColor: "#B8BBBE", stopOpacity: 0.2 })
|
65
|
-
)),
|
66
|
-
/* @__PURE__ */ React__default.createElement(
|
67
|
-
CartesianGrid,
|
68
|
-
{
|
69
|
-
stroke: isDarkMode ? "#666" : "#E5E7EB",
|
70
|
-
strokeDasharray: 0,
|
71
|
-
vertical: false
|
72
|
-
}
|
73
|
-
),
|
74
|
-
/* @__PURE__ */ React__default.createElement(
|
75
|
-
XAxis,
|
76
|
-
{
|
77
|
-
dataKey: "date",
|
78
|
-
tickFormatter: (date) => getXAxisformat(date, grouping),
|
79
|
-
ticks: getXAxisTickValues(data, grouping),
|
80
|
-
tick: { fill: theme.palette.text.primary },
|
81
|
-
axisLine: false,
|
82
|
-
tickLine: false,
|
83
|
-
padding: { left: 30, right: 30 },
|
84
|
-
tickMargin: 10
|
85
|
-
}
|
86
|
-
),
|
87
|
-
/* @__PURE__ */ React__default.createElement(
|
88
|
-
YAxis,
|
89
|
-
{
|
90
|
-
tick: { fill: theme.palette.text.primary },
|
91
|
-
tickLine: false,
|
92
|
-
axisLine: false,
|
93
|
-
tickFormatter: (value) => value.toLocaleString(),
|
94
|
-
tickMargin: 20
|
95
|
-
}
|
96
|
-
),
|
97
|
-
/* @__PURE__ */ React__default.createElement(
|
98
|
-
Tooltip,
|
99
|
-
{
|
100
|
-
cursor: /* @__PURE__ */ React__default.createElement(CustomCursor, { cursorHeight: 250 }),
|
101
|
-
content: /* @__PURE__ */ React__default.createElement(CustomTooltip, { grouping })
|
102
|
-
}
|
103
|
-
),
|
104
|
-
/* @__PURE__ */ React__default.createElement(
|
105
|
-
Area,
|
106
|
-
{
|
107
|
-
type: "linear",
|
108
|
-
dataKey: "returning_users",
|
109
|
-
stroke: "#555",
|
110
|
-
fill: "url(#returning_users)",
|
111
|
-
strokeWidth: 1
|
112
|
-
}
|
113
|
-
),
|
114
|
-
/* @__PURE__ */ React__default.createElement(
|
115
|
-
Area,
|
43
|
+
height: 200,
|
44
|
+
children: /* @__PURE__ */ jsx(CircularProgress, {})
|
45
|
+
}
|
46
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
47
|
+
/* @__PURE__ */ jsxs(Typography, { style: { margin: "20px 36px" }, children: [
|
48
|
+
/* @__PURE__ */ jsx("b", { children: `${Math.round(
|
49
|
+
getAverage(data, "total_users")
|
50
|
+
).toLocaleString()} active users per ${grouping === "hourly" ? "hour" : "day"}` }),
|
51
|
+
" ",
|
52
|
+
"were conducted during this period."
|
53
|
+
] }),
|
54
|
+
/* @__PURE__ */ jsx(Box, { sx: { height: 310, mt: 4, mb: 4, ml: 0, mr: 0 }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(
|
55
|
+
AreaChart,
|
116
56
|
{
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
57
|
+
data,
|
58
|
+
margin: { top: 10, right: 50, left: 20, bottom: 0 },
|
59
|
+
children: [
|
60
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
61
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "new_users", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
62
|
+
/* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: "#1976d2", stopOpacity: 0.8 }),
|
63
|
+
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: "#1976d2", stopOpacity: 0.2 })
|
64
|
+
] }),
|
65
|
+
/* @__PURE__ */ jsxs(
|
66
|
+
"linearGradient",
|
67
|
+
{
|
68
|
+
id: "returning_users",
|
69
|
+
x1: "0",
|
70
|
+
y1: "0",
|
71
|
+
x2: "0",
|
72
|
+
y2: "1",
|
73
|
+
children: [
|
74
|
+
/* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: "#B8BBBE", stopOpacity: 0.8 }),
|
75
|
+
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: "#B8BBBE", stopOpacity: 0.2 })
|
76
|
+
]
|
77
|
+
}
|
78
|
+
)
|
79
|
+
] }),
|
80
|
+
/* @__PURE__ */ jsx(
|
81
|
+
CartesianGrid,
|
82
|
+
{
|
83
|
+
stroke: isDarkMode ? "#666" : "#E5E7EB",
|
84
|
+
strokeDasharray: 0,
|
85
|
+
vertical: false
|
86
|
+
}
|
87
|
+
),
|
88
|
+
/* @__PURE__ */ jsx(
|
89
|
+
XAxis,
|
90
|
+
{
|
91
|
+
dataKey: "date",
|
92
|
+
tickFormatter: (date) => getXAxisformat(date, grouping),
|
93
|
+
ticks: getXAxisTickValues(data, grouping),
|
94
|
+
tick: { fill: theme.palette.text.primary },
|
95
|
+
axisLine: false,
|
96
|
+
tickLine: false,
|
97
|
+
padding: { left: 30, right: 30 },
|
98
|
+
tickMargin: 10
|
99
|
+
}
|
100
|
+
),
|
101
|
+
/* @__PURE__ */ jsx(
|
102
|
+
YAxis,
|
103
|
+
{
|
104
|
+
tick: { fill: theme.palette.text.primary },
|
105
|
+
tickLine: false,
|
106
|
+
axisLine: false,
|
107
|
+
tickFormatter: (value) => value.toLocaleString(),
|
108
|
+
tickMargin: 20
|
109
|
+
}
|
110
|
+
),
|
111
|
+
/* @__PURE__ */ jsx(
|
112
|
+
Tooltip,
|
113
|
+
{
|
114
|
+
cursor: /* @__PURE__ */ jsx(CustomCursor, { cursorHeight: 250 }),
|
115
|
+
content: /* @__PURE__ */ jsx(CustomTooltip, { grouping })
|
116
|
+
}
|
117
|
+
),
|
118
|
+
/* @__PURE__ */ jsx(
|
119
|
+
Area,
|
120
|
+
{
|
121
|
+
type: "linear",
|
122
|
+
dataKey: "returning_users",
|
123
|
+
stroke: "#555",
|
124
|
+
fill: "url(#returning_users)",
|
125
|
+
strokeWidth: 1
|
126
|
+
}
|
127
|
+
),
|
128
|
+
/* @__PURE__ */ jsx(
|
129
|
+
Area,
|
130
|
+
{
|
131
|
+
type: "linear",
|
132
|
+
dataKey: "new_users",
|
133
|
+
stroke: "#1976d2",
|
134
|
+
fill: "url(#new_users)",
|
135
|
+
strokeWidth: 1
|
136
|
+
}
|
137
|
+
),
|
138
|
+
/* @__PURE__ */ jsx(Legend, { content: /* @__PURE__ */ jsx(CustomLegend, {}) })
|
139
|
+
]
|
122
140
|
}
|
123
|
-
)
|
124
|
-
|
125
|
-
)))));
|
141
|
+
) }) })
|
142
|
+
] }) });
|
126
143
|
};
|
127
144
|
|
128
145
|
export { ActiveUsers as default };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ActiveUsers.esm.js","sources":["../../../src/components/ActiveUsers/ActiveUsers.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport Box from '@mui/material/Box';\nimport { useTheme } from '@mui/material/styles';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport {\n AreaChart,\n CartesianGrid,\n ResponsiveContainer,\n XAxis,\n YAxis,\n Tooltip,\n Area,\n Legend,\n} from 'recharts';\n\nimport CardWrapper from '../CardWrapper';\nimport CustomTooltip from './CustomTooltip';\nimport CustomCursor from '../Common/CustomCursor';\nimport CustomLegend from './CustomLegend';\nimport {\n getAverage,\n getXAxisformat,\n getXAxisTickValues,\n} from '../../utils/utils';\nimport { useActiveUsers } from '../../hooks/useActiveUsers';\nimport { Typography } from '@material-ui/core';\nimport ExportCSVButton from './ExportCSVButton';\nimport EmptyChartState from '../Common/EmptyChartState';\n\nconst ActiveUsers = () => {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { activeUsers, loading, error } = useActiveUsers();\n const { data, grouping = 'daily' } = activeUsers;\n\n if (error) {\n return (\n <CardWrapper title=\"Active users\">\n <ResponseErrorPanel error={error} />\n </CardWrapper>\n );\n }\n\n if (!data || data?.length === 0 || (!data?.[0] && !loading)) {\n return (\n <CardWrapper title=\"Active users\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={200}\n >\n <EmptyChartState />\n </Box>\n </CardWrapper>\n );\n }\n\n return (\n <CardWrapper title=\"Active users\" filter={<ExportCSVButton />}>\n {loading ? (\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={200}\n >\n <CircularProgress />\n </Box>\n ) : (\n <>\n <Typography style={{ margin: '20px 36px' }}>\n <b>\n {`${Math.round(\n getAverage(data, 'total_users'),\n ).toLocaleString()} active users per ${\n grouping === 'hourly' ? 'hour' : 'day'\n }`}\n </b>{' '}\n were conducted during this period.\n </Typography>\n <Box sx={{ height: 310, mt: 4, mb: 4, ml: 0, mr: 0 }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart\n data={data}\n margin={{ top: 10, right: 50, left: 20, bottom: 0 }}\n >\n <defs>\n <linearGradient id=\"new_users\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"5%\" stopColor=\"#1976d2\" stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor=\"#1976d2\" stopOpacity={0.2} />\n </linearGradient>\n <linearGradient\n id=\"returning_users\"\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor=\"#B8BBBE\" stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor=\"#B8BBBE\" stopOpacity={0.2} />\n </linearGradient>\n </defs>\n\n <CartesianGrid\n stroke={isDarkMode ? '#666' : '#E5E7EB'}\n strokeDasharray={0}\n vertical={false}\n />\n\n <XAxis\n dataKey=\"date\"\n tickFormatter={date => getXAxisformat(date, grouping)}\n ticks={getXAxisTickValues(data, grouping)}\n tick={{ fill: theme.palette.text.primary }}\n axisLine={false}\n tickLine={false}\n padding={{ left: 30, right: 30 }}\n tickMargin={10}\n />\n <YAxis\n tick={{ fill: theme.palette.text.primary }}\n tickLine={false}\n axisLine={false}\n tickFormatter={value => value.toLocaleString()}\n tickMargin={20}\n />\n <Tooltip\n cursor={<CustomCursor cursorHeight={250} />}\n content={<CustomTooltip grouping={grouping} />}\n />\n <Area\n type=\"linear\"\n dataKey=\"returning_users\"\n stroke=\"#555\"\n fill=\"url(#returning_users)\"\n strokeWidth={1}\n />\n <Area\n type=\"linear\"\n dataKey=\"new_users\"\n stroke=\"#1976d2\"\n fill=\"url(#new_users)\"\n strokeWidth={1}\n />\n <Legend content={<CustomLegend />} />\n </AreaChart>\n </ResponsiveContainer>\n </Box>\n </>\n )}\n </CardWrapper>\n );\n};\n\nexport default ActiveUsers;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAM,cAAc,MAAM;AACxB,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA;AAE1C,EAAA,MAAM,EAAE,WAAA,EAAa,OAAS,EAAA,KAAA,KAAU,cAAe,EAAA;AACvD,EAAA,MAAM,EAAE,IAAA,EAAM,QAAW,GAAA,OAAA,EAAY,GAAA,WAAA;AAErC,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,oDACG,WAAY,EAAA,EAAA,KAAA,EAAM,kCAChBA,cAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAmB,OAAc,CACpC,CAAA;AAAA;AAIJ,EAAI,IAAA,CAAC,IAAQ,IAAA,IAAA,EAAM,MAAW,KAAA,CAAA,IAAM,CAAC,IAAO,GAAA,CAAC,CAAK,IAAA,CAAC,OAAU,EAAA;AAC3D,IACE,uBAAAA,cAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,KAAA,EAAM,cACjB,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,cAAe,EAAA,QAAA;AAAA,QACf,UAAW,EAAA,QAAA;AAAA,QACX,MAAQ,EAAA;AAAA,OAAA;AAAA,mDAEP,eAAgB,EAAA,IAAA;AAAA,KAErB,CAAA;AAAA;AAIJ,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAC,eAAY,KAAM,EAAA,cAAA,EAAe,wBAASA,cAAA,CAA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AAAA,KACf;AAAA,oBACCA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAS,kBAAAA,cAAA,CAAA,aAAA,CAAC,kBAAa,CAAI,EAAA;AAAA,GAEvC,CACF,CACF,CAEJ,CAAA;AAEJ;;;;"}
|
1
|
+
{"version":3,"file":"ActiveUsers.esm.js","sources":["../../../src/components/ActiveUsers/ActiveUsers.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ResponseErrorPanel } from '@backstage/core-components';\nimport Box from '@mui/material/Box';\nimport { useTheme } from '@mui/material/styles';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport {\n AreaChart,\n CartesianGrid,\n ResponsiveContainer,\n XAxis,\n YAxis,\n Tooltip,\n Area,\n Legend,\n} from 'recharts';\n\nimport CardWrapper from '../CardWrapper';\nimport CustomTooltip from './CustomTooltip';\nimport CustomCursor from '../Common/CustomCursor';\nimport CustomLegend from './CustomLegend';\nimport {\n getAverage,\n getXAxisformat,\n getXAxisTickValues,\n} from '../../utils/utils';\nimport { useActiveUsers } from '../../hooks/useActiveUsers';\nimport { Typography } from '@material-ui/core';\nimport ExportCSVButton from './ExportCSVButton';\nimport EmptyChartState from '../Common/EmptyChartState';\n\nconst ActiveUsers = () => {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const { activeUsers, loading, error } = useActiveUsers();\n const { data, grouping = 'daily' } = activeUsers;\n\n if (error) {\n return (\n <CardWrapper title=\"Active users\">\n <ResponseErrorPanel error={error} />\n </CardWrapper>\n );\n }\n\n if (!data || data?.length === 0 || (!data?.[0] && !loading)) {\n return (\n <CardWrapper title=\"Active users\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={200}\n >\n <EmptyChartState />\n </Box>\n </CardWrapper>\n );\n }\n\n return (\n <CardWrapper title=\"Active users\" filter={<ExportCSVButton />}>\n {loading ? (\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={200}\n >\n <CircularProgress />\n </Box>\n ) : (\n <>\n <Typography style={{ margin: '20px 36px' }}>\n <b>\n {`${Math.round(\n getAverage(data, 'total_users'),\n ).toLocaleString()} active users per ${\n grouping === 'hourly' ? 'hour' : 'day'\n }`}\n </b>{' '}\n were conducted during this period.\n </Typography>\n <Box sx={{ height: 310, mt: 4, mb: 4, ml: 0, mr: 0 }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart\n data={data}\n margin={{ top: 10, right: 50, left: 20, bottom: 0 }}\n >\n <defs>\n <linearGradient id=\"new_users\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"5%\" stopColor=\"#1976d2\" stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor=\"#1976d2\" stopOpacity={0.2} />\n </linearGradient>\n <linearGradient\n id=\"returning_users\"\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor=\"#B8BBBE\" stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor=\"#B8BBBE\" stopOpacity={0.2} />\n </linearGradient>\n </defs>\n\n <CartesianGrid\n stroke={isDarkMode ? '#666' : '#E5E7EB'}\n strokeDasharray={0}\n vertical={false}\n />\n\n <XAxis\n dataKey=\"date\"\n tickFormatter={date => getXAxisformat(date, grouping)}\n ticks={getXAxisTickValues(data, grouping)}\n tick={{ fill: theme.palette.text.primary }}\n axisLine={false}\n tickLine={false}\n padding={{ left: 30, right: 30 }}\n tickMargin={10}\n />\n <YAxis\n tick={{ fill: theme.palette.text.primary }}\n tickLine={false}\n axisLine={false}\n tickFormatter={value => value.toLocaleString()}\n tickMargin={20}\n />\n <Tooltip\n cursor={<CustomCursor cursorHeight={250} />}\n content={<CustomTooltip grouping={grouping} />}\n />\n <Area\n type=\"linear\"\n dataKey=\"returning_users\"\n stroke=\"#555\"\n fill=\"url(#returning_users)\"\n strokeWidth={1}\n />\n <Area\n type=\"linear\"\n dataKey=\"new_users\"\n stroke=\"#1976d2\"\n fill=\"url(#new_users)\"\n strokeWidth={1}\n />\n <Legend content={<CustomLegend />} />\n </AreaChart>\n </ResponsiveContainer>\n </Box>\n </>\n )}\n </CardWrapper>\n );\n};\n\nexport default ActiveUsers;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,cAAc,MAAM;AACxB,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,UAAA,GAAa,KAAM,CAAA,OAAA,CAAQ,IAAS,KAAA,MAAA;AAE1C,EAAA,MAAM,EAAE,WAAA,EAAa,OAAS,EAAA,KAAA,KAAU,cAAe,EAAA;AACvD,EAAA,MAAM,EAAE,IAAA,EAAM,QAAW,GAAA,OAAA,EAAY,GAAA,WAAA;AAErC,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,2BACG,WAAY,EAAA,EAAA,KAAA,EAAM,gBACjB,QAAC,kBAAA,GAAA,CAAA,kBAAA,EAAA,EAAmB,OAAc,CACpC,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,CAAC,IAAQ,IAAA,IAAA,EAAM,MAAW,KAAA,CAAA,IAAM,CAAC,IAAO,GAAA,CAAC,CAAK,IAAA,CAAC,OAAU,EAAA;AAC3D,IACE,uBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,KAAA,EAAM,cACjB,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,cAAe,EAAA,QAAA;AAAA,QACf,UAAW,EAAA,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EAAA,SAAA;AAAA,cACP,IAAK,EAAA,iBAAA;AAAA,cACL,WAAa,EAAA;AAAA;AAAA,WACf;AAAA,0BACC,GAAA,CAAA,MAAA,EAAA,EAAO,OAAS,kBAAA,GAAA,CAAC,gBAAa,CAAI,EAAA;AAAA;AAAA;AAAA,OAEvC,CACF,EAAA;AAAA,GAAA,EACF,CAEJ,EAAA,CAAA;AAEJ;;;;"}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
2
2
|
import Typography from '@mui/material/Typography';
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
4
4
|
|
5
5
|
const CustomLegend = (props) => {
|
6
6
|
const theme = useTheme();
|
7
7
|
const { payload } = props;
|
8
|
-
return /* @__PURE__ */
|
8
|
+
return /* @__PURE__ */ jsx(
|
9
9
|
"div",
|
10
10
|
{
|
11
11
|
style: {
|
@@ -14,43 +14,48 @@ const CustomLegend = (props) => {
|
|
14
14
|
alignItems: "center",
|
15
15
|
marginLeft: 50,
|
16
16
|
paddingTop: 10
|
17
|
-
}
|
18
|
-
},
|
19
|
-
payload.map((entry) => /* @__PURE__ */ React__default.createElement(
|
20
|
-
"div",
|
21
|
-
{
|
22
|
-
key: entry.value,
|
23
|
-
style: { display: "flex", alignItems: "center", gap: 4 }
|
24
17
|
},
|
25
|
-
|
18
|
+
children: payload.map((entry) => /* @__PURE__ */ jsxs(
|
26
19
|
"div",
|
27
20
|
{
|
28
|
-
style: {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
21
|
+
style: { display: "flex", alignItems: "center", gap: 4 },
|
22
|
+
children: [
|
23
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
24
|
+
/* @__PURE__ */ jsx(
|
25
|
+
"div",
|
26
|
+
{
|
27
|
+
style: {
|
28
|
+
width: 20,
|
29
|
+
height: 3,
|
30
|
+
backgroundColor: entry.color
|
31
|
+
}
|
32
|
+
}
|
33
|
+
),
|
34
|
+
/* @__PURE__ */ jsx(
|
35
|
+
"div",
|
36
|
+
{
|
37
|
+
style: {
|
38
|
+
width: 20,
|
39
|
+
height: 4,
|
40
|
+
backgroundColor: entry.color,
|
41
|
+
opacity: "0.4"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
)
|
45
|
+
] }),
|
46
|
+
/* @__PURE__ */ jsx(
|
47
|
+
Typography,
|
48
|
+
{
|
49
|
+
variant: "body2",
|
50
|
+
style: { color: theme.palette.text.primary, fontSize: "0.875rem" },
|
51
|
+
children: entry.value === "new_users" ? "New users" : "Returning users"
|
52
|
+
}
|
53
|
+
)
|
54
|
+
]
|
50
55
|
},
|
51
|
-
entry.value
|
52
|
-
)
|
53
|
-
|
56
|
+
entry.value
|
57
|
+
))
|
58
|
+
}
|
54
59
|
);
|
55
60
|
};
|
56
61
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CustomLegend.esm.js","sources":["../../../src/components/ActiveUsers/CustomLegend.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
1
|
+
{"version":3,"file":"CustomLegend.esm.js","sources":["../../../src/components/ActiveUsers/CustomLegend.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\n\nconst CustomLegend = (props: any) => {\n const theme = useTheme();\n const { payload } = props;\n\n return (\n <div\n style={{\n display: 'flex',\n gap: 16,\n alignItems: 'center',\n marginLeft: 50,\n paddingTop: 10,\n }}\n >\n {payload.map((entry: any) => (\n <div\n key={entry.value}\n style={{ display: 'flex', alignItems: 'center', gap: 4 }}\n >\n <div>\n <div\n style={{\n width: 20,\n height: 3,\n backgroundColor: entry.color,\n }}\n />\n <div\n style={{\n width: 20,\n height: 4,\n backgroundColor: entry.color,\n opacity: '0.4',\n }}\n />\n </div>\n <Typography\n variant=\"body2\"\n style={{ color: theme.palette.text.primary, fontSize: '0.875rem' }}\n >\n {entry.value === 'new_users' ? 'New users' : 'Returning users'}\n </Typography>\n </div>\n ))}\n </div>\n );\n};\n\nexport default CustomLegend;\n"],"names":[],"mappings":";;;;AAkBM,MAAA,YAAA,GAAe,CAAC,KAAe,KAAA;AACnC,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAM,MAAA,EAAE,SAAY,GAAA,KAAA;AAEpB,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA;AAAA,QACL,OAAS,EAAA,MAAA;AAAA,QACT,GAAK,EAAA,EAAA;AAAA,QACL,UAAY,EAAA,QAAA;AAAA,QACZ,UAAY,EAAA,EAAA;AAAA,QACZ,UAAY,EAAA;AAAA,OACd;AAAA,MAEC,QAAA,EAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,KACZ,qBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UAEC,OAAO,EAAE,OAAA,EAAS,QAAQ,UAAY,EAAA,QAAA,EAAU,KAAK,CAAE,EAAA;AAAA,UAEvD,QAAA,EAAA;AAAA,4BAAA,IAAA,CAAC,KACC,EAAA,EAAA,QAAA,EAAA;AAAA,8BAAA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,KAAO,EAAA;AAAA,oBACL,KAAO,EAAA,EAAA;AAAA,oBACP,MAAQ,EAAA,CAAA;AAAA,oBACR,iBAAiB,KAAM,CAAA;AAAA;AACzB;AAAA,eACF;AAAA,8BACA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,KAAO,EAAA;AAAA,oBACL,KAAO,EAAA,EAAA;AAAA,oBACP,MAAQ,EAAA,CAAA;AAAA,oBACR,iBAAiB,KAAM,CAAA,KAAA;AAAA,oBACvB,OAAS,EAAA;AAAA;AACX;AAAA;AACF,aACF,EAAA,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,UAAA;AAAA,cAAA;AAAA,gBACC,OAAQ,EAAA,OAAA;AAAA,gBACR,KAAA,EAAO,EAAE,KAAO,EAAA,KAAA,CAAM,QAAQ,IAAK,CAAA,OAAA,EAAS,UAAU,UAAW,EAAA;AAAA,gBAEhE,QAAA,EAAA,KAAA,CAAM,KAAU,KAAA,WAAA,GAAc,WAAc,GAAA;AAAA;AAAA;AAC/C;AAAA,SAAA;AAAA,QAzBK,KAAM,CAAA;AAAA,OA2Bd;AAAA;AAAA,GACH;AAEJ;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
2
2
|
import Paper from '@mui/material/Paper';
|
3
3
|
import Typography from '@mui/material/Typography';
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
@@ -14,7 +14,7 @@ const CustomTooltip = ({
|
|
14
14
|
const theme = useTheme();
|
15
15
|
if (active && payload?.length) {
|
16
16
|
const date = label ? new Date(label) : /* @__PURE__ */ new Date();
|
17
|
-
return /* @__PURE__ */
|
17
|
+
return /* @__PURE__ */ jsxs(
|
18
18
|
Paper,
|
19
19
|
{
|
20
20
|
elevation: 1,
|
@@ -22,62 +22,73 @@ const CustomTooltip = ({
|
|
22
22
|
padding: "12px 16px",
|
23
23
|
boxShadow: 4,
|
24
24
|
borderRadius: 2
|
25
|
-
}
|
26
|
-
},
|
27
|
-
/* @__PURE__ */ React__default.createElement(
|
28
|
-
Typography,
|
29
|
-
{
|
30
|
-
sx: {
|
31
|
-
fontSize: "0.875rem",
|
32
|
-
fontWeight: 500,
|
33
|
-
marginBottom: "12px"
|
34
|
-
}
|
35
25
|
},
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
26
|
+
children: [
|
27
|
+
/* @__PURE__ */ jsx(
|
28
|
+
Typography,
|
29
|
+
{
|
30
|
+
sx: {
|
31
|
+
fontSize: "0.875rem",
|
32
|
+
fontWeight: 500,
|
33
|
+
marginBottom: "12px"
|
34
|
+
},
|
35
|
+
children: grouping === "hourly" ? format(date, "MMMM dd, yyyy hh:mm a") : format(date, "MMMM, dd yyyy")
|
36
|
+
}
|
37
|
+
),
|
38
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [
|
39
|
+
/* @__PURE__ */ jsxs(Box, { mr: 3, children: [
|
40
|
+
/* @__PURE__ */ jsx(
|
41
|
+
Typography,
|
42
|
+
{
|
43
|
+
sx: {
|
44
|
+
fontSize: "0.875rem",
|
45
|
+
fontWeight: 500,
|
46
|
+
color: theme.palette.text.secondary
|
47
|
+
},
|
48
|
+
children: "Returning users"
|
49
|
+
}
|
50
|
+
),
|
51
|
+
/* @__PURE__ */ jsx(
|
52
|
+
Typography,
|
53
|
+
{
|
54
|
+
sx: {
|
55
|
+
fontSize: "2.5rem",
|
56
|
+
fontWeight: 500,
|
57
|
+
color: "#009596",
|
58
|
+
lineHeight: 1.2
|
59
|
+
},
|
60
|
+
children: payload[0]?.value
|
61
|
+
}
|
62
|
+
)
|
63
|
+
] }),
|
64
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
65
|
+
/* @__PURE__ */ jsx(
|
66
|
+
Typography,
|
67
|
+
{
|
68
|
+
sx: {
|
69
|
+
fontSize: "0.875rem",
|
70
|
+
fontWeight: 500,
|
71
|
+
color: theme.palette.text.secondary
|
72
|
+
},
|
73
|
+
children: "New users"
|
74
|
+
}
|
75
|
+
),
|
76
|
+
/* @__PURE__ */ jsx(
|
77
|
+
Typography,
|
78
|
+
{
|
79
|
+
sx: {
|
80
|
+
fontSize: "2.5rem",
|
81
|
+
fontWeight: 500,
|
82
|
+
color: "#009596",
|
83
|
+
lineHeight: 1.2
|
84
|
+
},
|
85
|
+
children: payload[1]?.value
|
86
|
+
}
|
87
|
+
)
|
88
|
+
] })
|
89
|
+
] })
|
90
|
+
]
|
91
|
+
}
|
81
92
|
);
|
82
93
|
}
|
83
94
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CustomTooltip.esm.js","sources":["../../../src/components/ActiveUsers/CustomTooltip.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
1
|
+
{"version":3,"file":"CustomTooltip.esm.js","sources":["../../../src/components/ActiveUsers/CustomTooltip.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Paper from '@mui/material/Paper';\nimport Typography from '@mui/material/Typography';\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport { format } from 'date-fns';\n\nconst CustomTooltip = ({\n active,\n payload,\n label,\n grouping,\n}: {\n active?: boolean;\n payload?: any[];\n label?: string;\n grouping?: string;\n}) => {\n const theme = useTheme();\n\n if (active && payload?.length) {\n const date = label ? new Date(label) : new Date();\n return (\n <Paper\n elevation={1}\n sx={{\n padding: '12px 16px',\n boxShadow: 4,\n borderRadius: 2,\n }}\n >\n <Typography\n sx={{\n fontSize: '0.875rem',\n fontWeight: 500,\n marginBottom: '12px',\n }}\n >\n {grouping === 'hourly'\n ? format(date, 'MMMM dd, yyyy hh:mm a')\n : format(date, 'MMMM, dd yyyy')}\n </Typography>\n\n <Box display=\"flex\" justifyContent=\"space-between\" alignItems=\"center\">\n <Box mr={3}>\n <Typography\n sx={{\n fontSize: '0.875rem',\n fontWeight: 500,\n color: theme.palette.text.secondary,\n }}\n >\n Returning users\n </Typography>\n <Typography\n sx={{\n fontSize: '2.5rem',\n fontWeight: 500,\n color: '#009596',\n lineHeight: 1.2,\n }}\n >\n {payload[0]?.value}\n </Typography>\n </Box>\n\n <Box>\n <Typography\n sx={{\n fontSize: '0.875rem',\n fontWeight: 500,\n color: theme.palette.text.secondary,\n }}\n >\n New users\n </Typography>\n <Typography\n sx={{\n fontSize: '2.5rem',\n fontWeight: 500,\n color: '#009596',\n lineHeight: 1.2,\n }}\n >\n {payload[1]?.value}\n </Typography>\n </Box>\n </Box>\n </Paper>\n );\n }\n return null;\n};\n\nexport default CustomTooltip;\n"],"names":[],"mappings":";;;;;;;AAqBA,MAAM,gBAAgB,CAAC;AAAA,EACrB,MAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAKM,KAAA;AACJ,EAAA,MAAM,QAAQ,QAAS,EAAA;AAEvB,EAAI,IAAA,MAAA,IAAU,SAAS,MAAQ,EAAA;AAC7B,IAAA,MAAM,OAAO,KAAQ,GAAA,IAAI,KAAK,KAAK,CAAA,uBAAQ,IAAK,EAAA;AAChD,IACE,uBAAA,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,CAAA;AAAA,QACX,EAAI,EAAA;AAAA,UACF,OAAS,EAAA,WAAA;AAAA,UACT,SAAW,EAAA,CAAA;AAAA,UACX,YAAc,EAAA;AAAA,SAChB;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,EAAI,EAAA;AAAA,gBACF,QAAU,EAAA,UAAA;AAAA,gBACV,UAAY,EAAA,GAAA;AAAA,gBACZ,YAAc,EAAA;AAAA,eAChB;AAAA,cAEC,QAAA,EAAA,QAAA,KAAa,WACV,MAAO,CAAA,IAAA,EAAM,uBAAuB,CACpC,GAAA,MAAA,CAAO,MAAM,eAAe;AAAA;AAAA,WAClC;AAAA,+BAEC,GAAI,EAAA,EAAA,OAAA,EAAQ,QAAO,cAAe,EAAA,eAAA,EAAgB,YAAW,QAC5D,EAAA,QAAA,EAAA;AAAA,4BAAC,IAAA,CAAA,G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