From 25959faa229e6c62c96f303feb3836da64c69cf5 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Fri, 3 Apr 2026 21:51:56 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20state.js=20duplicado=20-=20app.?= =?UTF-8?q?js=20gerencia=20seus=20pr=C3=B3prios=20estados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 - public/js/core/state.js | 125 +--------------------------------------- 2 files changed, 2 insertions(+), 124 deletions(-) diff --git a/index.html b/index.html index 5a262a6..e40da8a 100644 --- a/index.html +++ b/index.html @@ -557,7 +557,6 @@ - diff --git a/public/js/core/state.js b/public/js/core/state.js index f53ee89..02d6801 100644 --- a/public/js/core/state.js +++ b/public/js/core/state.js @@ -1,121 +1,9 @@ /** * Application State Management * Central state for the entire application + * Apenas funções utilitárias - estados são gerenciados em app.js */ -// Main application state -var appState = { - history: [], - favorites: [], - budgetItems: [], - currentSection: 'cev', - currentTheme: 'dark', - expertMode: false, - currentSidebarTab: 0 -}; - -// User preferences (persisted to localStorage) -var userPreferences = { - theme: 'dark', - colorScheme: 'default', - fontSize: 'medium', - fontFamily: 'default' -}; - -// Load preferences from localStorage -function loadPreferences() { - try { - var saved = localStorage.getItem('acoCalcPreferences'); - if (saved) { - var parsed = JSON.parse(saved); - for (var key in parsed) { - if (parsed.hasOwnProperty(key)) { - userPreferences[key] = parsed[key]; - } - } - } - } catch (e) { - console.warn('Nao foi possivel carregar preferencias:', e); - } -} - -// Save preferences to localStorage -function savePreferences() { - try { - localStorage.setItem('acoCalcPreferences', JSON.stringify(userPreferences)); - } catch (e) { - console.warn('Nao foi possivel salvar preferencias:', e); - } -} - -// Admin configuration -var adminConfig = { - appName: 'SteelBase', - appSubtitle: 'Plataforma Tecnica com Base de Dados de Materiais Brasileiros', - footerText: '© 2025 SteelBase v7.5 PROFESSIONAL EDITION - Plataforma Tecnica 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 - */ -function updateState(key, value) { - appState[key] = value; -} - -/** - * Get state value - * @param {string} key - State key - * @returns {any} State value - */ -function getState(key) { - return appState[key]; -} - -/** - * Update user preferences - * @param {string} key - Preference key - * @param {any} value - New value - */ -function updatePreference(key, value) { - userPreferences[key] = value; -} - -/** - * Get preference value - * @param {string} key - Preference key - * @returns {any} Preference value - */ -function getPreference(key) { - return userPreferences[key]; -} - /** * Check if localStorage is available and has space * @returns {object} Storage status @@ -139,14 +27,5 @@ function checkStorage() { } } -// Make available globally -window.appState = appState; -window.userPreferences = userPreferences; -window.loadPreferences = loadPreferences; -window.savePreferences = savePreferences; -window.adminConfig = adminConfig; -window.updateState = updateState; -window.getState = getState; -window.updatePreference = updatePreference; -window.getPreference = getPreference; +// Make available globally (only functions) window.checkStorage = checkStorage; \ No newline at end of file