1
This commit is contained in:
@@ -7,8 +7,10 @@ import type {
|
||||
import type { PuzzleWorkSummary } from '../packages/shared/src/contracts/puzzleWorkSummary';
|
||||
import { PuzzleRuntimeShell } from './components/puzzle-runtime/PuzzleRuntimeShell';
|
||||
import {
|
||||
applyLocalPuzzleFreezeTime,
|
||||
advanceLocalPuzzleLevel,
|
||||
dragLocalPuzzlePiece,
|
||||
setLocalPuzzlePaused,
|
||||
startLocalPuzzleRun,
|
||||
swapLocalPuzzlePieces,
|
||||
} from './services/puzzle-runtime/puzzleLocalRuntime';
|
||||
@@ -16,7 +18,7 @@ import {
|
||||
const PLACEHOLDER_PUZZLE_IMAGE =
|
||||
'data:image/svg+xml;utf8,' +
|
||||
encodeURIComponent(`
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1280">
|
||||
<defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#fef3c7" />
|
||||
@@ -28,13 +30,13 @@ const PLACEHOLDER_PUZZLE_IMAGE =
|
||||
<stop offset="1" stop-color="#ffffff" stop-opacity="0" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<rect width="960" height="960" fill="url(#sky)" />
|
||||
<circle cx="312" cy="282" r="210" fill="url(#glow)" />
|
||||
<path d="M0 680 C170 610 278 724 424 650 C574 574 704 612 960 512 V960 H0 Z" fill="#1e1b4b" opacity="0.9" />
|
||||
<path d="M0 766 C178 710 320 794 492 732 C642 678 780 708 960 652 V960 H0 Z" fill="#111827" opacity="0.78" />
|
||||
<path d="M160 356 C238 298 326 304 388 376 C456 456 550 436 626 374 C710 306 824 330 882 410" fill="none" stroke="#fff7ed" stroke-width="18" stroke-linecap="round" opacity="0.72" />
|
||||
<path d="M204 502 h552" stroke="#ffffff" stroke-width="16" stroke-linecap="round" opacity="0.3" />
|
||||
<path d="M268 566 h424" stroke="#ffffff" stroke-width="12" stroke-linecap="round" opacity="0.22" />
|
||||
<rect width="720" height="1280" fill="url(#sky)" />
|
||||
<circle cx="310" cy="318" r="210" fill="url(#glow)" />
|
||||
<path d="M0 860 C118 808 226 894 348 828 C474 760 594 824 720 774 V1280 H0 Z" fill="#1e1b4b" opacity="0.9" />
|
||||
<path d="M0 1010 C142 954 282 1040 428 974 C552 918 638 938 720 904 V1280 H0 Z" fill="#111827" opacity="0.78" />
|
||||
<path d="M86 310 C184 242 302 252 376 334 C460 426 574 386 646 310" fill="none" stroke="#fff7ed" stroke-width="16" stroke-linecap="round" opacity="0.72" />
|
||||
<path d="M128 610 h464" stroke="#ffffff" stroke-width="14" stroke-linecap="round" opacity="0.3" />
|
||||
<path d="M174 704 h372" stroke="#ffffff" stroke-width="10" stroke-linecap="round" opacity="0.22" />
|
||||
</svg>`);
|
||||
|
||||
function buildPlaceholderPuzzleWork(): PuzzleWorkSummary {
|
||||
@@ -78,6 +80,20 @@ export default function PuzzlePlaygroundApp() {
|
||||
setRun((currentRun) => advanceLocalPuzzleLevel(currentRun));
|
||||
};
|
||||
|
||||
const handlePauseChange = async (paused: boolean) => {
|
||||
setRun((currentRun) => setLocalPuzzlePaused(currentRun, paused));
|
||||
};
|
||||
|
||||
const handleUseProp = async (
|
||||
propKind: 'hint' | 'reference' | 'freezeTime',
|
||||
) => {
|
||||
setRun((currentRun) =>
|
||||
propKind === 'freezeTime'
|
||||
? applyLocalPuzzleFreezeTime(currentRun)
|
||||
: setLocalPuzzlePaused(currentRun, propKind === 'reference'),
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<PuzzleRuntimeShell
|
||||
run={run}
|
||||
@@ -87,6 +103,8 @@ export default function PuzzlePlaygroundApp() {
|
||||
onSwapPieces={handleSwapPieces}
|
||||
onDragPiece={handleDragPiece}
|
||||
onAdvanceNextLevel={handleAdvanceNextLevel}
|
||||
onPauseChange={handlePauseChange}
|
||||
onUseProp={handleUseProp}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user