Skip to content

Commit

Permalink
Improve styles of webpages
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Dec 12, 2024
1 parent 488f2fa commit 4d05b85
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
21 changes: 17 additions & 4 deletions scripts/buildWebpages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,19 @@ const moduleData = JSON.parse(fs.readFileSync(path.join(__dirname, '../locales/e
const moduleControlPointSequenceKeys = {};
const moduleParametersKeys = {};
for (const id in moduleData) {
moduleControlPointSequenceKeys[id] = Object.keys(moduleData[id]).filter(key => key.startsWith('point'));
moduleParametersKeys[id] = Object.keys(moduleData[id]).filter(key => !key.startsWith('point') && key != 'title' && key != 'description');
// Load the module scene data
const moduleSceneData = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/moduleScenes', id + '.json'), 'utf8'));
const moduleDef = moduleSceneData.modules[id];
const numPoints = moduleDef.numPoints;
moduleControlPointSequenceKeys[id] = [];
moduleParametersKeys[id] = {};
for (let i = 1; i <= numPoints; i++) {
moduleControlPointSequenceKeys[id].push(`modules:moduleData.${id}.point${i}`);
}
for (const param of moduleDef.params) {
const paramName = param.split('=')[0];
moduleParametersKeys[id][paramName] = `modules:moduleData.${id}.${paramName.replace(/_/g, '')}`;
}
}

// List all module ids in the moduleList
Expand Down Expand Up @@ -565,8 +576,10 @@ for (const lang of homeLangs) {
titleKey: 'modules:moduleData.' + item.id + '.title',
contributors: item.contributors.join(', '),
descriptionKey: 'modules:moduleData.' + item.id + '.description',
controlPointSequenceKeys: moduleControlPointSequenceKeys[item.id].map(key => 'modules:moduleData.' + item.id + '.' + key),
parametersKeys: moduleParametersKeys[item.id].map(key => 'modules:moduleData.' + item.id + '.' + key),
hasControlPoints: moduleControlPointSequenceKeys[item.id].length > 0,
hasParameters: Object.keys(moduleParametersKeys[item.id]).length > 0,
controlPointSequenceKeys: moduleControlPointSequenceKeys[item.id],
parametersKeys: moduleParametersKeys[item.id],
};
}),
}
Expand Down
2 changes: 1 addition & 1 deletion src/webpages/gallery.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<a href="{{url}}" class="thumbnail example-container">
<picture>
<source srcset="{{url}}-thumbnail.avif" type="image/avif">
<img src="{{url}}-thumbnail.jpg" alt="{{t titleKey}}" class="img-rounded example-image" loading="lazy">
<img src="{{url}}-thumbnail.jpg" alt="{{title}}" class="img-rounded example-image" loading="lazy">
</picture>
<div class="caption">
<p class="example-title">{{title}}</p>
Expand Down
9 changes: 5 additions & 4 deletions src/webpages/modules.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
font-size: 12pt;
}
ul {
padding-left: 1rem;
}
</style>
</head>

Expand Down Expand Up @@ -89,18 +86,22 @@
</div>
</div>
<div id="details-collapse-{{this.id}}" class="collapse">
{{#if this.hasControlPoints}}
{{t "modules:modulesPage:specification:controlPointSequence"}}
<ol>
{{#each this.controlPointSequenceKeys}}
<li>{{t this blank=true}}</li>
{{/each}}
</ol>
{{/if}}
{{#if this.hasParameters}}
{{t "modules:modulesPage:specification:parameters"}}
<ul>
{{#each this.parametersKeys}}
<li>{{t this blank=true}}</li>
<li><code>{{@key}}</code>: {{t this blank=true}}</li>
{{/each}}
</ul>
{{/if}}
</div>
{{/each}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/webpages/partials/footer.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style="float: right;">
<div style="float: right; padding-bottom: 1em;">
<div class="dropup">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
<span id="language">{{t "main:languageDropdown.title" language=langName}}</span>
Expand Down

0 comments on commit 4d05b85

Please sign in to comment.