Files
SteelBase/public/js/core/state.js

92 lines
2.3 KiB
JavaScript

/**
* Application State Management
* Central state for the entire application
*/
// Main application state
export const appState = {
history: [],
favorites: [],
budgetItems: [],
currentSection: 'cev',
currentTheme: 'dark',
expertMode: false,
currentSidebarTab: 0
};
// User preferences (persisted to localStorage)
export const userPreferences = {
theme: 'dark',
colorScheme: 'default', // default, blue, green, purple, orange
fontSize: 'medium', // small, medium, large, xlarge
fontFamily: 'default' // default, modern, classic, mono
};
// Admin configuration
export const adminConfig = {
appName: 'SteelBase',
appSubtitle: 'Plataforma Técnica com Base de Dados de Materiais Brasileiros',
footerText: '© 2025 SteelBase v7.5 PROFESSIONAL EDITION - Plataforma Técnica com Base de Dados de Materiais Brasileiros',
themeDefault: 'escuro',
modeDefault: 'simples',
toolsVisibility: {
'cev': true,
'seletor': true,
'equivalencias': false,
'comparativo': false,
'parafusos': true,
'layout': true,
'parafuso-vs-solda': false,
'preaquecimento': true,
'dureza': true,
'charpy': true,
'certificado': false,
'ultrassom': false,
'area-pintura': true,
'consumo-tinta': true,
'galvanizacao': false,
'custo-pintura': true,
'secagem': false,
'inspecao-pintura': false,
'orcamento': true,
'peso-rigging': false,
'referencia': false
}
};
/**
* Update app state
* @param {string} key - State key
* @param {any} value - New value
*/
export function updateState(key, value) {
appState[key] = value;
}
/**
* Get state value
* @param {string} key - State key
* @returns {any} State value
*/
export function getState(key) {
return appState[key];
}
/**
* Update user preferences
* @param {string} key - Preference key
* @param {any} value - New value
*/
export function updatePreference(key, value) {
userPreferences[key] = value;
}
/**
* Get preference value
* @param {string} key - Preference key
* @returns {any} Preference value
*/
export function getPreference(key) {
return userPreferences[key];
}