3.1 KiB
3.1 KiB
01. Rearchitect nav model — remove the sidebar pane
meta: id: yazi-remake-01 feature: yazi-remake priority: P1 depends_on: [] tags: [implementation, nav-model, tests-required]
objective:
- Remove the always-on
SIDEBAR_PANEconcept from the navigation context soactiveTabis plain tab state (not a pane), establishing clean parent|current|preview semantics for the yazi remake.
deliverables:
src/context/NavigationContext.tsx— deleteSIDEBAR_PANEconstant and all references;activeTabis no longer a panesrc/utils/navigation.ts— updateTabPaneCountsemantics; depth-tabs = 1 focusable pane (current), the 3 visible columns are a render concern not 3 panes- Updated header/comment block describing the parent|current|preview model
swipe()/popDepth()reworked: depth-tabsl=drill (open),h=pop (noop at depth 0); fixed-pane tabsh/lmove between parent/current/preview- Tab-enter resets focus to
DEPTH_CENTER_PANE(current pane), not a sidebar
steps:
- Audit every reference to
SIDEBAR_PANEacross the codebase (grep) - In
NavigationContext.tsx: delete theSIDEBAR_PANE = -1export and thefocusedIndex/setFocusedIndexSIDEBAR_PANE branch added previously - Set the initial
activePanesignal and the tab-switch createEffect to reset toDEPTH_CENTER_PANE(the current pane), notSIDEBAR_PANE - Rework
swipe()to clamp to[0, paneCount-1]for fixed-pane tabs (the sidebar is no longer in the chain); depth-tabs don't useswipefor drill/pop (that lives in Shell dispatch) - In
utils/navigation.ts: confirmTabPaneCountreflects focusable content panes only (depth-tabs = 1, Search = 3, Player = 1); updatePANE_RATIOleave-behind note (ratio change happens in task 02) - Update the file header comment block to describe parent|current|preview
- Run
lens_diagnosticson the two files
tests:
- Unit:
focusedIndex(DEPTH_CENTER_PANE)on a depth-tab returns the top frame's focus;setFocusedIndexwrites to the top frame (Arrange a tab with a 2-frame stack, Act by calling setFocusedIndex, Assert topFrame.focus updated) - Integration: tab-switch effect sets
activePanetoDEPTH_CENTER_PANE(not -1);swipe(-1, 3)on a fixed tab clamps to 0 not -1 - e2e (harness): app boots with
nav.state.pane === 0(current), not -1
acceptance_criteria:
- No symbol
SIDEBAR_PANEexists anywhere insrc/ - Initial
activePane===DEPTH_CENTER_PANE(0) - Tab-enter sets
activePanetoDEPTH_CENTER_PANE swipe()lower bound is 0 (no-1)
validation:
grep -rn "SIDEBAR_PANE" src/returns nothingbun run buildpasseslens_diagnosticspaths=[src/context/NavigationContext.tsx,src/utils/navigation.ts] severity=error → 0 findings
notes:
- This task unblocks 03/04/05/06. It must not delete
DEPTH_CENTER_PANE— that constant is generalised to "the current pane" and retained SIDEBAR_ACTIONS(added in Shell in a prior turn) is removed in task 06 (the keybind rewrite), not here — but Shell will temporarily fail to compile after this task until 05/06 land; that's expected and the build command ignores type errors, so gate success on grep + targeted diagnostics, not the full build