feat: UI revamp with sidebar nav and grouped library
Replace top Nav with Sidebar, add lib/group.js for library grouping, tokenized color/alert styles, and tighter Settings/Canvas export layout. Adds @tabler/icons-react. Verified production build (standalone) passes, so the Docker image built from this tree matches the local app. Co-authored-by: Claude <claude-code@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// lib/group.js — group saved assignments by subject for the sidebar tree and
|
||||
// the Library page. Shared so both stay in sync.
|
||||
|
||||
export function groupBySubject(items) {
|
||||
const map = new Map();
|
||||
for (const a of items || []) {
|
||||
const key = (a.subject && a.subject.trim()) || a.gradeLevel || "Other";
|
||||
if (!map.has(key)) map.set(key, []);
|
||||
map.get(key).push(a);
|
||||
}
|
||||
const groups = [...map.entries()].map(([key, list]) => ({
|
||||
key,
|
||||
items: list.slice().sort((x, y) => String(y.updatedAt || "").localeCompare(String(x.updatedAt || ""))),
|
||||
}));
|
||||
// Stable, friendly order: alphabetical by subject, "Other" last.
|
||||
groups.sort((a, b) => {
|
||||
if (a.key === "Other") return 1;
|
||||
if (b.key === "Other") return -1;
|
||||
return a.key.localeCompare(b.key);
|
||||
});
|
||||
return groups;
|
||||
}
|
||||
Reference in New Issue
Block a user