sidebar fixes

This commit is contained in:
Codex
2026-03-07 07:13:07 +00:00
parent b38341b25a
commit 31671f5791
3 changed files with 54 additions and 30 deletions

View File

@@ -17,20 +17,21 @@
const calcs = getCalculatorsByCategory(key);
calcs.forEach(calc => {
const unit = calc.labels.in1;
const existing = buckets.get(unit);
if (existing) {
existing.push(calc);
} else {
buckets.set(unit, [calc]);
}
[calc.labels.in1, calc.labels.in2].forEach(unit => {
const existing = buckets.get(unit);
if (existing) {
existing.push(calc);
} else {
buckets.set(unit, [calc]);
}
});
});
const units = [...buckets.entries()]
.sort(([a], [b]) => a.localeCompare(b))
.map(([label, conversions]) => ({
label,
conversions: conversions.slice().sort((a, b) => a.labels.in2.localeCompare(b.labels.in2)),
conversions: conversions.slice().sort((a, b) => a.name.localeCompare(b.name)),
}));
return { key, meta, units };
@@ -116,13 +117,16 @@
<style>
.sidebar {
flex: 0 0 280px;
width: 280px;
height: 100%;
min-width: 280px;
position: sticky;
top: var(--header-h);
height: calc(100vh - var(--header-h));
overflow-y: auto;
background: var(--sidebar-bg);
border-right: 1px solid var(--border);
padding: 0;
flex-shrink: 0;
}
.sidebar-header {
display: flex;