fixes home page search
This commit is contained in:
@@ -166,6 +166,11 @@ func documentFromListRecord(r *core.Record, author *core.Record, includeShares b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
domain := ""
|
||||||
|
if !author.GetBool("isLocal") {
|
||||||
|
domain = author.GetString("domain")
|
||||||
|
}
|
||||||
|
|
||||||
document := map[string]interface{}{
|
document := map[string]interface{}{
|
||||||
"id": r.Id,
|
"id": r.Id,
|
||||||
"author": author.Id,
|
"author": author.Id,
|
||||||
@@ -178,6 +183,7 @@ func documentFromListRecord(r *core.Record, author *core.Record, includeShares b
|
|||||||
"elevation_loss": totalElevationLoss,
|
"elevation_loss": totalElevationLoss,
|
||||||
"distance": totalDistance,
|
"distance": totalDistance,
|
||||||
"duration": totalDuration,
|
"duration": totalDuration,
|
||||||
|
"domain": domain,
|
||||||
"public": r.GetBool("public"),
|
"public": r.GetBool("public"),
|
||||||
"created": r.GetDateTime("created").Time().Unix(),
|
"created": r.GetDateTime("created").Time().Unix(),
|
||||||
"trails": trails,
|
"trails": trails,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type ListSearchResult = {
|
|||||||
elevation_loss: number;
|
elevation_loss: number;
|
||||||
distance: number,
|
distance: number,
|
||||||
duration: number,
|
duration: number,
|
||||||
|
domain?: string,
|
||||||
public: boolean;
|
public: boolean;
|
||||||
trails: number
|
trails: number
|
||||||
shares?: string[];
|
shares?: string[];
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
const actors = await searchActors(q);
|
const actors = await searchActors(q);
|
||||||
searchDropdownItems = actors.map((a) => ({
|
searchDropdownItems = actors.map((a) => ({
|
||||||
text: a.username,
|
text: a.username,
|
||||||
description: `@${a.username}${a.isLocal ? "" : '@' + a.domain}`,
|
description: `@${a.username}${a.isLocal ? "" : "@" + a.domain}`,
|
||||||
value: a,
|
value: a,
|
||||||
icon:
|
icon:
|
||||||
a.icon ||
|
a.icon ||
|
||||||
@@ -64,13 +64,13 @@
|
|||||||
const trailItems = r[0].hits.map((t: TrailSearchResult) => ({
|
const trailItems = r[0].hits.map((t: TrailSearchResult) => ({
|
||||||
text: t.name,
|
text: t.name,
|
||||||
description: `Trail ${t.location.length ? ", " + t.location : ""}`,
|
description: `Trail ${t.location.length ? ", " + t.location : ""}`,
|
||||||
value: `@${t.author}${t.domain ? `@${t.domain}` : ""}/${t.id}`,
|
value: `@${t.author_name}${t.domain ? `@${t.domain}` : ""}/${t.id}`,
|
||||||
icon: "route",
|
icon: "route",
|
||||||
}));
|
}));
|
||||||
const listItems = r[1].hits.map((t: ListSearchResult) => ({
|
const listItems = r[1].hits.map((t: ListSearchResult) => ({
|
||||||
text: t.name,
|
text: t.name,
|
||||||
description: `List, ${t.trails} ${$_("trail", { values: { n: t.trails } })}`,
|
description: `List, ${t.trails} ${$_("trail", { values: { n: t.trails } })}`,
|
||||||
value: t.id,
|
value: `@${t.author_name}${t.domain ? `@${t.domain}` : ""}/${t.id}`,
|
||||||
icon: "layer-group",
|
icon: "layer-group",
|
||||||
}));
|
}));
|
||||||
const cityItems = r[2].hits.map((c: LocationSearchResult) => ({
|
const cityItems = r[2].hits.map((c: LocationSearchResult) => ({
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
if (item.icon == "route") {
|
if (item.icon == "route") {
|
||||||
goto(`/trail/view/${item.value}`);
|
goto(`/trail/view/${item.value}`);
|
||||||
} else if (item.icon == "layer-group") {
|
} else if (item.icon == "layer-group") {
|
||||||
goto(`/lists?list=${item.value}`);
|
goto(`/lists/${item.value}`);
|
||||||
} else if (item.value.username) {
|
} else if (item.value.username) {
|
||||||
goto(
|
goto(
|
||||||
`/profile/@${item.value.username}${item.value.isLocal ? "" : "@" + item.value.domain}`,
|
`/profile/@${item.value.username}${item.value.isLocal ? "" : "@" + item.value.domain}`,
|
||||||
@@ -120,6 +120,7 @@
|
|||||||
onupdate={search}
|
onupdate={search}
|
||||||
onclick={handleSearchClick}
|
onclick={handleSearchClick}
|
||||||
large={true}
|
large={true}
|
||||||
|
clearAfterSelect={false}
|
||||||
placeholder="{$_('search-for-trails-places')}..."
|
placeholder="{$_('search-for-trails-places')}..."
|
||||||
items={searchDropdownItems}
|
items={searchDropdownItems}
|
||||||
></Search>
|
></Search>
|
||||||
|
|||||||
Reference in New Issue
Block a user