Skip to content

Commit d8a5206

Browse files
committed
feat(ui): add quick-nav pinned recall shortcuts
1 parent 6c98997 commit d8a5206

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

storyverse-web/src/components/marketing/MarketingQuickNav.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ async function copyShortcutGuide() {
153153
"O → Open the direct link for the current section in a new tab",
154154
"R → Resume the last saved section",
155155
"F → Pin or unpin the current section",
156+
"5-8 → Jump to pinned sections",
157+
"9 → Jump to the latest recent-trail section",
156158
"Shift+C (while filter is focused) → Copy the filtered result bundle",
157159
"",
158160
...SECTIONS.map((section, index) => `${index + 1}${section.label} (${buildAnchorUrl(section.id)})`),
@@ -618,6 +620,29 @@ export function MarketingQuickNav() {
618620
return;
619621
}
620622

623+
if (/^[5-8]$/.test(event.key)) {
624+
const pinnedIndex = Number(event.key) - 5;
625+
const pinnedSectionId = pinnedSections[pinnedIndex] ?? null;
626+
const pinnedSection = pinnedSectionId ? SECTIONS.find((section) => section.id === pinnedSectionId) ?? null : null;
627+
if (!pinnedSection) return;
628+
629+
event.preventDefault();
630+
if (!jumpToSection(pinnedSection.id)) return;
631+
setActiveId(pinnedSection.id);
632+
return;
633+
}
634+
635+
if (event.key === "9") {
636+
const recentSectionId = recentTrail.find((sectionId) => sectionId !== activeSection.id) ?? null;
637+
const recentSection = recentSectionId ? SECTIONS.find((section) => section.id === recentSectionId) ?? null : null;
638+
if (!recentSection) return;
639+
640+
event.preventDefault();
641+
if (!jumpToSection(recentSection.id)) return;
642+
setActiveId(recentSection.id);
643+
return;
644+
}
645+
621646
if (event.key.toLowerCase() === "f") {
622647
event.preventDefault();
623648
togglePinnedSection(activeSection.id);
@@ -626,7 +651,7 @@ export function MarketingQuickNav() {
626651

627652
window.addEventListener("keydown", handleKeyDown);
628653
return () => window.removeEventListener("keydown", handleKeyDown);
629-
}, [activeIndex, activeSection.id, canJumpNext, canJumpPrev, filteredSections, resumeId, searchQuery, selectedFilteredSection, shortcutGuideOpen, togglePinnedSection]);
654+
}, [activeIndex, activeSection.id, canJumpNext, canJumpPrev, filteredSections, pinnedSections, recentTrail, resumeId, searchQuery, selectedFilteredSection, shortcutGuideOpen, togglePinnedSection]);
630655

631656
const recentTrailSections = recentTrail
632657
.filter((sectionId) => sectionId !== activeSection.id)
@@ -1178,6 +1203,8 @@ export function MarketingQuickNav() {
11781203
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 font-medium">O open current</span>
11791204
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 font-medium">R resume last stop</span>
11801205
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 font-medium">F pin current</span>
1206+
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 font-medium">5-8 pinned recall</span>
1207+
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 font-medium">9 recent bounceback</span>
11811208
</div>
11821209
<div className="grid gap-2 sm:grid-cols-2">
11831210
{SECTIONS.map((section, index) => (
@@ -1210,7 +1237,7 @@ export function MarketingQuickNav() {
12101237
<div className="flex flex-wrap items-center gap-2">
12111238
<span className="text-[11px] uppercase tracking-[0.22em] text-cosmos-200/45">Pinned lanes</span>
12121239
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 text-xs font-medium text-cosmos-200/55">
1213-
1-4 keyboard recall
1240+
5-8 keyboard recall
12141241
</span>
12151242
</div>
12161243
<div className="flex flex-wrap items-center gap-2">
@@ -1307,7 +1334,7 @@ export function MarketingQuickNav() {
13071334
<div className="flex flex-wrap items-center gap-2">
13081335
<span className="text-[11px] uppercase tracking-[0.22em] text-cosmos-200/45">Recent trail</span>
13091336
<span className="inline-flex items-center rounded-full border border-cosmos-200/10 bg-cosmos-900/70 px-3 py-1.5 text-xs font-medium text-cosmos-200/55">
1310-
5-7 operator bounceback
1337+
9 operator bounceback
13111338
</span>
13121339
</div>
13131340
<div className="flex flex-wrap items-center gap-2">

0 commit comments

Comments
 (0)