geo/frontend/types/next-action.ts

61 lines
1.3 KiB
TypeScript

/**
* 下一步行动相关类型定义
*/
// 行动优先级
export type ActionPriority = "primary" | "secondary" | "optional";
// 行动项
export interface NextAction {
id: string;
priority: ActionPriority;
title: string;
description: string;
actionText: string;
actionUrl: string;
icon: string;
}
// 用户状态上下文
export interface ActionContext {
// 用户数据状态
hasData: boolean;
hasBrands: boolean;
brandCount: number;
overallScore: number;
scoreChange: number;
competitorCount: number;
hasQueryHistory: boolean;
// 当前页面上下文
currentPage: "dashboard" | "brand" | "compare";
brandId?: string;
}
// 行动建议生成参数
export interface ActionGenerationParams {
context: ActionContext;
cachedActions?: NextAction[];
}
// 行动建议规则
export interface ActionRule {
condition: (context: ActionContext) => boolean;
primaryAction: Omit<NextAction, "id" | "priority">;
secondaryAction: Omit<NextAction, "id" | "priority"> | null;
optionalAction: Omit<NextAction, "id" | "priority"> | null;
}
// 行动建议卡片Props
export interface NextActionCardProps {
context: ActionContext;
className?: string;
onActionClick?: (action: NextAction) => void;
}
// 行动建议项渲染Props
export interface ActionItemProps {
action: NextAction;
onClick?: () => void;
}