From e9e4db55ba761d416efacebd3d4f4323ac13a4b9 Mon Sep 17 00:00:00 2001 From: Bastien DRUILLETTE Date: Mon, 11 Aug 2025 08:46:22 +0200 Subject: [PATCH] Upload files to "/" --- backend.js | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ config | 7 +++ database.html | 77 +++++++++++++++++++++++++++++++++ description | 1 + style.css | 69 +++++++++++++++++++++++++++++ 5 files changed, 271 insertions(+) create mode 100644 backend.js create mode 100644 config create mode 100644 database.html create mode 100644 description create mode 100644 style.css diff --git a/backend.js b/backend.js new file mode 100644 index 0000000..61c2d9f --- /dev/null +++ b/backend.js @@ -0,0 +1,117 @@ +// Initialiser la carte centrée sur la France +const map = L.map('map').setView([46.711100, 1.719100], 6); + +// Fond de carte +L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' +}).addTo(map); + +const iconMap = { + "archi privés": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-orange.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "archi hotel & spa": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-gold.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "archi publics": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-violet.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "paysagiste": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-green.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "pauseurs": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-yellow.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "fournisseurs": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-red.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "piscinistes": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-blue.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }), + "chantiers emblématiques": new L.Icon({ + iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-black.png', + shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41] + }) +}; + +// Charger les données du Google Sheet (CSV) +fetch("https://docs.google.com/spreadsheets/d/e/2PACX-1vQri4kOnjImxQFwbX5idNhjlQk1Hp-N6um5Ll46OVo4Hoe2o9SWKaHT2OYbNfb_j75StQ0VLDfBkq-6/pub?output=csv") + .then(response => response.text()) + .then(csv => { + const lines = csv.split("\n").slice(1); // Enlever l'en-tête + lines.forEach(line => { + const [nombre, type, lon, lat, nom, email, numero, note, website] = line.split(","); + + // Vérifier que les coordonnées sont valides + if (!isNaN(parseFloat(lat)) && !isNaN(parseFloat(lon))) { + const typeKey = (type || "").trim().toLowerCase(); + const icon = iconMap[typeKey] || iconMap["fournisseurs"]; // par défaut = rouge + + const popup = ` + ${nom}
+ Email: ${email}
+ Tel: ${numero}
+ Note: ${note}
+ Site web + `; + + L.marker([parseFloat(lat), parseFloat(lon)], { icon: icon }) + .addTo(map) + .bindPopup(popup); + } + }); + }) + .catch(error => { + console.error("Erreur de chargement du CSV :", error); + }); + + + + + const typeKey = data.type.trim().toLowerCase(); + const icon = iconMap[typeKey] || iconMap["fournisseurs"]; // couleur par défaut = rouge + + const marker = L.marker([data.lat, data.lon], { icon: icon }) + .addTo(map) + .bindPopup(popup); + + markers.push(marker); diff --git a/config b/config new file mode 100644 index 0000000..d545cda --- /dev/null +++ b/config @@ -0,0 +1,7 @@ +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true + symlinks = false + ignorecase = true diff --git a/database.html b/database.html new file mode 100644 index 0000000..fea5b9b --- /dev/null +++ b/database.html @@ -0,0 +1,77 @@ + + + + + Database Rosa Gres France + + + + + + + + + + + + + + + + + + + +
+ +

DATABASE ROSA GRES

+

France

+
+
+
+ + + + + +
+
+ + + + + + + + +
+ +
+ +
+ + + + // + + + + + \ No newline at end of file diff --git a/description b/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/style.css b/style.css new file mode 100644 index 0000000..6a09665 --- /dev/null +++ b/style.css @@ -0,0 +1,69 @@ +body{ + background-color: black; + font-family: 'Figtree'; +} + +h1 { + color: rgb(255, 255, 255); + margin: 0; + padding: 0; + text-align: center; +} + +#France { + color: rgb(196, 196, 196) ; + margin: 0px 3px 3px 3px; + padding-top: 0px; + text-align: center; + font-size: 30px; +} + + +.comerciales { + background-color: rgb(182, 182, 182); + width: 80px; + height: 20px; + border: 0.5px rgb(255, 255, 0) solid; + margin: 0; + padding: 0; +} + +.comerciales:hover { + background-color: rgb(128, 128, 128); +} + +.comerciales:active { + background-color: rgb(56, 56, 56); + color: rgb(255, 255, 255); + border: 0.5px rgb(255, 0, 0) solid; +} + + +.typo{ + background-color: rgb(204, 204, 204); + width: 50px; + height: 20px; + border: px beige solid; + font-size: 7px; + vertical-align: top; + border: 0.5px rgb(255, 255, 0) solid; + margin: 0; + padding: 0; + gap: 0; +} + +.typo:hover { + background-color: rgb(128, 128, 128); +} + +.typo:active { + background-color: rgb(56, 56, 56); + color: rgb(255, 255, 255); + border: 0.5px rgb(255, 0, 0) solid; +} + +/*SIZE OF THE MAP*/ +#map { + height: 600px; + text-align: center; +}