mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
Refactor and optimize various components and files
- Removed deprecated `ccw-contentPattern-optimization-summary.md` and related files. - Updated `A2UIPopupCard.tsx` to clarify comments on interaction handling. - Enhanced `QueueListColumn.tsx` and `QueuePanel.tsx` to handle potential undefined values for `config`. - Added `useEffect` in `QueuePanel.tsx` to load scheduler state on mount. - Improved `SchedulerPanel.tsx` to handle potential undefined values for `sessionPool`. - Introduced auto-initialization logic in `queueSchedulerStore.ts` to prevent multiple initialization calls. - Updated `A2UIWebSocketHandler.ts` to refine selection handling logic. - Enhanced `hooks-routes.ts` to support multi-question surfaces. - Added submit and cancel buttons in `ask-question.ts` for better user interaction. - Deleted `codex_prompt.md` and `contentPattern-library-options.md` as part of cleanup. - Removed `status-reference.md` to streamline documentation.
This commit is contained in:
@@ -405,7 +405,7 @@ export class A2UIWebSocketHandler {
|
||||
case 'submit': {
|
||||
const otherText = this.inputValues.get(`__other__:${questionId}`);
|
||||
|
||||
// Check if this is a single-select or multi-select
|
||||
// Check if this is a single-select
|
||||
const singleSelection = this.singleSelectSelections.get(questionId);
|
||||
if (singleSelection !== undefined) {
|
||||
// Resolve __other__ to actual text input
|
||||
@@ -413,14 +413,27 @@ export class A2UIWebSocketHandler {
|
||||
this.inputValues.delete(`__other__:${questionId}`);
|
||||
return resolveAndCleanup({ questionId, value, cancelled: false });
|
||||
}
|
||||
// Multi-select submit
|
||||
const multiSelected = this.multiSelectSelections.get(questionId) ?? new Set<string>();
|
||||
// Resolve __other__ in multi-select: replace with actual text
|
||||
const values = Array.from(multiSelected).map(v =>
|
||||
v === '__other__' && otherText ? otherText : v
|
||||
);
|
||||
this.inputValues.delete(`__other__:${questionId}`);
|
||||
return resolveAndCleanup({ questionId, value: values, cancelled: false });
|
||||
|
||||
// Check if this is a multi-select
|
||||
const multiSelected = this.multiSelectSelections.get(questionId);
|
||||
if (multiSelected !== undefined && multiSelected.size > 0) {
|
||||
// Resolve __other__ in multi-select: replace with actual text
|
||||
const values = Array.from(multiSelected).map(v =>
|
||||
v === '__other__' && otherText ? otherText : v
|
||||
);
|
||||
this.inputValues.delete(`__other__:${questionId}`);
|
||||
return resolveAndCleanup({ questionId, value: values, cancelled: false });
|
||||
}
|
||||
|
||||
// Check if this is a text input (no selections, but has input value)
|
||||
const inputValue = this.inputValues.get(questionId);
|
||||
if (inputValue !== undefined) {
|
||||
this.inputValues.delete(questionId);
|
||||
return resolveAndCleanup({ questionId, value: inputValue, cancelled: false });
|
||||
}
|
||||
|
||||
// No value found - submit empty string
|
||||
return resolveAndCleanup({ questionId, value: '', cancelled: false });
|
||||
}
|
||||
|
||||
case 'input-change': {
|
||||
|
||||
@@ -343,7 +343,19 @@ export async function handleHooksRoutes(ctx: HooksRouteContext): Promise<boolean
|
||||
const initState = extraData.initialState as Record<string, unknown>;
|
||||
const questionId = initState.questionId as string | undefined;
|
||||
const questionType = initState.questionType as string | undefined;
|
||||
if (questionId && questionType === 'select') {
|
||||
|
||||
// Handle multi-question surfaces (multi-page): initialize tracking for each page
|
||||
if (questionType === 'multi-question' && Array.isArray(initState.pages)) {
|
||||
const pages = initState.pages as Array<{ questionId: string; type: string }>;
|
||||
for (const page of pages) {
|
||||
if (page.type === 'multi-select') {
|
||||
a2uiWebSocketHandler.initMultiSelect(page.questionId);
|
||||
} else if (page.type === 'select') {
|
||||
a2uiWebSocketHandler.initSingleSelect(page.questionId);
|
||||
}
|
||||
}
|
||||
} else if (questionId && questionType === 'select') {
|
||||
// Single-question surface: initialize based on question type
|
||||
a2uiWebSocketHandler.initSingleSelect(questionId);
|
||||
} else if (questionId && questionType === 'multi-select') {
|
||||
a2uiWebSocketHandler.initMultiSelect(questionId);
|
||||
|
||||
@@ -409,12 +409,37 @@ function generateQuestionSurface(question: Question, surfaceId: string, timeoutM
|
||||
component: {
|
||||
TextField: {
|
||||
value: question.defaultValue ? { literalString: String(question.defaultValue) } : undefined,
|
||||
onChange: { actionId: 'answer', parameters: { questionId: question.id } },
|
||||
onChange: { actionId: 'input-change', parameters: { questionId: question.id } },
|
||||
placeholder: question.placeholder || 'Enter your answer',
|
||||
type: 'text',
|
||||
},
|
||||
},
|
||||
});
|
||||
// Add Submit/Cancel buttons for input type
|
||||
components.push({
|
||||
id: 'submit-btn',
|
||||
component: {
|
||||
Button: {
|
||||
onClick: { actionId: 'submit', parameters: { questionId: question.id } },
|
||||
content: {
|
||||
Text: { text: { literalString: 'Submit' } },
|
||||
},
|
||||
variant: 'primary',
|
||||
},
|
||||
},
|
||||
});
|
||||
components.push({
|
||||
id: 'cancel-btn',
|
||||
component: {
|
||||
Button: {
|
||||
onClick: { actionId: 'cancel', parameters: { questionId: question.id } },
|
||||
content: {
|
||||
Text: { text: { literalString: 'Cancel' } },
|
||||
},
|
||||
variant: 'secondary',
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user