Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

useSelectWorkspaceDetail.ts

21 lines774 Bytes

1import { useNavigation } from "@react-navigation/native";
2import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
3import {
4 selectWorkspaceDetail,
5 type WorkspaceDetail,
6 type WorkspaceDetailSheet,
7} from "./workspace-detail-selection";
8​
9/**
10 * Shows a page in the detail column the way selecting its list row does. Inside the workspace
11 * layout this also settles its panes; outside it, the root stack's router still does the rest.
12 */
13export function useSelectWorkspaceDetail() {
14 const navigation = useNavigation();
15 const { selectDetail } = useAdaptiveWorkspaceLayout();
16 return (
17 selectDetail ??
18 ((detail: WorkspaceDetail, sheet?: WorkspaceDetailSheet) =>
19 navigation.dispatch(selectWorkspaceDetail(detail, sheet)))
20 );