Add a built-in wiki.
This commit is contained in:
parent
358a8f68fd
commit
567ac1a26d
28 changed files with 4030 additions and 118 deletions
|
|
@ -10,8 +10,10 @@ import {
|
|||
import {
|
||||
applyThemeFromState,
|
||||
type DebriefScreenParams,
|
||||
getCurrentScreen,
|
||||
type LaunchScreenParams,
|
||||
state,
|
||||
type WikiScreenParams,
|
||||
} from "./state.js";
|
||||
import {
|
||||
getColorMode,
|
||||
|
|
@ -35,7 +37,11 @@ import { renderMainMenu } from "./screens/mainMenu.js";
|
|||
import { renderMissionConfig } from "./screens/missionConfig.js";
|
||||
import { renderOnboarding } from "./screens/onboarding.js";
|
||||
import { renderRocketBuilder } from "./screens/rocketBuilder.js";
|
||||
import { renderWiki } from "./screens/wiki.js";
|
||||
import { renderWorldMap } from "./screens/worldMap.js";
|
||||
import { initWalkthroughController } from "./wiki/walkthrough.js";
|
||||
import type { WikiArticleId } from "./wiki/wikiData.js";
|
||||
import { openWikiDrawer } from "./wiki/wikiModal.js";
|
||||
|
||||
registerScreenRenderers({
|
||||
mainMenu: (el) => renderMainMenu(el),
|
||||
|
|
@ -48,6 +54,7 @@ registerScreenRenderers({
|
|||
debrief: (el, p) => renderDebrief(el, p as DebriefScreenParams),
|
||||
contracts: (el) => renderContracts(el),
|
||||
worldMap: (el) => renderWorldMap(el),
|
||||
wiki: (el, p) => renderWiki(el, p as WikiScreenParams),
|
||||
});
|
||||
|
||||
function renderComfortToolbar(): void {
|
||||
|
|
@ -122,6 +129,41 @@ async function boot(): Promise<void> {
|
|||
window.addEventListener("sgywftp:theme-changed", renderComfortToolbar);
|
||||
initNotificationDrawer();
|
||||
initTooltipController();
|
||||
initWalkthroughController();
|
||||
window.addEventListener("sgywftp:open-wiki", (ev) => {
|
||||
const detail =
|
||||
(
|
||||
ev as CustomEvent<{
|
||||
articleId?: WikiArticleId;
|
||||
glossaryKey?: string;
|
||||
query?: string;
|
||||
preferDrawer?: boolean;
|
||||
}>
|
||||
).detail ?? {};
|
||||
const cur = getCurrentScreen();
|
||||
const preserveScreens = new Set([
|
||||
"builder",
|
||||
"config",
|
||||
"launch",
|
||||
"debrief",
|
||||
"contracts",
|
||||
"worldMap",
|
||||
]);
|
||||
if (detail.preferDrawer || preserveScreens.has(cur)) {
|
||||
openWikiDrawer({
|
||||
articleId: detail.articleId,
|
||||
glossaryKey: detail.glossaryKey,
|
||||
query: detail.query,
|
||||
});
|
||||
} else {
|
||||
navigate("wiki", {
|
||||
articleId: detail.articleId,
|
||||
glossaryKey: detail.glossaryKey,
|
||||
query: detail.query,
|
||||
returnTo: cur === "wiki" ? "dashboard" : cur,
|
||||
});
|
||||
}
|
||||
});
|
||||
const readyPromise = waitForStylesAndLoad();
|
||||
try {
|
||||
await loadCatalogs();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue