diff --git a/api/functions/graphql/nexus-typegen.ts b/api/functions/graphql/nexus-typegen.ts index 7120730..e40320a 100644 --- a/api/functions/graphql/nexus-typegen.ts +++ b/api/functions/graphql/nexus-typegen.ts @@ -1286,7 +1286,8 @@ export interface NexusGenArgTypes { type: NexusGenEnums['POST_TYPE']; // POST_TYPE! } getProject: { // args - id: number; // Int! + id?: number | null; // Int + tag?: string | null; // String } getProjectsInTournament: { // args roleId?: number | null; // Int diff --git a/api/functions/graphql/schema.graphql b/api/functions/graphql/schema.graphql index 2481ecb..2957a37 100644 --- a/api/functions/graphql/schema.graphql +++ b/api/functions/graphql/schema.graphql @@ -342,7 +342,7 @@ type Query { getMakersInTournament(openToConnect: Boolean, roleId: Int, search: String, skip: Int = 0, take: Int = 10, tournamentId: Int!): TournamentMakersResponse! getMyDrafts(type: POST_TYPE!): [Post!]! getPostById(id: Int!, type: POST_TYPE!): Post! - getProject(id: Int!): Project! + getProject(id: Int, tag: String): Project! getProjectsInTournament(roleId: Int, search: String, skip: Int = 0, take: Int = 10, tournamentId: Int!): TournamentProjectsResponse! getTournamentById(id: Int!): Tournament! getTournamentToRegister: [Tournament!]! diff --git a/api/functions/graphql/types/project.js b/api/functions/graphql/types/project.js index ef7bf46..0c6cc1a 100644 --- a/api/functions/graphql/types/project.js +++ b/api/functions/graphql/types/project.js @@ -273,9 +273,11 @@ const getProject = extendType({ t.nonNull.field('getProject', { type: "Project", args: { - id: nonNull(intArg()) + id: intArg(), + tag: stringArg(), }, - resolve(_, { id }) { + resolve(_, { id, tag }) { + if (tag) return prisma.project.findFirst({ where: { hashtag: tag } }) return prisma.project.findUnique({ where: { id } }) diff --git a/prisma/seed/index.js b/prisma/seed/index.js index 2c51ee4..80b378e 100644 --- a/prisma/seed/index.js +++ b/prisma/seed/index.js @@ -69,7 +69,9 @@ async function main() { // await migrateOldImages(); - await createCapabilities(); + // await createCapabilities(); + + // await createHashtags(); } async function migrateOldImages() { @@ -238,7 +240,7 @@ async function migrateOldImages() { /** * Tournament **/ - const tournaments = await prisma.tournament.findMany({ + const tournaments = await prisma.tournament.findMany({ select: { id: true, thumbnail_image: true, @@ -263,7 +265,7 @@ async function migrateOldImages() { /** * TournamentPrize **/ - const tournamentPrizes = await prisma.tournamentPrize.findMany({ + const tournamentPrizes = await prisma.tournamentPrize.findMany({ select: { id: true, image: true, @@ -508,6 +510,24 @@ async function createCapabilities() { }) } +async function createHashtags() { + console.log("Creating Hashtags for projects"); + const projects = await prisma.project.findMany({ select: { title: true, id: true } }); + for (let i = 0; i < projects.length; i++) { + const project = projects[i]; + await prisma.project.update({ + where: { id: project.id }, + data: { + hashtag: project.title.toLowerCase() + .trim() + .replace(/[^\w\s-]/g, '') + .replace(/[\s_-]+/g, '_') + .replace(/^-+|-+$/g, '') + } + }) + } +} + main() .catch((e) => { diff --git a/src/features/Projects/pages/ListProjectPage/Components/FormContainer/FormContainer.tsx b/src/features/Projects/pages/ListProjectPage/Components/FormContainer/FormContainer.tsx index cceed97..d10d3af 100644 --- a/src/features/Projects/pages/ListProjectPage/Components/FormContainer/FormContainer.tsx +++ b/src/features/Projects/pages/ListProjectPage/Components/FormContainer/FormContainer.tsx @@ -143,7 +143,8 @@ export default function FormContainer(props: PropsWithChildren) { const query = useProjectDetailsQuery({ variables: { - projectId: id! + projectId: id!, + projectTag: null, }, skip: !isUpdating, onCompleted: (res) => { diff --git a/src/features/Projects/pages/ProjectPage/Components/AboutCard/AboutCard.tsx b/src/features/Projects/pages/ProjectPage/Components/AboutCard/AboutCard.tsx index 2e4a4ac..d2032cc 100644 --- a/src/features/Projects/pages/ProjectPage/Components/AboutCard/AboutCard.tsx +++ b/src/features/Projects/pages/ProjectPage/Components/AboutCard/AboutCard.tsx @@ -4,7 +4,7 @@ import { MdLocalFireDepartment } from 'react-icons/md' import Button from 'src/Components/Button/Button' import Card from 'src/Components/Card/Card' import Lightbox from 'src/Components/Lightbox/Lightbox' -import { ProjectDetailsQuery, ProjectLaunchStatusEnum, } from 'src/graphql' +import { ProjectDetailsQuery, ProjectLaunchStatusEnum, ProjectPermissionEnum, } from 'src/graphql' import { openModal } from 'src/redux/features/modals.slice' import { setVoteAmount } from 'src/redux/features/vote.slice' import { numberFormatter } from 'src/utils/helperFunctions' @@ -45,6 +45,9 @@ export default function AboutCard({ project }: Props) { })) } + + const canEdit = project.permissions.includes(ProjectPermissionEnum.UpdateInfo); + return ( {/* Cover Image */} @@ -62,7 +65,7 @@ export default function AboutCard({ project }: Props) { {/* Title & Basic Info */}
- + {canEdit && } diff --git a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetails.graphql b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetails.graphql index 66ea49e..cbca6ac 100644 --- a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetails.graphql +++ b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetails.graphql @@ -1,5 +1,5 @@ -query ProjectDetails($projectId: Int!) { - getProject(id: $projectId) { +query ProjectDetails($projectId: Int, $projectTag: String) { + getProject(id: $projectId, tag: $projectTag) { id title tagline diff --git a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx index b513fef..bf8de1f 100644 --- a/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx +++ b/src/features/Projects/pages/ProjectPage/ProjectDetailsCard/ProjectDetailsCard.tsx @@ -41,7 +41,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P const isMdScreen = useMediaQuery(MEDIA_QUERIES.isMedium) const { data, loading, error } = useProjectDetailsQuery({ - variables: { projectId: projectId! }, + variables: { projectId: projectId!, projectTag: null }, onCompleted: data => { dispatch(setProject(data.getProject)) }, @@ -69,9 +69,6 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P if (loading || !data?.getProject) return ; - const onConnectWallet = async () => { - Wallet_Service.connectWallet() - } const project = data.getProject; @@ -105,10 +102,6 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P }, ]; - - - const canEdit = project.permissions.includes(ProjectPermissionEnum.UpdateInfo); - const onVote = (votes?: number) => { dispatch(setVoteAmount(votes ?? 10)); dispatch(openModal({ @@ -119,21 +112,6 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P })) } - - const onClaim = () => { - if (!isWalletConnected) { - dispatch(scheduleModal({ - Modal: 'Claim_GenerateSignatureCard', - })) - dispatch(openModal({ - Modal: 'Login_ScanningWalletCard' - })) - } else - dispatch(openModal({ - Modal: 'Claim_GenerateSignatureCard', - })) - } - return (
} - {project.capabilities.length > 0 && + {/* {project.capabilities.length > 0 &&

CAPABILITIES

{project.capabilities.map(cap => {cap.icon} {cap.title})}
} -
- {project.members.length > 0 && + */} + + {/* {project.members.length > 0 &&

MAKERS

@@ -267,7 +246,7 @@ export default function ProjectDetailsCard({ direction, projectId, ...props }: P /> )}
-
} +
} */} {/*

Are you the creator of this project