Skip to content

Commit

Permalink
style: lint and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Dec 4, 2024
1 parent 5c6d322 commit 7923578
Show file tree
Hide file tree
Showing 27 changed files with 432 additions and 401 deletions.
34 changes: 17 additions & 17 deletions frontend/components.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tsConfigPath": "./tsconfig.json",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"framework": "vite",
"aliases": {
"components": "@/components",
"utils": "@/utils"
}
}
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tsConfigPath": "./tsconfig.json",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"framework": "vite",
"aliases": {
"components": "@/components",
"utils": "@/utils"
}
}
10 changes: 5 additions & 5 deletions frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
40 changes: 20 additions & 20 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
</template>

<script lang="ts">
import { defineComponent, ref, onMounted } from "vue";
import { defineComponent, onMounted, ref } from "vue";
import HeaderComponent from "./components/HeaderComponent.vue";
import MainComponent from "./components/MainComponent.vue";
import MobileMessage from "./components/MobileMessage.vue"; // Assurez-vous que ce fichier existe
export default defineComponent({
name: "App",
components: {
HeaderComponent,
MainComponent,
MobileMessage,
},
setup() {
const isMobile = ref(false);
name: "App",
components: {
HeaderComponent,
MainComponent,
MobileMessage,
},
setup() {
const isMobile = ref(false);
// Détecter si l'utilisateur est sur un appareil mobile
onMounted(() => {
const userAgent = window.navigator.userAgent.toLowerCase();
isMobile.value =
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/.test(
userAgent
);
});
// Détecter si l'utilisateur est sur un appareil mobile
onMounted(() => {
const userAgent = window.navigator.userAgent.toLowerCase();
isMobile.value =
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/.test(
userAgent,
);
});
return { isMobile };
},
return { isMobile };
},
});
</script>

Expand Down Expand Up @@ -77,4 +77,4 @@ body, html, #app {
font-size: 1rem;
margin: 10px 0 0;
}
</style>
</style>
6 changes: 3 additions & 3 deletions frontend/src/components/HeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import tableGreyIcon from "@/assets/tablegrey.svg";
interface AddressFeature {
banId: string;
label: string;
citycode: string;
citycode: string;
}
interface Geometry {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default defineComponent({
const goToAddress = (coordinates: Array<number>, code: string) => {
appStore.updateAddress(coordinates);
appStore.updateCodeInsee(code);
appStore.updateCodeInsee(code);
resultsAdresses.value = null;
};
Expand Down Expand Up @@ -284,4 +284,4 @@ export default defineComponent({
background-color: #ebebeb;
}
</style>
</style>
154 changes: 77 additions & 77 deletions frontend/src/components/HistogramChart.vue
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
<script>
import {
Chart,
BarController,
BarElement,
CategoryScale,
LinearScale,
Title,
Tooltip,
Legend,
BarController,
BarElement,
CategoryScale,
Chart,
Legend,
LinearScale,
Title,
Tooltip,
} from "chart.js";
Chart.register(
BarController,
BarElement,
CategoryScale,
LinearScale,
Title,
Tooltip,
Legend
BarController,
BarElement,
CategoryScale,
LinearScale,
Title,
Tooltip,
Legend,
);
import { defineComponent } from "vue";
export default defineComponent({
name: "HistogramChart",
props: {
chartData: {
type: Array,
required: true,
},
colorHisto: {
type: String,
required: true,
}
},
mounted() {
this.$nextTick(() => {
this.createChart();
});
},
methods: {
createChart() {
if (!this.$refs.histogramChart) {
console.error("Canvas reference is not available.");
return;
}
name: "HistogramChart",
props: {
chartData: {
type: Array,
required: true,
},
colorHisto: {
type: String,
required: true,
},
},
mounted() {
this.$nextTick(() => {
this.createChart();
});
},
methods: {
createChart() {
if (!this.$refs.histogramChart) {
console.error("Canvas reference is not available.");
return;
}
const ctx = this.$refs.histogramChart.getContext("2d");
const labels = this.chartData.map((item) => item.x);
const values = this.chartData.map((item) => item.y);
const ctx = this.$refs.histogramChart.getContext("2d");
const labels = this.chartData.map((item) => item.x);
const values = this.chartData.map((item) => item.y);
new Chart(ctx, {
type: "bar",
data: {
labels: labels,
datasets: [
{
label: "Transactions",
data: values,
backgroundColor: this.colorHisto,
borderColor: this.colorHisto,
borderWidth: 1,
},
],
},
options: {
responsive: true,
plugins: {
legend: {
display: false,
},
tooltip: {
enabled: true,
},
},
scales: {
x: {
type: "category",
},
y: {
beginAtZero: true,
},
},
...this.chartOptions,
},
});
},
},
new Chart(ctx, {
type: "bar",
data: {
labels: labels,
datasets: [
{
label: "Transactions",
data: values,
backgroundColor: this.colorHisto,
borderColor: this.colorHisto,
borderWidth: 1,
},
],
},
options: {
responsive: true,
plugins: {
legend: {
display: false,
},
tooltip: {
enabled: true,
},
},
scales: {
x: {
type: "category",
},
y: {
beginAtZero: true,
},
},
...this.chartOptions,
},
});
},
},
});
</script>

Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/MapComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default defineComponent({
let displayDepLayer = true;
const tooltipTitle = ref(""); // Initialize as an empty string
const tooltip = ref({
top: "0px",
left: "0px",
Expand Down Expand Up @@ -131,7 +130,7 @@ export default defineComponent({
"fill-color": "rgba(0, 0, 255, 0.2)",
},
});
mapInstance.on("mousemove", "departements_fill", (e: any) => {
tooltipTitle.value = e.features[0]["properties"]["nom"];
const depCode = e.features[0]["properties"]["code"];
Expand Down Expand Up @@ -185,17 +184,19 @@ export default defineComponent({
watch(
() => appStore.codeInsee,
(newValue: string) => {
(newValue: string) => {
fetch(
"https://object.data.gouv.fr/dataeng-open/dev/parcelles/" + appStore.codeInsee + ".json"
"https://object.data.gouv.fr/dataeng-open/dev/parcelles/" +
appStore.codeInsee +
".json",
)
.then((response) => {
return response.json();
})
.then((data) => {
appStore.updateComData(data)
appStore.updateComData(data);
});
},
},
);
watch(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/MobileMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { defineComponent } from "vue";
export default defineComponent({
name: "MobileMessage",
name: "MobileMessage",
});
</script>

Expand Down Expand Up @@ -45,4 +45,4 @@ p {
font-size: 1rem;
margin: 10px 0 0;
}
</style>
</style>
Loading

0 comments on commit 7923578

Please sign in to comment.