From 2ec8f63cacd20b4295c1b6fdc9dc8a7021facb47 Mon Sep 17 00:00:00 2001 From: Zaki Ali Date: Wed, 8 Jan 2025 21:29:51 -0800 Subject: [PATCH] Fixes after rebase --- ui/desktop/src/LauncherWindow.tsx | 2 +- ui/desktop/src/components/MoreMenu.tsx | 162 ++++++++++++++----------- ui/desktop/src/goosed.ts | 5 +- 3 files changed, 92 insertions(+), 77 deletions(-) diff --git a/ui/desktop/src/LauncherWindow.tsx b/ui/desktop/src/LauncherWindow.tsx index c18916430..0d5b0589b 100644 --- a/ui/desktop/src/LauncherWindow.tsx +++ b/ui/desktop/src/LauncherWindow.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef } from 'react'; +import React, { useRef, useState } from 'react'; declare global { interface Window { diff --git a/ui/desktop/src/components/MoreMenu.tsx b/ui/desktop/src/components/MoreMenu.tsx index f5094dc98..e0a69ab35 100644 --- a/ui/desktop/src/components/MoreMenu.tsx +++ b/ui/desktop/src/components/MoreMenu.tsx @@ -1,4 +1,12 @@ -import { useEffect, useState } from 'react'; +import { + Popover, + PopoverContent, + PopoverTrigger, + PopoverPortal, +} from "@radix-ui/react-popover"; +import React, { useEffect, useState } from 'react'; +import { FaMoon, FaSun } from 'react-icons/fa'; +import VertDots from './ui/VertDots'; interface VersionInfo { current_version: string; @@ -115,81 +123,87 @@ export default function MoreMenu() { - -
-
- Use System Theme - -
- {!useSystemTheme && (
- {isDarkMode ? 'Dark Mode' : 'Light Mode'} - -
)} - - {/* Versions Menu */} - {versions && versions.available_versions.length > 0 && ( - <> + + +
+
+ Use System Theme + +
+ {!useSystemTheme && (
+ {isDarkMode ? 'Dark Mode' : 'Light Mode'} - {showVersions && ( -
- {versions.available_versions.map((version) => ( - - ))} -
- )} - - )} - - - -
- +
)} + + {/* Versions Menu */} + {versions && versions.available_versions.length > 0 && ( + <> + + {showVersions && ( +
+ {versions.available_versions.map((version) => ( + + ))} +
+ )} + + )} + + + +
+
+ ); } \ No newline at end of file diff --git a/ui/desktop/src/goosed.ts b/ui/desktop/src/goosed.ts index 64e98bb6d..041c8b1be 100644 --- a/ui/desktop/src/goosed.ts +++ b/ui/desktop/src/goosed.ts @@ -36,7 +36,7 @@ const fetchAgentVersion = async (port: number): Promise => { // Goose process manager. Take in the app, port, and directory to start goosed in. // Check if goosed server is ready by polling the status endpoint -const checkServerStatus = async (port: number, maxAttempts: number = 30, interval: number = 100): Promise => { +const checkServerStatus = async (port: number, maxAttempts: number = 60, interval: number = 100): Promise => { const statusUrl = `http://127.0.0.1:${port}/status`; log.info(`Checking server status at ${statusUrl}`); @@ -102,7 +102,7 @@ export const startGoosed = async (app, dir=null, env={}): Promise<[number, strin const processEnv = { ...process.env, ...additionalEnv }; // Spawn the goosed process with the user's home directory as cwd - const goosedProcess = spawn(goosedPath, [], { cwd: dir, env: processEnv, stdio: ["ignore", "pipe", "pipe"] }); + const goosedProcess = spawn(goosedPath, ["agent"], { cwd: dir, env: processEnv, stdio: ["ignore", "pipe", "pipe"] }); goosedProcess.stdout.on('data', (data) => { log.info(`goosed stdout for port ${port} and dir ${dir}: ${data.toString()}`); @@ -123,6 +123,7 @@ export const startGoosed = async (app, dir=null, env={}): Promise<[number, strin // Wait for the server to be ready const isReady = await checkServerStatus(port); + log.info(`Goosed isReady ${isReady}`); if (!isReady) { log.error(`Goosed server failed to start on port ${port}`); goosedProcess.kill();