收口前端平台组件能力
新增 PlatformAsyncStatePanel 统一 profile 异步状态骨架 扩展 PlatformSegmentedTabs 支持滚动 tab 并接入创作入口与发现页 统一 PixelCloseButton 复用 PlatformModalCloseButton 像素关闭能力 抽取平台入口泥点前置提示弹层并收紧阻断语义 补充组件收口文档与共享决策记录
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import { PlatformAcknowledgeStatusDialog } from '../common/PlatformAcknowledgeStatusDialog';
|
||||
|
||||
export type DraftGenerationPointNotice =
|
||||
| {
|
||||
kind: 'insufficient-points';
|
||||
requiredPoints: number;
|
||||
currentPoints: number;
|
||||
}
|
||||
| {
|
||||
kind: 'balance-load-failed';
|
||||
};
|
||||
|
||||
type PlatformDraftGenerationPointNoticeDialogProps = {
|
||||
notice: DraftGenerationPointNotice | null;
|
||||
onClose: () => void;
|
||||
overlayClassName?: string;
|
||||
panelClassName?: string;
|
||||
zIndexClassName?: string;
|
||||
};
|
||||
|
||||
function resolveDraftGenerationPointNoticeTitle(
|
||||
notice: DraftGenerationPointNotice,
|
||||
) {
|
||||
return notice.kind === 'balance-load-failed' ? '读取泥点余额失败' : '泥点不足';
|
||||
}
|
||||
|
||||
function resolveDraftGenerationPointNoticeDescription(
|
||||
notice: DraftGenerationPointNotice,
|
||||
) {
|
||||
return notice.kind === 'balance-load-failed'
|
||||
? '当前表单不会丢失,关闭后可继续编辑,稍后再试。'
|
||||
: '当前表单不会丢失,关闭后可继续编辑或补足泥点再继续。';
|
||||
}
|
||||
|
||||
function resolveDraftGenerationPointNoticeMessage(
|
||||
notice: DraftGenerationPointNotice,
|
||||
) {
|
||||
return notice.kind === 'balance-load-failed'
|
||||
? '请稍后重试。'
|
||||
: `本次需要 ${notice.requiredPoints} 泥点,当前 ${notice.currentPoints} 泥点。`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创作前置泥点提示弹层。
|
||||
* 只承接平台入口里“泥点不足 / 读取余额失败”这类阻断提示,避免 FlowShell 直接拼底层状态弹窗。
|
||||
*/
|
||||
export function PlatformDraftGenerationPointNoticeDialog({
|
||||
notice,
|
||||
onClose,
|
||||
overlayClassName,
|
||||
panelClassName,
|
||||
zIndexClassName,
|
||||
}: PlatformDraftGenerationPointNoticeDialogProps) {
|
||||
if (!notice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<PlatformAcknowledgeStatusDialog
|
||||
status="error"
|
||||
title={resolveDraftGenerationPointNoticeTitle(notice)}
|
||||
description={resolveDraftGenerationPointNoticeDescription(notice)}
|
||||
onClose={onClose}
|
||||
showHeader
|
||||
showCloseButton
|
||||
closeOnBackdrop
|
||||
overlayClassName={overlayClassName}
|
||||
panelClassName={panelClassName}
|
||||
zIndexClassName={zIndexClassName}
|
||||
iconClassName={
|
||||
notice.kind === 'balance-load-failed'
|
||||
? undefined
|
||||
: 'bg-amber-100/80 text-amber-600'
|
||||
}
|
||||
>
|
||||
{resolveDraftGenerationPointNoticeMessage(notice)}
|
||||
</PlatformAcknowledgeStatusDialog>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user