Commit Graph

65 Commits

Author SHA1 Message Date
fahed
9c0ffa5721 docs: add ETL pipeline design spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:26:23 +03:00
fahed
b4f4104e3e chore: remove Slides page and Salla console output
- Remove Slides route, import, and mobile nav link from App.tsx
- Remove Salla route mounting and console output from server

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 17:16:40 +03:00
fahed
18821fd560 fix: fetch ERP months sequentially to avoid 500 errors
The ERP API can't handle concurrent requests — switch from batched
parallel (4 at a time) to sequential fetching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 16:59:21 +03:00
fahed
ea71e54058 fix: change server port to 3002 to avoid conflict with rawaj-v2
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 16:49:59 +03:00
fahed
4ed4d83257 feat: add unified dev script that launches server + client
npm run dev now starts both the ERP proxy server and Vite in parallel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 16:46:31 +03:00
fahed
f6b7d4ba8d feat: migrate museum sales from NocoDB to Hono ERP API
- Replace NocoDB museum data (Districts/Museums/DailyStats) with ERP API
- Client fetches via server proxy (/api/erp/sales) — no credentials in browser
- Aggregate transaction-level ERP data into daily/museum/channel records
- Replace "district" dimension with "channel" (B2C/HiHala, POS, B2B, etc.)
- Add product-to-museum mapping (46 products → 6 museums)
- NocoDB retained only for PilgrimStats
- Remove old server/index.js (replaced by modular TS in server/src/)
- Update all components, types, and locale files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 16:43:34 +03:00
fahed
a84caaa31e feat: add product-to-museum and channel mapping config
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 15:03:10 +03:00
fahed
8bdfc85027 refactor: extract fetch helpers to shared util
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 15:02:43 +03:00
fahed
e84d961536 feat: convert server to TypeScript + add ERP API proxy
- Migrate server/index.js → modular TS structure (config, routes, services)
- Add ERP proxy: GET /api/erp/sales proxies Hono ERP API with server-side auth
- JWT token cached server-side, auto-refreshes on 401
- ERP credentials stay server-side only (no VITE_ prefix)
- Vite dev proxy routes /api/erp → localhost:3001
- Preserve existing Salla OAuth integration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:58:35 +03:00
fahed
9c1552e439 chore: add ERP API migration plan (pre-migration snapshot)
Preserves current NocoDB-based state before switching museum
sales data source to the Hono ERP API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:43:20 +03:00
fahed
802ff28754 Update default theme to light and fix data source subtitle
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
Default to light theme instead of system preference, and update
dashboard subtitle to reflect VivaTicket as the data source.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:03:17 +03:00
fahed
7d919979cc Delight: Add micro-interactions and entrance animations
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 6s
- Stat cards lift on hover (translateY -2px + shadow elevation)
- Metric cards lift on hover
- Chart cards fade-up with staggered delays on mount
- All animations respect prefers-reduced-motion (already in place)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:30:21 +03:00
fahed
784a914ebf Colorize: Add dark mode with system/dark/light toggle
- Add prefers-color-scheme: dark media query for automatic dark mode
- Add data-theme attribute for manual override (persisted to localStorage)
- 3-state cycle: system → dark → light → system
- Theme toggle button in nav with contextual icon (sun/moon/half)
- Dark palette: slate-900 bg, slate-800 surfaces, adjusted text/accent/success/danger

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:29:39 +03:00
fahed
0df13abfee Polish + Optimize: Clean metadata, remove !important, prune unused CSS
- Update theme-color to match brand (#f8fafc), fix stale CRA description
- Remove manifest.json and logo192.png references (not used)
- Replace !important on chart export buttons with higher specificity selectors
- Remove unused .skeleton-text and .skeleton-loading CSS classes
- Remove duplicate skeleton animation keyframes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:28:34 +03:00
fahed
cf169b6b69 Normalize + Adapt: CSS tokens, RTL fixes, mobile nav, fluid charts
Normalize:
- Add 10+ new CSS variables (brand-icon, brand-text, text-inverse, warning-*, etc.)
- Replace 35+ hardcoded hex colors with CSS variable references

Adapt:
- Add Slides link to mobile bottom nav (was unreachable on mobile)
- Fix RTL table alignment: text-align left → start
- Make chart height fluid: 380px → clamp(280px, 30vw, 420px)
- Fix carousel dot touch targets to minimum 24px
- Fix margin-left → margin-inline-start for RTL

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:27:27 +03:00
fahed
25066af67c Harden: Fix critical accessibility issues
- Add aria-labels to icon-only buttons (refresh, language toggle)
- Add aria-hidden to decorative SVGs
- Add aria-label to data source select
- Replace outline:none with visible focus rings on all inputs/selects
- Add <main> landmark for screen reader navigation
- Add prefers-reduced-motion: disable all animations for vestibular safety
- Move error message inline style to CSS class
- Add aria-label to both nav landmarks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:23:04 +03:00
fahed
c8567da75f Enable TypeScript strict mode and fix all type errors
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 6s
- Enable strict: true in tsconfig.json (was false)
- Add proper interfaces for all component props (Dashboard, Comparison, Slides)
- Add SlideConfig, ChartTypeOption, MetricOption types
- Type all function parameters, callbacks, and state variables
- Fix dynamic property access with proper keyof assertions
- 233 type errors resolved across 5 files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:17:09 +03:00
fahed
30ea4b6ecb Add route-based code splitting and loading skeletons
- Lazy-load Dashboard, Comparison, Slides via React.lazy + Suspense
- Main bundle reduced from 606KB to 256KB
- Replace full-screen spinner with skeleton cards during load
- Skeleton used for both initial data fetch and route transitions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:10:42 +03:00
fahed
cd1e395ffa Remove unused useUrlState hook and sallaService
Both were implemented but never imported by any component.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:09:18 +03:00
fahed
8934ba1e51 Add fetch timeout/retry, friendly error messages, and VAT rate constant
- fetchWithTimeout (10s) + fetchWithRetry (3 attempts, exponential backoff)
- DataError class with type classification (config/network/auth/timeout/unknown)
- User-friendly error messages in EN/AR instead of raw error strings
- Extract VAT_RATE constant (was hardcoded 1.15)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:08:24 +03:00
fahed
ed29e7c22c Remove CI/CD debug output
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:58:02 +03:00
fahed
39b36bf6d9 Add debug output to CI/CD to verify secrets are injected
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 6s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:55:23 +03:00
fahed
bf996749e5 Discover NocoDB table IDs dynamically instead of hardcoding them
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
Table IDs are now fetched at runtime via the NocoDB meta API using
VITE_NOCODB_BASE_ID, so the same code works against any NocoDB instance
(local or Cloudron). Also adds a migration script for moving data between
instances with correct FK remapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:50:44 +03:00
fahed
db2617f37d Support both link columns and plain foreign key columns
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 6s
Production NocoDB uses DistrictId/MuseumId columns instead of
nc_epk____ link columns. Code now checks both column names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:03:07 +03:00
fahed
a720b4a0aa Retrigger build with updated NocoDB token
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
2026-03-09 17:47:31 +03:00
fahed
d98fd2cd36 Retrigger CI/CD build
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
2026-03-09 17:41:16 +03:00
fahed
7c1a8fa31a Add NocoDB env vars to CI/CD build step
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
Vite inlines env vars at build time, so they must be available
during the build step via Gitea secrets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:39:43 +03:00
fahed
6cf0bf626b Simplify CI/CD to deploy static frontend only
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 6s
Remove server deployment, dependency install, and systemd restart.
The app connects directly to NocoDB from the browser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:36:46 +03:00
fahed
b7ad978e29 Migrate from Create React App to Vite
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
CRA (react-scripts 5.0.1) is abandoned and incompatible with TypeScript 5.x.
Vite provides faster builds, active maintenance, and native TS5 support.

- Replace react-scripts with vite + @vitejs/plugin-react
- Move index.html to root with script module entry point
- Replace setupProxy.js with vite.config.ts proxy config
- Rename env vars from REACT_APP_ to VITE_ prefix
- Update tsconfig for bundler module resolution
- Add nginx setup script for deployment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:24:11 +03:00
fahed
42cb524cd8 Final NocoDB config update - DailyStats table recreated with correct structure
Some checks failed
Deploy HiHala Dashboard / deploy (push) Failing after 4s
2026-03-09 16:43:07 +03:00
fahed
a1394d4901 Update NocoDB config for Cloudron - fix DailyStats table ID 2026-03-09 16:29:20 +03:00
fahed
3068463995 Update NocoDB config for Cloudron deployment 2026-03-09 16:04:24 +03:00
fahed
97a208734e updates 2026-02-18 14:13:45 +03:00
fahed
0caef0b89a removed /server/node_modules 2026-02-16 11:00:54 +03:00
fahed
9bb4ecb0dd last changes 2026-02-16 10:59:55 +03:00
fahed
e92f11241d feat: add linear regression trendline to revenue charts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:56:49 +03:00
fahed
a71a741f76 feat: add start script to launch NocoDB and React together
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:30:15 +03:00
fahed
d1c500a677 Complete TypeScript migration
- Convert all shared components to TypeScript (.jsx → .tsx)
  - Carousel, ChartCard, EmptyState, FilterControls, StatCard, ToggleSwitch
- Add proper TypeScript interfaces for all component props
- Delete unused dataService.legacy.ts (archived Google Sheets code)
- Build passes successfully
2026-02-04 13:59:56 +03:00
fahed
868f46fc6e chore: migrate to TypeScript
- Convert all .js files to .tsx/.ts
- Add types for data structures (MuseumRecord, Metrics, etc.)
- Add type declarations for react-chartjs-2
- Configure tsconfig with relaxed strictness for gradual adoption
- All components now use TypeScript
2026-02-04 13:45:50 +03:00
fahed
e98bebd60b fix: match refresh button size to other nav buttons 2026-02-04 11:53:18 +03:00
fahed
7e72d6c02d fix: properly detect offline mode when using cached data 2026-02-04 11:49:25 +03:00
fahed
9044ab7da3 feat: VAT toggle + offline mode
- Rename Revenue to GrossRevenue, add NetRevenue (excl. VAT)
- Add VAT toggle (Incl/Excl) on Dashboard and Comparison pages
- Add offline mode with localStorage caching (24h validity)
- Add refresh button and offline indicator in nav
- Remove Google Sheets fallback (archived to dataService.legacy.js)
- Add AR/EN translations for new UI elements
2026-02-04 11:47:42 +03:00
fahed
afe276541f Fix chart data labels RTL alignment issue
- Force LTR direction on chart canvas elements via CSS
- Add locale: 'en-US' to chart options for consistent number formatting
- Add textDirection: 'ltr' to datalabels and tooltip configs
- Fixes background/text misalignment in Arabic RTL mode
2026-02-03 16:40:30 +03:00
fahed
0c7987493e Improve language toggle button design
- Add globe icon to language toggle
- Style with border, proper padding, and hover effects
- Match overall nav design language
- Use Inter font for Arabic mode to show 'EN' consistently
2026-02-03 16:32:31 +03:00
fahed
fa43cf8dd1 Fix chart height - override flex with explicit 380px
- Add .exportable-chart.chart-container rule with flex:none and height:380px
- This overrides the flex:1 that was preventing height from being applied
- Also fixed .chart-section .chart-container to 380px
2026-02-03 16:21:22 +03:00
fahed
1d7389cd43 Improve chart UX: taller charts, controls below header
- Increase chart height from 280px to 380px (more square-like)
- Move controls below chart title (column layout)
- Spread two control groups left/right with space-between
- Make controls more compact (smaller padding, font-size)
2026-02-03 15:53:14 +03:00
fahed
60eda25fe3 Position download button in corner + better Arabic font
- Move export button outside header-actions to enable absolute positioning
- Button now positioned at top-right (LTR) / top-left (RTL)
- Switch from Tajawal to IBM Plex Sans Arabic (slicker, more technical)
- Add RTL-specific font-family in CSS
2026-02-03 15:49:31 +03:00
fahed
12f548fc78 Fix chart export buttons and improve controls UX
- Add missing CSS for .chart-header-with-export layout
- Add .chart-header-actions for horizontal controls alignment
- Make .chart-export-btn.visible always show (was opacity: 0)
- Controls now display in clean horizontal row: title → toggles → tabs → download
2026-02-03 15:43:11 +03:00
fahed
00724aac3d Improve desktop UI readability
Typography improvements:
- Base font size increased to 15px
- Better text color contrast (darker text-secondary/muted)
- Stat card values: 2rem with font-weight 700
- Page titles: 1.75rem with font-weight 700
- Table font: 0.9375rem with better padding
- Toggle switches: larger buttons (0.8125rem, 6px 14px padding)
- Metric selector buttons: 0.8125rem with better padding
- Filter controls: larger labels and inputs
- Period banner: 1.75rem year display
- Metric cards: larger values (1.25rem)
- Nav links: 0.9375rem font size

Visual improvements:
- Subtle box shadows on stat/metric cards
- Better border contrast
- Improved spacing throughout
2026-02-03 15:39:03 +03:00
fahed
eb477158cb Restore translations + fix CSS for new components
- Restored Arabic/English translations from overhaul
- Restored LanguageContext for language switching
- Restored updated components with i18n support
- Kept original CSS from f17e19f (working desktop styling)
- Added missing CSS for new components:
  - .page-title-with-actions
  - .toggle-with-label
  - .period-display-banner

Desktop and Arabic translations both working.
2026-02-03 15:32:52 +03:00