Skip to content

Commit d480fc6

Browse files
Fix UX: add back-to-home navigation in topic wikis
- Add "← Super Brain" link at the top of every topic wiki's nav panel, linking back to the Face Page (homeUrl: "../../"). - Brand text now shows the topic name instead of generic "Super Brain". - Face Page topic cards now use <a> tags for proper accessibility. - Add .nav-home-link CSS to shared styles.
1 parent 4d5b652 commit d480fc6

6 files changed

Lines changed: 43 additions & 9 deletions

File tree

‎site/face.css‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ body {
125125

126126
/* Topic card */
127127
.topic-card {
128+
display: block;
129+
text-decoration: none;
130+
color: inherit;
128131
background: var(--c-surface);
129132
border: 1px solid var(--c-border);
130133
border-radius: var(--radius-xl);

‎site/face.js‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
html += '<div class="face-grid">';
4848
cat.topics.forEach(function (topic) {
4949
html +=
50-
'<div class="topic-card" data-path="' + topic.path + '">' +
50+
'<a class="topic-card" href="' + topic.path + '">' +
5151
'<div class="topic-card-header">' +
5252
'<div class="topic-card-icon" style="background:' + (topic.color || "#1d4ed8") + '">' +
5353
topic.icon +
@@ -64,17 +64,13 @@
6464
'<div class="topic-stat">Updated ' + (topic.updated || "\u2014") + '</div>' +
6565
'</div>' +
6666
'<div class="topic-card-arrow">\u203a</div>' +
67-
'</div>';
67+
'</a>';
6868
});
6969
html += '</div></div>';
7070
});
7171
mainEl.innerHTML = html;
7272

73-
mainEl.querySelectorAll(".topic-card").forEach(function (card) {
74-
card.addEventListener("click", function () {
75-
window.location.href = card.dataset.path;
76-
});
77-
});
73+
// Cards are native <a> tags — no JS click handler needed
7874
}
7975

8076
loadRegistry();

‎site/shared/wiki-framework.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var WikiEngine = (function () {
1616
opts.features || {}
1717
);
1818
var brand = opts.brand || { icon: "SB", text: "Super Brain" };
19+
var homeUrl = opts.homeUrl || null;
1920
var labels = Object.assign(
2021
{
2122
domains: "Knowledge Domains",
@@ -160,7 +161,15 @@ var WikiEngine = (function () {
160161
}
161162
});
162163

163-
var html =
164+
var html = "";
165+
166+
if (homeUrl) {
167+
html +=
168+
'<a class="nav-home-link" href="' + homeUrl + '">' +
169+
'<span class="nav-home-arrow">\u2190</span> Super Brain</a>';
170+
}
171+
172+
html +=
164173
'<div class="nav-brand" id="nav-home">' +
165174
'<div class="nav-brand-icon">' +
166175
brand.icon +

‎site/shared/wiki-styles.css‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,30 @@ body {
101101
border-radius: 2px;
102102
}
103103

104+
.nav-home-link {
105+
display: flex;
106+
align-items: center;
107+
gap: 4px;
108+
padding: 6px var(--space-sm);
109+
margin-bottom: var(--space-xs);
110+
font-family: var(--font-ui);
111+
font-size: 0.6875rem;
112+
font-weight: 500;
113+
color: var(--c-text-tertiary);
114+
text-decoration: none;
115+
border-radius: var(--radius);
116+
transition: background 0.12s, color 0.12s;
117+
}
118+
119+
.nav-home-link:hover {
120+
background: var(--c-nav-hover);
121+
color: var(--c-accent);
122+
}
123+
124+
.nav-home-arrow {
125+
font-size: 0.75rem;
126+
}
127+
104128
.nav-brand {
105129
display: flex;
106130
align-items: center;

‎site/topics/compiler-research/app.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
data: WIKI,
44
dataCN: typeof WIKI_CN !== "undefined" ? WIKI_CN : null,
55
container: document.getElementById("wiki-shell"),
6-
brand: { icon: "SB", text: "Super Brain" },
6+
homeUrl: "../../",
7+
brand: { icon: "SB", text: "Compiler Research" },
78
features: {
89
search: true,
910
conceptRail: true,

‎site/topics/mpv-research/app.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
var engine = WikiEngine.create({
33
data: WIKI,
44
container: document.getElementById("wiki-shell"),
5+
homeUrl: "../../",
56
brand: { icon: "MPV", text: "MPV 调研" },
67
features: {
78
search: false,

0 commit comments

Comments
 (0)