Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep the store out of the sign-in page: windowPlaceName lives in lib/places
AdityaUmale4c47f78e9d01
diff --git a/src/components/DesktopWorkspaceSwitcher.tsx b/src/components/DesktopWorkspaceSwitcher.tsxindex ec4e2d76d0..a0fbb420d0 100644--- a/src/components/DesktopWorkspaceSwitcher.tsx+++ b/src/components/DesktopWorkspaceSwitcher.tsx@@ -6,10 +6,9 @@ import type { Action } from "@/state/store";import type { CloudPlanSnapshot } from "../../electron/cloud-account.mjs";import { cloudColor } from "@/lib/cloud-look";import { t } from "@/lib/i18n";-import { railShown, usePlaces } from "@/lib/places";+import { railShown, usePlaces, windowPlaceName } from "@/lib/places";import { CloudTile } from "./cloud-buy/parts";import { SIMPLE_RAIL_BUTTON } from "./SidebarSimpleTop";-import { windowPlaceName } from "./WindowPlaceTitle";export function openServerMenu(bridge: { menu: (options?: { from?: "howto" }) => Promise<void> }, { howTo = false, onClosed }: { howTo?: boolean; onClosed?: () => void } = {}): Promise<void> {return bridge.menu(howTo ? { from: "howto" } : undefined).finally(() => { if (howTo) onClosed?.(); });diff --git a/src/components/WindowPlaceTitle.tsx b/src/components/WindowPlaceTitle.tsxindex df7a38153b..5a7ee9ea07 100644--- a/src/components/WindowPlaceTitle.tsx+++ b/src/components/WindowPlaceTitle.tsx@@ -1,11 +1,10 @@import { useEffect, useState } from "react";-import { t } from "@/lib/i18n";import { usePlaceLook } from "@/lib/place-look";-import { computerName } from "@/lib/places";+import { type WorkspaceState, windowPlaceName } from "@/lib/places";import { useStore } from "@/state/store";import { PlaceMark } from "./PlacesRail";-type WorkspaceState = Awaited<ReturnType<NonNullable<NonNullable<typeof window.ogb>["workspaces"]>["state"]>>;+export { windowPlaceName };/** The place this window shows, as main tells this page: null in a browser, on a remote client, or until main answers. */export function useWindowPlace(): WorkspaceState | null {@@ -22,15 +21,6 @@ export function useWindowPlace(): WorkspaceState | null {return place;}-const CLOUD_HOME_NAME = "My Cloud";--export function windowPlaceName(place: WorkspaceState, team: string | undefined): string {- if (place.home) return team || (place.name && place.name !== CLOUD_HOME_NAME ? place.name : t("cloudSetup.myCloud"));- if (place.profile) return place.profileName || computerName({ profile: place.profile });- if (place.local && !place.localPath) return t("rail.thisComputer");- return place.name;-}-/** The middle of the window frame's top bar: the place on screen, its mark as the rail draws it and its name, quiet. It* stays part of the bar's drag region. */export function WindowPlaceTitle() {diff --git a/src/lib/places.ts b/src/lib/places.tsindex 2c3d1b877a..f3d159b906 100644--- a/src/lib/places.ts+++ b/src/lib/places.ts@@ -91,6 +91,18 @@ export function computerName(place: Pick<RailPlace, "profile"> & Partial<Pick<Rareturn place.profile && place.named && place.name ? place.name : t("rail.thisComputer");}+export type WorkspaceState = Awaited<ReturnType<NonNullable<NonNullable<typeof window.ogb>["workspaces"]>["state"]>>;++const CLOUD_HOME_NAME = "My Cloud";++/** The name of the place a window shows: its team, the Cloud's own name, the workspace or This computer. */+export function windowPlaceName(place: WorkspaceState, team: string | undefined): string {+ if (place.home) return team || (place.name && place.name !== CLOUD_HOME_NAME ? place.name : t("cloudSetup.myCloud"));+ if (place.profile) return place.profileName || computerName({ profile: place.profile });+ if (place.local && !place.localPath) return t("rail.thisComputer");+ return place.name;+}+/** A new workspace's first name: Work, then Personal, then Workspace 2, 3 and on, whichever no place here has yet. */export function suggestedLocalName(taken: readonly string[]): string {const used = new Set(taken.map((name) => name.toLocaleLowerCase()));