瀏覽代碼

shipbuilding: collapse top level

raylu 6 天之前
父節點
當前提交
bb306d9e04
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 2 2
      ts/shipbuilding.ts
  2. 4 0
      www/style.css

+ 2 - 2
ts/shipbuilding.ts

@@ -232,7 +232,7 @@ function renderAnalysisNode(node: AnalysisNode, level = 0): HTMLElement {
 	if (node.children.length === 0) {
 		el = element('div', {textContent: node.text, className: 'analysis-node'});
 	} else {
-		el = element('details', {className: 'analysis-node', open: true});
+		el = element('details', {className: 'analysis-node', open: level > 0});
 		el.append(element('summary', {textContent: node.text}));
 		for (const child of node.children)
 			el.append(renderAnalysisNode(child, level + 1));
@@ -270,7 +270,7 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
 
 	let totalConsumablesCost = 0;
 	for (const [expertise, productionBuildings] of Object.entries(expertiseGroups)) {
-		section.append(element('h3', {textContent: expertise}));
+		section.append(element('h3', {textContent: expertise.toLocaleLowerCase()}));
 		for (const building of productionBuildings) {
 			const buildingMats = element('div');
 			const mats = Object.entries(production[building]);

+ 4 - 0
www/style.css

@@ -160,6 +160,10 @@ main.ledger {
 main.shipbuilding {
 	.analysis-node {
 		padding-left: 40px;
+
+		summary {
+			cursor: pointer;
+		}
 	}
 	.analysis-node.root {
 		margin-top: 2em;