feat: update branding with official HiHala logo + 'Museums Data'
- Add official HiHala logo SVG (text portion from v1.5) - Replace text-based nav brand with logo image + 'Museums Data' - Update data source to default to NocoDB with Sheets fallback - Move all credentials to environment variables (.env.local)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user