Fix searchview

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-08-22 13:47:10 +02:00
parent ffac91a027
commit 2eee09bf4b
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 14 additions and 5 deletions

View file

@ -23,14 +23,14 @@
</figure> </figure>
<AccountGroup v-else :size="64" /> <AccountGroup v-else :size="64" />
</div> </div>
<div class="px-1"> <div class="px-1 overflow-hidden">
<h3 <h3
class="text-2xl leading-5 line-clamp-3 font-bold text-violet-3 dark:text-white" class="text-2xl leading-5 line-clamp-3 font-bold text-violet-3 dark:text-white"
dir="auto" dir="auto"
> >
{{ displayName(group) }} {{ displayName(group) }}
</h3> </h3>
<span> <span class="block truncate">
{{ `@${usernameWithDomain(group)}` }} {{ `@${usernameWithDomain(group)}` }}
</span> </span>
</div> </div>

View file

@ -539,6 +539,8 @@ import FilterSection from "@/components/Search/filters/FilterSection.vue";
import { listShortDisjunctionFormatter } from "@/utils/listFormat"; import { listShortDisjunctionFormatter } from "@/utils/listFormat";
import langs from "@/i18n/langs.json"; import langs from "@/i18n/langs.json";
import { useEventCategories, useFeatures } from "@/composition/apollo/config"; import { useEventCategories, useFeatures } from "@/composition/apollo/config";
import geohash from "ngeohash";
import { coordsToGeoHash } from "@/utils/location";
const search = useRouteQuery("search", ""); const search = useRouteQuery("search", "");
@ -560,8 +562,9 @@ const arrayTransformer: RouteQueryTransformer<string[]> = {
const eventPage = useRouteQuery("eventPage", 1, integerTransformer); const eventPage = useRouteQuery("eventPage", 1, integerTransformer);
const groupPage = useRouteQuery("groupPage", 1, integerTransformer); const groupPage = useRouteQuery("groupPage", 1, integerTransformer);
const geohash = useRouteQuery("geohash", ""); const latitude = useRouteQuery("lat", undefined, floatTransformer);
const radius = useRouteQuery("radius", null, floatTransformer); const longitude = useRouteQuery("lon", undefined, floatTransformer);
const distance = useRouteQuery("distance", "10_km"); const distance = useRouteQuery("distance", "10_km");
const when = useRouteQuery("when", "any"); const when = useRouteQuery("when", "any");
const contentType = useRouteQuery( const contentType = useRouteQuery(
@ -811,13 +814,19 @@ const filtersPanelOpened = ref(true);
const toggleFilters = () => const toggleFilters = () =>
(filtersPanelOpened.value = !filtersPanelOpened.value); (filtersPanelOpened.value = !filtersPanelOpened.value);
const geoHashLocation = computed(() =>
coordsToGeoHash(latitude.value, longitude.value)
);
const radius = computed(() => Number.parseInt(distance.value.slice(0, -3)));
const { result: searchElementsResult, loading: searchLoading } = useQuery<{ const { result: searchElementsResult, loading: searchLoading } = useQuery<{
searchEvents: Paginate<IEvent>; searchEvents: Paginate<IEvent>;
searchGroups: Paginate<IGroup>; searchGroups: Paginate<IGroup>;
}>(SEARCH_EVENTS_AND_GROUPS, () => ({ }>(SEARCH_EVENTS_AND_GROUPS, () => ({
term: search.value, term: search.value,
tags: props.tag, tags: props.tag,
location: geohash.value, location: geoHashLocation.value,
beginsOn: start.value, beginsOn: start.value,
endsOn: end.value, endsOn: end.value,
radius: radius.value, radius: radius.value,