mirror of
https://github.com/dralkh/spaceforge.git
synced 2026-07-22 16:40:30 +00:00
65 lines
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
import { SpaceforgeSettings, DEFAULT_SETTINGS } from './settings';
|
|
import { ReviewSchedule, ReviewHistoryItem } from './review-schedule';
|
|
import { ReviewSessionStore } from './review-session';
|
|
import { MCQSet, MCQSession } from './mcq';
|
|
|
|
/**
|
|
* Interface for the plugin's operational state (excluding settings).
|
|
* This corresponds to the data previously managed by DataStorage.
|
|
*/
|
|
export interface PluginStateData {
|
|
schedules: Record<string, ReviewSchedule>;
|
|
history: ReviewHistoryItem[];
|
|
reviewSessions: ReviewSessionStore;
|
|
mcqSets: Record<string, MCQSet>;
|
|
mcqSessions: Record<string, MCQSession[]>;
|
|
customNoteOrder: string[];
|
|
lastLinkAnalysisTimestamp?: number | null;
|
|
version: string; // To track data structure version for migrations
|
|
|
|
// Pomodoro Timer State
|
|
pomodoroCurrentMode: 'work' | 'shortBreak' | 'longBreak' | 'idle';
|
|
pomodoroTimeLeftInSeconds: number;
|
|
pomodoroSessionsCompletedInCycle: number;
|
|
pomodoroIsRunning: boolean;
|
|
pomodoroEndTimeMs: number | null; // Timestamp when the current session ends
|
|
}
|
|
|
|
/**
|
|
* Default values for the plugin's operational state.
|
|
*/
|
|
export const DEFAULT_PLUGIN_STATE_DATA: PluginStateData = {
|
|
schedules: {},
|
|
history: [],
|
|
reviewSessions: { sessions: {}, activeSessionId: null },
|
|
mcqSets: {},
|
|
mcqSessions: {},
|
|
customNoteOrder: [],
|
|
lastLinkAnalysisTimestamp: null,
|
|
version: "0.0.0", // This will be updated from plugin.manifest.version on save
|
|
|
|
// Pomodoro Timer State Defaults
|
|
pomodoroCurrentMode: 'idle',
|
|
pomodoroTimeLeftInSeconds: 25 * 60, // Default to work duration
|
|
pomodoroSessionsCompletedInCycle: 0,
|
|
pomodoroIsRunning: false,
|
|
pomodoroEndTimeMs: null,
|
|
};
|
|
|
|
/**
|
|
* Unified data structure for everything persisted in data.json.
|
|
* This includes both plugin settings and the plugin's operational state.
|
|
*/
|
|
export interface SpaceforgePluginData {
|
|
settings: SpaceforgeSettings;
|
|
pluginState: PluginStateData;
|
|
}
|
|
|
|
/**
|
|
* Default values for the entire application data, including settings and state.
|
|
* Used for new installations or when data.json is missing/corrupted.
|
|
*/
|
|
export const DEFAULT_APP_DATA: SpaceforgePluginData = {
|
|
settings: DEFAULT_SETTINGS,
|
|
pluginState: DEFAULT_PLUGIN_STATE_DATA,
|
|
};
|