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 { createSignal, createMemo, ErrorBoundary, Accessor } from "solid-js";
|
||||||
import { useSelectionHandler } from "@opentui/solid";
|
import { useKeyboard, useSelectionHandler } from "@opentui/solid";
|
||||||
import { TabNavigation } from "./components/TabNavigation";
|
import { TabNavigation } from "./components/TabNavigation";
|
||||||
|
|
||||||
import { CodeValidation } from "@/components/CodeValidation";
|
import { CodeValidation } from "@/components/CodeValidation";
|
||||||
|
|
||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
import { useFeedStore } from "@/stores/feed";
|
import { useFeedStore } from "@/stores/feed";
|
||||||
import { useAudio } from "@/hooks/useAudio";
|
import { useAudio } from "@/hooks/useAudio";
|
||||||
import { useMultimediaKeys } from "@/hooks/useMultimediaKeys";
|
import { useMultimediaKeys } from "@/hooks/useMultimediaKeys";
|
||||||
import { FeedVisibility } from "@/types/feed";
|
import { FeedVisibility } from "@/types/feed";
|
||||||
import { useAppKeyboard } from "@/hooks/useAppKeyboard";
|
|
||||||
import { Clipboard } from "@/utils/clipboard";
|
import { Clipboard } from "@/utils/clipboard";
|
||||||
import { useToast } from "@/ui/toast";
|
import { useToast } from "@/ui/toast";
|
||||||
import { useRenderer } from "@opentui/solid";
|
import { useRenderer } from "@opentui/solid";
|
||||||
@@ -34,6 +31,7 @@ export function App() {
|
|||||||
const audio = useAudio();
|
const audio = useAudio();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const renderer = useRenderer();
|
const renderer = useRenderer();
|
||||||
|
const { theme } = useTheme();
|
||||||
|
|
||||||
useMultimediaKeys({
|
useMultimediaKeys({
|
||||||
playerFocused: () => activeTab() === TABS.PLAYER && layerDepth() > 0,
|
playerFocused: () => activeTab() === TABS.PLAYER && layerDepth() > 0,
|
||||||
@@ -47,35 +45,6 @@ export function App() {
|
|||||||
setLayerDepth(1);
|
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) => {
|
useSelectionHandler((selection: any) => {
|
||||||
if (!selection) return;
|
if (!selection) return;
|
||||||
const text = selection.getSelectedText?.();
|
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 (
|
return (
|
||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={(err) => (
|
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 {
|
export enum TABS {
|
||||||
FEED,
|
FEED = 1,
|
||||||
MYSHOWS,
|
MYSHOWS = 2,
|
||||||
DISCOVER,
|
DISCOVER = 3,
|
||||||
SEARCH,
|
SEARCH = 4,
|
||||||
PLAYER,
|
PLAYER = 5,
|
||||||
SETTINGS,
|
SETTINGS = 6,
|
||||||
}
|
}
|
||||||
|
export const TabsCount = 6;
|
||||||
|
|
||||||
export const LayerGraph = {
|
export const LayerGraph = {
|
||||||
[TABS.FEED]: FeedPage,
|
[TABS.FEED]: FeedPage,
|
||||||
|
|||||||
Reference in New Issue
Block a user