import { Box, Text } from "ink";
import { useStore } from "../state/store.tsx";
import { SORT_FIELDS } from "../state/reducer.ts";
export function FilterOptionsOverlay() {
const { state } = useStore();
const { quickFilter, viewMode, sortBy, languageFilter } = state;
// Highlight the currently active filter
const isActive = (filter: string) => quickFilter === filter;
return (
{/* Title */}
Filter Options
{/* Quick Filters section */}
Quick Filters:
{/* View Modes */}
View Modes:
(Tab to cycle)
→
→
{/* Sort */}
Sort:
(s to cycle)
{SORT_FIELDS.map((field, index) => (
{index < SORT_FIELDS.length - 1 && → }
))}
{/* Search */}
Search:
/
Start text search (by name, description, path)
{/* Language Filter */}
Language Filter:
Type language name to filter (e.g., typescript, rust)
Current:
{languageFilter || "[none]"}
{/* Footer */}
Press any key to close
);
}
// Helper components
function FilterKey({ num, label, active }: { num: string; label: string; active: boolean }) {
return (
{num}
{label}
{active && ✓}
);
}
function ViewModeOption({ mode, current }: { mode: string; current: string }) {
const isActive = mode === current;
return {mode};
}
function SortOption({ field, current }: { field: string; current: string }) {
const isActive = field === current;
return {field};
}