mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(activity): animate the braille spinner in SVG and tighten the activity lists
- Draw the TUI braille spinner as a 2x4 SVG dot cell stepped by declarative <animate> timelines derived from SPINNER_FRAMES: no JavaScript timer or React render per frame, and it keeps animating under prefers-reduced-motion so an active session never looks stalled - Enlarge the spinner cell and dots so it stays legible next to 14px text - Add a compact ActivityList variant for the mobile More drawer and Repos sheet: one flat list capped at five rows, single-line rows, no group subheadings - Let ActivityList callers own navigation so a row tap navigates once instead of pushing a duplicate history entry - Share the picker keyboard navigation between the session and project tabs and reuse the shared session merge helpers in the sidebar repo groups
This commit is contained in:
1 parent
d8f2fcf29c
commit
8b6251d83b
24 files changed
+858
-787
No files matched your search
@@ -240,7 +240,7 @@ describe('EventProvider permissions and forms', () => {
|
||||
mocks.replyForm.mockResolvedValue(undefined)
|
||||
mocks.cancelForm.mockResolvedValue(undefined)
|
||||
mocks.getHealth.mockReturnValue({ isConnected: false, isHealthy: false, lastEventAt: null, isStalled: false })
|
||||
useSessionStatus.setState({ statuses: new Map(), statusCache: new Map(), statusRevisions: new Map(), knownSessions: new Set(), outcomes: new Map(), parents: new Map(), runningShells: new Map(), shellRevisions: new Map(), shellRevision: 0, revision: 0 })
|
||||
useSessionStatus.setState({ statuses: new Map(), statusCache: new Map(), statusRevisions: new Map(), knownSessions: new Set(), outcomes: new Map(), parents: new Map(), directories: new Map(), runningShells: new Map(), shellRevisions: new Map(), shellRevision: 0, revision: 0 })
|
||||
mocks.subscribeGlobalMonitor.mockReturnValue({
|
||||
dispose: vi.fn(),
|
||||
updateDirectories: vi.fn(),
|
||||
@@ -275,6 +275,18 @@ describe('EventProvider permissions and forms', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('records the session directory for a pending permission loaded without an SSE status event', async () => {
|
||||
mocks.listRepos.mockResolvedValue([{ id: 123, fullPath: '/repo' }])
|
||||
mocks.listPendingPermissions.mockResolvedValue([pendingPermission])
|
||||
|
||||
render(<Harness />, { wrapper: createWrapper() })
|
||||
|
||||
await waitFor(() => {
|
||||
expect(useSessionStatus.getState().directories.get('session-1')).toBe('/repo')
|
||||
})
|
||||
expect(useSessionStatus.getState().statuses.has('session-1')).toBe(false)
|
||||
})
|
||||
|
||||
it('clears stale pending permissions for a session', async () => {
|
||||
mocks.listPendingPermissions
|
||||
.mockResolvedValueOnce([pendingPermission])
|
||||
|
||||
@@ -126,7 +126,7 @@ function reconcileBySessionForDirectory<T extends SessionScopedItem>(
|
||||
prev: Record<string, T[]>,
|
||||
directory: string,
|
||||
items: T[],
|
||||
sessionDirectories: Map<string, string>,
|
||||
sessionDirectories: ReadonlyMap<string, string>,
|
||||
): Record<string, T[]> {
|
||||
const grouped = groupBySession(items)
|
||||
const next = { ...prev }
|
||||
@@ -273,7 +273,6 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
const [formsBySession, setFormsBySession] = useState<FormsBySession>({})
|
||||
const [showPermissionDialog, setShowPermissionDialog] = useState(true)
|
||||
|
||||
const sessionDirectoriesRef = useRef<Map<string, string>>(new Map())
|
||||
const prevPermissionCountRef = useRef(0)
|
||||
const initialFetchDoneRef = useRef(false)
|
||||
const statusSyncVersionRef = useRef(0)
|
||||
@@ -304,7 +303,7 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
|
||||
const rememberSessionDirectory = useCallback((sessionID: string, directory?: string) => {
|
||||
if (!directory) return
|
||||
sessionDirectoriesRef.current.set(sessionID, directory)
|
||||
useSessionStatus.getState().setSessionDirectory(sessionID, directory)
|
||||
}, [])
|
||||
|
||||
const findCachedSessionDirectory = useCallback((sessionID: string): string | null => {
|
||||
@@ -354,7 +353,7 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
}, [queryClient])
|
||||
|
||||
const findSessionDirectory = useCallback((sessionID: string): string | null => {
|
||||
const remembered = sessionDirectoriesRef.current.get(sessionID)
|
||||
const remembered = useSessionStatus.getState().directories.get(sessionID)
|
||||
if (remembered) return remembered
|
||||
return findCachedSessionDirectory(sessionID)
|
||||
}, [findCachedSessionDirectory])
|
||||
@@ -398,7 +397,7 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
})
|
||||
|
||||
setPermissionsBySession(prev =>
|
||||
reconcileBySessionForDirectory(prev, directory, permissions, sessionDirectoriesRef.current),
|
||||
reconcileBySessionForDirectory(prev, directory, permissions, useSessionStatus.getState().directories),
|
||||
)
|
||||
}, [rememberSessionDirectory])
|
||||
|
||||
@@ -408,7 +407,7 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
})
|
||||
|
||||
setFormsBySession(prev =>
|
||||
reconcileBySessionForDirectory(prev, directory, forms, sessionDirectoriesRef.current),
|
||||
reconcileBySessionForDirectory(prev, directory, forms, useSessionStatus.getState().directories),
|
||||
)
|
||||
}, [rememberSessionDirectory])
|
||||
|
||||
@@ -520,7 +519,7 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
for (const repo of reposRef.current ?? []) {
|
||||
if (repo.fullPath) directories.add(repo.fullPath)
|
||||
}
|
||||
for (const directory of sessionDirectoriesRef.current.values()) {
|
||||
for (const directory of useSessionStatus.getState().directories.values()) {
|
||||
if (directory) directories.add(directory)
|
||||
}
|
||||
return [...directories]
|
||||
@@ -659,9 +658,6 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
case 'permission.asked': {
|
||||
const request = event.data
|
||||
rememberSessionDirectory(request.sessionID, event.directory)
|
||||
if (event.directory) {
|
||||
useSessionStatus.getState().setSessionDirectory(request.sessionID, event.directory)
|
||||
}
|
||||
addPermission(request)
|
||||
if (!useSessionStatus.getState().parents.has(request.sessionID)) {
|
||||
void resolveSessionAncestry([request.sessionID])
|
||||
@@ -676,9 +672,6 @@ export function EventProvider({ children }: { children: React.ReactNode }) {
|
||||
case 'form.created': {
|
||||
const form = event.data.form
|
||||
rememberSessionDirectory(form.sessionID, event.directory)
|
||||
if (event.directory) {
|
||||
useSessionStatus.getState().setSessionDirectory(form.sessionID, event.directory)
|
||||
}
|
||||
addForm(form)
|
||||
if (!useSessionStatus.getState().parents.has(form.sessionID)) {
|
||||
void resolveSessionAncestry([form.sessionID])
|
||||
|
||||
Reference in new issue
Block a user