mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Highlight current-folder sessions in resume browser
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { useState, useCallback, useMemo, useEffect } from 'react';
|
import { useState, useCallback, useMemo, useEffect } from 'react';
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
|
import path from 'node:path';
|
||||||
import { Colors } from '../colors.js';
|
import { Colors } from '../colors.js';
|
||||||
import { useTerminalSize } from '../hooks/useTerminalSize.js';
|
import { useTerminalSize } from '../hooks/useTerminalSize.js';
|
||||||
import { useKeypress } from '../hooks/useKeypress.js';
|
import { useKeypress } from '../hooks/useKeypress.js';
|
||||||
@@ -419,6 +420,18 @@ const formatTimestamp = (timestamp: string): string => {
|
|||||||
return parsed.toLocaleString();
|
return parsed.toLocaleString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isSessionFromCurrentFolder = (projectRoot?: string): boolean => {
|
||||||
|
if (!projectRoot) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return path.resolve(projectRoot) === path.resolve(process.cwd());
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const SessionDetailsPanel = ({
|
const SessionDetailsPanel = ({
|
||||||
session,
|
session,
|
||||||
}: {
|
}: {
|
||||||
@@ -505,11 +518,13 @@ const SessionItem = ({
|
|||||||
state.startIndex + state.visibleSessions.indexOf(session);
|
state.startIndex + state.visibleSessions.indexOf(session);
|
||||||
const isActive = originalIndex === state.activeIndex;
|
const isActive = originalIndex === state.activeIndex;
|
||||||
const isDisabled = session.isCurrentSession;
|
const isDisabled = session.isCurrentSession;
|
||||||
|
const isCurrentFolder = isSessionFromCurrentFolder(session.projectRoot);
|
||||||
|
const activeColor = isCurrentFolder ? Colors.AccentCyan : Colors.AccentPurple;
|
||||||
const textColor = (c: string = Colors.Foreground) => {
|
const textColor = (c: string = Colors.Foreground) => {
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
return Colors.Gray;
|
return Colors.Gray;
|
||||||
}
|
}
|
||||||
return isActive ? Colors.AccentPurple : c;
|
return isActive ? activeColor : c;
|
||||||
};
|
};
|
||||||
|
|
||||||
const prefix = isActive ? '❯ ' : ' ';
|
const prefix = isActive ? '❯ ' : ' ';
|
||||||
|
|||||||
Reference in New Issue
Block a user