chore(vscode-ide-companion): remove the ui component of the active save session temporarily

This commit is contained in:
yiliang114
2025-11-29 18:29:43 +08:00
parent c038745897
commit 82205034cc
6 changed files with 1 additions and 338 deletions

View File

@@ -26,7 +26,6 @@ import { EmptyState } from './components/EmptyState.js';
import type { PlanEntry } from './components/PlanDisplay.js';
import { type CompletionItem } from './components/CompletionMenu.js';
import { useCompletionTrigger } from './hooks/useCompletionTrigger.js';
import { SaveSessionDialog } from './components/SaveSessionDialog.js';
import { InfoBanner } from './components/InfoBanner.js';
import { ChatHeader } from './components/layouts/ChatHeader.js';
import {
@@ -69,7 +68,6 @@ export const App: React.FC = () => {
const [editMode, setEditMode] = useState<EditMode>('ask');
const [thinkingEnabled, setThinkingEnabled] = useState(false);
const [isComposing, setIsComposing] = useState(false);
const [showSaveDialog, setShowSaveDialog] = useState(false);
// Completion system
const getCompletionItems = React.useCallback(
@@ -344,32 +342,6 @@ export const App: React.FC = () => {
[completion, inputFieldRef, setInputText, fileContext, vscode],
);
// Handle save session
const handleSaveSession = useCallback(
async (tag: string) => {
if (!sessionManagement.currentSessionId) {
return;
}
try {
vscode.postMessage({
type: 'saveSession',
data: {
sessionId: sessionManagement.currentSessionId,
tag,
},
});
// Assume success for now, as we don't get a response
sessionManagement.setSavedSessionTags((prev) => [...prev, tag]);
setShowSaveDialog(false);
} catch (error) {
console.error('[App] Error saving session:', error);
}
},
[sessionManagement, vscode],
);
// Handle attach context click
const handleAttachContextClick = useCallback(() => {
// Open native file picker (different from '@' completion which searches workspace files)
@@ -422,7 +394,6 @@ export const App: React.FC = () => {
<ChatHeader
currentSessionTitle={sessionManagement.currentSessionTitle}
onLoadSessions={sessionManagement.handleLoadQwenSessions}
onSaveSession={() => setShowSaveDialog(true)}
onNewSession={sessionManagement.handleNewQwenSession}
/>
@@ -621,13 +592,6 @@ export const App: React.FC = () => {
onCompletionClose={completion.closeCompletion}
/>
<SaveSessionDialog
isOpen={showSaveDialog}
onClose={() => setShowSaveDialog(false)}
onSave={handleSaveSession}
existingTags={sessionManagement.savedSessionTags}
/>
{permissionRequest && (
<PermissionDrawer
isOpen={!!permissionRequest}

View File

@@ -1,173 +0,0 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
/* Save Session Dialog Styles */
.dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.dialog-content {
background: var(--app-menu-background);
border: 1px solid var(--app-menu-border);
border-radius: var(--corner-radius-small);
min-width: 400px;
max-width: 500px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
font-size: var(--vscode-chat-font-size, 13px);
font-family: var(--vscode-chat-font-family);
}
.dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
border-bottom: 1px solid var(--app-menu-border);
}
.dialog-header h3 {
margin: 0;
font-weight: 600;
color: var(--app-primary-foreground);
}
.dialog-close {
background: transparent;
border: none;
cursor: pointer;
padding: 4px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
}
.dialog-close:hover {
background: var(--app-ghost-button-hover-background);
}
.dialog-body {
padding: 16px;
}
.form-group {
margin-bottom: 16px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: var(--app-primary-foreground);
}
.form-group input {
width: 100%;
padding: 8px 12px;
border: 1px solid var(--app-primary-border-color);
border-radius: 4px;
background: var(--vscode-input-background);
color: var(--vscode-input-foreground);
font-size: var(--vscode-chat-font-size, 13px);
font-family: var(--vscode-chat-font-family);
box-sizing: border-box;
}
.form-group input:focus {
outline: none;
border-color: var(--vscode-focusBorder);
}
.form-group input.error {
border-color: var(--vscode-inputValidation-errorBorder);
}
.form-help {
margin-top: 6px;
font-size: 0.9em;
color: var(--app-secondary-foreground);
opacity: 0.7;
}
.error-message {
margin-top: 6px;
font-size: 0.9em;
color: var(--vscode-inputValidation-errorForeground);
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 8px;
padding: 16px;
border-top: 1px solid var(--app-menu-border);
}
.primary-button,
.secondary-button {
padding: 6px 12px;
border-radius: 4px;
border: none;
font-size: var(--vscode-chat-font-size, 13px);
font-family: var(--vscode-chat-font-family);
cursor: pointer;
display: flex;
align-items: center;
gap: 6px;
}
.primary-button {
background: var(--vscode-button-background);
color: var(--vscode-button-foreground);
}
.primary-button:hover {
background: var(--vscode-button-hoverBackground);
}
.secondary-button {
background: var(--vscode-button-secondaryBackground);
color: var(--vscode-button-secondaryForeground);
}
.secondary-button:hover {
background: var(--vscode-button-secondaryHoverBackground);
}
/* Save Session Header Button */
.save-session-header-button {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
background: transparent;
border: 1px solid transparent;
border-radius: 4px;
cursor: pointer;
outline: none;
width: 28px;
height: 28px;
margin-right: 4px;
}
.save-session-header-button:hover {
background: var(--app-ghost-button-hover-background);
}
.save-session-header-button svg {
width: 16px;
height: 16px;
color: var(--app-primary-foreground);
}

View File

@@ -1,120 +0,0 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { useState, useEffect, useRef } from 'react';
import { CloseIcon } from './icons/index.js';
interface SaveSessionDialogProps {
isOpen: boolean;
onClose: () => void;
onSave: (tag: string) => void;
existingTags?: string[];
}
export const SaveSessionDialog: React.FC<SaveSessionDialogProps> = ({
isOpen,
onClose,
onSave,
existingTags = [],
}) => {
const [tag, setTag] = useState('');
const [error, setError] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (isOpen && inputRef.current) {
// Focus the input when dialog opens
setTimeout(() => {
inputRef.current?.focus();
}, 100);
}
}, [isOpen]);
useEffect(() => {
if (!isOpen) {
// Reset state when dialog closes
setTag('');
setError('');
}
}, [isOpen]);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!tag.trim()) {
setError('Please enter a name for this conversation');
return;
}
// Check if tag already exists
if (existingTags.includes(tag.trim())) {
setError(
'A conversation with this name already exists. Please choose a different name.',
);
return;
}
onSave(tag.trim());
};
if (!isOpen) {
return null;
}
return (
<div className="dialog-overlay" onClick={onClose}>
<div className="dialog-content" onClick={(e) => e.stopPropagation()}>
<div className="dialog-header">
<h3>Save Conversation</h3>
<button className="dialog-close" onClick={onClose} aria-label="Close">
<CloseIcon width="16" height="16" />
</button>
</div>
<form onSubmit={handleSubmit}>
<div className="dialog-body">
<div className="form-group">
<label htmlFor="session-tag">Conversation Name</label>
<input
ref={inputRef}
id="session-tag"
type="text"
value={tag}
onChange={(e) => {
setTag(e.target.value);
if (error) {
setError('');
}
}}
placeholder="e.g., project-planning, bug-fix, research"
className={error ? 'error' : ''}
/>
{error && <div className="error-message">{error}</div>}
<div className="form-help">
Give this conversation a meaningful name so you can find it
later
</div>
</div>
</div>
<div className="dialog-footer">
<button
type="button"
className="secondary-button"
onClick={onClose}
>
Cancel
</button>
<button type="submit" className="primary-button">
Save Conversation
</button>
</div>
</form>
</div>
</div>
);
};

View File

@@ -10,12 +10,7 @@
export type { IconProps } from './types.js';
// File icons
export {
FileIcon,
FileListIcon,
SaveDocumentIcon,
FolderIcon,
} from './FileIcons.js';
export { FileIcon, FileListIcon, FolderIcon } from './FileIcons.js';
// Navigation icons
export {

View File

@@ -10,14 +10,12 @@ import { ChevronDownIcon, PlusIcon } from '../icons/index.js';
interface ChatHeaderProps {
currentSessionTitle: string;
onLoadSessions: () => void;
onSaveSession: () => void;
onNewSession: () => void;
}
export const ChatHeader: React.FC<ChatHeaderProps> = ({
currentSessionTitle,
onLoadSessions,
onSaveSession: _onSaveSession,
onNewSession,
}) => (
<div

View File

@@ -8,7 +8,6 @@
*/
/* Import component styles */
@import '../components/SaveSessionDialog.css';
@import '../components/EmptyState.css';
@import '../components/CompletionMenu.css';
@import '../components/ContextPills.css';