Buckets:
| import { | |
| createContext, | |
| createMemo, | |
| createSignal, | |
| useContext, | |
| type Accessor, | |
| type ParentProps, | |
| type Setter, | |
| } from "solid-js" | |
| import { useSync } from "../../context/sync" | |
| import { useTuiPaths } from "../../context/runtime" | |
| export type HomeSessionDestination = { type: "directory"; directory: string; subdirectory: boolean } | { type: "new" } | |
| type Context = { | |
| destination: Accessor<HomeSessionDestination | undefined> | |
| setDestination: Setter<HomeSessionDestination | undefined> | |
| clear: () => void | |
| } | |
| const HomeSessionDestinationContext = createContext<Context>() | |
| export function HomeSessionDestinationProvider(props: ParentProps) { | |
| const sync = useSync() | |
| const paths = useTuiPaths() | |
| const [selected, setDestination] = createSignal<HomeSessionDestination>() | |
| const destination = createMemo<HomeSessionDestination>( | |
| () => selected() ?? { type: "directory", directory: sync.path.directory || paths.cwd, subdirectory: false }, | |
| ) | |
| return ( | |
| <HomeSessionDestinationContext.Provider | |
| value={{ destination, setDestination, clear: () => setDestination(undefined) }} | |
| > | |
| {props.children} | |
| </HomeSessionDestinationContext.Provider> | |
| ) | |
| } | |
| export function useHomeSessionDestination() { | |
| return useContext(HomeSessionDestinationContext) | |
| } | |
Xet Storage Details
- Size:
- 1.28 kB
- Xet hash:
- 65f3179141bb5b0fac5edddfd0ebe6453d867f28cd7c22fb7cd9c8e5d1c9cd08
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.