fix: final refactoring pass

This commit is contained in:
2026-02-16 07:06:47 +01:00
parent 4051fa9333
commit 600b94ce32
6 changed files with 80 additions and 44 deletions

View File

@@ -2,3 +2,4 @@ export { AutoSaveManager, type AutoSaveConfig } from './autoSave';
export { getContrastColor } from './color';
export { unescapeMacroSyntax } from './markdownEscape';
export { groupPostsByStatus, type GroupedPosts, type PostStatus } from './postGrouping';
export { loadTabsForProject, saveTabsForProject } from './tabPersistence';

View File

@@ -0,0 +1,23 @@
import type { TabState } from '../store';
const TAB_STATE_PREFIX = 'bds-tabs-';
export const saveTabsForProject = (projectId: string, tabState: TabState): void => {
try {
localStorage.setItem(`${TAB_STATE_PREFIX}${projectId}`, JSON.stringify(tabState));
} catch (error) {
console.error('Failed to save tab state:', error);
}
};
export const loadTabsForProject = (projectId: string): TabState | null => {
try {
const stored = localStorage.getItem(`${TAB_STATE_PREFIX}${projectId}`);
if (stored) {
return JSON.parse(stored) as TabState;
}
} catch (error) {
console.error('Failed to load tab state:', error);
}
return null;
};