diff --git a/renderer/script.js b/renderer/script.js index 2a52fda..08759cf 100644 --- a/renderer/script.js +++ b/renderer/script.js @@ -128,6 +128,38 @@ function addToSiteHistory(url) { } } +// Search history management using localStorage +function getSearchHistory() { + try { + const history = localStorage.getItem('searchHistory'); + return history ? JSON.parse(history) : []; + } catch (err) { + console.error('Error reading search history from localStorage:', err); + return []; + } +} + +function addToSearchHistory(searchQuery) { + try { + let history = getSearchHistory(); + // Remove if already exists to avoid duplicates + history = history.filter(item => item !== searchQuery); + // Add to beginning + history.unshift(searchQuery); + // Keep only last 100 entries + if (history.length > 100) { + history = history.slice(0, 100); + } + localStorage.setItem('searchHistory', JSON.stringify(history)); + // Also save to file via IPC for persistence + if (window.electronAPI && window.electronAPI.invoke) { + window.electronAPI.invoke('save-search-history', history); + } + } catch (err) { + console.error('Error saving search history to localStorage:', err); + } +} + // Store current theme colors globally for use by renderTabs let currentThemeColors = null; @@ -653,6 +685,7 @@ function performNavigation(input, originalInputForHistory) { const isInternal = input.startsWith('nebula://'); const isLikelyUrl = hasProtocol || input.includes('.'); let resolved; + let isSearch = false; if (isFileProtocol) { resolved = input; } else if (looksLikeLocalPath) { @@ -660,6 +693,9 @@ function performNavigation(input, originalInputForHistory) { if (/^[A-Za-z]:\//.test(p)) resolved = 'file:///' + encodeURI(p); else if (p.startsWith('/')) resolved = 'file://' + encodeURI(p); else resolved = 'file://' + encodeURI(p); } else if (!isInternal && !isLikelyUrl) { resolved = `https://www.google.com/search?q=${encodeURIComponent(input)}`; + isSearch = true; + // Save to search history + addToSearchHistory(input); } else { resolved = resolveInternalUrl(input); } diff --git a/renderer/settings.css b/renderer/settings.css index e69ad31..345d5c6 100644 --- a/renderer/settings.css +++ b/renderer/settings.css @@ -234,7 +234,7 @@ button:hover { padding: 0.5rem 1rem; font-size: 14px; font-weight: 500; - background: linear-gradient(135deg, var(--primary), var(--accent)); + background: var(--primary); color: var(--text); border: 1px solid var(--primary); border-radius: 6px; @@ -244,7 +244,7 @@ button:hover { } .primary-btn:hover { - background: linear-gradient(135deg, var(--primary-hover), var(--accent)); + background: var(--primary-hover); box-shadow: 0 4px 24px rgba(123, 46, 255, 0.25); transform: translateY(-1px); } @@ -372,6 +372,84 @@ button:hover { color: color-mix(in srgb, var(--text) 85%, transparent); } +/* Zoom controls */ +.zoom-controls { + display: flex; + align-items: center; + gap: 12px; + margin-bottom: 12px; +} + +.zoom-btn { + width: 40px; + height: 40px; + border: 1px solid var(--border); + background: var(--surface); + color: var(--text); + border-radius: 6px; + font-size: 20px; + font-weight: 400; + cursor: pointer; + transition: all 0.2s ease; + display: flex; + align-items: center; + justify-content: center; + padding: 0; +} + +.zoom-btn:hover { + background: var(--surface-hover); + border-color: var(--primary); +} + +.zoom-btn:active { + transform: scale(0.95); +} + +.zoom-value { + flex: 1; + font-size: 15px; + font-weight: 600; + color: var(--text); + text-align: center; + padding: 0 8px; +} + +.zoom-presets { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); + gap: 8px; +} + +.zoom-preset-btn { + padding: 10px 16px; + border: 1px solid var(--border); + background: var(--surface); + color: var(--text-secondary); + border-radius: 6px; + font-size: 13px; + font-weight: 500; + cursor: pointer; + transition: all 0.2s ease; +} + +.zoom-preset-btn:hover { + background: var(--surface-hover); + border-color: var(--primary); + color: var(--text); +} + +.zoom-preset-btn.active { + background: var(--primary); + border-color: var(--primary); + color: white; + box-shadow: var(--glow-subtle); +} + +.zoom-preset-btn:active { + transform: scale(0.95); +} + .settings-fieldset { border: 1px solid var(--border); border-radius: 6px; diff --git a/renderer/settings.html b/renderer/settings.html index 08c156d..127a79d 100644 --- a/renderer/settings.html +++ b/renderer/settings.html @@ -10,7 +10,7 @@