Restructure project as Worldshaper
This commit is contained in:
parent
ab891a315c
commit
b4dbd4ee8e
583 changed files with 279 additions and 189269 deletions
35
src/App.tsx
35
src/App.tsx
|
|
@ -4,7 +4,7 @@ import ConfigSection from "./components/ConfigSection";
|
|||
import EditorToolbar from "./components/EditorToolbar";
|
||||
import StatusFooter from "./components/StatusFooter";
|
||||
import TopNavTabs from "./components/TopNavTabs";
|
||||
import { openStandaloneMapEditorPopup } from "./mapEditorPopup/windowing";
|
||||
import { openWorldshaperStudioWindow } from "./worldshaperStudio/windowing";
|
||||
import {
|
||||
CONFIG_TAB_TO_KEY,
|
||||
DIALOGUE_NODE_FIELD_ORDER,
|
||||
|
|
@ -76,7 +76,7 @@ type ValidationWorkerResponse = {
|
|||
issues: string[];
|
||||
};
|
||||
|
||||
const LAST_ACTIVE_TYPE_STORAGE_KEY = "content-editor-v2:lastActiveType";
|
||||
const LAST_ACTIVE_TYPE_STORAGE_KEY = "worldshaper:lastActiveType";
|
||||
const DEFAULT_EDITOR_WORLD_ID_FALLBACK = "overworld";
|
||||
|
||||
function getContentRecordsForType(contentDataByType: Record<string, JsonObject>, type: string): JsonObject[] {
|
||||
|
|
@ -1564,27 +1564,27 @@ function App() {
|
|||
}
|
||||
}
|
||||
|
||||
async function resolveDefaultMapEditorWorldId(): Promise<string> {
|
||||
async function resolveDefaultWorldshaperStudioWorldId(): Promise<string> {
|
||||
const payload = await fetchJsonOrThrow<{ worldId?: string; world?: JsonObject }>("/api/world-default");
|
||||
const resolvedWorldId = String(payload.worldId || payload.world?.id || "").trim();
|
||||
return resolvedWorldId || DEFAULT_EDITOR_WORLD_ID_FALLBACK;
|
||||
}
|
||||
|
||||
async function handleLaunchMapEditor(): Promise<void> {
|
||||
async function handleLaunchWorldshaperStudio(): Promise<void> {
|
||||
try {
|
||||
setError("");
|
||||
setStatus("Preparing world editor...");
|
||||
const nextWorldId = await resolveDefaultMapEditorWorldId().catch(() => DEFAULT_EDITOR_WORLD_ID_FALLBACK);
|
||||
const popup = openStandaloneMapEditorPopup(nextWorldId, window, { worldId: nextWorldId });
|
||||
setStatus("Preparing Worldshaper Studio...");
|
||||
const nextWorldId = await resolveDefaultWorldshaperStudioWorldId().catch(() => DEFAULT_EDITOR_WORLD_ID_FALLBACK);
|
||||
const popup = openWorldshaperStudioWindow(nextWorldId, window, { worldId: nextWorldId });
|
||||
if (!popup) {
|
||||
setError("The browser blocked the world editor popup.");
|
||||
setStatus("World editor unavailable: popup was blocked.");
|
||||
setError("The browser blocked the Worldshaper Studio window.");
|
||||
setStatus("Worldshaper Studio unavailable: studio window was blocked.");
|
||||
return;
|
||||
}
|
||||
setStatus(`Opening world editor for ${nextWorldId}...`);
|
||||
setStatus(`Opening Worldshaper Studio for ${nextWorldId}...`);
|
||||
} catch (err: unknown) {
|
||||
setError(String(err));
|
||||
setStatus("World editor unavailable: failed to prepare world data.");
|
||||
setStatus("Worldshaper Studio unavailable: failed to prepare world data.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1593,16 +1593,16 @@ function App() {
|
|||
<header className="header-card">
|
||||
<div className="header-copy">
|
||||
<p className="eyebrow">New RPG</p>
|
||||
<h1>Content Editor V2</h1>
|
||||
<p className="lede">Canonical editor with tabbed pages, structured editing, and raw JSON fallback.</p>
|
||||
<h1>Worldshaper</h1>
|
||||
<p className="lede">Worldbuilding studio with tabbed pages, structured editing, and raw JSON fallback.</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="header-map-editor-btn"
|
||||
onClick={handleLaunchMapEditor}
|
||||
onClick={handleLaunchWorldshaperStudio}
|
||||
disabled={isLoading}
|
||||
>
|
||||
<span className="header-map-editor-btn-label">World Editor</span>
|
||||
<span className="header-map-editor-btn-label">Worldshaper Studio</span>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
|
|
@ -1773,10 +1773,6 @@ function App() {
|
|||
parsedJsonError={parsedJsonError}
|
||||
recordDraftError={recordDraftError}
|
||||
/>
|
||||
|
||||
<p className="wiki-link-row">
|
||||
Documentation: <a href="/wiki" target="_blank" rel="noreferrer">Open Wiki</a>
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -1784,3 +1780,4 @@ function App() {
|
|||
|
||||
export default App;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue