fix nav context
This commit is contained in:
21
src/App.tsx
21
src/App.tsx
@@ -86,7 +86,7 @@ export function App() {
|
|||||||
const isInverting = keybind.isInverting(keyEvent);
|
const isInverting = keybind.isInverting(keyEvent);
|
||||||
|
|
||||||
// only handling top navigation here, cycle through tabs, just to high priority(player) all else to be handled in each tab
|
// only handling top navigation here, cycle through tabs, just to high priority(player) all else to be handled in each tab
|
||||||
if (nav.activeDepth == 0) {
|
if (nav.activeDepth() == 0) {
|
||||||
if (
|
if (
|
||||||
(isCycle && !isInverting) ||
|
(isCycle && !isInverting) ||
|
||||||
(isDown && !isInverting) ||
|
(isDown && !isInverting) ||
|
||||||
@@ -103,11 +103,24 @@ export function App() {
|
|||||||
nav.prevTab();
|
nav.prevTab();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((isRight && !isInverting) || (isLeft && isInverting)) {
|
if (
|
||||||
|
(isDive && !isInverting) ||
|
||||||
|
(isOut && isInverting) ||
|
||||||
|
(isRight && !isInverting) ||
|
||||||
|
(isLeft && isInverting)
|
||||||
|
) {
|
||||||
nav.setActiveDepth(1);
|
nav.setActiveDepth(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nav.activeDepth == 1) {
|
if (nav.activeDepth() == 1) {
|
||||||
|
if (
|
||||||
|
(isDive && isInverting) ||
|
||||||
|
(isOut && !isInverting) ||
|
||||||
|
(isRight && isInverting) ||
|
||||||
|
(isLeft && !isInverting)
|
||||||
|
) {
|
||||||
|
nav.setActiveDepth(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ release: false },
|
{ release: false },
|
||||||
@@ -166,7 +179,7 @@ export function App() {
|
|||||||
)}
|
)}
|
||||||
<box flexDirection="row" width="100%" height="100%">
|
<box flexDirection="row" width="100%" height="100%">
|
||||||
<TabNavigation />
|
<TabNavigation />
|
||||||
{LayerGraph[nav.activeTab]()}
|
{LayerGraph[nav.activeTab()]()}
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function TabNavigation() {
|
|||||||
return (
|
return (
|
||||||
<box
|
<box
|
||||||
border
|
border
|
||||||
borderColor={activeDepth !== 0 ? "transparent" : theme.accent}
|
borderColor={activeDepth() !== 0 ? theme.border : theme.accent}
|
||||||
backgroundColor={"transparent"}
|
backgroundColor={"transparent"}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
@@ -32,11 +32,11 @@ export function TabNavigation() {
|
|||||||
<SelectableBox
|
<SelectableBox
|
||||||
border
|
border
|
||||||
height={3}
|
height={3}
|
||||||
selected={() => tab.id == activeTab}
|
selected={() => tab.id == activeTab()}
|
||||||
onMouseDown={() => setActiveTab(tab.id)}
|
onMouseDown={() => setActiveTab(tab.id)}
|
||||||
>
|
>
|
||||||
<SelectableText
|
<SelectableText
|
||||||
selected={() => tab.id == activeTab}
|
selected={() => tab.id == activeTab()}
|
||||||
primary
|
primary
|
||||||
alignSelf="center"
|
alignSelf="center"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -29,15 +29,9 @@ export const { use: useNavigation, provider: NavigationProvider } =
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
get activeTab() {
|
activeTab,
|
||||||
return activeTab();
|
activeDepth,
|
||||||
},
|
inputFocused,
|
||||||
get activeDepth() {
|
|
||||||
return activeDepth();
|
|
||||||
},
|
|
||||||
get inputFocused() {
|
|
||||||
return inputFocused();
|
|
||||||
},
|
|
||||||
setActiveTab,
|
setActiveTab,
|
||||||
setActiveDepth,
|
setActiveDepth,
|
||||||
setInputFocused,
|
setInputFocused,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ enum FeedPaneType {
|
|||||||
}
|
}
|
||||||
export const FeedPaneCount = 1;
|
export const FeedPaneCount = 1;
|
||||||
|
|
||||||
/** Episodes to load per batch */
|
|
||||||
const ITEMS_PER_BATCH = 50;
|
const ITEMS_PER_BATCH = 50;
|
||||||
|
|
||||||
export function FeedPage() {
|
export function FeedPage() {
|
||||||
@@ -64,6 +63,10 @@ export function FeedPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<box
|
<box
|
||||||
|
border
|
||||||
|
borderColor={
|
||||||
|
nav.activeDepth() !== FeedPaneType.FEED ? theme.border : theme.accent
|
||||||
|
}
|
||||||
backgroundColor={theme.background}
|
backgroundColor={theme.background}
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
height="100%"
|
height="100%"
|
||||||
@@ -79,7 +82,10 @@ export function FeedPage() {
|
|||||||
</box>
|
</box>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<scrollbox height="100%" focused={nav.activeDepth == FeedPaneType.FEED}>
|
<scrollbox
|
||||||
|
height="100%"
|
||||||
|
focused={nav.activeDepth() == FeedPaneType.FEED}
|
||||||
|
>
|
||||||
<For each={groupEpisodesByDate()}>
|
<For each={groupEpisodesByDate()}>
|
||||||
{([date, items]) => (
|
{([date, items]) => (
|
||||||
<box flexDirection="column" gap={1} padding={1}>
|
<box flexDirection="column" gap={1} padding={1}>
|
||||||
@@ -90,8 +96,8 @@ export function FeedPage() {
|
|||||||
{(item) => {
|
{(item) => {
|
||||||
const isSelected = () => {
|
const isSelected = () => {
|
||||||
if (
|
if (
|
||||||
nav.activeTab == TABS.FEED &&
|
nav.activeTab() == TABS.FEED &&
|
||||||
nav.activeDepth == FeedPaneType.FEED &&
|
nav.activeDepth() == FeedPaneType.FEED &&
|
||||||
selectedEpisodeID() &&
|
selectedEpisodeID() &&
|
||||||
selectedEpisodeID() === item.episode.id
|
selectedEpisodeID() === item.episode.id
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user