Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collected and logout #11

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions @types/graphql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare module '*/customer.graphql' {
export const CreateCustomerWallet: DocumentNode;
export const GetCustomerWallet: DocumentNode;
export const GetCustomerTreasury: DocumentNode;
export const GetCustomerCollections: DocumentNode;

export default defaultDocument;
}
Expand All @@ -30,6 +31,15 @@ declare module '*/mint.graphql' {
}


declare module '*/collections.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const GetCollections: DocumentNode;

export default defaultDocument;
}


declare module '*/me.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
Expand Down
45 changes: 26 additions & 19 deletions holaplex.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ enum FilterType {
"""Event triggered when a new drop is minted"""
DROP_MINTED

"""Event triggered when a mint has been successfully transfered"""
MINT_TRANSFERED

"""Event triggered when a new project is created"""
PROJECT_CREATED

Expand Down Expand Up @@ -658,7 +661,7 @@ type Invite {
"""
The datetime, in UTC, when the invitation to join the organization was created.
"""
createdAt: NaiveDateTime!
createdAt: DateTime!

"""The ID of the user who created the invitation."""
createdBy: UUID!
Expand Down Expand Up @@ -686,7 +689,7 @@ type Invite {
status: InviteStatus!

"""The datetime, in UTC, when the invitation status was updated."""
updatedAt: NaiveDateTime
updatedAt: DateTime
}

"""Input required for inviting a member to the organization."""
Expand Down Expand Up @@ -720,12 +723,12 @@ A member of a Holaplex organization, representing an individual who has been gra
"""
type Member {
"""The datetime, in UTC, when the member joined the organization."""
createdAt: NaiveDateTime!
createdAt: DateTime!

"""
The datetime, in UTC, when the member was deactivated from the organization.
"""
deactivatedAt: NaiveDateTime
deactivatedAt: DateTime

"""The unique identifier of the member."""
id: UUID!
Expand Down Expand Up @@ -753,7 +756,7 @@ type Member {
"""
The datetime, in UTC, when the member was revoked from the organization.
"""
revokedAt: NaiveDateTime
revokedAt: DateTime

"""The user identity who is a member of the organization."""
user: User
Expand Down Expand Up @@ -1053,7 +1056,7 @@ type Organization {
"""
The datetime, in UTC, when the Holaplex organization was created by its owner.
"""
createdAt: NaiveDateTime!
createdAt: DateTime!

"""
Get a single API credential by client ID.
Expand Down Expand Up @@ -1095,7 +1098,7 @@ type Organization {
"""
The datetime, in UTC, when the Holaplex organization was deactivated by its owner.
"""
deactivatedAt: NaiveDateTime
deactivatedAt: DateTime

"""
Define an asynchronous function to load the total credits deducted for each action
Expand Down Expand Up @@ -1129,11 +1132,12 @@ type Organization {
The owner of the Holaplex organization, who has created the organization and has full control over its settings and members.
"""
owner: Owner
profileImageUrl: String

"""
The optional profile image associated with the Holaplex organization, which can be used to visually represent the organization.
"""
profileImageUrl: String
profileImageUrlOriginal: String

"""
The projects that have been created and are currently associated with the Holaplex organization, which are used to organize NFT campaigns or initiatives within the organization.
Expand Down Expand Up @@ -1181,7 +1185,7 @@ The owner of the Holaplex organization, who is the individual that created the o
"""
type Owner {
"""The datetime, in UTC, when the organization was created."""
createdAt: NaiveDateTime!
createdAt: DateTime!

"""
The unique identifier assigned to the record of the user who created the Holaplex organization and serves as its owner, which is used to distinguish their record from other records within the Holaplex ecosystem.
Expand Down Expand Up @@ -1251,7 +1255,7 @@ A Holaplex project that belongs to an organization. Projects are used to group u
"""
type Project {
"""The datetime, in UTC, when the project was created."""
createdAt: NaiveDateTime!
createdAt: DateTime!

"""Retrieve a customer record associated with the project, using its ID."""
customer(id: UUID!): Customer
Expand All @@ -1262,7 +1266,7 @@ type Project {
"""
The date and time in Coordinated Universal Time (UTC) when the Holaplex project was created. Once a project is deactivated, objects that were assigned to the project can no longer be interacted with.
"""
deactivatedAt: NaiveDateTime
deactivatedAt: DateTime

"""Look up a drop associated with the project by its ID."""
drop(id: UUID!): Drop
Expand All @@ -1281,11 +1285,12 @@ type Project {

"""The ID of the Holaplex organization to which the project belongs."""
organizationId: UUID!
profileImageUrl: String

"""
The optional profile image associated with the project, which can be used to visually represent the project.
"""
profileImageUrl: String
profileImageUrlOriginal: String

"""
The treasury assigned to the project, which contains the project's wallets.
Expand Down Expand Up @@ -1321,6 +1326,8 @@ type Purchase {
}

type Query {
collections: [CollectionMint]

"""
Returns a list of `ActionCost` which represents the cost of each action on different blockchains.

Expand Down Expand Up @@ -1416,8 +1423,8 @@ type TransferAssetPayload {
A collection of wallets assigned to different entities in the Holaplex ecosystem.
"""
type Treasury {
"""The creation datetime of the vault."""
createdAt: NaiveDateTime!
"""The creation DateTimeWithTimeZone of the vault."""
createdAt: DateTime!

"""The unique identifier for the treasury."""
id: UUID!
Expand Down Expand Up @@ -1484,20 +1491,20 @@ A blockchain wallet is a digital wallet that allows users to securely store, man
"""
type Wallet {
"""The wallet address."""
address: String!
address: String

"""The wallet's associated blockchain."""
assetId: AssetType!
createdAt: NaiveDateTime!
createdAt: DateTime!
createdBy: UUID!
legacyAddress: String!
deductionId: UUID
id: UUID!

"""
The NFTs that were minted from Holaplex and are owned by the wallet's address.
"""
mints: [CollectionMint!]
removedAt: NaiveDateTime
tag: String!
removedAt: DateTime
treasuryId: UUID!
}

Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@graphql-codegen/typescript-resolvers": "^3.1.1",
"@graphql-tools/graphql-file-loader": "^7.5.17",
"@graphql-tools/load": "^7.8.14",
"@headlessui/react": "^1.7.15",
"@heroicons/react": "^2.0.16",
"@next-auth/prisma-adapter": "^1.0.5",
"@prisma/client": "^4.9.0",
Expand Down
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type User {
type Query {
drop: Drop
me: User
collections: [CollectionMint]
}

type Mutation {
Expand Down
26 changes: 26 additions & 0 deletions src/app/(home)/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use client';
import { usePathname } from 'next/navigation';
import Header from '../../components/Header';
import Tabs from '../../layouts/Tabs';
import { cloneElement } from 'react';

export default function Home({ children }: { children: React.ReactNode }) {
const pathname = usePathname();

return (
<>
<Header />
<Tabs.Page className='mt-8'>
<Tabs.Panel>
<Tabs.Tab name='Drop' href='/' active={pathname === '/'} />
<Tabs.Tab
name='Your collections'
href='/collections'
active={pathname === '/collections'}
/>
</Tabs.Panel>
<Tabs.Content>{cloneElement(children as JSX.Element)}</Tabs.Content>
</Tabs.Page>
</>
);
}
44 changes: 44 additions & 0 deletions src/app/(home)/collections/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use client';
import { GetCollections } from '@/queries/collections.graphql';
import { useQuery } from '@apollo/client';
import { CollectionMint } from '../../../graphql.types';

interface GetCollectionsData {
collections: [CollectionMint];
}

export default function CollectionsPage() {
const collectionsQuery = useQuery<GetCollectionsData>(GetCollections);
return (
<div>
<div className='flex flex-wrap gap-6 justify-center mt-4 mb-10'>
{collectionsQuery.loading ? (
<>
{Array.from(Array(8)).map((_, index) => (
<div key={index}>
<div className='w-52 h-52 rounded-lg bg-gray-600 animate-pulse' />
</div>
))}
</>
) : (
<>
{collectionsQuery.data?.collections?.map((mint: CollectionMint) => (
<div
key={mint.id}
className='flex flex-col bg-gray-100 rounded-lg p-4'
>
<img
className='w-40 h-40 rounded-lg object-contain'
src={mint.metadataJson?.image as string}
/>
<span className='font-bold mt-2'>
{mint.metadataJson?.name}
</span>
</div>
))}
</>
)}
</div>
</div>
);
}
9 changes: 9 additions & 0 deletions src/app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Home from './Home';

export default async function HomeLayout({
children
}: {
children: React.ReactNode;
}) {
return <Home>{children}</Home>;
}
Loading