Files
AIclinicalresearch/frontend-v2/src/modules/aia/protocol-agent/components/ActionCard.tsx
HaHafeng 303dd78c54 feat(aia): Protocol Agent MVP complete with one-click generation and Word export
- Add one-click research protocol generation with streaming output

- Implement Word document export via Pandoc integration

- Add dynamic dual-panel layout with resizable split pane

- Implement collapsible content for StatePanel stages

- Add conversation history management with title auto-update

- Fix scroll behavior, markdown rendering, and UI layout issues

- Simplify conversation creation logic for reliability
2026-01-25 19:16:36 +08:00

68 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Action Card - Deep Link 动作卡片
*
* 100%还原原型图Action Card设计
*/
import React from 'react';
import { Calculator, ExternalLink, Rocket } from 'lucide-react';
import type { ActionCard } from '../types';
interface ActionCardProps {
card: ActionCard;
}
const CARD_ICONS: Record<string, React.ComponentType<any>> = {
sample_size_calculator: Calculator,
generate_protocol: Rocket,
};
export const ActionCardComponent: React.FC<ActionCardProps> = ({ card }) => {
const Icon = CARD_ICONS[card.id] || Calculator;
const handleClick = () => {
if (card.type === 'tool') {
// 打开工具页面(新标签页或模态框)
window.open(card.actionUrl, '_blank');
} else if (card.type === 'action') {
// 触发动作(如一键生成)
// 这里会被父组件处理
console.log('Action triggered:', card.id);
}
};
return (
<div className={`action-card ${card.type}`} onClick={handleClick}>
<div className="action-card-header">
<div className="action-icon-box">
<Icon size={20} />
</div>
<div className="action-info">
<h3 className="action-title">{card.title}</h3>
<p className="action-description">{card.description}</p>
</div>
</div>
{card.type === 'tool' && (
<div className="action-footer">
<button className="action-button">
<span>🚀 </span>
<ExternalLink size={14} />
</button>
<p className="action-hint"></p>
</div>
)}
{card.type === 'action' && (
<button className="action-button primary">
<span></span>
<Rocket size={14} />
</button>
)}
</div>
);
};