mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
feat: search results for guilds added
This commit is contained in:
@@ -113,7 +113,7 @@ type MorePlayersProps = {
|
||||
showSeasonalXP?: boolean;
|
||||
};
|
||||
|
||||
const MorePlayers = React.forwardRef<HTMLDivElement, MorePlayersProps>(
|
||||
export const MorePlayers = React.forwardRef<HTMLDivElement, MorePlayersProps>(
|
||||
({ fetching, total, queryVariables, showSeasonalXP = false }, ref) => {
|
||||
const isTimeZoneSelected = useMemo(
|
||||
() => queryVariables.timeZones && queryVariables.timeZones.length > 0,
|
||||
|
||||
34
packages/web/pages/search/guilds.tsx
Normal file
34
packages/web/pages/search/guilds.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { PageContainer } from 'components/Container';
|
||||
import { GuildList } from 'components/Guild/GuildList';
|
||||
import { HeadComponent } from 'components/Seo';
|
||||
import { GuildFragmentFragment } from 'graphql/autogen/types';
|
||||
import { useRouter } from 'next/router';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import SearchFilters from '../../components/SearchFilters';
|
||||
import { getGuildsByText } from '../../graphql/queries/guild';
|
||||
import { GlobalFilters } from '../../utils/GlobalSearch';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
const GuildSearchPage = () => {
|
||||
const { query } = useRouter();
|
||||
const [guilds, setGuilds] = useState<GuildFragmentFragment[]>([]);
|
||||
const search: string = decodeURI(query.q as string);
|
||||
useEffect(() => {
|
||||
if (search) {
|
||||
const getData = async () => {
|
||||
const res = await getGuildsByText(search);
|
||||
setGuilds(res.guilds);
|
||||
};
|
||||
getData();
|
||||
}
|
||||
}, [search]);
|
||||
return (
|
||||
<PageContainer>
|
||||
<HeadComponent url="https://my.metagame.wtf/community/search" />
|
||||
<SearchFilters activeFilter={GlobalFilters.GUILDS} search={search} />
|
||||
<GuildList guilds={guilds} />
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
export default GuildSearchPage;
|
||||
Reference in New Issue
Block a user