/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { type ProjectSummaryInfo } from '@qwen-code/qwen-code-core'; import { RadioButtonSelect, type RadioSelectItem, } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; interface WelcomeBackDialogProps { welcomeBackInfo: ProjectSummaryInfo; onSelect: (choice: 'restart' | 'continue') => void; onClose: () => void; } export function WelcomeBackDialog({ welcomeBackInfo, onSelect, onClose, }: WelcomeBackDialogProps) { useKeypress( (key) => { if (key.name === 'escape') { onClose(); } }, { isActive: true }, ); const options: Array> = [ { label: 'Start new chat session', value: 'restart', }, { label: 'Continue previous conversation', value: 'continue', }, ]; // Extract data from welcomeBackInfo const { timeAgo, goalContent, totalTasks = 0, doneCount = 0, inProgressCount = 0, pendingTasks = [], } = welcomeBackInfo; return ( 👋 Welcome back! (Last updated: {timeAgo}) {/* Overall Goal Section */} {goalContent && ( 🎯 Overall Goal: {goalContent} )} {/* Current Plan Section */} {totalTasks > 0 && ( 📋 Current Plan: Progress: {doneCount}/{totalTasks} tasks completed {inProgressCount > 0 && `, ${inProgressCount} in progress`} {pendingTasks.length > 0 && ( Pending Tasks: {pendingTasks.map((task: string, index: number) => ( • {task} ))} )} )} {/* Action Selection */} What would you like to do? Choose how to proceed with your session: ); }