Web layer cleanup: Bootstrap removal, JS splitting, CSS consolidation, legal page injection #32

Merged
gelu merged 7 commits from refactor/web-cleanup-31 into main 2026-05-28 10:39:58 +00:00

7 Commits

Author SHA1 Message Date
claude af5d9fd7ad refactor(web): enhance legal.js to inject topbar + footer; strip duplication from legal pages
legal.js now:
- Dynamically injects a common topbar (logo + language switcher) on all 6 pages
- Dynamically injects a language-aware footer (EN vs RO copyright text)
- Detects page language and builds appropriate language links
- Uses event delegation for language links (works on injected elements)
- Persists language preference to localStorage

All 6 legal HTML pages now:
- Removed the hardcoded topbar div (12 lines of identical HTML per file)
- Removed the hardcoded footer div (7 lines of HTML with language-specific content)
- Total savings: 114 lines of duplicated HTML across 6 pages
- Pages are 38% smaller (60 lines → 37 lines core content)

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 13:34:18 +03:00
claude 513d925be1 refactor(web): rewrite main.js — slim, modular, well-documented
From 722 lines → 387 lines. Removed CV matcher logic (moved to cv-matcher.js)
and i18n dictionary (moved to i18n.js).

Keeps core functionality:
- i18n initialization, language switching, translation helpers
- Header/nav behavior
- Contact and subscribe forms (with reCaptcha validation)
- Cookie consent management
- API health checks and configuration loading

Additions:
- JSDoc on all public functions with parameter/return types
- Section block comments for navigability
- Expose utilities on window.MyAi: t(), currentLang(), showFieldError(),
  clearFieldErrors(), isValidEmail(), extractApiError()
- Cleaner separation of concerns between main.js, cv-matcher.js, i18n.js

Load order: jQuery → i18n.js → main.js → cv-matcher.js (on cv-matcher page)

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 13:33:20 +03:00
claude 9227c92a88 feat(web): create cv-matcher.js with CV form and result rendering
Extract CV matcher form logic from main.js into dedicated cv-matcher.js:
- CV file upload with validation
- Job URL/description input
- reCaptcha token retrieval for upload and match actions
- Match result rendering with score badge, strengths, gaps, evidence
- Helper functions: extractApiError, escapeHtml, showFieldError, etc.

Depends on jQuery, i18n.js, and shared utilities from main.js.

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 13:32:34 +03:00
claude 6b460fded4 feat(web): create i18n.js with EN/RO translation dictionaries
Extract i18n dictionary from main.js into dedicated i18n.js module.
Sets window.MyAi.i18n with 228 keys across English and Romanian.

Main.js will consume this via t(key) helper function.

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 13:31:53 +03:00
claude 4e086f3eca refactor(web): HTML cleanup — remove inline styles, add script tags for i18n and cv-matcher
- Remove all 7 inline style="display:none;" attributes from loaders/cookie elements
  (now handled by CSS with .loader-overlay { display: none } and
  .loader-overlay.loader-visible { display: flex })
- Remove orphan footer-legal class (unused in CSS) from footer-links divs
- Add <script src="/js/i18n.js"></script> before main.js on both pages
- Add <script src="/js/cv-matcher.js"></script> after main.js on cv-matcher page

jQuery 4.0 now detects CSS display:none correctly via getComputedStyle,
so class-based visibility (.loader-visible) works seamlessly.

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 13:30:59 +03:00
claude 04ce55bfc3 refactor(web): restructure myai.css with section comments and cleanup
- Add section block comments throughout for navigability
- Merge two duplicate @media (max-width:900px) blocks into one
- Remove dead .ai-mark rule (replaced by <img> logo, never rendered)
- Move .cookie-overlay, .cookie-manage to display:none by default
  (removes need for inline style="display:none;" on those elements)
- Add .loader-overlay.loader-visible{display:flex} so JS can use
  class toggling instead of .css('display','flex') — works correctly
  with jQuery 4.0's getComputedStyle-based visibility detection
- Consolidate brand-mark, console-line, nav-actions rules next to
  their related blocks (were scattered at end of file)

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 10:13:27 +03:00
claude 3a39b03ff1 chore(web): remove Bootstrap, add 4 replacement utility rules, delete dead style.css
Bootstrap CSS (232 KB) and Bootstrap JS (39 KB) were loaded for only
4 utility classes (.btn-sm, .btn-dark, .btn-warning, .shadow).
Replace with 4 targeted rules in myai.css and delete both files.

style.css (784 lines) was unreferenced by any HTML page — delete it.

Closes #31

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 10:11:42 +03:00