Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 14 additions & 47 deletions apps/ui/src/store/app-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { getElectronAPI } from '@/lib/electron';
import { getHttpApiClient } from '@/lib/http-api-client';
import { createLogger } from '@automaker/utils/logger';
// Note: setItem/getItem moved to ./utils/theme-utils.ts
import {
UI_SANS_FONT_OPTIONS,
UI_MONO_FONT_OPTIONS,
DEFAULT_FONT_VALUE,
} from '@/config/ui-font-options';
import { UI_SANS_FONT_OPTIONS, UI_MONO_FONT_OPTIONS } from '@/config/ui-font-options';
import type {
Feature as BaseFeature,
FeatureImagePath,
Expand Down Expand Up @@ -63,6 +59,7 @@ import {
type BoardViewMode,
type ShortcutKey,
type KeyboardShortcuts,
type BackgroundSettings,
// Settings types
type ApiKeys,
// Chat types
Expand Down Expand Up @@ -111,6 +108,9 @@ import {
isClaudeUsageAtLimit,
} from './utils';

// Import default values from modular defaults files
import { defaultBackgroundSettings, defaultTerminalState, MAX_INIT_OUTPUT_LINES } from './defaults';

// Import internal theme utils (not re-exported publicly)
import {
getEffectiveFont,
Expand Down Expand Up @@ -145,6 +145,7 @@ export type {
BoardViewMode,
ShortcutKey,
KeyboardShortcuts,
BackgroundSettings,
ApiKeys,
ImageAttachment,
TextFileAttachment,
Expand Down Expand Up @@ -189,6 +190,9 @@ export {
isClaudeUsageAtLimit,
};

// Re-export defaults from ./defaults for backward compatibility
export { defaultBackgroundSettings, defaultTerminalState, MAX_INIT_OUTPUT_LINES } from './defaults';

// NOTE: Type definitions moved to ./types/ directory, utilities moved to ./utils/ directory
// The following inline types have been replaced with imports above:
// - ViewMode, ThemeMode, BoardViewMode (./types/ui-types.ts)
Expand All @@ -203,31 +207,10 @@ export {
// - Theme utilities: THEME_STORAGE_KEY, getStoredTheme, getStoredFontSans, getStoredFontMono, etc. (./utils/theme-utils.ts)
// - Shortcut utilities: parseShortcut, formatShortcut, DEFAULT_KEYBOARD_SHORTCUTS (./utils/shortcut-utils.ts)
// - Usage utilities: isClaudeUsageAtLimit (./utils/usage-utils.ts)

// Maximum number of output lines to keep in init script state (prevents unbounded memory growth)
export const MAX_INIT_OUTPUT_LINES = 500;

// Default background settings for board backgrounds
export const defaultBackgroundSettings: {
imagePath: string | null;
imageVersion?: number;
cardOpacity: number;
columnOpacity: number;
columnBorderEnabled: boolean;
cardGlassmorphism: boolean;
cardBorderEnabled: boolean;
cardBorderOpacity: number;
hideScrollbar: boolean;
} = {
imagePath: null,
cardOpacity: 100,
columnOpacity: 100,
columnBorderEnabled: true,
cardGlassmorphism: true,
cardBorderEnabled: true,
cardBorderOpacity: 100,
hideScrollbar: false,
};
// The following default values have been moved to ./defaults/:
// - MAX_INIT_OUTPUT_LINES (./defaults/constants.ts)
// - defaultBackgroundSettings (./defaults/background-settings.ts)
// - defaultTerminalState (./defaults/terminal-defaults.ts)

const initialState: AppState = {
projects: [],
Expand Down Expand Up @@ -319,23 +302,7 @@ const initialState: AppState = {
isAnalyzing: false,
boardBackgroundByProject: {},
previewTheme: null,
terminalState: {
isUnlocked: false,
authToken: null,
tabs: [],
activeTabId: null,
activeSessionId: null,
maximizedSessionId: null,
defaultFontSize: 14,
defaultRunScript: '',
screenReaderMode: false,
fontFamily: DEFAULT_FONT_VALUE,
scrollbackLines: 5000,
lineHeight: 1.0,
maxSessions: 100,
lastActiveProjectPath: null,
openTerminalMode: 'newTab',
},
terminalState: defaultTerminalState,
terminalLayoutByProject: {},
specCreatingForProject: null,
defaultPlanningMode: 'skip' as PlanningMode,
Expand Down
13 changes: 13 additions & 0 deletions apps/ui/src/store/defaults/background-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { BackgroundSettings } from '../types/ui-types';

// Default background settings for board backgrounds
export const defaultBackgroundSettings: BackgroundSettings = {
imagePath: null,
cardOpacity: 100,
columnOpacity: 100,
columnBorderEnabled: true,
cardGlassmorphism: true,
cardBorderEnabled: true,
cardBorderOpacity: 100,
hideScrollbar: false,
};
2 changes: 2 additions & 0 deletions apps/ui/src/store/defaults/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Maximum number of output lines to keep in init script state (prevents unbounded memory growth)
export const MAX_INIT_OUTPUT_LINES = 500;
3 changes: 3 additions & 0 deletions apps/ui/src/store/defaults/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { defaultBackgroundSettings } from './background-settings';
export { defaultTerminalState } from './terminal-defaults';
export { MAX_INIT_OUTPUT_LINES } from './constants';
21 changes: 21 additions & 0 deletions apps/ui/src/store/defaults/terminal-defaults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { DEFAULT_FONT_VALUE } from '@/config/ui-font-options';
import type { TerminalState } from '../types/terminal-types';

// Default terminal state values
export const defaultTerminalState: TerminalState = {
isUnlocked: false,
authToken: null,
tabs: [],
activeTabId: null,
activeSessionId: null,
maximizedSessionId: null,
defaultFontSize: 14,
defaultRunScript: '',
screenReaderMode: false,
fontFamily: DEFAULT_FONT_VALUE,
scrollbackLines: 5000,
lineHeight: 1.0,
maxSessions: 100,
lastActiveProjectPath: null,
openTerminalMode: 'newTab',
};
23 changes: 8 additions & 15 deletions apps/ui/src/store/types/state-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ import type {
SidebarStyle,
} from '@automaker/types';

import type { ViewMode, ThemeMode, BoardViewMode, KeyboardShortcuts } from './ui-types';
import type {
ViewMode,
ThemeMode,
BoardViewMode,
KeyboardShortcuts,
BackgroundSettings,
} from './ui-types';
import type { ApiKeys } from './settings-types';
import type { ChatMessage, ChatSession, FeatureImage } from './chat-types';
import type { TerminalState, TerminalPanelContent, PersistedTerminalState } from './terminal-types';
Expand Down Expand Up @@ -253,20 +259,7 @@ export interface AppState {
isAnalyzing: boolean;

// Board Background Settings (per-project, keyed by project path)
boardBackgroundByProject: Record<
string,
{
imagePath: string | null; // Path to background image in .automaker directory
imageVersion?: number; // Timestamp to bust browser cache when image is updated
cardOpacity: number; // Opacity of cards (0-100)
columnOpacity: number; // Opacity of columns (0-100)
columnBorderEnabled: boolean; // Whether to show column borders
cardGlassmorphism: boolean; // Whether to use glassmorphism (backdrop-blur) on cards
cardBorderEnabled: boolean; // Whether to show card borders
cardBorderOpacity: number; // Opacity of card borders (0-100)
hideScrollbar: boolean; // Whether to hide the board scrollbar
}
>;
boardBackgroundByProject: Record<string, BackgroundSettings>;

// Theme Preview (for hover preview in theme selectors)
previewTheme: ThemeMode | null;
Expand Down
13 changes: 13 additions & 0 deletions apps/ui/src/store/types/ui-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ export interface ShortcutKey {
alt?: boolean; // Alt/Option key modifier
}

// Board background settings
export interface BackgroundSettings {
imagePath: string | null;
imageVersion?: number;
cardOpacity: number;
columnOpacity: number;
columnBorderEnabled: boolean;
cardGlassmorphism: boolean;
cardBorderEnabled: boolean;
cardBorderOpacity: number;
hideScrollbar: boolean;
}

// Keyboard Shortcuts - stored as strings like "K", "Shift+N", "Cmd+K"
export interface KeyboardShortcuts {
// Navigation shortcuts
Expand Down