init with react+axum+spacetimedb
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-26 18:06:23 +08:00
commit cbc27bad4a
20199 changed files with 883714 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import type {
CampaignPack,
CustomWorldProfile,
} from '../../types';
export interface ContentDiffReport {
summary: string;
changedFields: string[];
}
export function buildContentDiffReport(params: {
previousProfile: CustomWorldProfile | null | undefined;
nextProfile: CustomWorldProfile | null | undefined;
previousCampaignPack?: CampaignPack | null;
nextCampaignPack?: CampaignPack | null;
}) {
const changedFields: string[] = [];
if (params.previousProfile?.summary !== params.nextProfile?.summary) changedFields.push('profile.summary');
if (params.previousProfile?.scenarioPackId !== params.nextProfile?.scenarioPackId) changedFields.push('profile.scenarioPackId');
if (params.previousProfile?.campaignPackId !== params.nextProfile?.campaignPackId) changedFields.push('profile.campaignPackId');
if (params.previousCampaignPack?.authoringStyle !== params.nextCampaignPack?.authoringStyle) {
changedFields.push('campaignPack.authoringStyle');
}
if (params.previousCampaignPack?.actTemplates.length !== params.nextCampaignPack?.actTemplates.length) {
changedFields.push('campaignPack.actTemplates');
}
return {
summary:
changedFields.length > 0
? `当前版本相较上个版本改动了 ${changedFields.length} 个关键 narrative 字段。`
: '当前版本与上个版本相比没有明显 narrative 结构差异。',
changedFields,
} satisfies ContentDiffReport;
}