Commit Graph
16 Commits
Author SHA1 Message Date
evandro 30d7ef701f fix: cache JSON concorrente, validação do sync e timeout nas chamadas ao Open Food Facts
- JsonCacheManager: a leitura inicial concorrente carregava o arquivo duas
  vezes e a segunda descartava as alterações da primeira; gravações
  simultâneas escreviam no mesmo arquivo. Agora a leitura é compartilhada
  e a gravação é enfileirada, via arquivo temporário + rename.
- POST /api/cache/sync: aceitava qualquer objeto e usava code como chave
  do cache (inclusive ausente ou não numérico); agora só grava produtos
  com code numérico e conta os demais em failed. JSON malformado responde
  400 em vez de 500.
- GET /api/products/[barcode]: resposta da API sem product virava 200
  com corpo vazio; agora responde 404.
- Chamadas ao Open Food Facts (busca e produto) passam a ter timeout de
  15 s e o User-Agent vem de um único lugar (lib/offSearch).
2026-10-10 04:18:59 -03:00
evandro 3d59903114 perf: remover polling de storage-stats e trabalho repetido na busca do cache
- useStorageMonitor: o efeito com setInterval de 10 s chamava
  /api/storage-stats em toda aba aberta só para escrever no console
  (nenhum estado é atualizado); o servidor faz fs.stat e conta as
  chaves do cache a cada chamada. A busca inicial de estatísticas
  continua.
- JsonCacheManager.searchProducts: convertToAPIProduct rodava duas vezes
  por produto (filtro e map) e a relevância era recalculada, com
  toLowerCase, a cada comparação do sort; agora é uma vez por produto.
2026-10-10 04:16:34 -03:00
evandro a9ab66e26f chore: remover código morto e artefatos, adicionar CI e script typecheck
- componentes sem nenhuma importação (card, items, DeleteButton, IdInput,
  NutriScoreBadge, NutritionBar, NutritionChart, PageTitle, PersuasiveCTA,
  landing/SearchBar), imports e variável não usados (avisos do lint)
- sw.js na raiz: não é referenciado e carrega script de terceiros
  (fenoofaussut.net)
- bun.lock (o deploy e o README usam pnpm), graphify-out/ e os bancos
  SQLite versionados em prisma/prisma (pnpm db:push recria o banco)
- devDependency depcheck sem uso
- .gitignore: *.sqlite, *.sqlite-journal, graphify-out/
- script typecheck e workflow do GitHub Actions (lint, typecheck, test, build)
2026-10-10 04:16:04 -03:00
evandro bf688257ef refactor(api): extrair montagem e paginação da busca para lib/offSearch
GET /api/search passa de CC 41 para <= 10. Testes de caracterização
(sem rede: fetch e cache JSON temporário) cobrem validação, filtros,
ordenação, paginação, modo cache-only e erros.

Também: parameter property de NutriScanError virou campo explícito e
imports só de tipo usam import type, para o type stripping nativo do
Node; o script de teste não usa mais --experimental-transform-types
(removida no Node 26).
2026-10-10 04:14:48 -03:00
Evandro Fonseca Junior fa07ba8910 fix: normalize nutrition units and retain zero-valued nutrients 2026-09-30 17:13:27 -03:00
evandrodevbr f71cd167b3 feat: complete NutriScan redesign 2026-07-16 16:31:50 -03:00
Evandro Fonseca Junior 50ffed4fee fix(error tracking): streamline Rybbit integration by removing unnecessary type assertions
- Updated ErrorBoundary and ErrorTracking components to directly access the Rybbit object without type assertions.
- Enhanced error tracking by ensuring stack traces and component stacks are only included if available.
- Improved the HeroSection component by replacing the standard img tag with Next.js Image component for better performance and optimization.
2026-01-20 21:36:20 -03:00
Evandro Fonseca Junior c99c82c837 refactor(product page, api): improve error handling and enhance type safety
- Refactored error handling in the product page to simplify catch block.
- Updated type definitions in openFoodFactsApi for better type safety.
- Introduced utility functions for search type detection and barcode validation.
2026-01-20 12:10:56 -03:00
Evandro Fonseca Junior f98c648311 feat(footer, header, landing): enhance UI components and improve navigation
- Updated Footer component with new links and dynamic year display.
- Refactored Header component to improve mobile navigation and theme toggling.
- Enhanced DonationSection and Features components with improved layout and animations.
- Updated HowItWorks and Impact sections for better user engagement and clarity.
- Improved product page layout and error handling in API interactions.
- General UI refinements across various components for a cohesive user experience.
2026-01-12 19:55:50 -03:00
Evandro Fonseca Junior bfb58ef16e feat(search): implement paginated API fetching for large page sizes
- Removed upper limit on page_size validation to support requests >100
- Added automatic pagination logic to fetch from Open Food Facts API in chunks of 1000
- Accumulates products across multiple API pages until desired count is reached
- Updated error messages and product data fields for consistency
2025-10-09 07:16:26 -03:00
Evandro Fonseca Junior c173fec668 feat(api): implement product caching mechanism
- Add NODE_ENV=production to .env for environment configuration
- Enhance product API route with JSON cache manager for local storage and retrieval
- Introduce cache-only mode and detailed logging for better performance and offline support
- Update UI to display cache status and storage statistics
2025-10-09 04:30:46 -03:00
Evandro Fonseca Junior e4ed666074 feat(results-page): enhance search with caching, pagination, and UI tweaks
- Add dynamic rendering and Node.js runtime config to location API for better performance
- Improve ProductCardSkeleton with dark mode styling for consistent theming
- Simplify Hero search placeholder to focus on product name input
- Integrate caching, pagination, and cache clearing in results page for optimized search experience and user control
2025-10-09 01:53:42 -03:00
Evandro Fonseca Junior 166abeb64e refactor(CardList): replace ProductCard with ListaProductCard
Updated CardList component to use ListaProductCard instead of ProductCard for rendering products, improving component specificity for list views. Also adjusted indentation for consistency.
2025-10-09 01:28:33 -03:00
Evandro Fonseca Junior 9a4e4c762e feat(ui): enhance footer with NutriScan branding and fix database path
- Redesigned Footer.tsx with comprehensive layout including brand section, navigation links, social media icons, and contact info to improve user engagement and brand visibility
- Updated DATABASE_URL in .env to correct Prisma database path for proper configuration and connectivity
- Updated dependencies to support new UI components and ensure compatibility with enhanced features
2025-10-09 00:14:30 -03:00
Evandro b3eceeb78d feat: 🐛 2024-11-28 13:00:26 -03:00
Evandro e775435c9f feat: 🚀 2024-11-28 12:37:47 -03:00