Prompt to start recording for library guides
Template tests / tests (push) Failing after 12m49s
Template tests / tests (pull_request) Has been cancelled

This commit is contained in:
2026-06-13 14:05:10 -05:00
parent 85b1f6f143
commit e46f01885b
2 changed files with 28 additions and 8 deletions
+22 -5
View File
@@ -191,8 +191,7 @@ class StepForgeApp {
const guide = await api.library.create({ title: 'Untitled capture' }); const guide = await api.library.create({ title: 'Untitled capture' });
await this.refreshData(); await this.refreshData();
await this.openGuide(guide.guideId); await this.openGuide(guide.guideId);
const state = await api.capture.session({ action: 'start', guideId: guide.guideId }); const state = await this.armCaptureSession(guide.guideId);
this.updateCaptureState(state);
const hotkey = this.state.settings?.capture?.hotkeyCapture; const hotkey = this.state.settings?.capture?.hotkeyCapture;
let how; let how;
if (state.clickCapture) { if (state.clickCapture) {
@@ -230,14 +229,26 @@ class StepForgeApp {
this.renderTopbar(); this.renderTopbar();
} }
// Start a paused session, optionally show a reminder, and continue once
// the user acknowledges it.
async armCaptureSession(guideId, reminder = null) {
const state = await api.capture.session({ action: 'start', guideId });
this.updateCaptureState(state);
if (!reminder) return state;
const acknowledged = await dialogs.showRecordingReminder(reminder);
if (!acknowledged) return state;
const next = await api.capture.session({ action: 'resume', guideId });
this.updateCaptureState(next);
return next;
}
// Opens a guide and arms (paused) capture for it, so the red REC bar pops // Opens a guide and arms (paused) capture for it, so the red REC bar pops
// up right away with a "Start recording" option to resume capturing steps. // up right away with a "Start recording" option to resume capturing steps.
async openGuideAndArmCapture(guideId, stepId = null) { async openGuideAndArmCapture(guideId, stepId = null) {
await this.openGuide(guideId, stepId); await this.openGuide(guideId, stepId);
// Don't restart (and reset the count of) a session already running for this guide. // Don't restart (and reset the count of) a session already running for this guide.
if (this.captureState?.active && this.captureState.guideId === guideId) return; if (this.captureState?.active && this.captureState.guideId === guideId) return;
const state = await api.capture.session({ action: 'start', guideId }); await this.armCaptureSession(guideId);
this.updateCaptureState(state);
} }
onEditorMeta(meta) { onEditorMeta(meta) {
@@ -767,7 +778,8 @@ class StepForgeApp {
await this.refreshLibrary(); await this.refreshLibrary();
} }
async createGuide() { async createGuide({ armCapture = undefined } = {}) {
const shouldArmCapture = armCapture ?? this.state.view === 'library';
const title = await dialogs.promptText({ const title = await dialogs.promptText({
title: 'New Guide', title: 'New Guide',
label: 'Title', label: 'Title',
@@ -778,6 +790,11 @@ class StepForgeApp {
const guide = await api.library.create({ title: title.trim() || 'Untitled guide' }); const guide = await api.library.create({ title: title.trim() || 'Untitled guide' });
await this.refreshLibrary(); await this.refreshLibrary();
await this.openGuide(guide.guideId); await this.openGuide(guide.guideId);
if (!shouldArmCapture) return;
await this.armCaptureSession(guide.guideId, {
actionLabel: 'Start recording',
headline: 'StepForge will hide after you start recording.',
});
} }
async createFolder() { async createFolder() {
+6 -3
View File
@@ -693,13 +693,16 @@ function showInfoDialog(title, bodyText) {
}); });
} }
function showRecordingReminder() { function showRecordingReminder({
actionLabel = 'Continue',
headline = 'StepForge will hide after you continue.',
} = {}) {
return new Promise((resolve) => { return new Promise((resolve) => {
const { close } = openModal({ const { close } = openModal({
title: 'Before recording starts', title: 'Before recording starts',
body: el('div.recording-notice', {}, body: el('div.recording-notice', {},
el('div.recording-notice__badge', {}, 'Recording tip'), el('div.recording-notice__badge', {}, 'Recording tip'),
el('div.recording-notice__title', {}, 'StepForge will hide after you continue.'), el('div.recording-notice__title', {}, headline),
el('div.recording-notice__text', {}, el('div.recording-notice__text', {},
'When you want to pause or stop, use the red tray icon in the system tray.', 'When you want to pause or stop, use the red tray icon in the system tray.',
), ),
@@ -707,7 +710,7 @@ function showRecordingReminder() {
footer: [ footer: [
el('button.primary', { el('button.primary', {
onClick: () => { close(); resolve(true); }, onClick: () => { close(); resolve(true); },
}, 'Continue'), }, actionLabel),
], ],
onClose: () => resolve(false), onClose: () => resolve(false),
}); });