Support scenic-only scenes and blackout fades

This commit is contained in:
2026-04-10 16:40:42 -07:00
parent 679044d0b3
commit 4c6982bf68
7 changed files with 195 additions and 111 deletions
+4 -14
View File
@@ -198,7 +198,8 @@ const ensureSafeCue = (cues: Cue[]) => {
const mergeCollections = (state: RepositoryState, importedAssetIds: string[]) => {
const defaultCollectionIds = new Set(defaultCollections.map((collection) => collection.id));
const existingCollectionMap = new Map(state.collections.map((collection) => [collection.id, collection] as const));
const existingCollections = state.collections.filter((collection) => collection.kind !== "favorites");
const existingCollectionMap = new Map(existingCollections.map((collection) => [collection.id, collection] as const));
const mergedDefaults = defaultCollections.map((collection) => {
const existing = existingCollectionMap.get(collection.id);
@@ -218,7 +219,7 @@ const mergeCollections = (state: RepositoryState, importedAssetIds: string[]) =>
};
});
const customCollections = state.collections
const customCollections = existingCollections
.filter((collection) => !defaultCollectionIds.has(collection.id))
.map((collection) => ({
...collection,
@@ -296,7 +297,7 @@ const buildGeneratedCueDraft = (state: RepositoryState, payload: CueGeneratePayl
const usablePool =
assetPool.length >= scene.inputRules.minAssets ? assetPool : approvedAssets;
const maxAssets = Math.min(scene.inputRules.maxAssets ?? usablePool.length, usablePool.length);
const minAssets = Math.min(scene.inputRules.minAssets, maxAssets);
const minAssets = Math.min(Math.max(scene.inputRules.minAssets, usablePool.length > 0 ? 1 : 0), maxAssets);
const assetCount = Math.max(minAssets, Math.round(random(minAssets, maxAssets + 0.49)));
const selectedAssets = shuffle(usablePool).slice(0, assetCount);
@@ -543,10 +544,6 @@ export class StateStore {
submission.status = "approved_all";
asset.moderationStatus = "approved";
asset.approvedAt = new Date().toISOString();
const favorites = state.collections.find((collection) => collection.kind === "favorites");
if (favorites && !favorites.assetIds.includes(assetId)) {
favorites.assetIds.unshift(assetId);
}
} else {
submission.status = "pending_moderation";
}
@@ -619,13 +616,6 @@ export class StateStore {
})
);
if (payload.decision === "approved") {
const favorites = state.collections.find((collection) => collection.kind === "favorites");
if (favorites && !favorites.assetIds.includes(assetId)) {
favorites.assetIds.unshift(assetId);
}
}
if (payload.collectionIds?.length) {
const collections = state.collections.filter((collection) => payload.collectionIds?.includes(collection.id));
for (const collection of collections) {