diff --git a/index.html b/index.html index 5a255c7..7ed50ee 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@
- +
- Paulin & Agathe
+ Vincent & Antoine
{stats && (
-- {stats.count} annonce{stats.count > 1 ? "s" : ""} | moy.{" "}
diff --git a/src/api.js b/src/api.js
index da6c2a6..ebd6d13 100644
--- a/src/api.js
+++ b/src/api.js
@@ -1,4 +1,4 @@
-const BASE = "https://n8n.holo795.fr/webhook/annonce_appart";
+const BASE = "https://n8n.holo795.fr/webhook/annonce_appart_july";
export async function fetchAnnonces() {
const res = await fetch(`${BASE}/get`);
diff --git a/src/components/AppartCard.jsx b/src/components/AppartCard.jsx
index 940b66e..4e067c4 100644
--- a/src/components/AppartCard.jsx
+++ b/src/components/AppartCard.jsx
@@ -4,8 +4,6 @@ import {
Euro,
Maximize2,
DoorOpen,
- Bus,
- Car,
Calendar,
Sofa,
ParkingCircle,
@@ -92,17 +90,17 @@ const formatFrDate = (value) => {
});
};
-const normalizeFeedback = (noteP, noteA, commentP, commentA) => ({
- NOTE_P: typeof noteP === "number" ? noteP : parseFloat(noteP) || 0,
+const normalizeFeedback = (noteV, noteA, commentV, commentA) => ({
+ NOTE_V: typeof noteV === "number" ? noteV : parseFloat(noteV) || 0,
NOTE_A: typeof noteA === "number" ? noteA : parseFloat(noteA) || 0,
- COMMENTAIRE_P: commentP?.trim() ? commentP.trim() : null,
+ COMMENTAIRE_V: commentV?.trim() ? commentV.trim() : null,
COMMENTAIRE_A: commentA?.trim() ? commentA.trim() : null,
});
export default function AppartCard({ annonce, onDelete, onUpdated }) {
- const [noteP, setNoteP] = useState(annonce.NOTE_P || 0);
+ const [noteV, setNoteV] = useState(annonce.NOTE_V || 0);
const [noteA, setNoteA] = useState(annonce.NOTE_A || 0);
- const [commentP, setCommentP] = useState(annonce.COMMENTAIRE_P || "");
+ const [commentV, setCommentV] = useState(annonce.COMMENTAIRE_V || "");
const [commentA, setCommentA] = useState(annonce.COMMENTAIRE_A || "");
const [saving, setSaving] = useState(false);
const [pendingSave, setPendingSave] = useState(false);
@@ -110,20 +108,20 @@ export default function AppartCard({ annonce, onDelete, onUpdated }) {
const [deleting, setDeleting] = useState(false);
const lastSavedRef = useRef(
- normalizeFeedback(noteP, noteA, commentP, commentA)
+ normalizeFeedback(noteV, noteA, commentV, commentA)
);
- const hasPaulinFeedback = (noteP ?? 0) > 0 || !!commentP?.trim();
- const hasAgatheFeedback = (noteA ?? 0) > 0 || !!commentA?.trim();
+ const hasVincentFeedback = (noteV ?? 0) > 0 || !!commentV?.trim();
+ const hasAntoineFeedback = (noteA ?? 0) > 0 || !!commentA?.trim();
useEffect(() => {
- const normalized = normalizeFeedback(noteP, noteA, commentP, commentA);
+ const normalized = normalizeFeedback(noteV, noteA, commentV, commentA);
const lastSaved = lastSavedRef.current;
if (
- normalized.NOTE_P === lastSaved.NOTE_P &&
+ normalized.NOTE_V === lastSaved.NOTE_V &&
normalized.NOTE_A === lastSaved.NOTE_A &&
- normalized.COMMENTAIRE_P === lastSaved.COMMENTAIRE_P &&
+ normalized.COMMENTAIRE_V === lastSaved.COMMENTAIRE_V &&
normalized.COMMENTAIRE_A === lastSaved.COMMENTAIRE_A
) {
return;
@@ -147,14 +145,14 @@ export default function AppartCard({ annonce, onDelete, onUpdated }) {
}, 700);
return () => clearTimeout(timeout);
- }, [annonce.id, commentA, commentP, noteA, noteP, onUpdated]);
+ }, [annonce.id, commentA, commentV, noteA, noteV, onUpdated]);
const handleSave = async () => {
setSaving(true);
await updateAnnonce(annonce.id, {
- NOTE_P: noteP,
+ NOTE_V: noteV,
NOTE_A: noteA,
- COMMENTAIRE_P: commentP || null,
+ COMMENTAIRE_V: commentV || null,
COMMENTAIRE_A: commentA || null,
});
onUpdated?.();
@@ -168,7 +166,7 @@ export default function AppartCard({ annonce, onDelete, onUpdated }) {
setDeleting(false);
};
- const avgNote = noteP || noteA ? ((noteP + noteA) / (noteP && noteA ? 2 : 1)).toFixed(1) : null;
+ const avgNote = noteV || noteA ? ((noteV + noteA) / (noteV && noteA ? 2 : 1)).toFixed(1) : null;
const dateDispo = formatFrDate(annonce.DATE_DISPO);
const dateAjout = formatFrDate(annonce.createdAt);
@@ -228,11 +226,12 @@ export default function AppartCard({ annonce, onDelete, onUpdated }) {