mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 08:03:14 +00:00
Gate the optional account sign-in UI to dev builds
The account switcher stays hidden in packaged builds while the feature is in progress. Dev builds still show it when the client env vars are set, and a dev-only Settings > Dev Tools > Orca Cloud section mirrors it. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -86,6 +86,15 @@ export function OrcaProfileSwitcher({
|
||||
}
|
||||
}, [fetchProfiles, loading, profiles.length])
|
||||
|
||||
// Why: the Orca Cloud account UX isn't ready for production users yet, so the
|
||||
// trigger stays hidden in packaged builds. Dev builds still show it when
|
||||
// cloud auth is configured, and a dev-only Settings > Dev Tools > Orca Cloud
|
||||
// section mirrors it. import.meta.env.PROD is true only in packaged builds
|
||||
// (false in dev and under vitest), so tests still exercise the render path.
|
||||
if (import.meta.env.PROD) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Why: paired web/mobile clients only see the desktop stub's fabricated
|
||||
// profile list; showing a switcher there would misreport the active profile
|
||||
// and none of its actions can work remotely.
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SettingsSubsectionHeader } from './SettingsFormControls'
|
||||
import { showDeleteWorktreeFailureToast } from '../sidebar/delete-worktree-failure-toast'
|
||||
import { showLocalBaseRefUpdateSuggestionToast } from '../sidebar/local-base-ref-suggestion-toast'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
|
||||
const LONG_WORKSPACE_NAME = 'feature/dev-toast-layout-with-a-long-workspace-name'
|
||||
@@ -124,6 +125,85 @@ function showDeleteFailureToast(): void {
|
||||
})
|
||||
}
|
||||
|
||||
// Dev-only preview of the first-party Orca Cloud sign-in. The sidebar/titlebar
|
||||
// account switcher is hidden in packaged builds while the feature is in
|
||||
// progress; this surfaces it (and its status) in dev when the env vars are set.
|
||||
function OrcaCloudDevSubsection(): React.JSX.Element {
|
||||
const authStatus = useAppStore((s) => s.orcaProfileAuthStatus)
|
||||
const connecting = useAppStore((s) => s.orcaProfileConnecting)
|
||||
const connect = useAppStore((s) => s.connectCurrentOrcaProfile)
|
||||
const signOut = useAppStore((s) => s.signOutCurrentOrcaProfile)
|
||||
const refresh = useAppStore((s) => s.fetchOrcaProfileAuthStatus)
|
||||
const configured = authStatus?.configured === true
|
||||
const connected = authStatus?.state === 'connected'
|
||||
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<SettingsSubsectionHeader
|
||||
title={translate('auto.components.settings.DevToolsPane.orcaCloud', 'Orca Cloud')}
|
||||
description={translate(
|
||||
'auto.components.settings.DevToolsPane.orcaCloudDescription',
|
||||
'Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.'
|
||||
)}
|
||||
/>
|
||||
<Badge variant="outline" className="mt-0.5">
|
||||
{translate('auto.components.settings.DevToolsPane.devOnly', 'Dev only')}
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
{configured ? (
|
||||
<div className="space-y-2">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{translate('auto.components.settings.DevToolsPane.orcaCloudStatus', 'Status')}:{' '}
|
||||
<span className="font-medium text-foreground">{authStatus?.state}</span>
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{connected ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={connecting}
|
||||
onClick={() => void signOut()}
|
||||
>
|
||||
{translate('auto.components.settings.DevToolsPane.orcaCloudSignOut', 'Sign out')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={connecting}
|
||||
onClick={() => void connect()}
|
||||
>
|
||||
{translate(
|
||||
'auto.components.settings.DevToolsPane.orcaCloudConnect',
|
||||
'Connect profile'
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
<Button type="button" variant="ghost" size="sm" onClick={() => void refresh()}>
|
||||
{translate(
|
||||
'auto.components.settings.DevToolsPane.orcaCloudRefresh',
|
||||
'Refresh status'
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{authStatus?.setupMessage ??
|
||||
translate(
|
||||
'auto.components.settings.DevToolsPane.orcaCloudNotConfigured',
|
||||
'Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build.'
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export function DevToolsPane(): React.JSX.Element {
|
||||
const actions: DevToastAction[] = [
|
||||
{
|
||||
@@ -221,28 +301,32 @@ export function DevToolsPane(): React.JSX.Element {
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<SettingsSubsectionHeader
|
||||
title={translate(
|
||||
'auto.components.settings.DevToolsPane.notificationPlayground',
|
||||
'Notification playground'
|
||||
)}
|
||||
description={translate(
|
||||
'auto.components.settings.DevToolsPane.notificationPlaygroundDescription',
|
||||
'Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.'
|
||||
)}
|
||||
/>
|
||||
<Badge variant="outline" className="mt-0.5">
|
||||
{translate('auto.components.settings.DevToolsPane.devOnly', 'Dev only')}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="space-y-8">
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<SettingsSubsectionHeader
|
||||
title={translate(
|
||||
'auto.components.settings.DevToolsPane.notificationPlayground',
|
||||
'Notification playground'
|
||||
)}
|
||||
description={translate(
|
||||
'auto.components.settings.DevToolsPane.notificationPlaygroundDescription',
|
||||
'Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.'
|
||||
)}
|
||||
/>
|
||||
<Badge variant="outline" className="mt-0.5">
|
||||
{translate('auto.components.settings.DevToolsPane.devOnly', 'Dev only')}
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2 sm:grid-cols-2">
|
||||
{actions.map((action) => (
|
||||
<DevToastActionButton key={action.title} action={action} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<div className="grid gap-2 sm:grid-cols-2">
|
||||
{actions.map((action) => (
|
||||
<DevToastActionButton key={action.title} action={action} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<OrcaCloudDevSubsection />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8676,7 +8676,14 @@
|
||||
"behindBaseRefToastDescription": "Persistent prompt with an inline Settings link and footer action.",
|
||||
"notificationPlayground": "Notification playground",
|
||||
"notificationPlaygroundDescription": "Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.",
|
||||
"devOnly": "Dev only"
|
||||
"devOnly": "Dev only",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"orcaCloudDescription": "Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.",
|
||||
"orcaCloudStatus": "Status",
|
||||
"orcaCloudSignOut": "Sign out",
|
||||
"orcaCloudConnect": "Connect profile",
|
||||
"orcaCloudRefresh": "Refresh status",
|
||||
"orcaCloudNotConfigured": "Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build."
|
||||
},
|
||||
"EphemeralVmRecipeRow": {
|
||||
"useInWorkspace": "Use in workspace"
|
||||
|
||||
@@ -8676,7 +8676,14 @@
|
||||
"behindBaseRefToastDescription": "Persistent prompt with an inline Settings link and footer action.",
|
||||
"notificationPlayground": "Notification playground",
|
||||
"notificationPlaygroundDescription": "Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.",
|
||||
"devOnly": "Dev only"
|
||||
"devOnly": "Dev only",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"orcaCloudDescription": "Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.",
|
||||
"orcaCloudStatus": "Status",
|
||||
"orcaCloudSignOut": "Sign out",
|
||||
"orcaCloudConnect": "Connect profile",
|
||||
"orcaCloudRefresh": "Refresh status",
|
||||
"orcaCloudNotConfigured": "Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build."
|
||||
},
|
||||
"EphemeralVmRecipeRow": {
|
||||
"useInWorkspace": "Usar en el espacio de trabajo"
|
||||
|
||||
@@ -8676,7 +8676,14 @@
|
||||
"behindBaseRefToastDescription": "インラインの設定リンクとフッターアクション付きの永続プロンプト。",
|
||||
"notificationPlayground": "Notification playground",
|
||||
"notificationPlaygroundDescription": "Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.",
|
||||
"devOnly": "Dev only"
|
||||
"devOnly": "Dev only",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"orcaCloudDescription": "Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.",
|
||||
"orcaCloudStatus": "Status",
|
||||
"orcaCloudSignOut": "Sign out",
|
||||
"orcaCloudConnect": "Connect profile",
|
||||
"orcaCloudRefresh": "Refresh status",
|
||||
"orcaCloudNotConfigured": "Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build."
|
||||
},
|
||||
"EphemeralVmRecipeRow": {
|
||||
"useInWorkspace": "ワークスペースでの使用"
|
||||
|
||||
@@ -8676,7 +8676,14 @@
|
||||
"behindBaseRefToastDescription": "인라인 설정 링크와 바닥글 작업이 있는 영구 프롬프트입니다.",
|
||||
"notificationPlayground": "Notification playground",
|
||||
"notificationPlaygroundDescription": "Dev-only triggers for checking toast layout, recovery actions, and long-copy wrapping.",
|
||||
"devOnly": "Dev only"
|
||||
"devOnly": "Dev only",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"orcaCloudDescription": "Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.",
|
||||
"orcaCloudStatus": "Status",
|
||||
"orcaCloudSignOut": "Sign out",
|
||||
"orcaCloudConnect": "Connect profile",
|
||||
"orcaCloudRefresh": "Refresh status",
|
||||
"orcaCloudNotConfigured": "Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build."
|
||||
},
|
||||
"EphemeralVmRecipeRow": {
|
||||
"useInWorkspace": "워크스페이스에서 사용"
|
||||
|
||||
@@ -8676,7 +8676,14 @@
|
||||
"behindBaseRefToastDescription": "带有内联设置链接和底部操作按钮的持久提示。",
|
||||
"notificationPlayground": "通知测试面板",
|
||||
"notificationPlaygroundDescription": "用于检查提示布局、恢复操作和长文案换行的开发触发器。",
|
||||
"devOnly": "仅开发"
|
||||
"devOnly": "仅开发",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"orcaCloudDescription": "Dev-only preview of first-party cloud sign-in. Hidden in production; in dev it also appears in the sidebar account switcher once ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID are set.",
|
||||
"orcaCloudStatus": "Status",
|
||||
"orcaCloudSignOut": "Sign out",
|
||||
"orcaCloudConnect": "Connect profile",
|
||||
"orcaCloudRefresh": "Refresh status",
|
||||
"orcaCloudNotConfigured": "Set ORCA_CLOUD_API_URL and ORCA_CLOUD_CLIENT_ID to preview Orca Cloud sign-in in this dev build."
|
||||
},
|
||||
"EphemeralVmRecipeRow": {
|
||||
"useInWorkspace": "在工作区中使用"
|
||||
|
||||
Reference in New Issue
Block a user