diff --git a/.env.example b/.env.example index ec47392..f58a03e 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,7 @@ -# NocoDB Configuration (optional - only needed if using NocoDB as data source) +# NocoDB (primary data source) REACT_APP_NOCODB_URL=http://localhost:8090 REACT_APP_NOCODB_TOKEN=your_token_here + +# Google Sheets (fallback if NocoDB fails) +REACT_APP_SHEETS_ID=your_spreadsheet_id_here +REACT_APP_SHEETS_NAME=Consolidated Data diff --git a/public/hihala-logo.svg b/public/hihala-logo.svg new file mode 100644 index 0000000..20952ba --- /dev/null +++ b/public/hihala-logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/App.css b/src/App.css index e6e7190..1b027ad 100644 --- a/src/App.css +++ b/src/App.css @@ -159,14 +159,22 @@ body { } .nav-brand { - font-size: 1.125rem; + display: flex; + align-items: center; + gap: 8px; + font-size: 1rem; font-weight: 600; - color: var(--text-primary); + color: var(--text-secondary); letter-spacing: -0.02em; } +.nav-logo { + height: 24px; + width: auto; +} + .nav-brand span { - color: var(--gold); + color: var(--text-secondary); } .nav-links { @@ -1011,7 +1019,11 @@ table tbody tr:hover { } .nav-brand { - font-size: 1.1rem; + font-size: 0.9rem; + } + + .nav-logo { + height: 20px; } /* Mobile Bottom Navigation */ diff --git a/src/App.js b/src/App.js index 56e6811..4c1a3be 100644 --- a/src/App.js +++ b/src/App.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { BrowserRouter as Router, Routes, Route, Link, useLocation } from 'react-router-dom'; import Dashboard from './components/Dashboard'; import Comparison from './components/Comparison'; -import { fetchSheetData } from './services/dataService'; +import { fetchData } from './services/dataService'; import './App.css'; function NavLink({ to, children }) { @@ -25,7 +25,7 @@ function App() { async function loadData() { try { setLoading(true); - const result = await fetchSheetData(); + const result = await fetchData(); setData(result); setError(null); } catch (err) { @@ -61,7 +61,10 @@ function App() { - HiHala Museums + + + Museums Data + diff --git a/src/services/dataService.js b/src/services/dataService.js index b0a3b9f..6c1e10f 100644 --- a/src/services/dataService.js +++ b/src/services/dataService.js @@ -1,13 +1,17 @@ -// Google Sheets configuration -const SPREADSHEET_ID = '1rdK1e7jmfu-es4Ql0YwDYNBY2OvVihBjYaXTM-MHHqg'; -const SHEET_NAME = 'Consolidated Data'; -const SHEET_URL = `https://docs.google.com/spreadsheets/d/${SPREADSHEET_ID}/gviz/tq?tqx=out:csv&sheet=${encodeURIComponent(SHEET_NAME)}`; +// Data source configuration - all from environment variables +// Set these in .env.local (never commit .env.local to git) -// NocoDB configuration - uses environment variables for security -// Set REACT_APP_NOCODB_URL and REACT_APP_NOCODB_TOKEN in .env.local +// NocoDB (primary/default) const NOCODB_URL = process.env.REACT_APP_NOCODB_URL || ''; const NOCODB_TOKEN = process.env.REACT_APP_NOCODB_TOKEN || ''; +// Google Sheets (fallback) +const SPREADSHEET_ID = process.env.REACT_APP_SHEETS_ID || ''; +const SHEET_NAME = process.env.REACT_APP_SHEETS_NAME || 'Consolidated Data'; +const SHEET_URL = SPREADSHEET_ID + ? `https://docs.google.com/spreadsheets/d/${SPREADSHEET_ID}/gviz/tq?tqx=out:csv&sheet=${encodeURIComponent(SHEET_NAME)}` + : ''; + // Table IDs (not sensitive - just identifiers) const NOCODB_TABLES = { districts: 'm8cup7lesbet0sa', @@ -168,8 +172,23 @@ export async function fetchNocoDBData() { } } -export async function fetchData(source = 'sheets') { - return source === 'nocodb' ? fetchNocoDBData() : fetchSheetData(); +// Main data fetcher - tries NocoDB first, falls back to Sheets +export async function fetchData() { + // Try NocoDB if configured + if (NOCODB_URL && NOCODB_TOKEN) { + try { + return await fetchNocoDBData(); + } catch (err) { + console.warn('NocoDB failed, trying Google Sheets fallback...', err.message); + } + } + + // Fallback to Google Sheets if configured + if (SHEET_URL) { + return await fetchSheetData(); + } + + throw new Error('No data source configured. Set REACT_APP_NOCODB_URL + REACT_APP_NOCODB_TOKEN, or REACT_APP_SHEETS_ID in .env.local'); } export function filterData(data, filters) {