mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(schedules): add workspace modes and worktree management
This commit is contained in:
1 parent
c06075651d
commit
6ec3f3bd91
90 files changed
+2084
-801
No files matched your search
@@ -3,21 +3,29 @@ import { openDialogParam, useDialogParam } from './useDialogParam'
|
||||
import { useUrlParams } from './useUrlParams'
|
||||
|
||||
const TERMINAL_DIALOG = 'terminal'
|
||||
const TERMINAL_DIALOG_PARAMS = ['terminal'] as const
|
||||
const TERMINAL_DIALOG_PARAMS = ['terminal', 'terminalDirectory'] as const
|
||||
|
||||
export function useTerminalDialogParam(): [boolean, (open: boolean) => void] {
|
||||
return useDialogParam(TERMINAL_DIALOG, TERMINAL_DIALOG_PARAMS)
|
||||
}
|
||||
|
||||
/**
|
||||
* The directory the terminal dialog was opened for, such as a repo worktree; null means the repo itself.
|
||||
*/
|
||||
export function useTerminalDirectoryParam(): string | null {
|
||||
const { searchParams } = useUrlParams()
|
||||
return searchParams.get('terminalDirectory')
|
||||
}
|
||||
|
||||
export function useOpenTerminal(): (
|
||||
terminalId: string,
|
||||
terminalId: string | null,
|
||||
extraParams?: Record<string, string>,
|
||||
) => void {
|
||||
const { updateParams } = useUrlParams()
|
||||
|
||||
return useCallback(
|
||||
(terminalId: string, extraParams?: Record<string, string>) => {
|
||||
openDialogParam(updateParams, TERMINAL_DIALOG, { terminal: terminalId, ...extraParams })
|
||||
(terminalId: string | null, extraParams?: Record<string, string>) => {
|
||||
openDialogParam(updateParams, TERMINAL_DIALOG, { ...(terminalId ? { terminal: terminalId } : {}), ...extraParams })
|
||||
},
|
||||
[updateParams],
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user