Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

refactor: rename stepIndex to activeStepIndex in session

Luis Ortiz42b8312c55ac
diff --git a/src/core/guideme/content.ts b/src/core/guideme/content.ts
index e85cde7..f0f9d95 100644
--- a/src/core/guideme/content.ts
+++ b/src/core/guideme/content.ts
@@ -42,7 +42,7 @@ export class GuideMeController {
const session = data[SESSION_KEY] as GuideMeSession | null;
const step = data[STEP_KEY] as Step | null;
if (session?.active && step) {
- this.showStep(step, session.stepIndex);
+ this.showStep(step, session.activeStepIndex);
}
}
@@ -57,7 +57,7 @@ export class GuideMeController {
return;
}
- this.showStep(step, session.stepIndex);
+ this.showStep(step, session.activeStepIndex);
}
private async showStep(step: Step, stepIndex: number) {
diff --git a/src/core/guideme/session.ts b/src/core/guideme/session.ts
index 97da6af..b209c52 100644
--- a/src/core/guideme/session.ts
+++ b/src/core/guideme/session.ts
@@ -3,7 +3,7 @@ import { localStorage } from '@/lib/browser-api';
export interface GuideMeSession {
guideId: string;
- stepIndex: number;
+ activeStepIndex: number;
totalSteps: number;
active: boolean;
}
@@ -12,7 +12,7 @@ const SESSION_KEY = 'guideMeSession';
const STEP_KEY = 'guideMeStep';
export async function startSession(guideId: string, totalSteps: number, firstStep: Step): Promise<void> {
- const session: GuideMeSession = { guideId, stepIndex: 0, totalSteps, active: true };
+ const session: GuideMeSession = { guideId, activeStepIndex: 0, totalSteps, active: true };
await localStorage.set({ [SESSION_KEY]: session, [STEP_KEY]: firstStep });
}
@@ -21,7 +21,7 @@ export async function advanceSession(nextStep: Step, nextIndex: number): Promise
const session = data[SESSION_KEY] as GuideMeSession | undefined;
if (!session || !session.active) return;
await localStorage.set({
- [SESSION_KEY]: { ...session, stepIndex: nextIndex },
+ [SESSION_KEY]: { ...session, activeStepIndex: nextIndex },
[STEP_KEY]: nextStep,
});
}