diff --git a/backend/src/infrastructure/ranking_store.py b/backend/src/infrastructure/ranking_store.py index 677888d..8034db0 100644 --- a/backend/src/infrastructure/ranking_store.py +++ b/backend/src/infrastructure/ranking_store.py @@ -45,12 +45,14 @@ def extrair_selos_entry(detalhes: Dict[str, Any]) -> Set[str]: papel = (prem.get("papel") or "").lower() codigo = prem.get("codigo", "") - if "GP" in codigo or "grande" in codigo.lower(): + if codigo == "PREMIACAO": tipo_prem = "GP" - elif "MENCAO" in codigo or "menção" in codigo.lower(): + elif codigo == "PREMIACAO_GP": + tipo_prem = "PREMIO" + elif codigo == "MENCAO": tipo_prem = "MENCAO" else: - tipo_prem = "PREMIO" + continue if "autor" in papel: selos.add(f"AUTOR_{tipo_prem}") @@ -64,18 +66,18 @@ def extrair_selos_entry(detalhes: Dict[str, Any]) -> Set[str]: is_coorient = orient.get("coorientacao", False) if is_coorient: - if "POS_DOC" in codigo: + if codigo == "CO_ORIENT_POS_DOC": selos.add("CO_ORIENT_POS_DOC") - elif "TESE" in codigo: + elif codigo == "CO_ORIENT_TESE": selos.add("CO_ORIENT_TESE") - elif "DISS" in codigo: + elif codigo == "CO_ORIENT_DISS": selos.add("CO_ORIENT_DISS") else: - if "POS_DOC" in codigo: + if codigo == "ORIENT_POS_DOC": selos.add("ORIENT_POS_DOC") - elif "TESE" in codigo: + elif codigo == "ORIENT_TESE": selos.add("ORIENT_TESE") - elif "DISS" in codigo: + elif codigo == "ORIENT_DISS": selos.add("ORIENT_DISS") return selos @@ -146,7 +148,7 @@ class RankingStore: selos_set = set(filtro_selos) entries = [ e for e in entries - if selos_set & extrair_selos_entry(e.detalhes) + if selos_set.issubset(extrair_selos_entry(e.detalhes)) ] total = len(entries) diff --git a/frontend/src/App.css b/frontend/src/App.css index 7240858..bf8a134 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -48,22 +48,30 @@ .controls { margin: 1.5rem 0; + background: linear-gradient(165deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4)); + border: 1px solid var(--stroke); + border-radius: 12px; + padding: 0.75rem 1rem; display: flex; - gap: 1.5rem; - flex-wrap: wrap; align-items: center; + gap: 1rem; + flex-wrap: wrap; } -.controls label { +.control-group { display: flex; align-items: center; gap: 0.5rem; - font-size: 0.9rem; +} + +.control-group-label { + font-size: 0.8rem; color: var(--muted); + white-space: nowrap; } .controls select { - padding: 0.5rem 1rem; + padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.06); border: 1px solid var(--stroke); border-radius: 8px; @@ -81,23 +89,25 @@ display: flex; gap: 0.5rem; align-items: center; + flex: 1; } .search-box input { - padding: 0.55rem 0.8rem; + padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.06); border: 1px solid var(--stroke); border-radius: 8px; color: var(--text); - min-width: 240px; + flex: 1; } .search-box input:focus { - outline: 1px solid var(--accent-2); + outline: none; + border-color: var(--accent-2); } .search-box button { - padding: 0.55rem 1rem; + padding: 0.5rem 0.9rem; background: var(--accent); border: 1px solid var(--accent); color: white; @@ -120,17 +130,17 @@ display: flex; align-items: center; gap: 0.5rem; - flex-wrap: wrap; } .pagination button { - padding: 0.6rem 0.9rem; - border-radius: 8px; + padding: 0.5rem 0.75rem; + border-radius: 6px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.06); color: var(--text); cursor: pointer; transition: all 150ms ease; + font-size: 0.9rem; } .pagination button:hover:not(:disabled) { @@ -145,6 +155,20 @@ .page-info { color: var(--muted); font-weight: 500; + font-size: 0.9rem; + padding: 0 0.5rem; + white-space: nowrap; +} + +@media (max-width: 900px) { + .controls { + gap: 0.75rem; + } + + .search-box { + min-width: 100%; + order: 10; + } } .ranking-list { diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 32ce983..1d41eca 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -182,16 +182,16 @@ function App() {
-
diff --git a/frontend/src/components/FiltroSelos.jsx b/frontend/src/components/FiltroSelos.jsx index e946b53..d1d3076 100644 --- a/frontend/src/components/FiltroSelos.jsx +++ b/frontend/src/components/FiltroSelos.jsx @@ -36,8 +36,15 @@ const SELOS_CONFIG = { function FiltroSelos({ selecionados, onChange }) { const [aberto, setAberto] = useState(false); + const [selosTemp, setSelosTemp] = useState([]); const ref = useRef(null); + useEffect(() => { + if (aberto) { + setSelosTemp([...selecionados]); + } + }, [aberto, selecionados]); + useEffect(() => { const handleClickOutside = (e) => { if (ref.current && !ref.current.contains(e.target)) { @@ -49,18 +56,27 @@ function FiltroSelos({ selecionados, onChange }) { }, []); const toggleSelo = (codigo) => { - if (selecionados.includes(codigo)) { - onChange(selecionados.filter((s) => s !== codigo)); + if (selosTemp.includes(codigo)) { + setSelosTemp(selosTemp.filter((s) => s !== codigo)); } else { - onChange([...selecionados, codigo]); + setSelosTemp([...selosTemp, codigo]); } }; + const limparTemp = () => { + setSelosTemp([]); + }; + const limparFiltros = (e) => { e.stopPropagation(); onChange([]); }; + const aplicarFiltro = () => { + onChange(selosTemp); + setAberto(false); + }; + const totalSelos = Object.values(SELOS_CONFIG).reduce( (acc, g) => acc + g.selos.length, 0 @@ -90,9 +106,9 @@ function FiltroSelos({ selecionados, onChange }) {
Selecione os selos para filtrar - {selecionados.length > 0 && ( - )}
@@ -105,11 +121,11 @@ function FiltroSelos({ selecionados, onChange }) { {grupo.selos.map((selo) => (