mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
feat(frontend): open session details from the header
Pressing the session title opens a details sheet with server, project, branch and directory and inline rename. Linked-server sessions show a server icon and their branch, child sessions show a parent session pill, a banner marks paused live updates while the stream reconnects, and the header context indicator is removed now that usage lives on the model pill.
This commit is contained in:
1 parent
52162d5c4a
commit
d99fcc268e
20 files changed
+732
-418
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { getVcsInfo } from '@/api/opencode'
|
||||
import { serverScopedKey } from '@/lib/serverScope'
|
||||
|
||||
export interface UseVcsInfoOptions {
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the version-control info of a directory through the OpenCode server in
|
||||
* scope. The query is keyed by directory and server id, so the session header,
|
||||
* the project header and the source control panel share one cached read, and a
|
||||
* linked server reports its own checkout rather than the Manager's.
|
||||
*
|
||||
* @param directory Absolute checkout directory; the query stays disabled without one.
|
||||
* @param serverId Linked server to read from, or the local Manager when omitted.
|
||||
* @param options.enabled Whether to read the info; defaults to `true`.
|
||||
*/
|
||||
export function useVcsInfo(
|
||||
directory: string | undefined,
|
||||
serverId: string | undefined,
|
||||
options: UseVcsInfoOptions = {},
|
||||
) {
|
||||
const { enabled = true } = options
|
||||
|
||||
return useQuery({
|
||||
queryKey: [...serverScopedKey(['opencode', 'vcs', directory ?? ''], serverId), 'info'],
|
||||
queryFn: () => getVcsInfo(directory ?? '', serverId),
|
||||
enabled: enabled && Boolean(directory),
|
||||
retry: false,
|
||||
staleTime: 60_000,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user