|
66 | 66 | let exportDestination = $state('dist/bootanimation.zip'); |
67 | 67 | let exporting = $state(false); |
68 | 68 | let buildResult = $state<{ kind: 'success' | 'error'; title: string; text: string } | null>(null); |
69 | | - let statusBanner = $state('Ready. Archive storage mode is verified on every build.'); |
| 69 | + let statusBanner = $state('No project open. Open a project folder to load parts and frames.'); |
70 | 70 | let newPartName = $state(''); |
71 | 71 | let dockTab = $state(0); |
72 | 72 |
|
|
79 | 79 | let activeProjectPart = $derived(snapshot?.manifest.parts[selectedPartIdx]); |
80 | 80 | let activeFrame = $derived<ScheduledFrame | undefined>(snapshot?.schedule.frames[currentTick]); |
81 | 81 | let totalFrames = $derived(snapshot?.validation.performance.total_frames ?? 0); |
| 82 | + let hasParts = $derived((snapshot?.manifest.parts.length ?? 0) > 0); |
82 | 83 | let diagnostics = $derived(snapshot?.validation.diagnostics ?? []); |
83 | 84 | let blockingCount = $derived(diagnostics.filter((d) => d.blocks_export || d.severity === 'error').length); |
84 | 85 | let warningCount = $derived(diagnostics.filter((d) => d.severity === 'warning' && !d.blocks_export).length); |
|
675 | 676 |
|
676 | 677 | <div class="header-actions"> |
677 | 678 | <Button kind="ghost" size="small" disabled={!bridge.isDesktop} onclick={handleOpenProject} icon={FolderOpen}>Open</Button> |
678 | | - <Button kind="ghost" size="small" onclick={handleSaveProject} icon={Save}>Save</Button> |
| 679 | + <Button kind="ghost" size="small" disabled={!snapshot.project_dir} onclick={handleSaveProject} icon={Save}>Save</Button> |
679 | 680 | <span class="divider" aria-hidden="true"></span> |
680 | 681 | <Button kind="ghost" size="small" iconDescription="Undo" disabled={!snapshot.can_undo} onclick={handleUndo} icon={Undo}></Button> |
681 | 682 | <Button kind="ghost" size="small" iconDescription="Redo" disabled={!snapshot.can_redo} onclick={handleRedo} icon={Redo}></Button> |
682 | 683 | <span class="divider" aria-hidden="true"></span> |
683 | 684 |
|
684 | | - <span class="validation-chip {snapshot.validation.outcome}"> |
685 | | - {#if snapshot.validation.outcome === 'valid'} |
| 685 | + <span class="validation-chip {hasParts ? snapshot.validation.outcome : 'empty'}"> |
| 686 | + {#if !hasParts} |
| 687 | + <Information size={16} /> |
| 688 | + <span>No project</span> |
| 689 | + {:else if snapshot.validation.outcome === 'valid'} |
686 | 690 | <CheckmarkFilled size={16} /> |
687 | 691 | <span>Valid</span> |
688 | 692 | {:else if snapshot.validation.outcome === 'valid_with_warnings'} |
|
694 | 698 | {/if} |
695 | 699 | </span> |
696 | 700 |
|
697 | | - <Button kind="primary" size="small" onclick={openExport} icon={DocumentExport}>Build & export</Button> |
| 701 | + <Button |
| 702 | + kind="primary" |
| 703 | + size="small" |
| 704 | + disabled={totalFrames === 0} |
| 705 | + onclick={openExport} |
| 706 | + icon={DocumentExport} |
| 707 | + > |
| 708 | + Build & export |
| 709 | + </Button> |
698 | 710 | </div> |
699 | 711 | </header> |
700 | 712 |
|
|
708 | 720 | </div> |
709 | 721 |
|
710 | 722 | <div class="part-list"> |
| 723 | + {#if !hasParts} |
| 724 | + <p class="empty">No parts yet. Open a project folder to load its animation.</p> |
| 725 | + {/if} |
711 | 726 | {#each snapshot.manifest.descriptor.parts as part, idx (part.path + idx)} |
712 | 727 | {@const frames = snapshot.manifest.parts[idx]?.frames.length ?? 0} |
713 | 728 | <button |
|
767 | 782 | </div> |
768 | 783 |
|
769 | 784 | <div class="frame-list"> |
770 | | - {#if filteredFrames.length === 0} |
771 | | - <p class="empty">No frames match “{assetFilter}”.</p> |
| 785 | + {#if !activeProjectPart} |
| 786 | + <p class="empty">No part selected.</p> |
| 787 | + {:else if filteredFrames.length === 0} |
| 788 | + <p class="empty"> |
| 789 | + {partFrameCount === 0 ? 'This part has no frames yet.' : `No frames match “${assetFilter}”.`} |
| 790 | + </p> |
772 | 791 | {:else} |
773 | 792 | {#each filteredFrames as { frame, index } (frame.relative_path + index)} |
774 | 793 | <button |
|
833 | 852 | </div> |
834 | 853 |
|
835 | 854 | <div class="stage" bind:this={stageEl}> |
836 | | - <div class="device" style="width: {displayWidth + 24}px"> |
837 | | - <canvas |
838 | | - bind:this={canvasEl} |
839 | | - width={canvasWidth} |
840 | | - height={CANVAS_HEIGHT} |
841 | | - style="width: {displayWidth}px; height: {displayHeight}px" |
842 | | - ></canvas> |
843 | | - </div> |
844 | | - <p class="stage-note"> |
845 | | - <Information size={14} /> |
846 | | - Geometry and timing preview. Frame pixels stay on disk until export. |
847 | | - </p> |
| 855 | + {#if scheduleLength === 0} |
| 856 | + <div class="stage-empty"> |
| 857 | + <span class="stage-empty-icon"><ImageIcon size={24} /></span> |
| 858 | + <p class="stage-empty-title">Nothing to preview</p> |
| 859 | + <p class="stage-empty-body"> |
| 860 | + {hasParts |
| 861 | + ? 'This project has no frames yet.' |
| 862 | + : 'Open a project folder containing project.bootanimix.json to load its parts and frames.'} |
| 863 | + </p> |
| 864 | + {#if bridge.isDesktop} |
| 865 | + <Button kind="tertiary" size="small" icon={FolderOpen} onclick={handleOpenProject}> |
| 866 | + Open project |
| 867 | + </Button> |
| 868 | + {:else} |
| 869 | + <p class="hint stage-empty-hint"> |
| 870 | + Opening a project from disk requires the desktop app. |
| 871 | + </p> |
| 872 | + {/if} |
| 873 | + </div> |
| 874 | + {:else} |
| 875 | + <div class="device" style="width: {displayWidth + 24}px"> |
| 876 | + <canvas |
| 877 | + bind:this={canvasEl} |
| 878 | + width={canvasWidth} |
| 879 | + height={CANVAS_HEIGHT} |
| 880 | + style="width: {displayWidth}px; height: {displayHeight}px" |
| 881 | + ></canvas> |
| 882 | + </div> |
| 883 | + <p class="stage-note"> |
| 884 | + <Information size={14} /> |
| 885 | + Geometry and timing preview. Frame pixels stay on disk until export. |
| 886 | + </p> |
| 887 | + {/if} |
848 | 888 | </div> |
849 | 889 |
|
850 | 890 | <div class="transport"> |
|
853 | 893 | size="small" |
854 | 894 | icon={ChevronLeft} |
855 | 895 | iconDescription="Previous frame" |
| 896 | + disabled={scheduleLength === 0} |
856 | 897 | onclick={() => stepFrame(-1)} |
857 | 898 | ></Button> |
858 | 899 | <Button |
859 | 900 | kind="primary" |
860 | 901 | size="small" |
861 | 902 | icon={isPlaying ? Pause : Play} |
862 | 903 | iconDescription={isPlaying ? 'Pause preview' : 'Play preview'} |
| 904 | + disabled={scheduleLength === 0} |
863 | 905 | onclick={togglePlayback} |
864 | 906 | ></Button> |
865 | 907 | <Button |
866 | 908 | kind="ghost" |
867 | 909 | size="small" |
868 | 910 | icon={ChevronRight} |
869 | 911 | iconDescription="Next frame" |
| 912 | + disabled={scheduleLength === 0} |
870 | 913 | onclick={() => stepFrame(1)} |
871 | 914 | ></Button> |
872 | 915 |
|
|
1091 | 1134 | disabled={selectedFrameIdx >= Math.max(0, partFrameCount - 1)} |
1092 | 1135 | onclick={() => moveSelectedFrame(1)} |
1093 | 1136 | ></Button> |
1094 | | - <Button kind="ghost" size="small" onclick={duplicateSelectedFrame} icon={Copy}>Duplicate</Button> |
| 1137 | + <Button |
| 1138 | + kind="ghost" |
| 1139 | + size="small" |
| 1140 | + disabled={partFrameCount === 0} |
| 1141 | + onclick={duplicateSelectedFrame} |
| 1142 | + icon={Copy} |
| 1143 | + > |
| 1144 | + Duplicate |
| 1145 | + </Button> |
1095 | 1146 | <Button kind="ghost" size="small" disabled={partFrameCount <= 1} onclick={removeSelectedFrame} icon={TrashCan}>Remove</Button> |
1096 | 1147 | </div> |
1097 | 1148 |
|
|
1118 | 1169 |
|
1119 | 1170 | <TabContent> |
1120 | 1171 | <div class="diagnostics"> |
1121 | | - {#if diagnostics.length === 0} |
| 1172 | + {#if totalFrames === 0} |
| 1173 | + <div class="clean-state neutral"> |
| 1174 | + <Information size={20} /> |
| 1175 | + <div> |
| 1176 | + <p class="clean-title">Nothing to validate yet</p> |
| 1177 | + <p class="hint"> |
| 1178 | + Open a project folder to check its archive structure and desc.txt semantics. |
| 1179 | + </p> |
| 1180 | + </div> |
| 1181 | + </div> |
| 1182 | + {:else if diagnostics.length === 0} |
1122 | 1183 | <div class="clean-state"> |
1123 | 1184 | <CheckmarkFilled size={20} /> |
1124 | 1185 | <div> |
|
1181 | 1242 | modalLabel="Artifact" |
1182 | 1243 | primaryButtonText="Verify and write" |
1183 | 1244 | secondaryButtonText="Cancel" |
1184 | | - primaryButtonDisabled={snapshot.validation.outcome === 'invalid'} |
| 1245 | + primaryButtonDisabled={snapshot.validation.outcome === 'invalid' || totalFrames === 0} |
1185 | 1246 | primaryButtonLoading={exporting} |
1186 | 1247 | on:click:button--primary={executeReviewedExport} |
1187 | 1248 | on:click:button--secondary={() => (showExportModal = false)} |
|
1423 | 1484 | border-color: rgba(250, 77, 86, 0.3); |
1424 | 1485 | } |
1425 | 1486 |
|
| 1487 | + .validation-chip.empty { |
| 1488 | + color: var(--cds-text-04, #a8a8a8); |
| 1489 | + background: #262626; |
| 1490 | + border-color: #393939; |
| 1491 | + } |
| 1492 | +
|
1426 | 1493 | /* ------------------------------------------------------------- workspace */ |
1427 | 1494 |
|
1428 | 1495 | .workspace { |
|
1716 | 1783 | color: var(--cds-text-03, #6f6f6f); |
1717 | 1784 | } |
1718 | 1785 |
|
| 1786 | + .stage-empty { |
| 1787 | + display: flex; |
| 1788 | + flex-direction: column; |
| 1789 | + align-items: center; |
| 1790 | + gap: 6px; |
| 1791 | + max-width: 320px; |
| 1792 | + padding: 20px 24px; |
| 1793 | + text-align: center; |
| 1794 | + border: 1px dashed #393939; |
| 1795 | + background: rgba(22, 22, 22, 0.72); |
| 1796 | + } |
| 1797 | +
|
| 1798 | + .stage-empty-icon { |
| 1799 | + display: inline-flex; |
| 1800 | + align-items: center; |
| 1801 | + justify-content: center; |
| 1802 | + width: 40px; |
| 1803 | + height: 40px; |
| 1804 | + margin-bottom: 2px; |
| 1805 | + color: var(--cds-text-04, #a8a8a8); |
| 1806 | + border: 1px solid #393939; |
| 1807 | + } |
| 1808 | +
|
| 1809 | + .stage-empty-title { |
| 1810 | + font-size: 13px; |
| 1811 | + font-weight: 600; |
| 1812 | + color: var(--cds-text-01, #f4f4f4); |
| 1813 | + } |
| 1814 | +
|
| 1815 | + .stage-empty-body { |
| 1816 | + font-size: 11px; |
| 1817 | + line-height: 1.6; |
| 1818 | + color: var(--cds-text-05, #8d8d8d); |
| 1819 | + } |
| 1820 | +
|
| 1821 | + .stage-empty-hint { |
| 1822 | + margin-top: 2px; |
| 1823 | + } |
| 1824 | +
|
1719 | 1825 | @media (max-width: 1180px) { |
1720 | 1826 | .stage-head { |
1721 | 1827 | flex-wrap: wrap; |
|
2067 | 2173 | color: #42be65; |
2068 | 2174 | } |
2069 | 2175 |
|
| 2176 | + .clean-state.neutral { |
| 2177 | + color: var(--cds-text-04, #a8a8a8); |
| 2178 | + } |
| 2179 | +
|
2070 | 2180 | .clean-title { |
2071 | 2181 | font-size: 12px; |
2072 | 2182 | color: #42be65; |
2073 | 2183 | } |
2074 | 2184 |
|
| 2185 | + .clean-state.neutral .clean-title { |
| 2186 | + color: var(--cds-text-02, #c6c6c6); |
| 2187 | + } |
| 2188 | +
|
2075 | 2189 | .finding { |
2076 | 2190 | display: flex; |
2077 | 2191 | align-items: flex-start; |
|
0 commit comments