Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(profile-ui): expose desktop setup states r1-l1
Josué17e90aaf6ef1
diff --git a/profile-ui/app/components/__tests__/ProfilePortalHome.test.tsx b/profile-ui/app/components/__tests__/ProfilePortalHome.test.tsxindex 69c615de1..ccbd02353 100644--- a/profile-ui/app/components/__tests__/ProfilePortalHome.test.tsx+++ b/profile-ui/app/components/__tests__/ProfilePortalHome.test.tsx@@ -50,6 +50,30 @@ beforeEach(() => {afterEach(cleanup)describe('Profile Portal home desktop setup link', () => {+ it('shows a loading status while desktop setup availability is checked', () => {+ api.getDesktopEnvironment.mockReturnValue(new Promise(() => {}))++ render(<Page />)++ expect(screen.getByRole('status')).toHaveTextContent('Checking desktop app setup…')+ expect(screen.queryByRole('link', { name: 'Set up Desktop App' })).not.toBeInTheDocument()+ })++ it('explains unavailable setup and links to Settings when discovery fails', async () => {+ api.getDesktopEnvironment.mockRejectedValue(new Error('Service unavailable'))++ render(<Page />)++ const unavailableStatus = await screen.findByRole('status')++ expect(unavailableStatus).toHaveTextContent('Desktop app setup is unavailable right now.')+ expect(screen.getByRole('link', { name: 'Settings' })).toHaveAttribute(+ 'href',+ '/settings/profile'+ )+ expect(screen.queryByRole('link', { name: 'Set up Desktop App' })).not.toBeInTheDocument()+ })+it('labels the environment setup handoff accurately', async () => {render(<Page />)diff --git a/profile-ui/app/page.tsx b/profile-ui/app/page.tsxindex f10ee131f..c16333d44 100644--- a/profile-ui/app/page.tsx+++ b/profile-ui/app/page.tsx@@ -1,9 +1,11 @@'use client'import { useEffect, useState } from 'react'+import Link from 'next/link'import { useAuth } from '@components/AuthContext'import { AuthGate } from '@components/AuthGate'import { IconExternalLink } from '@components/icons'+import { PROFILE_ROUTES } from '@constants/routes'import { getDesktopEnvironment } from '@lib/api'import { buildDesktopEnvironmentLink } from '@lib/desktopAppLinks'@@ -11,16 +13,20 @@ function HomeContent() {const { authState } = useAuth()const me = authState.meconst displayName = me?.profile?.displayName || me?.name || me?.email || 'there'- const [desktopAppHref, setDesktopAppHref] = useState<string | null>(null)+ const [desktopAppLink, setDesktopAppLink] = useState<+ { state: 'loading' } | { state: 'ready'; href: string } | { state: 'unavailable' }+ >({ state: 'loading' })useEffect(() => {let isCurrent = truevoid getDesktopEnvironment().then(environment => {- if (isCurrent) setDesktopAppHref(buildDesktopEnvironmentLink(environment))+ if (!isCurrent) return+ const href = buildDesktopEnvironmentLink(environment)+ setDesktopAppLink(href ? { state: 'ready', href } : { state: 'unavailable' })}).catch(() => {- if (isCurrent) setDesktopAppHref(null)+ if (isCurrent) setDesktopAppLink({ state: 'unavailable' })})return () => {@@ -42,21 +48,23 @@ function HomeContent() {<p className="body-copy">You are signed in to the Evenfire <strong>Profile Portal</strong>.</p>- <p className="body-copy">- {desktopAppHref ? (- <a className="cu-home-desktop-link" href={desktopAppHref}>- Set up Desktop App <IconExternalLink />- </a>- ) : (- <span- className="cu-home-desktop-link cu-home-desktop-link--unavailable"- aria-disabled="true"- >+ {desktopAppLink.state === 'loading' ? (+ <p className="body-copy" role="status" aria-live="polite">+ Checking desktop app setup…+ </p>+ ) : desktopAppLink.state === 'unavailable' ? (+ <p className="body-copy" role="status" aria-live="polite">+ Desktop app setup is unavailable right now. Visit{' '}+ <Link href={PROFILE_ROUTES.settings.profile}>Settings</Link> to review setup options.+ </p>+ ) : (+ <p className="body-copy">+ <a className="cu-home-desktop-link" href={desktopAppLink.href}>Set up Desktop App <IconExternalLink />- </span>- )}{' '}- instead- </p>+ </a>{' '}+ instead+ </p>+ )}</div></div>diff --git a/profile-ui/package-lock.json b/profile-ui/package-lock.jsonindex fa0166975..ae4b15ce9 100644--- a/profile-ui/package-lock.json+++ b/profile-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-profile-ui",- "version": "0.1.146",+ "version": "0.1.147","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-profile-ui",- "version": "0.1.146",+ "version": "0.1.147","dependencies": {"@clerum/desktop-app-links": "file:../packages/desktop-app-links","@clerum/frontend-components": "file:../packages/frontend-components",diff --git a/profile-ui/package.json b/profile-ui/package.jsonindex b0d3d18c7..b40c8dca6 100644--- a/profile-ui/package.json+++ b/profile-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-profile-ui",- "version": "0.1.146",+ "version": "0.1.147","private": true,"scripts": {"dev": "next dev",