mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 00:03:20 +00:00
fix(auth): clarify sign-out confirmation
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { OrcaProfileSignOutConfirmDialog } from './OrcaProfileSignOutConfirmDialog'
|
||||
|
||||
vi.mock('@/components/ui/dialog', () => ({
|
||||
Dialog: ({ children }: { children: ReactNode }) => <>{children}</>,
|
||||
DialogContent: ({ children }: { children: ReactNode }) => <div>{children}</div>,
|
||||
DialogDescription: ({ children }: { children: ReactNode }) => <p>{children}</p>,
|
||||
DialogFooter: ({ children }: { children: ReactNode }) => <footer>{children}</footer>,
|
||||
DialogHeader: ({ children }: { children: ReactNode }) => <header>{children}</header>,
|
||||
DialogTitle: ({ children }: { children: ReactNode }) => <h1>{children}</h1>
|
||||
}))
|
||||
|
||||
vi.mock('@/components/ui/button', () => ({
|
||||
Button: ({ children }: { children: ReactNode }) => <button>{children}</button>
|
||||
}))
|
||||
|
||||
describe('OrcaProfileSignOutConfirmDialog', () => {
|
||||
it('describes account sign-out without presenting a local profile or warning', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<OrcaProfileSignOutConfirmDialog
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
onConfirm={vi.fn()}
|
||||
signingOut={false}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(html).toContain('Sign out of Orca?')
|
||||
expect(html).toContain(
|
||||
'You'll be signed out of Orca on this device. Your local projects and worktrees won't be affected.'
|
||||
)
|
||||
expect(html).not.toContain('Personal')
|
||||
expect(html).not.toContain('alert-triangle')
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AlertTriangle, Loader2 } from 'lucide-react'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
@@ -14,28 +14,24 @@ export function OrcaProfileSignOutConfirmDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
onConfirm,
|
||||
profileName,
|
||||
signingOut
|
||||
}: {
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
onConfirm: () => void
|
||||
profileName: string
|
||||
signingOut: boolean
|
||||
}): React.JSX.Element {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-[420px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<AlertTriangle className="size-4 text-muted-foreground" />
|
||||
{translate('auto.components.orca.profiles.signout.confirm.title', 'Sign out?')}
|
||||
<DialogTitle>
|
||||
{translate('auto.components.orca.profiles.signout.confirm.title', 'Sign out of Orca?')}
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
{translate(
|
||||
'auto.components.orca.profiles.signout.confirm.description',
|
||||
'Sign out of {{profileName}} and keep its projects, worktrees, and local metadata on this device.',
|
||||
{ profileName }
|
||||
"You'll be signed out of Orca on this device. Your local projects and worktrees won't be affected."
|
||||
)}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -402,7 +402,6 @@ export function OrcaProfileSwitcher({
|
||||
onConfirm={() => {
|
||||
void handleConfirmSignOut()
|
||||
}}
|
||||
profileName={activeProfile.name}
|
||||
signingOut={signingOut}
|
||||
/>
|
||||
{multiProfileUi ? (
|
||||
|
||||
@@ -12874,8 +12874,8 @@
|
||||
},
|
||||
"signout": {
|
||||
"confirm": {
|
||||
"title": "Sign out?",
|
||||
"description": "Sign out of {{profileName}} and keep its projects, worktrees, and local metadata on this device.",
|
||||
"title": "Sign out of Orca?",
|
||||
"description": "You'll be signed out of Orca on this device. Your local projects and worktrees won't be affected.",
|
||||
"cancel": "Cancel",
|
||||
"action": "Sign out"
|
||||
}
|
||||
|
||||
@@ -12874,8 +12874,8 @@
|
||||
},
|
||||
"signout": {
|
||||
"confirm": {
|
||||
"title": "¿Cerrar sesión?",
|
||||
"description": "Cerrar sesión de {{profileName}} y mantener sus proyectos, worktrees y metadatos locales en este dispositivo.",
|
||||
"title": "¿Cerrar sesión en Orca?",
|
||||
"description": "Se cerrará tu sesión de Orca en este dispositivo. Tus proyectos y worktrees locales no se verán afectados.",
|
||||
"cancel": "Cancelar",
|
||||
"action": "Cerrar sesión"
|
||||
}
|
||||
|
||||
@@ -12874,8 +12874,8 @@
|
||||
},
|
||||
"signout": {
|
||||
"confirm": {
|
||||
"title": "ログアウトしますか?",
|
||||
"description": "{{profileName}}からログアウトし、プロジェクト、ワークツリー、ローカルメタデータをこのデバイスに保持します。",
|
||||
"title": "Orcaからログアウトしますか?",
|
||||
"description": "このデバイスでOrcaからログアウトします。ローカルのプロジェクトとワークツリーには影響しません。",
|
||||
"cancel": "キャンセル",
|
||||
"action": "ログアウト"
|
||||
}
|
||||
|
||||
@@ -12874,8 +12874,8 @@
|
||||
},
|
||||
"signout": {
|
||||
"confirm": {
|
||||
"title": "로그아웃하시겠습니까?",
|
||||
"description": "{{profileName}}에서 로그아웃하고 프로젝트, 워크트리 및 로컬 메타데이터를 이 장치에 유지합니다.",
|
||||
"title": "Orca에서 로그아웃할까요?",
|
||||
"description": "이 기기의 Orca에서 로그아웃됩니다. 로컬 프로젝트와 워크트리에는 영향을 주지 않습니다.",
|
||||
"cancel": "취소",
|
||||
"action": "로그아웃"
|
||||
}
|
||||
|
||||
@@ -12874,8 +12874,8 @@
|
||||
},
|
||||
"signout": {
|
||||
"confirm": {
|
||||
"title": "退出登录?",
|
||||
"description": "退出 {{profileName}},并在此设备上保留其项目、工作树和本地元数据。",
|
||||
"title": "退出 Orca?",
|
||||
"description": "你将在此设备上退出 Orca。本地项目和工作树不会受到影响。",
|
||||
"cancel": "取消",
|
||||
"action": "退出登录"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user