caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

136 lines
4.3 KiB
TypeScript

/**
* Single-group navigation view — a focused, searchable list of every screen in
* one registry group (e.g. /navigation/discoverability/Monetize). Reachable as
* a "see all" deep-link and useful as a compact contextual target.
*
* NAV MANIFEST:
* route: /navigation/discoverability/[group] (param: group = group name)
* parent hub: app/navigation/discoverability/index.tsx
*/
import { useCallback, useEffect, useMemo, useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import { useLocalSearchParams, useRouter } from "expo-router";
import { EmptyState } from "@/components/ui/EmptyState";
import { Screen } from "@/components/ui/Screen";
import { SearchBar } from "@/components/ui/SearchBar";
import { colors } from "@/components/me/theme";
import { spacing, typeScale, weight } from "@/src/shared/theme";
import { NavRow } from "@/components/nav/NavRow";
import { badgeForRoute } from "@/lib/nav/badges";
import { getRegistryGroups } from "@/lib/nav/registry";
import { searchScreens } from "@/lib/nav/search";
import { loadPins, pushRecent, togglePin } from "@/lib/nav/recents";
import { useNavHubData } from "@/lib/nav/useNavHubData";
import { usePlatformAdmin } from "@/lib/nav/usePlatformAdmin";
import { useSession } from "@/src/shared/auth";
import { isRouteAvailable } from "@/src/shared/release/surface";
export default function NavigationGroupScreen(): React.JSX.Element {
const params = useLocalSearchParams<{ group?: string }>();
const groupName = typeof params.group === "string" ? params.group : "";
const router = useRouter();
const { apiKey } = useSession();
const token = apiKey ?? undefined;
const hub = useNavHubData(token);
const [query, setQuery] = useState("");
const [pins, setPins] = useState<readonly string[]>([]);
useEffect(() => {
void loadPins().then(setPins);
}, []);
const includeStaff = usePlatformAdmin();
const group = useMemo(
() => getRegistryGroups({ includeStaff }).find((g) => g.name === groupName),
[groupName, includeStaff],
);
const screens = useMemo(() => {
const all = group?.screens ?? [];
if (query.trim().length === 0) return all;
return searchScreens(query, all).map((r) => r.screen);
}, [group, query]);
const onOpen = useCallback(
(route: string) => {
void pushRecent(route);
router.push(route as Parameters<typeof router.push>[0]);
},
[router],
);
const onTogglePin = useCallback((route: string) => {
void togglePin(route).then(setPins);
}, []);
const pinSet = new Set(pins);
return (
<Screen scroll refreshing={hub.loading} onRefresh={hub.reload}>
<View style={styles.header}>
<Text style={styles.title}>{groupName || "Group"}</Text>
<Text style={styles.subtitle}>
{group ? `${group.screens.length} screens` : "Unknown group"}
</Text>
</View>
{group ? (
<SearchBar
value={query}
onChangeText={setQuery}
placeholder={`Search in ${groupName}…`}
style={styles.search}
/>
) : null}
<View style={styles.body}>
{!group ? (
<EmptyState
title="Group not found"
body="This navigation group no longer exists."
actionLabel="Back to hub"
onAction={() =>
router.replace(
isRouteAvailable("/navigation/discoverability") ? "/navigation/discoverability" : "/(tabs)/me",
)
}
/>
) : screens.length === 0 ? (
<EmptyState
title="No screens match"
body={`Nothing in ${groupName} matches "${query.trim()}".`}
/>
) : (
screens.map((screen) => (
<NavRow
key={screen.route}
screen={screen}
badge={badgeForRoute(screen.route, hub.data)}
pinned={pinSet.has(screen.route)}
onOpen={onOpen}
onTogglePin={onTogglePin}
/>
))
)}
</View>
</Screen>
);
}
const styles = StyleSheet.create({
header: { gap: 4, marginBottom: spacing.md },
title: {
color: colors.textPrimary,
fontSize: typeScale.title,
fontWeight: weight.black,
textTransform: "capitalize",
},
subtitle: { color: colors.textSecondary, fontSize: 13 },
search: { marginBottom: spacing.md },
body: { gap: spacing.sm },
});