Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gnomadic committed Oct 17, 2024
1 parent 0f5113b commit a557c62
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
2 changes: 0 additions & 2 deletions lib/features/project/components/ProjectCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const meta = {
}
}
`;

const project = await GitcoinGraphqlService.getProject(query);

return { project };
} catch (error) {
console.error(error);
Expand Down
17 changes: 11 additions & 6 deletions lib/features/project/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from "react";
// import { Button } from "@/primitives/shadcn/ui/button";

import { Card, CardContent } from "@/primitives/shadcn/ui/card";
import { Project } from "@/types/types";
import BannerImage from "@/primitives/BannerImage";
import ProfileImage from "@/primitives/ProfileImage";
import { Skeleton } from "@/primitives/shadcn/ui/skeleton";
// import Image from "next/image";

type ProjectCardProps = {
project?: Project | undefined;
Expand All @@ -17,11 +16,9 @@ export default function ProjectCard({ project }: ProjectCardProps) {

function LoadingCard() {
return (
<Card className="h-96 w-[350px] overflow-hidden">
<Card className="block max-w-sm overflow-hidden">
<div className="relative">
{/* <Skeleton className="h-[150px] w-full rounded-md" /> */}
<Skeleton className="h-[150px] w-full rounded-md" />

<div className="absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2">
<Skeleton className="size-[60px] rounded-full" />
</div>
Expand All @@ -36,7 +33,7 @@ function LoadingCard() {

export function DataCard({ project }: ProjectCardProps) {
return (
<Card className="h-96 w-[350px] overflow-hidden">
<Card className="block max-w-sm overflow-hidden">
<div className="relative">
<BannerImage ipfsCID={project?.metadata?.bannerImg} />
<div className="absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2">
Expand All @@ -50,3 +47,11 @@ export function DataCard({ project }: ProjectCardProps) {
</Card>
);
}

{
/* <a href="#" class="block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Noteworthy technology acquisitions 2021</h5>
<p class="font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
</a> */
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ProjectDisplayGrid from "./ProjectDisplayGrid";
import { activeProjects } from "@/types/QueryFilters/rounds/QueryFilters";
import { QueryClient } from "@tanstack/react-query";
import { QueryClientProvider } from "@tanstack/react-query";
import { undefinedArrayHandler, undefinedHandler } from "@/mocks/handlers";

Check failure on line 6 in lib/features/project/components/ProjectDisplayGrid.stories.tsx

View workflow job for this annotation

GitHub Actions / test

'"@/mocks/handlers"' has no exported member named 'undefinedArrayHandler'. Did you mean 'undefinedHandler'?

Check failure on line 6 in lib/features/project/components/ProjectDisplayGrid.stories.tsx

View workflow job for this annotation

GitHub Actions / Run Chromatic

'"@/mocks/handlers"' has no exported member named 'undefinedArrayHandler'. Did you mean 'undefinedHandler'?

const meta = {
title: "Components/ProjectDisplayGrid",
Expand Down Expand Up @@ -34,3 +35,11 @@ export default meta;
type Story = StoryObj<typeof ProjectDisplayGrid>;

export const Default: Story = {};

// export const Loading: Story = {
// parameters: {
// msw: {
// handlers: [undefinedArrayHandler],
// },
// },
// };
13 changes: 10 additions & 3 deletions lib/features/project/components/ProjectDisplayGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ type Props = {

export default function ProjectDisplayGrid(props: Props) {
// const rounds = useRounds(props.query);
const projects = useProjects(props.query);
const { data: projects, isPending, isError, isSuccess } = useProjects(props.query);

function getProjects() {
if (isSuccess) {
return projects;
}

return new Array(6).fill(undefined);
}

return (
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{/* <div>{JSON.stringify(projects)}</div> */}
{projects?.data?.map((object: Project, i: number) => {
{getProjects().map((object: Project | undefined, i: number) => {
return (
// <Link key={i} href={`/project/${object.chainId}/${object.id}`}>
<ProjectCard project={object} key={i} />
Expand Down
4 changes: 2 additions & 2 deletions lib/features/project/hooks/useProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useProjects = (query: string = defaultQuery) => {
staleTime: minutesToMilliseconds(120),
});

console.log(JSON.stringify(result));
// console.log(JSON.stringify(result));
return result;
};

Expand All @@ -43,6 +43,6 @@ export const useProject = (projectId: string, chainId: number) => {
staleTime: minutesToMilliseconds(120),
});

console.log("useprojects", JSON.stringify(result));
// console.log("useprojects", JSON.stringify(result));
return result;
};
4 changes: 2 additions & 2 deletions lib/services/GitcoinGraphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class GitcoinGraphqlService {

static async getRound(query: string): Promise<Round> {
const response = await client.request<{ round: Round }>(query);
console.log("gitcoinGraphql", JSON.stringify(response));
// console.log("gitcoinGraphql", JSON.stringify(response));
return response.round;
}

Expand All @@ -29,7 +29,7 @@ export class GitcoinGraphqlService {

static async getProject(query: string): Promise<Project> {
const response = await client.request<{ project: Project }>(query);
console.log("gitcoingraphql", response);
// console.log("gitcoingraphql", response);
return response.project;
}
}

0 comments on commit a557c62

Please sign in to comment.