@@ -184,6 +184,8 @@ const WORKER_STATUS_POLL_MS = 5000;
184184const DEFAULT_AUTH_NAME = "OpenWork User" ;
185185const OPENWORK_APP_CONNECT_BASE_URL = ( process . env . NEXT_PUBLIC_OPENWORK_APP_CONNECT_URL ?? "" ) . trim ( ) ;
186186const OPENWORK_AUTH_CALLBACK_BASE_URL = ( process . env . NEXT_PUBLIC_OPENWORK_AUTH_CALLBACK_URL ?? "https://app.openwork.software" ) . trim ( ) ;
187+ const OPENWORK_DOWNLOAD_URL = "https://openwork.software/" ;
188+ const OPENWORK_DOWNLOAD_FALLBACK_URL = "https://openwork.software/download" ;
187189const BILLING_DISABLED_FOR_EXPERIMENT = true ;
188190const STARTUP_ROTATION_MS = 2700 ;
189191const STARTUP_SEQUENCE : StartupSequenceItem [ ] = [
@@ -759,24 +761,11 @@ function getWorkerStatusCopy(status: string): string {
759761 }
760762}
761763
762- function getStatusIndicatorClasses ( bucket : WorkerStatusBucket ) {
764+ function getTrafficLightClasses ( bucket : WorkerStatusBucket ) {
763765 return {
764- pill :
765- bucket === "ready"
766- ? "bg-[#E8F5E9] text-[#2E7D32]"
767- : bucket === "starting"
768- ? "bg-amber-100 text-amber-700"
769- : bucket === "attention"
770- ? "bg-rose-100 text-rose-700"
771- : "bg-slate-100 text-slate-500" ,
772- dot :
773- bucket === "ready"
774- ? "bg-[#2E7D32]"
775- : bucket === "starting"
776- ? "bg-amber-500"
777- : bucket === "attention"
778- ? "bg-rose-500"
779- : "bg-slate-400"
766+ red : bucket === "attention" || bucket === "other" ? "bg-rose-500 shadow-[0_0_0_4px_rgba(244,63,94,0.16)]" : "bg-rose-100" ,
767+ amber : bucket === "starting" ? "bg-amber-500 shadow-[0_0_0_4px_rgba(245,158,11,0.16)]" : "bg-amber-100" ,
768+ green : bucket === "ready" ? "bg-emerald-500 shadow-[0_0_0_4px_rgba(16,185,129,0.16)]" : "bg-emerald-100"
780769 } ;
781770}
782771
@@ -1340,6 +1329,9 @@ export function CloudControlPanel() {
13401329 const [ runtimeBusy , setRuntimeBusy ] = useState ( false ) ;
13411330 const [ runtimeError , setRuntimeError ] = useState < string | null > ( null ) ;
13421331 const [ runtimeUpgradeBusy , setRuntimeUpgradeBusy ] = useState ( false ) ;
1332+ const [ dismissedDesktopPromptWorkerId , setDismissedDesktopPromptWorkerId ] = useState < string | null > ( null ) ;
1333+ const [ isDesktopViewport , setIsDesktopViewport ] = useState ( false ) ;
1334+
13431335 const selectedWorker = workers . find ( ( item ) => item . workerId === workerLookupId ) ?? null ;
13441336 const activeWorker : WorkerLaunch | null =
13451337 worker && workerLookupId === worker . workerId
@@ -1457,13 +1449,20 @@ export function CloudControlPanel() {
14571449
14581450 const selectedWorkerStatus = activeWorker ?. status ?? selectedWorker ?. status ?? "unknown" ;
14591451 const selectedStatusMeta = getWorkerStatusMeta ( selectedWorkerStatus ) ;
1460- const selectedStatusIndicator = getStatusIndicatorClasses ( selectedStatusMeta . bucket ) ;
1452+ const trafficLights = getTrafficLightClasses ( selectedStatusMeta . bucket ) ;
14611453 const primaryWorker = activeWorker ;
1462- const primaryAppUrl = openworkDeepLink ?? openworkAppConnectUrl ;
1454+ const primaryAppUrl = openworkDeepLink ;
14631455 const browserStartUrl = openworkAppConnectUrl ;
1464- const canStartWorker = selectedStatusMeta . bucket === "ready" && Boolean ( primaryAppUrl ?? browserStartUrl ) ;
1456+ const canOpenWorker = selectedStatusMeta . bucket === "ready" && Boolean ( primaryAppUrl ) ;
1457+ const canStartInOpenwork = selectedStatusMeta . bucket === "ready" && Boolean ( openworkDeepLink ) ;
1458+ const canStartHere = selectedStatusMeta . bucket === "ready" && Boolean ( browserStartUrl ) ;
14651459 const showStartupSequence = launchBusy || ( Boolean ( primaryWorker ) && selectedStatusMeta . bucket !== "ready" ) ;
1466- const showInlineStartupSequence = showStartupSequence ;
1460+ const showDesktopStartupModal =
1461+ isDesktopViewport &&
1462+ Boolean ( primaryWorker ) &&
1463+ selectedStatusMeta . bucket !== "ready" &&
1464+ dismissedDesktopPromptWorkerId !== primaryWorker ?. workerId ;
1465+ const showInlineStartupSequence = showStartupSequence && ! showDesktopStartupModal ;
14671466 const effectiveCheckoutUrl = BILLING_DISABLED_FOR_EXPERIMENT ? null : ( checkoutUrl ?? billingSummary ?. checkoutUrl ?? null ) ;
14681467 const billingSubscription = billingSummary ?. subscription ?? null ;
14691468 const billingPrice = billingSummary ?. price ?? null ;
@@ -1487,6 +1486,37 @@ export function CloudControlPanel() {
14871486 } ) ;
14881487 }
14891488
1489+ useEffect ( ( ) => {
1490+ if ( typeof window === "undefined" ) {
1491+ return ;
1492+ }
1493+
1494+ const mediaQuery = window . matchMedia ( "(min-width: 1024px)" ) ;
1495+ const handleChange = ( ) => setIsDesktopViewport ( mediaQuery . matches ) ;
1496+
1497+ handleChange ( ) ;
1498+ mediaQuery . addEventListener ( "change" , handleChange ) ;
1499+ return ( ) => mediaQuery . removeEventListener ( "change" , handleChange ) ;
1500+ } , [ ] ) ;
1501+
1502+ useEffect ( ( ) => {
1503+ if ( ! primaryWorker || selectedStatusMeta . bucket === "ready" ) {
1504+ setDismissedDesktopPromptWorkerId ( null ) ;
1505+ }
1506+ } , [ primaryWorker ?. workerId , selectedStatusMeta . bucket ] ) ;
1507+
1508+ useEffect ( ( ) => {
1509+ if ( ! showDesktopStartupModal || ! primaryWorker ) {
1510+ return ;
1511+ }
1512+
1513+ const timeout = window . setTimeout ( ( ) => {
1514+ setDismissedDesktopPromptWorkerId ( primaryWorker . workerId ) ;
1515+ } , 90_000 ) ;
1516+
1517+ return ( ) => window . clearTimeout ( timeout ) ;
1518+ } , [ primaryWorker , showDesktopStartupModal ] ) ;
1519+
14901520 async function withResolvedOpenworkCredentials ( candidate : WorkerLaunch , options : { quiet ?: boolean } = { } ) {
14911521 const existingConnectUrl = candidate . openworkUrl ?. trim ( ) ?? "" ;
14921522 const existingWorkspaceId = candidate . workspaceId ?. trim ( ) ?? "" ;
@@ -2883,10 +2913,10 @@ export function CloudControlPanel() {
28832913
28842914 { primaryWorker ? (
28852915 < div className = "rounded-[20px] border border-slate-200 bg-slate-50 p-3" >
2886- < div className = { `inline- flex items-center gap-2 rounded-full px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.14em] ${ selectedStatusIndicator . pill } ` } >
2887- < span className = { `h-2 w-2 rounded-full ${ selectedStatusIndicator . dot } ` } />
2888- < span > Status </ span >
2889- < span > { getSimplifiedStatusTitle ( selectedStatusMeta . bucket ) } </ span >
2916+ < div className = " flex items-center gap-2" >
2917+ < span className = { `h-3 w-3 rounded-full ${ trafficLights . red } ` } />
2918+ < span className = { `h-3 w-3 rounded-full ${ trafficLights . amber } ` } / >
2919+ < span className = { `h-3 w-3 rounded-full ${ trafficLights . green } ` } / >
28902920 </ div >
28912921 </ div >
28922922 ) : null }
@@ -2921,34 +2951,72 @@ export function CloudControlPanel() {
29212951 onClick = { handleLaunchWorker }
29222952 disabled = { ! user || launchBusy }
29232953 >
2924- { launchBusy ? "Starting the worker..." : "Start the worker" }
2954+ { launchBusy ? "Starting worker..." : "Start worker" }
29252955 </ button >
29262956 ) : (
29272957 < >
2928- { canStartWorker && ( primaryAppUrl ?? browserStartUrl ) ? (
2958+ { canOpenWorker && primaryAppUrl ? (
29292959 < a
2930- href = { primaryAppUrl ?? browserStartUrl ?? "#" }
2960+ href = { primaryAppUrl }
29312961 target = "_blank"
29322962 rel = "noreferrer"
2933- className = "block w-full rounded-[18px] bg-[#1B29FF] px-4 py-3 text-center text-base font-semibold text-white shadow-[0_14px_30px_rgba(27,41,255,0.22)] transition hover:bg-[#151FDA]"
2963+ className = "block w-full rounded-[18px] bg-[#1B29FF] px-4 py-3 text-center text-base font-semibold text-white shadow-[0_14px_30px_rgba(27,41,255,0.22)] transition hover:bg-[#151FDA] lg:hidden "
29342964 >
2935- Start the worker
2965+ Open in app
29362966 </ a >
29372967 ) : (
29382968 < button
29392969 type = "button"
29402970 disabled
2941- className = "w-full rounded-[18px] bg-slate-200 px-4 py-3 text-base font-semibold text-slate-500"
2971+ className = "w-full rounded-[18px] bg-slate-200 px-4 py-3 text-base font-semibold text-slate-500 lg:hidden "
29422972 >
2943- Start the worker
2973+ Open in app
29442974 </ button >
29452975 ) }
2976+
2977+ < div className = "hidden gap-3 lg:grid" >
2978+ { canStartInOpenwork && openworkDeepLink ? (
2979+ < a
2980+ href = { openworkDeepLink }
2981+ className = "block w-full rounded-[18px] bg-[#1B29FF] px-4 py-3 text-center text-base font-semibold text-white shadow-[0_14px_30px_rgba(27,41,255,0.22)] transition hover:bg-[#151FDA]"
2982+ >
2983+ Start in OpenWork
2984+ </ a >
2985+ ) : (
2986+ < button
2987+ type = "button"
2988+ disabled
2989+ className = "w-full rounded-[18px] bg-slate-200 px-4 py-3 text-base font-semibold text-slate-500"
2990+ >
2991+ Start in OpenWork
2992+ </ button >
2993+ ) }
2994+
2995+ { canStartHere && browserStartUrl ? (
2996+ < a
2997+ href = { browserStartUrl }
2998+ target = "_blank"
2999+ rel = "noreferrer"
3000+ className = "block w-full rounded-[18px] border border-slate-300 bg-white px-4 py-3 text-center text-base font-semibold text-slate-700 transition hover:border-slate-400 hover:text-slate-900"
3001+ >
3002+ Start here
3003+ </ a >
3004+ ) : (
3005+ < button
3006+ type = "button"
3007+ disabled
3008+ className = "w-full rounded-[18px] border border-slate-200 bg-slate-100 px-4 py-3 text-base font-semibold text-slate-400"
3009+ >
3010+ Start here
3011+ </ button >
3012+ ) }
3013+ </ div >
29463014 </ >
29473015 ) }
29483016
29493017 < p className = "text-xs leading-5 text-slate-500" >
29503018 { primaryWorker
2951- ? canStartWorker
3019+ ? canOpenWorker
29523020 ? "The start button unlocks as soon as the worker is ready."
29533021 : "The start button unlocks automatically when the worker is ready."
29543022 : "Founder Ops is the default name. Change it before launch if you want to." }
@@ -3048,7 +3116,6 @@ export function CloudControlPanel() {
30483116 </ div >
30493117 ) : null }
30503118
3051- { /* Preserved for later recovery: desktop download modal.
30523119 { showDesktopStartupModal ? (
30533120 < div
30543121 className = "fixed inset-0 z-50 hidden items-center justify-center bg-slate-950/10 p-5 backdrop-blur-[2px] lg:flex"
@@ -3141,7 +3208,6 @@ export function CloudControlPanel() {
31413208 </ div >
31423209 </ div >
31433210 ) : null }
3144- */ }
31453211
31463212 </ div >
31473213 </ section >
0 commit comments