-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
192 lines (171 loc) · 8.91 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>France Fabrique</title>
<meta name="title" content="France Fabrique - Découvrez le Made in France">
<meta name="description" content="France Fabrique vous permet de visualiser tout le Made in France : usines, boutiques, marques et bien plus encore. Explorez la richesse de la production française.">
<meta name="keywords" content="Made in France, usines, boutiques, marques, production française, fabriqué en France, industrie française, artisanat français, produits français">
<meta name="robots" content="index, follow">
<link rel="icon" href="fav.png" type="image/x-icon">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.Default.css" />
<style>
#map {
height: calc(100vh - 64px);
}
.popup-content {
text-align: center;
}
.popup-content img {
width: 100%;
max-width: 200px;
height: auto;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
.popup-content h3 {
margin: 0 0 10px;
}
.popup-content p {
margin: 0 0 10px;
}
.popup-content a {
color: #007BFF;
text-decoration: none;
}
.popup-content a:hover {
text-decoration: underline;
}
.marker-icon img {
width: 100%;
height: auto;
object-fit: contain;
}
</style>
</head>
<body>
<!-- <header style="text-align: center; font-family: fantasy; text-transform: uppercase;">france fabrique.fr</header> -->
<nav class="bg-white border-gray-200 dark:bg-gray-900">
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<a href="/" class="flex items-center space-x-3 rtl:space-x-reverse">
<img src="fav.png" class="h-8" alt="FranceFabrique.fr Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">FranceFabrique.fr</span>
</a>
<button data-collapse-toggle="navbar-default" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15"/>
</svg>
</button>
<div class="hidden w-full md:block md:w-auto" id="navbar-default">
<ul class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<a href="marquelisting.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Listing des marques</a>
</li>
<li>
<a href="form.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Ajout de marker</a>
</li>
<li>
<a href="marque.html" class="block py-2 px-3 text-white bg-white-700 rounded md:bg-transparent md:text-white-700 md:p-0 dark:text-white md:dark:text-white-500" aria-current="page">Ajout d'une marque</a>
</li>
</ul>
</div>
</div>
</nav>
<div id="map"></div>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<script type="module">
// Importer le SDK de Supabase
import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm';
import { SUPABASE_URL, SUPABASE_KEY } from './config.js';
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const map = L.map('map').setView([46.603354, 1.888334], 6);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 18,
}).addTo(map);
const markers = L.markerClusterGroup({
iconCreateFunction: function(cluster) {
// Récupérer le nombre de marqueurs dans le cluster
const markersCount = cluster.getChildCount();
// Choisir une image selon le nombre de marqueurs
let imageUrl = 'cluster.jpg'; // Par défaut, une petite image
// Retourner un DivIcon personnalisé avec l'image
return new L.DivIcon({
html: `<div style="width: 40px; height: 40px; background-image: url(${imageUrl}); background-size: cover; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;">${markersCount}</div>`,
className: 'marker-cluster',
iconSize: new L.Point(40, 40) // Taille de l'icône
});
}
});
// Définir des icônes pour chaque type
const iconMap = {
usi: L.icon({
iconUrl: 'usi.png',
iconSize: [20, 32],
iconAnchor: [16, 32],
popupAnchor: [0, -32],
className: 'marker-icon'
}),
mag: L.icon({
iconUrl: 'mif.png',
iconSize: [32, 32],
iconAnchor: [16, 32],
popupAnchor: [0, -32],
className: 'marker-icon'
})
};
async function fetchData() {
// Récupérer les données depuis Supabase
const { data, error } = await supabase
.from('Marker') // Remplacez par le nom de votre table
.select('*'); // Sélectionner toutes les colonnes
if (error) {
console.error('Erreur lors de la récupération des données :', error);
return;
}
// Ajouter les marqueurs à la carte
data.forEach(point => {
const markerIcon = iconMap[point.type] || L.icon({
iconUrl: 'marker.png',
iconSize: [32, 32],
iconAnchor: [16, 32],
popupAnchor: [0, -32],
className: 'marker-icon'
});
const marker = L.marker([point.lat, point.lng], { icon: markerIcon });
const popupContent = `
<div class="popup-content">
<img src="${point.image}" alt="${point.title}" />
<h3>${point.title}</h3>
<p>${point.description}</p>
<a href="${point.link}" target="_blank">En savoir plus</a>
</div>
`;
marker.bindPopup(popupContent);
markers.addLayer(marker);
});
map.addLayer(markers);
}
// Appeler la fonction de récupération des données
fetchData();
const hamburgerButton = document.getElementById('hamburger-button');
const navbar = document.getElementById('navbar-default');
// Ajouter un écouteur d'événements sur le bouton hamburger
hamburgerButton.addEventListener('click', () => {
// Bascule la classe 'hidden' pour afficher ou masquer le menu
navbar.classList.toggle('hidden');
// Mettez à jour l'attribut 'aria-expanded' pour l'accessibilité
const isExpanded = navbar.classList.contains('hidden');
hamburgerButton.setAttribute('aria-expanded', !isExpanded);
});
</script>
</body>
</html>