From 5cf461030a46b9078b4931d5daa608947b34b8b7 Mon Sep 17 00:00:00 2001 From: aeolian <94939382+aeolianeth@users.noreply.github.com> Date: Thu, 19 Sep 2024 08:43:06 +1000 Subject: [PATCH] feat: v4 projects on proejcts page --- .../Projects/ProjectsFilterAndSort.tsx | 20 +++++++++++++++---- src/components/Projects/ProjectsView.tsx | 11 +++++++--- src/lib/api/supabase/projects/api.ts | 12 +++++++---- .../v4/graphql/queries}/dbV4Projects.graphql | 2 +- 4 files changed, 33 insertions(+), 12 deletions(-) rename src/{graphql/projects => packages/v4/graphql/queries}/dbV4Projects.graphql (97%) diff --git a/src/components/Projects/ProjectsFilterAndSort.tsx b/src/components/Projects/ProjectsFilterAndSort.tsx index 29cdbb4123..3abd96435c 100644 --- a/src/components/Projects/ProjectsFilterAndSort.tsx +++ b/src/components/Projects/ProjectsFilterAndSort.tsx @@ -21,8 +21,13 @@ export type CheckboxOnChange = (checked: boolean) => void export default function ProjectsFilterAndSort({ includeV1, setIncludeV1, + includeV2, setIncludeV2, + + includeV4, + setIncludeV4, + showArchived, setShowArchived, searchTags, @@ -34,8 +39,13 @@ export default function ProjectsFilterAndSort({ }: { includeV1: boolean setIncludeV1: CheckboxOnChange + includeV2: boolean setIncludeV2: CheckboxOnChange + + includeV4: boolean + setIncludeV4: CheckboxOnChange + showArchived: boolean setShowArchived: CheckboxOnChange searchTags: ProjectTagName[] @@ -67,10 +77,7 @@ export default function ProjectsFilterAndSort({ return (
+ ('volume') const [includeV1, setIncludeV1] = useState(true) const [includeV2, setIncludeV2] = useState(true) + const [includeV4, setIncludeV4] = useState(true) const [showArchived, setShowArchived] = useState(false) const [reversed, setReversed] = useState(false) @@ -72,8 +73,10 @@ export function ProjectsView() { const _pv: PV[] = [] if (includeV1) _pv.push(PV_V1) if (includeV2) _pv.push(PV_V2) - return _pv.length ? _pv : [PV_V1, PV_V2] - }, [includeV1, includeV2]) + if (includeV4) _pv.push(PV_V4) + + return _pv.length ? _pv : [PV_V1, PV_V2, PV_V4] + }, [includeV1, includeV2, includeV4]) function updateRoute( _searchTags: ProjectTagName[], @@ -137,8 +140,10 @@ export function ProjectsView() { ({ + paginateDepleteQuery({ client: v4ServerClient, document: Dbv4ProjectsDocument, }), @@ -43,7 +47,8 @@ export async function queryAllSGProjectsForServer() { return { ...p, id: getSubgraphIdForProject(PV_V4, p.projectId), // Patch in the subgraph ID for V4 projects (to be consitent with legacy subgraph) - pv: PV_V4, // Patch in the PV for V4 projects + pv: PV_V4, // Patch in the PV for V4 projects, + metadataUri: p.metadata, } }) as unknown as Json>[] @@ -109,7 +114,6 @@ export async function queryDBProjects( const pageSize = opts.pageSize ?? 20 // Only sort ascending if orderBy is defined and orderDirection is 'asc' const ascending = opts.orderBy ? opts.orderDirection === 'asc' : false - const searchFilter = createSearchFilter(opts.text) const supabase = createServerSupabaseClient({ req, res }) diff --git a/src/graphql/projects/dbV4Projects.graphql b/src/packages/v4/graphql/queries/dbV4Projects.graphql similarity index 97% rename from src/graphql/projects/dbV4Projects.graphql rename to src/packages/v4/graphql/queries/dbV4Projects.graphql index 6101335916..65898c2047 100644 --- a/src/graphql/projects/dbV4Projects.graphql +++ b/src/packages/v4/graphql/queries/dbV4Projects.graphql @@ -3,7 +3,7 @@ query DBV4Projects($first: Int, $skip: Int) { id projectId handle - # uri + metadata currentBalance volume volumeUSD