refactor: fix indentation

This commit is contained in:
2026-06-16 18:34:33 +02:00 Unverified
parent 26733b74de
commit 71de3589e6
14 changed files with 287 additions and 339 deletions
+2 -15
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
import type { Map as LeafletMap, CircleMarker, LatLngBoundsExpression } from 'leaflet'
import type { CircleMarker, LatLngBoundsExpression, Map as LeafletMap } from 'leaflet'
import { BARI_BOUNDS, BARI_CENTER, isWithinBariBounds } from '~/utils/bari'
const { getOpenDataReports } = usePublic()
@@ -10,14 +10,13 @@ const perPage = ref(9)
const { data: openDataResponse, pending } = await useAsyncData(
'open-data-reports',
() => getOpenDataReports({ page: currentPage.value, per_page: perPage.value }),
{ watch: [currentPage] } // Nuxt will re-fetch when currentPage changes
{ watch: [currentPage] }
)
const visibleReports = computed(() =>
(openDataResponse.value?.reports || []).filter((report) => isWithinBariBounds(report.latitude, report.longitude))
)
// Pagination logic: If we receive less items than `perPage`, we are on the last page.
const isLastPage = computed(() => {
if (!openDataResponse.value?.reports) return true
return openDataResponse.value.reports.length < perPage.value
@@ -140,7 +139,6 @@ onBeforeUnmount(() => {
<template>
<div>
<!-- HERO SECTION (Small version for internal pages) -->
<div class="it-hero-wrapper it-primary">
<div class="container">
<div class="row">
@@ -156,13 +154,9 @@ onBeforeUnmount(() => {
</div>
</div>
<!-- MAIN CONTENT -->
<div class="container my-5">
<!-- TOOLBAR: View Toggles & Export -->
<div class="row align-items-center mb-5 pb-3 border-bottom">
<div class="col-12 col-md-6 mb-3 mb-md-0 d-flex gap-2">
<!-- View Toggle Buttons -->
<button
class="btn btn-sm"
:class="currentView === 'grid' ? 'btn-primary' : 'btn-outline-primary'"
@@ -181,7 +175,6 @@ onBeforeUnmount(() => {
</button>
</div>
<div class="col-12 col-md-6 text-md-end">
<!-- Fake Export CTA (Very common in Open Data portals) -->
<button class="btn btn-sm btn-outline-secondary" title="Scarica dataset in formato JSON">
<BIIcon name="it-download" size="sm" class="me-1" />
Scarica JSON
@@ -189,18 +182,15 @@ onBeforeUnmount(() => {
</div>
</div>
<!-- LOADER -->
<div v-if="pending" class="d-flex justify-content-center my-5 py-5">
<div class="progress-spinner progress-spinner-active" role="status">
<span class="visually-hidden">Caricamento in corso...</span>
</div>
</div>
<!-- GRID VIEW -->
<div v-else-if="currentView === 'grid'">
<div class="row" v-if="openDataResponse?.reports && openDataResponse.reports.length > 0">
<div class="col-12 col-md-6 col-lg-4 mb-4" v-for="report in visibleReports" :key="report.id">
<!-- Strict BI Card -->
<div class="card-wrapper card-space h-100">
<div class="card card-bg h-100 shadow-sm">
<div class="card-body d-flex flex-column">
@@ -245,7 +235,6 @@ onBeforeUnmount(() => {
Nessun dato pubblico disponibile al momento.
</div>
<!-- BOOTSTRAP ITALIA PAGINATION -->
<nav class="pagination-wrapper justify-content-center mt-5" aria-label="Navigazione pagine open data">
<ul class="pagination">
<li class="page-item" :class="{ disabled: currentPage === 1 }">
@@ -267,7 +256,6 @@ onBeforeUnmount(() => {
</nav>
</div>
<!-- MAP VIEW -->
<div v-else-if="currentView === 'map'" class="map-view-wrapper">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
<p class="text-muted mb-0">Mappa pubblica delle segnalazioni nell'area di Bari.</p>
@@ -283,7 +271,6 @@ onBeforeUnmount(() => {
</template>
<style scoped>
/* Ensures the cards inside the grid stretch to equal heights */
.card-wrapper {
height: 100%;
}