This reverts commit 34fe8183b6.
This commit is contained in:
+2
-53
@@ -6,14 +6,13 @@ const dialogs = window.StepForgeDialogs || {};
|
||||
class StepForgeApp {
|
||||
constructor() {
|
||||
this.view = document.getElementById('view');
|
||||
this.topbar = document.getElementById('topbar');
|
||||
this.topbarContext = document.getElementById('topbar-context');
|
||||
this.searchInput = document.getElementById('global-search');
|
||||
this.captureStatus = document.getElementById('capture-status');
|
||||
this.homeBtn = document.getElementById('btn-home');
|
||||
|
||||
this.state = {
|
||||
view: 'welcome',
|
||||
view: 'library',
|
||||
query: '',
|
||||
folderFilter: 'all',
|
||||
library: { guides: [], folders: [], guideFolders: {} },
|
||||
@@ -25,11 +24,9 @@ class StepForgeApp {
|
||||
this.libraryRenderToken = 0;
|
||||
|
||||
this.view.innerHTML = `
|
||||
<div id="welcome-host"></div>
|
||||
<div id="library-host"></div>
|
||||
<div id="editor-host" class="hidden"></div>
|
||||
`;
|
||||
this.welcomeHost = document.getElementById('welcome-host');
|
||||
this.libraryHost = document.getElementById('library-host');
|
||||
this.editorHost = document.getElementById('editor-host');
|
||||
|
||||
@@ -90,7 +87,7 @@ class StepForgeApp {
|
||||
async init() {
|
||||
await this.refreshData();
|
||||
this.updateCaptureState(await api.capture.state());
|
||||
this.renderWelcome();
|
||||
this.renderLibrary();
|
||||
}
|
||||
|
||||
async refreshData() {
|
||||
@@ -126,44 +123,12 @@ class StepForgeApp {
|
||||
|
||||
setView(view) {
|
||||
this.state.view = view;
|
||||
this.topbar.classList.toggle('hidden', view === 'welcome');
|
||||
this.welcomeHost.classList.toggle('hidden', view !== 'welcome');
|
||||
this.libraryHost.classList.toggle('hidden', view !== 'library');
|
||||
this.editorHost.classList.toggle('hidden', view !== 'editor');
|
||||
this.searchInput.classList.toggle('hidden', view !== 'library');
|
||||
this.renderTopbar();
|
||||
}
|
||||
|
||||
renderWelcome() {
|
||||
this.setView('welcome');
|
||||
clearNode(this.welcomeHost);
|
||||
this.welcomeHost.append(
|
||||
el('section.welcome-screen', {},
|
||||
el('div.welcome-copy', {},
|
||||
el('div.welcome-kicker', {}, 'Offline capture workspace'),
|
||||
el('h1', {}, 'StepForge'),
|
||||
el('p', {},
|
||||
'Start a new capture, open an existing workspace, or adjust settings before you begin.'),
|
||||
),
|
||||
el('div.welcome-spacer', {}),
|
||||
el('div.welcome-actions', {},
|
||||
el('button.primary', {
|
||||
type: 'button',
|
||||
onClick: () => this.startNewCapture(),
|
||||
}, 'New Capture'),
|
||||
el('button', {
|
||||
type: 'button',
|
||||
onClick: () => this.showLibrary(),
|
||||
}, 'Existing Workspace'),
|
||||
el('button', {
|
||||
type: 'button',
|
||||
onClick: () => this.openSettings(),
|
||||
}, 'settings'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async showLibrary(reason = null) {
|
||||
this.editor.setActive(false);
|
||||
this.setView('library');
|
||||
@@ -217,7 +182,6 @@ class StepForgeApp {
|
||||
|
||||
renderTopbar() {
|
||||
clearNode(this.topbarContext);
|
||||
if (this.state.view === 'welcome') return;
|
||||
if (this.state.view === 'library') {
|
||||
this.topbarContext.append(
|
||||
el('button', { type: 'button', onClick: () => this.createGuide() }, 'New'),
|
||||
@@ -484,21 +448,6 @@ class StepForgeApp {
|
||||
await this.openGuide(guide.guideId);
|
||||
}
|
||||
|
||||
async startNewCapture() {
|
||||
const title = await dialogs.promptText({
|
||||
title: 'New Capture',
|
||||
label: 'Title',
|
||||
value: 'Untitled guide',
|
||||
placeholder: 'Untitled guide',
|
||||
});
|
||||
if (title == null) return;
|
||||
const guide = await api.library.create({ title: title.trim() || 'Untitled guide' });
|
||||
await this.refreshLibrary();
|
||||
await this.openGuide(guide.guideId);
|
||||
await api.capture.session({ action: 'start', guideId: guide.guideId });
|
||||
this.updateCaptureState(await api.capture.state());
|
||||
}
|
||||
|
||||
async createFolder() {
|
||||
const name = await dialogs.promptText({ title: 'New folder', label: 'Folder name', value: '' });
|
||||
if (name == null || !name.trim()) return;
|
||||
|
||||
Reference in New Issue
Block a user