Skip to content

Commit 357a700

Browse files
committed
Added demos for grid-lite and grid-pro
1 parent c08af3a commit 357a700

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

routes/samples/list-samples.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ const getSample = (path) => {
3939
const getSamples = () => {
4040
const samples = [];
4141

42+
const getCategoriesFromDemo = (demo) => {
43+
const categories = [];
44+
demo.details.categories?.forEach(cat => {
45+
if (typeof cat === 'string') {
46+
categories.push(cat);
47+
}
48+
if (typeof cat === 'object') {
49+
categories.push.apply(
50+
categories,
51+
Object.keys(cat)
52+
);
53+
}
54+
});
55+
return categories;
56+
};
57+
4258
[
4359
'highcharts',
4460
'stock',
@@ -90,11 +106,23 @@ const getSamples = () => {
90106
const demoConfigGroup = Object.values(demoConfig.default).find(
91107
config => (
92108
config.path === `/${group}/` ||
93-
config.path === '/' && group === 'highcharts'
109+
(config.path === '/' && group === 'highcharts')
94110
)
95111
);
96112

97-
demoConfigGroup?.categories?.forEach(category => {
113+
// Get the unique list of categories from the demos
114+
const categories = demoConfigGroup?.categories || [];
115+
116+
// Include also categories that may not be in the demoConfig
117+
demos.forEach(demo => {
118+
getCategoriesFromDemo(demo).forEach(cat => {
119+
if (!categories.includes(cat)) {
120+
categories.push(cat);
121+
}
122+
});
123+
});
124+
125+
categories.forEach(category => {
98126
const demosInCategory = [];
99127

100128
for (let demo of demos) {

0 commit comments

Comments
 (0)