Make New Workspace an app-wide screen (#1746)

* fix(app): make new workspace global

New Workspace now opens as an app-wide screen. Host and project context can still preselect the form through query params, but the route itself no longer lives under a host.

* fix(app): simplify new workspace selection
This commit is contained in:
Mohamed Boudra
2026-06-26 15:50:02 +08:00
committed by GitHub
parent 14a91d889c
commit 3fbd82664d
14 changed files with 140 additions and 89 deletions
@@ -976,11 +976,24 @@ function submitWorkspaceDraft(input: SubmitDraftInput): void {
function useNewWorkspaceHostSelector(initialServerId: string) {
const allHosts = useHosts();
const allServerIds = useMemo(() => allHosts.map((h) => h.serverId), [allHosts]);
const [selectedServerId, setSelectedServerId] = useState(initialServerId);
const lastWorkspaceSelection = useLastWorkspaceSelection();
const normalizedInitialServerId = initialServerId.trim();
const routeInitialServerId = allServerIds.includes(normalizedInitialServerId)
? normalizedInitialServerId
: null;
const fallbackServerId =
lastWorkspaceSelection && allServerIds.includes(lastWorkspaceSelection.serverId)
? lastWorkspaceSelection.serverId
: (allServerIds[0] ?? "");
const [manualServerId, setManualServerId] = useState<string | null>(null);
const [hostPickerOpen, setHostPickerOpen] = useState(false);
const selectedServerId =
manualServerId && allServerIds.includes(manualServerId)
? manualServerId
: (routeInitialServerId ?? fallbackServerId);
const handleSelectHost = useCallback((id: string) => {
setSelectedServerId(id);
setManualServerId(id);
setHostPickerOpen(false);
}, []);
@@ -996,9 +1009,7 @@ function useNewWorkspaceHostSelector(initialServerId: string) {
allHosts,
allServerIds,
selectedServerId,
setSelectedServerId,
hostPickerOpen,
setHostPickerOpen,
handleSelectHost,
handleHostPickerOpenChange,
openHostPicker,