Adjust search behavior and add GA tag
This commit is contained in:
parent
81c64999c4
commit
252c6b3891
|
|
@ -25,6 +25,15 @@
|
|||
<meta name="twitter:image" content="https://www.sociowire.com/icons/og-image.png" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<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 -->
|
||||
<title>SocioWire.com - Wired to life</title>
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -338,7 +338,9 @@ export default function MapView({
|
|||
map.__swForceFetchAt = Date.now();
|
||||
|
||||
// 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;
|
||||
setSearchQuery("");
|
||||
setMainFilter("All");
|
||||
|
|
@ -364,6 +366,10 @@ export default function MapView({
|
|||
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 {
|
||||
const q = (item.title || item.name || "").toString().trim();
|
||||
skipAutoZoomRef.current = false;
|
||||
|
|
|
|||
|
|
@ -158,11 +158,8 @@ export default function SmartSearchBar({
|
|||
setActive((i) => Math.max(i - 1, 0));
|
||||
} else if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
if (items.length && active >= 0) {
|
||||
// Pick the selected suggestion
|
||||
pick(items[active], "enter");
|
||||
} else if (q.trim()) {
|
||||
// No item selected, trigger search/filter
|
||||
if (q.trim()) {
|
||||
// Always filter on Enter; do not auto-pick dropdown items.
|
||||
skipSearchRef.current = true;
|
||||
setOpen(false);
|
||||
onSearch && onSearch(q.trim());
|
||||
|
|
|
|||
Loading…
Reference in New Issue