fix: isola helpers de UI para evitar vazamento de SDK de backend e corrige tela branca
This commit is contained in:
parent
b11ce359a6
commit
52d00343fa
|
|
@ -26,3 +26,4 @@
|
||||||
4. **Upload de Arquivos:** Proibido o uso de Base64 para envio de novos arquivos ao servidor. Use obrigatoriamente `FormData` e envie o objeto `File/Blob` para as rotas de API que integram com o MinIO.
|
4. **Upload de Arquivos:** Proibido o uso de Base64 para envio de novos arquivos ao servidor. Use obrigatoriamente `FormData` e envie o objeto `File/Blob` para as rotas de API que integram com o MinIO.
|
||||||
5. **Build & Deploy Stability:** O pipeline de deploy deve obrigatoriamente utilizar `runs-on: self-hosted` e compilar apenas a plataforma `linux/arm64` (sem emulação QEMU). A atualização da stack em produção deve ser automatizada via container transiente do Watchtower.
|
5. **Build & Deploy Stability:** O pipeline de deploy deve obrigatoriamente utilizar `runs-on: self-hosted` e compilar apenas a plataforma `linux/arm64` (sem emulação QEMU). A atualização da stack em produção deve ser automatizada via container transiente do Watchtower.
|
||||||
6. **Express Compatibility**: Avoid using raw `/*` wildcards in Express 5 routes; use Regex paths (`/^\/route\/(.+)$/`) for compatibility with `path-to-regexp` v8.
|
6. **Express Compatibility**: Avoid using raw `/*` wildcards in Express 5 routes; use Regex paths (`/^\/route\/(.+)$/`) for compatibility with `path-to-regexp` v8.
|
||||||
|
7. **Frontend Independence**: NEVER import files from `services/` or `server.js` directly into React components to prevent Node.js/SDK leakage (causes White Screen). Use `helpers.ts` for UI logic.
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
- [x] Correção do Crash 404 no Portal: Injeção da pasta `src/services` no container de produção para permitir o import do `storage.js`.
|
- [x] Correção do Crash 404 no Portal: Injeção da pasta `src/services` no container de produção para permitir o import do `storage.js`.
|
||||||
- [x] Correção das Imagens de Prova: Normalização das URLs nas questões de avaliações (Portal e Manager).
|
- [x] Correção das Imagens de Prova: Normalização das URLs nas questões de avaliações (Portal e Manager).
|
||||||
- [x] Estabilização de CI/CD: Transição para `runs-on: self-hosted` (ARM64 nativo) eliminando lentidão e crashes do QEMU.
|
- [x] Estabilização de CI/CD: Transição para `runs-on: self-hosted` (ARM64 nativo) eliminando lentidão e crashes do QEMU.
|
||||||
|
- [x] Fix Tela Branca (Portal): Refatoração de `normalizePhotoUrl` para `helpers.ts` isolado, evitando vazamento de SDK de Backend no Navegador.
|
||||||
- [ ] Próximo Passo: Verificar se o Watchtower sincronizou as imagens corretamente na produção.
|
- [ ] Próximo Passo: Verificar se o Watchtower sincronizou as imagens corretamente na produção.
|
||||||
|
|
||||||
### 💳 Módulo Financeiro (Portal do Aluno)
|
### 💳 Módulo Financeiro (Portal do Aluno)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { useTheme } from '../context/ThemeContext';
|
||||||
import { Moon, Sun } from 'lucide-react';
|
import { Moon, Sun } from 'lucide-react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
import Notifications from './Notifications';
|
import Notifications from './Notifications';
|
||||||
import { normalizePhotoUrl } from '../services/storage';
|
import { normalizePhotoUrl } from '../helpers';
|
||||||
|
|
||||||
const pageTitles: Record<string, string> = {
|
const pageTitles: Record<string, string> = {
|
||||||
'/': 'Dashboard',
|
'/': 'Dashboard',
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
FileText, Award, User, LogOut, GraduationCap, X, Menu, ClipboardList
|
FileText, Award, User, LogOut, GraduationCap, X, Menu, ClipboardList
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { normalizePhotoUrl } from '../services/storage';
|
import { normalizePhotoUrl } from '../helpers';
|
||||||
|
|
||||||
const navItems = [
|
const navItems = [
|
||||||
{ path: '/', label: 'Dashboard', icon: LayoutDashboard },
|
{ path: '/', label: 'Dashboard', icon: LayoutDashboard },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
* Helpers compartihados de UI
|
||||||
|
*/
|
||||||
|
export function normalizePhotoUrl(url) {
|
||||||
|
if (!url || typeof url !== 'string') return '';
|
||||||
|
if (url.startsWith('data:image')) return url;
|
||||||
|
if (url.startsWith('/storage/')) return url;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const match = url.match(/^https?:\/\/[^\/]+\/(.+)$/);
|
||||||
|
if (match) return `/storage/${match[1]}`;
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
ClipboardList, Clock, ChevronLeft, ChevronRight, Send, CheckCircle2,
|
ClipboardList, Clock, ChevronLeft, ChevronRight, Send, CheckCircle2,
|
||||||
XCircle, Award, AlertTriangle, Timer, ArrowLeft
|
XCircle, Award, AlertTriangle, Timer, ArrowLeft
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { normalizePhotoUrl } from '../services/storage';
|
import { normalizePhotoUrl } from '../helpers';
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// Exam Environment — Portal do Aluno
|
// Exam Environment — Portal do Aluno
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue