feat(ST-1116): mobile auto-switch tabs + back button in BacklogSplitPane

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-04-30 17:53:38 +02:00
parent 6052aa81fb
commit 3e86a8d5c9
5 changed files with 218 additions and 5 deletions

View file

@ -0,0 +1,34 @@
'use client'
import { useState } from 'react'
import { useSelectionStore } from '@/stores/selection-store'
import { SplitPane, type SplitPaneProps } from '@/components/split-pane/split-pane'
type Props = Omit<SplitPaneProps, 'activeTab' | 'onActiveTabChange'>
export function BacklogSplitPane(props: Props) {
const { selectedPbiId, selectedStoryId } = useSelectionStore()
const [activeTab, setActiveTab] = useState(0)
// React-recommended "derived state from props" pattern: update state during render
// instead of useEffect to avoid cascading renders.
const [prevPbiId, setPrevPbiId] = useState(selectedPbiId)
const [prevStoryId, setPrevStoryId] = useState(selectedStoryId)
if (selectedStoryId !== prevStoryId) {
setPrevStoryId(selectedStoryId)
if (selectedStoryId) setActiveTab(2)
}
if (selectedPbiId !== prevPbiId) {
setPrevPbiId(selectedPbiId)
if (selectedPbiId && !selectedStoryId) setActiveTab(1)
}
return (
<SplitPane
{...props}
activeTab={activeTab}
onActiveTabChange={setActiveTab}
/>
)
}