Files
MyIP/frontend/utils/nav-target.js
T
Claude 96525d2fc7 Chore: trim the branch — leftovers, redundancy, comments
A pass over every file the branch touched, after the iOS animation hunt
left tries and reverts behind it. Removed what nothing reaches: the
view-transition rule for a transition no code starts, an unreachable
guard in the transition hook, a no-op KeepAlive key branch, a sign-in
guard the menu already enforces, usage-dialog wrappers that only
forwarded to the store, a duplicated modifier-click check and card
filter (isPlainClick / listedTools), a test that hand-rolled
listedTools, a drawer-era fixture parameter. auth-flow.js folded into
auth-redirect.js. Comments cut to what the code cannot say itself —
file headers of a few lines, the measured iOS reasons, non-obvious
orderings — and stale ones fixed (Nav under KeepAlive, Home.vue
reusing DEFAULT_META, "from Nav", enabledCards). AGENTS.md sections
tightened to the code as it is now.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GbLTGMZ45MV78qd2tHoco
2026-10-05 16:50:16 +00:00

20 lines
917 B
JavaScript

// What a click on a site-navigation entry (Nav, mobile nav sheet, breadcrumb)
// does on the current route: `{ tool }` → { kind: 'tool', slug }; `{ section }`
// → 'scroll' on Home, 'home-then-scroll' elsewhere; anything else → null.
// composables/use-nav-target.js carries it out.
export const resolveNavTarget = ({ item, routeName } = {}) => {
if (typeof item?.tool === 'string' && item.tool) return { kind: 'tool', slug: item.tool };
if (typeof item?.section === 'string' && item.section) {
const kind = routeName === 'home' ? 'scroll' : 'home-then-scroll';
return { kind, section: item.section };
}
return null;
};
// False for a click the browser should keep (modified or non-primary: new tab / window).
export const isPlainClick = (event) => !(
event.defaultPrevented || event.button !== 0
|| event.metaKey || event.ctrlKey || event.shiftKey || event.altKey
);