feat(cli): TUI grid threshold, narrow agents view, new-task popup, browser launch
- Lower the multi-panel grid threshold from 100×24 to 80×20 so standard terminals render the full layout instead of falling back to single-pane. - Agents view stacks list above detail when cols < 80; Tab focus model preserved. - Board view: press [n] to open a centered create-task popup. Title is edited via ink-text-input; submit calls TaskStore.createTask, refresh the task list on success. - System panel: shows the tokenized auth URL alongside the token, says "no auth" plainly when --no-auth was used, and prompts with "Press [Enter] to open in browser". Enter (while System is focused) spawns the platform's URL opener (open / start / xdg-open). - Tighten log-row layout: each row is now a single Text with inline spans + fixed-width prefix slot so columns align and the highlight bar spans the full row. - Default status section is "logs" so the live feed is what users see when they run `fn`. - Drop the ASCII circle brand mark from the splash; FUSION block letters + tagline + spinner only, pinned to the top-left. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import type { ProjectItem, TaskItem, InteractiveData } from "../state.js";
|
||||
|
||||
export interface ProjectsState {
|
||||
@@ -11,44 +11,60 @@ export interface TasksState {
|
||||
tasks: TaskItem[];
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
refresh: () => void;
|
||||
}
|
||||
|
||||
export function useProjects(interactiveData: InteractiveData | null): ProjectsState {
|
||||
const [state, setState] = useState<ProjectsState>({ projects: [], loading: false, error: null });
|
||||
const [projects, setProjects] = useState<ProjectItem[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!interactiveData) return;
|
||||
setState({ projects: [], loading: true, error: null });
|
||||
interactiveData.listProjects().then((projects) => {
|
||||
setState({ projects, loading: false, error: null });
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
interactiveData.listProjects().then((p) => {
|
||||
setProjects(p);
|
||||
setLoading(false);
|
||||
}).catch((err: unknown) => {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
setState({ projects: [], loading: false, error: message });
|
||||
setProjects([]);
|
||||
setLoading(false);
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
});
|
||||
}, [interactiveData]);
|
||||
|
||||
return state;
|
||||
return { projects, loading, error };
|
||||
}
|
||||
|
||||
export function useTasks(
|
||||
interactiveData: InteractiveData | null,
|
||||
selectedProject: ProjectItem | null,
|
||||
): TasksState {
|
||||
const [state, setState] = useState<TasksState>({ tasks: [], loading: false, error: null });
|
||||
const [tasks, setTasks] = useState<TaskItem[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [reloadTick, setReloadTick] = useState(0);
|
||||
|
||||
const refresh = useCallback(() => setReloadTick((n) => n + 1), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!interactiveData || !selectedProject) {
|
||||
setState({ tasks: [], loading: false, error: null });
|
||||
setTasks([]);
|
||||
setLoading(false);
|
||||
setError(null);
|
||||
return;
|
||||
}
|
||||
setState({ tasks: [], loading: true, error: null });
|
||||
interactiveData.listTasks(selectedProject.path).then((tasks) => {
|
||||
setState({ tasks, loading: false, error: null });
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
interactiveData.listTasks(selectedProject.path).then((t) => {
|
||||
setTasks(t);
|
||||
setLoading(false);
|
||||
}).catch((err: unknown) => {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
setState({ tasks: [], loading: false, error: message });
|
||||
setTasks([]);
|
||||
setLoading(false);
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
});
|
||||
}, [interactiveData, selectedProject]);
|
||||
}, [interactiveData, selectedProject, reloadTick]);
|
||||
|
||||
return state;
|
||||
return { tasks, loading, error, refresh };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user