Skip to content

Commit

Permalink
Merge pull request #291 from DAOmasons/filterlistandfixes
Browse files Browse the repository at this point in the history
Filterlistandfixes
  • Loading branch information
jordanlesich authored Aug 8, 2024
2 parents ef6900a + bae8546 commit 20a9dff
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 48 deletions.
10 changes: 8 additions & 2 deletions src/.graphclient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10876,7 +10876,10 @@ export const getProjectGrantsDocument = gql`
${ShipDisplayFragmentDoc}` as unknown as DocumentNode<getProjectGrantsQuery, getProjectGrantsQueryVariables>;
export const GetProjectsDocument = gql`
query GetProjects($chainId: Int!) {
Project(where: {chainId: {_eq: $chainId}}) {
Project(
order_by: {db_write_timestamp: desc, hasEditedProfile: desc_nulls_last}
where: {chainId: {_eq: $chainId}}
) {
...ProjectDetails
metadata {
...RawMetadata
Expand All @@ -10887,7 +10890,10 @@ export const GetProjectsDocument = gql`
${RawMetadataFragmentDoc}` as unknown as DocumentNode<GetProjectsQuery, GetProjectsQueryVariables>;
export const GetUserProjectsDocument = gql`
query GetUserProjects($id: String!) {
Project(where: {owner: {_eq: $id}}) {
Project(
order_by: {db_write_timestamp: desc, hasEditedProfile: desc_nulls_last}
where: {owner: {_eq: $id}}
) {
...ProjectDetails
metadata {
...RawMetadata
Expand Down
14 changes: 13 additions & 1 deletion src/constants/filterLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ export const PROD_PROJECT_FILTER_LIST: string[] = [
'0x4abcf5af3284bc04f1b22839c9795e638a1e98b1',
'0x6cc0ab6764657bbf9bf44a9156674eebe870528a',
'0x9474322501a0d6dae5729a2eed6ab8498af65fbc',
'0x087593361D738C972181781e442CD58718d6b42E',
'0x98a92adc79fa79e38dd3ce6373ebb74b8f90b486',
];
'0x4695B577F2A243476E34060c15675F296212BBc9',
'0xC19257E31402446183F87a5a45803AB93c1fFC27',
'0x899E0e86eB3A97508bA1603140ecBaBBcabd0BaC',
'0x272a05D0a4AD86Ca0e9c4760eb061cff7Cad2a49',
'0x8d3EE1bfa283B487aF9e1975b8E9E45Cb73AD074',
// Hackathon Projects
'0x73bBeaE4478c5E0530C9e01C839dFB299Ae7b419',
'0xB4783D9Bbb02238A43d3e54a6A58E7e9585Ba0A3',
'0x6A7b8dda03759b3aE87723572D1686153909425D',
// Jord's Tester
'0x6068962E7a64DAFDf69f13a85EB191260705008E',
].map((id) => id.toLowerCase());

export const PROJECT_FILTER_LIST =
import.meta.env.VITE_RUNTIME_ENV === 'dev'
Expand Down
10 changes: 8 additions & 2 deletions src/graphql/newQueries/getProjects.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ fragment RawMetadata on RawMetadata {
}

query GetProjects($chainId: Int!) {
Project(where: { chainId: { _eq: $chainId } }) {
Project(
order_by: { db_write_timestamp: desc, hasEditedProfile: desc_nulls_last }
where: { chainId: { _eq: $chainId } }
) {
...ProjectDetails
metadata {
...RawMetadata
Expand All @@ -22,7 +25,10 @@ query GetProjects($chainId: Int!) {
}

query GetUserProjects($id: String!) {
Project(where: { owner: { _eq: $id } }) {
Project(
order_by: { db_write_timestamp: desc, hasEditedProfile: desc_nulls_last }
where: { owner: { _eq: $id } }
) {
...ProjectDetails
metadata {
...RawMetadata
Expand Down
32 changes: 2 additions & 30 deletions src/queries/getProjectCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { getGatewayUrl, getIpfsJson } from '../utils/ipfs/get';
import { ProjectProfileMetadata } from '../utils/ipfs/metadataValidation';
import { SUBGRAPH_URL } from '../constants/gameSetup';
import { PROJECT_FILTER_LIST } from '../constants/filterLists';
import { Chain } from 'viem';

type ProjectMetadataType = z.infer<typeof ProjectProfileMetadata>;

Expand Down Expand Up @@ -40,14 +39,12 @@ const projectMetadataResolver = async (project: ProjectCardFromQuery) => {

export const getProjectCards = async ({ chainId }: { chainId: number }) => {
try {
const { GetProjects } = getBuiltGraphSDK({
apiEndpoint: SUBGRAPH_URL,
});
const { GetProjects } = getBuiltGraphSDK();

const result = await GetProjects({ chainId });

const filteredProjects = result.Project?.filter(
(project) => !PROJECT_FILTER_LIST.includes(project.id)
(project) => !PROJECT_FILTER_LIST.includes(project.id.toLocaleLowerCase())
);

const resolvedProjects = await Promise.all(
Expand All @@ -62,28 +59,3 @@ export const getProjectCards = async ({ chainId }: { chainId: number }) => {
throw new Error(error?.mesasge || 'Error fetching projects');
}
};

// export const getUserProjects = async (userId: string) => {
// try {
// const { GetUserProjects } = getBuiltGraphSDK({
// apiEndpoint: SUBGRAPH_URL,
// });

// const { projects } = await GetUserProjects({ id: userId });

// const filteredProjects = projects?.filter(
// (project) => !PROJECT_FILTER_LIST.includes(project.id)
// );

// console.log('filteredProjects', filteredProjects);

// const resolvedProjects = await Promise.all(
// filteredProjects?.map((project) => projectMetadataResolver(project))
// );

// return resolvedProjects as ProjectCard[];
// } catch (error: any) {
// console.error(error);
// throw new Error(error?.mesasge || 'Error fetching projects');
// }
// };
22 changes: 9 additions & 13 deletions src/utils/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,14 @@ export const parseShowcaseLink = (
};
};

const testPNG = youtubeRegex.test(
'https://presskit.manada.dev/images/cloudlines/0000screenshot.png'
);
// const testPNG = youtubeRegex.test(
// 'https://presskit.manada.dev/images/cloudlines/0000screenshot.png'
// );

const youtubeURLTest = youtubeRegex.test(
'https://www.youtube.com/watch?v=Sg-G1E1UwAY'
);
// const youtubeURLTest = youtubeRegex.test(
// 'https://www.youtube.com/watch?v=Sg-G1E1UwAY'
// );

const youtubeShareTest = youtubeRegex.test(
'https://youtu.be/Sg-G1E1UwAY?feature=shared'
);

console.log('test PNG', testPNG);
console.log('youtubeTest', youtubeURLTest);
console.log('youtubeShareTest', youtubeShareTest);
// const youtubeShareTest = youtubeRegex.test(
// 'https://youtu.be/Sg-G1E1UwAY?feature=shared'
// );

0 comments on commit 20a9dff

Please sign in to comment.