Adjust search behavior and add GA tag
This commit is contained in:
parent
81c64999c4
commit
252c6b3891
13
index.html
13
index.html
|
|
@ -23,8 +23,17 @@
|
||||||
<meta name="twitter:title" content="SocioWire.com - Wired to life" />
|
<meta name="twitter:title" content="SocioWire.com - Wired to life" />
|
||||||
<meta name="twitter:description" content="Local news, events, market deals & friends on the map." />
|
<meta name="twitter:description" content="Local news, events, market deals & friends on the map." />
|
||||||
<meta name="twitter:image" content="https://www.sociowire.com/icons/og-image.png" />
|
<meta name="twitter:image" content="https://www.sociowire.com/icons/og-image.png" />
|
||||||
<meta property="og:image:width" content="1200" />
|
<meta property="og:image:width" content="1200" />
|
||||||
<meta property="og:image:height" content="630" />
|
<meta property="og:image:height" content="630" />
|
||||||
|
|
||||||
|
<!-- Google tag (gtag.js) -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QT0P53R99H"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', 'G-QT0P53R99H');
|
||||||
|
</script>
|
||||||
<!-- Titre de la page -->
|
<!-- Titre de la page -->
|
||||||
<title>SocioWire.com - Wired to life</title>
|
<title>SocioWire.com - Wired to life</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,9 @@ export default function MapView({
|
||||||
map.__swForceFetchAt = Date.now();
|
map.__swForceFetchAt = Date.now();
|
||||||
|
|
||||||
// If picking a post, clear filters and avoid query-locking
|
// If picking a post, clear filters and avoid query-locking
|
||||||
if (item.type === 'post') {
|
const kind = (item?.kind || item?.type || "").toString().toLowerCase();
|
||||||
|
|
||||||
|
if (kind === 'post') {
|
||||||
skipAutoZoomRef.current = true;
|
skipAutoZoomRef.current = true;
|
||||||
setSearchQuery("");
|
setSearchQuery("");
|
||||||
setMainFilter("All");
|
setMainFilter("All");
|
||||||
|
|
@ -364,6 +366,10 @@ export default function MapView({
|
||||||
url_hash: raw.url_hash || "",
|
url_hash: raw.url_hash || "",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (kind === 'city') {
|
||||||
|
// City pick should move the map without forcing a text filter.
|
||||||
|
skipAutoZoomRef.current = false;
|
||||||
|
setSearchQuery("");
|
||||||
} else {
|
} else {
|
||||||
const q = (item.title || item.name || "").toString().trim();
|
const q = (item.title || item.name || "").toString().trim();
|
||||||
skipAutoZoomRef.current = false;
|
skipAutoZoomRef.current = false;
|
||||||
|
|
|
||||||
|
|
@ -158,11 +158,8 @@ export default function SmartSearchBar({
|
||||||
setActive((i) => Math.max(i - 1, 0));
|
setActive((i) => Math.max(i - 1, 0));
|
||||||
} else if (e.key === "Enter") {
|
} else if (e.key === "Enter") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (items.length && active >= 0) {
|
if (q.trim()) {
|
||||||
// Pick the selected suggestion
|
// Always filter on Enter; do not auto-pick dropdown items.
|
||||||
pick(items[active], "enter");
|
|
||||||
} else if (q.trim()) {
|
|
||||||
// No item selected, trigger search/filter
|
|
||||||
skipSearchRef.current = true;
|
skipSearchRef.current = true;
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
onSearch && onSearch(q.trim());
|
onSearch && onSearch(q.trim());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue