Spaces:
Running
Running
Guilherme Silberfarb Costa commited on
Commit ·
5c357b1
1
Parent(s): 33a1b4a
pequenos ajustes
Browse files
frontend/src/components/TrabalhosTecnicosTab.jsx
CHANGED
|
@@ -185,6 +185,8 @@ export default function TrabalhosTecnicosTab({
|
|
| 185 |
const quickOpenHandledRef = useRef('')
|
| 186 |
const mapaRequestKeyRef = useRef('')
|
| 187 |
const mapaUltimaSelecaoRef = useRef({ ids: [], avaliando: null })
|
|
|
|
|
|
|
| 188 |
|
| 189 |
useEffect(() => {
|
| 190 |
void carregarTrabalhos()
|
|
@@ -230,6 +232,13 @@ export default function TrabalhosTecnicosTab({
|
|
| 230 |
return `${modo}::${idsKey}::${avalKey}`
|
| 231 |
}
|
| 232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
function atualizarCampoLocalizacao(field, value) {
|
| 234 |
if (!field) return
|
| 235 |
setLocalizacaoInputs((prev) => ({ ...prev, [field]: value }))
|
|
@@ -404,6 +413,7 @@ export default function TrabalhosTecnicosTab({
|
|
| 404 |
return
|
| 405 |
}
|
| 406 |
if (origemAbertura === 'trabalhos_tecnicos_mapa') {
|
|
|
|
| 407 |
setActiveInnerTab('mapa')
|
| 408 |
onVoltarLista()
|
| 409 |
return
|
|
@@ -597,7 +607,24 @@ export default function TrabalhosTecnicosTab({
|
|
| 597 |
)
|
| 598 |
}, 180)
|
| 599 |
return () => window.clearTimeout(timeoutId)
|
| 600 |
-
}, [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
if (trabalhoAberto) {
|
| 603 |
const modelos = Array.isArray(trabalhoAberto?.modelos) ? trabalhoAberto.modelos : []
|
|
@@ -1290,7 +1317,7 @@ export default function TrabalhosTecnicosTab({
|
|
| 1290 |
</button>
|
| 1291 |
</div>
|
| 1292 |
|
| 1293 |
-
<div className="trabalhos-mapa-controls">
|
| 1294 |
<label className="trabalhos-filter-field trabalhos-mapa-control-field">
|
| 1295 |
Exibição do mapa
|
| 1296 |
<select
|
|
|
|
| 185 |
const quickOpenHandledRef = useRef('')
|
| 186 |
const mapaRequestKeyRef = useRef('')
|
| 187 |
const mapaUltimaSelecaoRef = useRef({ ids: [], avaliando: null })
|
| 188 |
+
const mapaAreaRef = useRef(null)
|
| 189 |
+
const scrollRetornoMapaRef = useRef(false)
|
| 190 |
|
| 191 |
useEffect(() => {
|
| 192 |
void carregarTrabalhos()
|
|
|
|
| 232 |
return `${modo}::${idsKey}::${avalKey}`
|
| 233 |
}
|
| 234 |
|
| 235 |
+
function scrollToElementTop(el, behavior = 'smooth', offsetPx = 0) {
|
| 236 |
+
if (!el || typeof window === 'undefined') return
|
| 237 |
+
const rect = el.getBoundingClientRect()
|
| 238 |
+
const targetTop = Math.max(0, window.scrollY + rect.top - offsetPx)
|
| 239 |
+
window.scrollTo({ top: targetTop, behavior })
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
function atualizarCampoLocalizacao(field, value) {
|
| 243 |
if (!field) return
|
| 244 |
setLocalizacaoInputs((prev) => ({ ...prev, [field]: value }))
|
|
|
|
| 413 |
return
|
| 414 |
}
|
| 415 |
if (origemAbertura === 'trabalhos_tecnicos_mapa') {
|
| 416 |
+
scrollRetornoMapaRef.current = true
|
| 417 |
setActiveInnerTab('mapa')
|
| 418 |
onVoltarLista()
|
| 419 |
return
|
|
|
|
| 607 |
)
|
| 608 |
}, 180)
|
| 609 |
return () => window.clearTimeout(timeoutId)
|
| 610 |
+
}, [mapaModoExibicao])
|
| 611 |
+
|
| 612 |
+
useEffect(() => {
|
| 613 |
+
if (!scrollRetornoMapaRef.current) return undefined
|
| 614 |
+
if (trabalhoAberto || activeInnerTab !== 'mapa') return undefined
|
| 615 |
+
let frame1 = 0
|
| 616 |
+
let frame2 = 0
|
| 617 |
+
frame1 = window.requestAnimationFrame(() => {
|
| 618 |
+
frame2 = window.requestAnimationFrame(() => {
|
| 619 |
+
scrollToElementTop(mapaAreaRef.current, 'smooth', 0)
|
| 620 |
+
scrollRetornoMapaRef.current = false
|
| 621 |
+
})
|
| 622 |
+
})
|
| 623 |
+
return () => {
|
| 624 |
+
window.cancelAnimationFrame(frame1)
|
| 625 |
+
window.cancelAnimationFrame(frame2)
|
| 626 |
+
}
|
| 627 |
+
}, [activeInnerTab, trabalhoAberto])
|
| 628 |
|
| 629 |
if (trabalhoAberto) {
|
| 630 |
const modelos = Array.isArray(trabalhoAberto?.modelos) ? trabalhoAberto.modelos : []
|
|
|
|
| 1317 |
</button>
|
| 1318 |
</div>
|
| 1319 |
|
| 1320 |
+
<div ref={mapaAreaRef} className="trabalhos-mapa-controls">
|
| 1321 |
<label className="trabalhos-filter-field trabalhos-mapa-control-field">
|
| 1322 |
Exibição do mapa
|
| 1323 |
<select
|
frontend/src/components/VisaoGeralTab.jsx
CHANGED
|
@@ -172,7 +172,7 @@ export default function VisaoGeralTab() {
|
|
| 172 |
const [loading, setLoading] = useState(false)
|
| 173 |
const [error, setError] = useState('')
|
| 174 |
const [listaPage, setListaPage] = useState(1)
|
| 175 |
-
const [sortConfig, setSortConfig] = useState({ column: '
|
| 176 |
const [columnFilters, setColumnFilters] = useState({})
|
| 177 |
const [headerMenu, setHeaderMenu] = useState({ column: '', query: '' })
|
| 178 |
const headerMenuRef = useRef(null)
|
|
|
|
| 172 |
const [loading, setLoading] = useState(false)
|
| 173 |
const [error, setError] = useState('')
|
| 174 |
const [listaPage, setListaPage] = useState(1)
|
| 175 |
+
const [sortConfig, setSortConfig] = useState({ column: 'total_avaliandos', direction: 'desc' })
|
| 176 |
const [columnFilters, setColumnFilters] = useState({})
|
| 177 |
const [headerMenu, setHeaderMenu] = useState({ column: '', query: '' })
|
| 178 |
const headerMenuRef = useRef(null)
|