Skip to content
Merged
1 change: 0 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"noStaticElementInteractions": "off",
"useKeyWithClickEvents": "off"
},
"style": { "noNonNullAssertion": "error" },
"complexity": { "noVoid": "error" }
}
},
Expand Down
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@astrojs/solid-js": "^6.0.1",
"@biomejs/biome": "2.4.8",
"@gameroman/config": "^0.0.3",
"@gameroman/config": "^0.0.4",
"@tailwindcss/vite": "^4.2.2",
"typescript": "^5.9.3",
"wrangler": "^4.76.0"
Expand Down
34 changes: 22 additions & 12 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ import Toolbar from "./Toolbar";
function App() {
const {
pages,
currentPageIndex,
setCurrentPageIndex,
setPages,
currentPageId,
setCurrentPageId,
addPage,
renameItem,
deleteItem,
moveItem,
updatePageContent,
renamePage,
deletePage,
getCurrentPage,
} = usePages();

const { settings, updateSettings } = useEditorSettings();
Expand All @@ -33,7 +36,7 @@ function App() {

const [toolbarOpacity, setToolbarOpacity] = createSignal(1);

const currentPage = () => pages()[currentPageIndex()];
const currentPage = () => getCurrentPage();

const PAGES_BROKEN = "<something has broken - this page does not exist>";

Expand Down Expand Up @@ -104,6 +107,10 @@ function App() {
setCurrentMatchIndex(0);
};

const selectPageByTreeItem = (itemId: string) => {
setCurrentPageId(itemId);
};

onMount(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (
Expand All @@ -123,13 +130,14 @@ function App() {
<>
<Toolbar
opacity={toolbarOpacity()}
currentPageIndex={currentPageIndex()}
currentPageId={currentPageId()}
currentPageTitle={currentPage()?.name ?? PAGES_BROKEN}
onMouseMove={() => setToolbarOpacity(1)}
onPagesClick={() => setIsPagesMenuOpen(!isPagesMenuOpen())}
onSettingsClick={() => setIsSettingsOpen(true)}
onSearchClick={handleOpenSearch}
renamePage={renamePage}
renameItem={renameItem}
pages={pages()}
/>

<SettingsModal
Expand All @@ -142,11 +150,13 @@ function App() {
<PagesMenu
isOpen={isPagesMenuOpen()}
pages={pages()}
currentPageIndex={currentPageIndex()}
selectPage={setCurrentPageIndex}
newPage={addPage}
renamePage={renamePage}
deletePage={deletePage}
currentPageId={currentPageId()}
selectPageByTreeItem={selectPageByTreeItem}
addPage={addPage}
renameItem={renameItem}
deleteItem={deleteItem}
moveItem={moveItem}
setPages={setPages}
/>

<FindReplaceModal
Expand Down
Loading