simple
This commit is contained in:
44
src/App.tsx
44
src/App.tsx
@@ -1,15 +1,12 @@
|
||||
import { createSignal, createMemo, ErrorBoundary, Accessor } from "solid-js";
|
||||
import { useSelectionHandler } from "@opentui/solid";
|
||||
import { useKeyboard, useSelectionHandler } from "@opentui/solid";
|
||||
import { TabNavigation } from "./components/TabNavigation";
|
||||
|
||||
import { CodeValidation } from "@/components/CodeValidation";
|
||||
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { useFeedStore } from "@/stores/feed";
|
||||
import { useAudio } from "@/hooks/useAudio";
|
||||
import { useMultimediaKeys } from "@/hooks/useMultimediaKeys";
|
||||
import { FeedVisibility } from "@/types/feed";
|
||||
import { useAppKeyboard } from "@/hooks/useAppKeyboard";
|
||||
import { Clipboard } from "@/utils/clipboard";
|
||||
import { useToast } from "@/ui/toast";
|
||||
import { useRenderer } from "@opentui/solid";
|
||||
@@ -34,6 +31,7 @@ export function App() {
|
||||
const audio = useAudio();
|
||||
const toast = useToast();
|
||||
const renderer = useRenderer();
|
||||
const { theme } = useTheme();
|
||||
|
||||
useMultimediaKeys({
|
||||
playerFocused: () => activeTab() === TABS.PLAYER && layerDepth() > 0,
|
||||
@@ -47,35 +45,6 @@ export function App() {
|
||||
setLayerDepth(1);
|
||||
};
|
||||
|
||||
useAppKeyboard({
|
||||
layerDepth,
|
||||
onAction: (action, direction) => {
|
||||
if (action == "cycle") {
|
||||
if (direction == DIRECTION.Increment) {
|
||||
//if()
|
||||
}
|
||||
if (direction == DIRECTION.Decrement) {
|
||||
}
|
||||
}
|
||||
if (action == "depth") {
|
||||
if (direction == DIRECTION.Increment) {
|
||||
}
|
||||
if (direction == DIRECTION.Decrement) {
|
||||
}
|
||||
}
|
||||
|
||||
if (action === "escape") {
|
||||
if (layerDepth() > 0) {
|
||||
setLayerDepth(0);
|
||||
setInputFocused(false);
|
||||
} else {
|
||||
setShowAuthPanel(false);
|
||||
setInputFocused(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
useSelectionHandler((selection: any) => {
|
||||
if (!selection) return;
|
||||
const text = selection.getSelectedText?.();
|
||||
@@ -91,7 +60,14 @@ export function App() {
|
||||
});
|
||||
});
|
||||
|
||||
const { theme } = useTheme();
|
||||
//useKeyboard(
|
||||
//(keyEvent) => {
|
||||
////handle intra layer navigation
|
||||
//if(keyEvent.name == "up" || keyEvent.name)
|
||||
//},
|
||||
//{ release: false }, // Not strictly necessary
|
||||
//);
|
||||
|
||||
return (
|
||||
<ErrorBoundary
|
||||
fallback={(err) => (
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { describe, expect, it } from "bun:test"
|
||||
import { ThemeProvider } from "./ThemeContext"
|
||||
|
||||
describe("ThemeContext", () => {
|
||||
it("exports provider", () => {
|
||||
expect(typeof ThemeProvider).toBe("function")
|
||||
})
|
||||
})
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Centralized keyboard shortcuts hook for PodTUI
|
||||
* Single handler to prevent conflicts
|
||||
*/
|
||||
|
||||
import { TabId } from "@/components/TabNavigation";
|
||||
import { useKeyboard, useRenderer } from "@opentui/solid";
|
||||
import type { Accessor } from "solid-js";
|
||||
|
||||
type ShortcutOptions = {
|
||||
onAction?: (action: string, direction: Direction) => void;
|
||||
layerDepth: Accessor<number>;
|
||||
};
|
||||
|
||||
export function useAppKeyboard(props: ShortcutOptions) {
|
||||
const renderer = useRenderer();
|
||||
|
||||
// layer depth 0 is tabs, they are oriented
|
||||
// vertically, all others are vertically
|
||||
useKeyboard((key) => {
|
||||
// handle cycle current layer
|
||||
if (props.layerDepth() == 0) {
|
||||
let reverse = false;
|
||||
if (key.shift) {
|
||||
reverse = true;
|
||||
}
|
||||
if (key.name == "tab" || key.name == "down" || key.name == "j") {
|
||||
}
|
||||
}
|
||||
// handle cycle depth
|
||||
});
|
||||
}
|
||||
@@ -11,13 +11,14 @@ export enum DIRECTION {
|
||||
}
|
||||
|
||||
export enum TABS {
|
||||
FEED,
|
||||
MYSHOWS,
|
||||
DISCOVER,
|
||||
SEARCH,
|
||||
PLAYER,
|
||||
SETTINGS,
|
||||
FEED = 1,
|
||||
MYSHOWS = 2,
|
||||
DISCOVER = 3,
|
||||
SEARCH = 4,
|
||||
PLAYER = 5,
|
||||
SETTINGS = 6,
|
||||
}
|
||||
export const TabsCount = 6;
|
||||
|
||||
export const LayerGraph = {
|
||||
[TABS.FEED]: FeedPage,
|
||||
|
||||
Reference in New Issue
Block a user