feat: surface platform errors in copyable dialogs

This commit is contained in:
kdletters
2026-05-26 14:27:18 +08:00
parent 44c65df5c9
commit fbda614156
16 changed files with 715 additions and 191 deletions

View File

@@ -1,12 +1,12 @@
import { useEffect, useMemo, useState } from 'react';
import type { BigFishWorkSummary } from '../../../packages/shared/src/contracts/bigFishWorkSummary';
import type { BarkBattleWorkSummary } from '../../../packages/shared/src/contracts/barkBattle';
import type { BigFishWorkSummary } from '../../../packages/shared/src/contracts/bigFishWorkSummary';
import type { CustomWorldWorkSummary } from '../../../packages/shared/src/contracts/customWorldAgent';
import type { BabyObjectMatchDraft } from '../../../packages/shared/src/contracts/edutainmentBabyObject';
import type { JumpHopWorkSummaryResponse } from '../../../packages/shared/src/contracts/jumpHop';
import type { Match3DWorkSummary } from '../../../packages/shared/src/contracts/match3dWorks';
import type { PuzzleWorkSummary } from '../../../packages/shared/src/contracts/puzzleWorkSummary';
import type { JumpHopWorkSummaryResponse } from '../../../packages/shared/src/contracts/jumpHop';
import type { CustomWorldLibraryEntry } from '../../../packages/shared/src/contracts/runtime';
import type { SquareHoleWorkSummary } from '../../../packages/shared/src/contracts/squareHoleWorks';
import type { VisualNovelWorkSummary } from '../../../packages/shared/src/contracts/visualNovel';
@@ -43,7 +43,6 @@ type CustomWorldCreationHubProps = {
loading: boolean;
error: string | null;
onRetry: () => void;
createError?: string | null;
createBusy?: boolean;
entryConfig: CreationEntryConfig;
creationTypes: readonly PlatformCreationTypeCard[];
@@ -154,7 +153,6 @@ export function CustomWorldCreationHub({
loading,
error,
onRetry,
createError = null,
createBusy = false,
entryConfig,
creationTypes,
@@ -360,7 +358,6 @@ export function CustomWorldCreationHub({
{showStartCard ? (
<CustomWorldCreationStartCard
busy={createBusy}
error={createError}
entryConfig={entryConfig}
creationTypes={creationTypes}
onCreateType={onCreateType}
@@ -377,12 +374,11 @@ export function CustomWorldCreationHub({
) : null}
{showWorkShelf && error ? (
<div className="platform-banner platform-banner--danger rounded-[1.4rem] px-4 py-4 text-sm leading-7">
<div>{error}</div>
<div className="flex justify-end">
<button
type="button"
onClick={onRetry}
className="platform-button platform-button--ghost mt-3 min-h-0 rounded-full px-4 py-2 text-sm"
className="platform-button platform-button--ghost min-h-0 rounded-full px-4 py-2 text-sm"
>
</button>

View File

@@ -1,5 +1,5 @@
import { Coins, Trophy } from 'lucide-react';
import { useMemo, useState, type UIEvent } from 'react';
import { type UIEvent,useMemo, useState } from 'react';
import type { CreationEntryConfig } from '../../services/creationEntryConfigService';
import {
@@ -10,7 +10,6 @@ import {
type CustomWorldCreationStartCardProps = {
busy?: boolean;
error?: string | null;
entryConfig: CreationEntryConfig;
creationTypes: readonly PlatformCreationTypeCard[];
onCreateType: (type: PlatformCreationTypeId) => void;
@@ -25,7 +24,6 @@ function shouldShowCreationBadge(badge: string) {
export function CustomWorldCreationStartCard({
busy = false,
error = null,
entryConfig,
creationTypes,
onCreateType,
@@ -233,11 +231,6 @@ export function CustomWorldCreationStartCard({
})}
</div>
{error ? (
<div className="platform-banner platform-banner--danger mt-4 rounded-[1rem] px-3 py-2 text-sm leading-5 sm:rounded-[1.25rem] sm:leading-6">
{error}
</div>
) : null}
</section>
</div>
);