Sync local updates with origin/master
This commit is contained in:
@@ -352,6 +352,7 @@ import {
|
||||
type WoodenFishWorkProfileResponse,
|
||||
type WoodenFishWorkspaceCreateRequest,
|
||||
} from '../../services/wooden-fish/woodenFishClient';
|
||||
import type { WoodenFishWorkSummaryResponse } from '../../../packages/shared/src/contracts/woodenFish';
|
||||
import type { CustomWorldProfile } from '../../types';
|
||||
import { useAuthUi } from '../auth/AuthUiContext';
|
||||
import { PublishShareModal } from '../common/PublishShareModal';
|
||||
@@ -2384,6 +2385,15 @@ function getGenerationNoticeShelfKeys(item: CreationWorkShelfItem): string[] {
|
||||
item.source.item.workId,
|
||||
item.source.item.draftId,
|
||||
]);
|
||||
case 'wooden-fish':
|
||||
return collectDraftNoticeKeys('wooden-fish', [
|
||||
item.id,
|
||||
item.source.item.workId,
|
||||
item.source.item.profileId,
|
||||
item.source.item.sourceSessionId,
|
||||
]);
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3173,6 +3183,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
>(null);
|
||||
const [woodenFishWork, setWoodenFishWork] =
|
||||
useState<WoodenFishWorkProfileResponse | null>(null);
|
||||
const [woodenFishWorks, setWoodenFishWorks] = useState<
|
||||
WoodenFishWorkSummaryResponse[]
|
||||
>([]);
|
||||
const [woodenFishGalleryEntries, setWoodenFishGalleryEntries] = useState<
|
||||
WoodenFishGalleryCardResponse[]
|
||||
>([]);
|
||||
@@ -3920,6 +3933,20 @@ export function PlatformEntryFlowShellImpl({
|
||||
}
|
||||
}, []);
|
||||
|
||||
const refreshWoodenFishShelf = useCallback(async () => {
|
||||
try {
|
||||
const worksResponse = await woodenFishClient.listWorks();
|
||||
setWoodenFishWorks(worksResponse.items);
|
||||
return worksResponse.items;
|
||||
} catch (error) {
|
||||
setWoodenFishWorks([]);
|
||||
setWoodenFishError(
|
||||
resolvePuzzleErrorMessage(error, '读取敲木鱼作品列表失败。'),
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}, [resolvePuzzleErrorMessage]);
|
||||
|
||||
const refreshPuzzleShelf = useCallback(async () => {
|
||||
setIsPuzzleLoadingLibrary(true);
|
||||
|
||||
@@ -4499,6 +4526,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
],
|
||||
[jumpHopWorks, pendingDraftShelfItems],
|
||||
);
|
||||
const woodenFishShelfItems = useMemo(
|
||||
() => woodenFishWorks,
|
||||
[woodenFishWorks],
|
||||
);
|
||||
const match3dShelfItems = useMemo(
|
||||
() => [
|
||||
...buildPendingMatch3DWorks(pendingDraftShelfItems.match3d, match3dWorks),
|
||||
@@ -4581,6 +4612,13 @@ export function PlatformEntryFlowShellImpl({
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...woodenFishShelfItems.flatMap((item) =>
|
||||
collectDraftNoticeKeys('wooden-fish', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...match3dShelfItems.flatMap((item) =>
|
||||
collectDraftNoticeKeys('match3d', [
|
||||
item.workId,
|
||||
@@ -4624,6 +4662,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
barkBattleShelfItems,
|
||||
bigFishShelfItems,
|
||||
jumpHopShelfItems,
|
||||
woodenFishShelfItems,
|
||||
creationHubItems,
|
||||
isSquareHoleCreationVisible,
|
||||
match3dShelfItems,
|
||||
@@ -9088,6 +9127,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
try {
|
||||
const response = await woodenFishClient.publishWork(profileId);
|
||||
setWoodenFishWork(response.item);
|
||||
void refreshWoodenFishShelf();
|
||||
void refreshWoodenFishGallery();
|
||||
openPublishShareModal({
|
||||
title: response.item.summary.workTitle || '敲木鱼',
|
||||
publicWorkCode: buildWoodenFishPublicWorkCode(
|
||||
@@ -9105,6 +9146,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
}
|
||||
}, [
|
||||
openPublishShareModal,
|
||||
refreshWoodenFishGallery,
|
||||
refreshWoodenFishShelf,
|
||||
setSelectionStage,
|
||||
woodenFishWork?.summary.profileId,
|
||||
]);
|
||||
@@ -11750,6 +11793,48 @@ export function PlatformEntryFlowShellImpl({
|
||||
[openPublicWorkDetail, setSelectionStage],
|
||||
);
|
||||
|
||||
const openWoodenFishDraft = useCallback(
|
||||
async (item: WoodenFishWorkSummaryResponse) => {
|
||||
markDraftNoticeSeen(
|
||||
collectDraftNoticeKeys('wooden-fish', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
);
|
||||
|
||||
if (item.publicationStatus === 'published') {
|
||||
void openWoodenFishPublicWorkDetail(item.profileId);
|
||||
return;
|
||||
}
|
||||
|
||||
setWoodenFishError(null);
|
||||
setPublicWorkDetailError(null);
|
||||
setIsWoodenFishBusy(true);
|
||||
try {
|
||||
const detail = await woodenFishClient.getWorkDetail(item.profileId);
|
||||
setWoodenFishSession(null);
|
||||
setWoodenFishRun(null);
|
||||
setWoodenFishWork(detail.item);
|
||||
setWoodenFishRuntimeReturnStage('wooden-fish-result');
|
||||
enterCreateTab();
|
||||
setSelectionStage('wooden-fish-result');
|
||||
} catch (error) {
|
||||
setWoodenFishError(
|
||||
resolveRpgCreationErrorMessage(error, '读取敲木鱼草稿失败。'),
|
||||
);
|
||||
} finally {
|
||||
setIsWoodenFishBusy(false);
|
||||
}
|
||||
},
|
||||
[
|
||||
enterCreateTab,
|
||||
markDraftNoticeSeen,
|
||||
openWoodenFishPublicWorkDetail,
|
||||
setSelectionStage,
|
||||
],
|
||||
);
|
||||
|
||||
const openPublicGalleryDetail = useCallback(
|
||||
(entry: PlatformPublicGalleryCard) => {
|
||||
if (isBigFishGalleryEntry(entry)) {
|
||||
@@ -14622,6 +14707,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
if (isVisualNovelCreationOpen) {
|
||||
void refreshVisualNovelShelf();
|
||||
}
|
||||
void refreshWoodenFishShelf();
|
||||
void refreshBabyObjectMatchShelf();
|
||||
void refreshBarkBattleShelf();
|
||||
}
|
||||
@@ -14634,6 +14720,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
refreshBarkBattleShelf,
|
||||
refreshMatch3DShelf,
|
||||
refreshPuzzleShelf,
|
||||
refreshWoodenFishShelf,
|
||||
refreshSquareHoleShelf,
|
||||
refreshVisualNovelShelf,
|
||||
selectionStage,
|
||||
@@ -14728,6 +14815,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
void refreshSquareHoleShelf();
|
||||
}
|
||||
void refreshPuzzleShelf();
|
||||
void refreshWoodenFishShelf();
|
||||
if (isVisualNovelCreationOpen) {
|
||||
void refreshVisualNovelShelf();
|
||||
}
|
||||
@@ -14781,6 +14869,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
rpgLibraryEntries={platformBootstrap.savedCustomWorldEntries}
|
||||
bigFishItems={isBigFishCreationVisible ? bigFishShelfItems : []}
|
||||
jumpHopItems={isJumpHopCreationVisible ? jumpHopShelfItems : []}
|
||||
woodenFishItems={woodenFishShelfItems}
|
||||
onOpenBigFishDetail={
|
||||
isBigFishCreationVisible
|
||||
? (item) => {
|
||||
@@ -14809,6 +14898,13 @@ export function PlatformEntryFlowShellImpl({
|
||||
: null
|
||||
}
|
||||
onDeleteJumpHop={null}
|
||||
onOpenWoodenFishDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openWoodenFishDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeleteWoodenFish={null}
|
||||
match3dItems={match3dShelfItems}
|
||||
onOpenMatch3DDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
|
||||
Reference in New Issue
Block a user