refactor(tui): replace v2 sync with data context (#31826)

This commit is contained in:
Dax
2026-06-10 23:34:35 -04:00
committed by GitHub
parent 69623c2b79
commit 47a45601fd
16 changed files with 1113 additions and 2380 deletions
@@ -4,19 +4,21 @@ import { createMemo, Match, Show, Switch } from "solid-js"
import { abbreviateHome } from "../../runtime"
import { useTuiPaths } from "../../context/runtime"
import { useHomeSessionDestination } from "../../routes/home/session-destination"
import { useData } from "../../context/data"
const id = "internal:home-footer"
function Directory(props: { api: TuiPluginApi }) {
const theme = () => props.api.theme.current
const destination = useHomeSessionDestination()
const data = useData()
const paths = useTuiPaths()
const dir = createMemo(() => {
const selected = destination?.destination()
if (!selected || selected.type === "new") return
const out = abbreviateHome(selected.directory, paths.home)
const directory = !selected || selected.type === "new" ? data.location.default().directory : selected.directory
const out = abbreviateHome(directory, paths.home)
const branch =
selected.directory === (props.api.state.path.directory || paths.cwd) ? props.api.state.vcs?.branch : undefined
directory === (props.api.state.path.directory || paths.cwd) ? props.api.state.vcs?.branch : undefined
if (branch) return out + ":" + branch
return out
})