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
commit 47a45601fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1113 additions and 2380 deletions

View file

@ -10,7 +10,6 @@ import SidebarTodo from "./sidebar/todo"
import DiffViewer from "./system/diff-viewer"
import Notifications from "./system/notifications"
import PluginManager from "./system/plugins"
import SessionV2Debug from "./system/session-v2"
import WhichKey from "./system/which-key"
export type BuiltinTuiPlugin = Omit<TuiPluginModule, "id"> & {
@ -33,6 +32,5 @@ export function createBuiltinPlugins(options: { experimentalEventSystem: boolean
PluginManager,
WhichKey,
DiffViewer,
...(options.experimentalEventSystem ? [SessionV2Debug] : []),
]
}

View file

@ -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
})

File diff suppressed because it is too large Load diff