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

chore: do not blur projects which are not approved yet #315

Merged
merged 1 commit into from
Sep 9, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import clsx from "clsx";
import { type ReactNode } from "react";

import { Heading } from "~/components/ui/Heading";
Expand All @@ -20,14 +19,12 @@ export interface IProjectDetailsProps {
action?: ReactNode;
projectId?: string;
attestation?: Attestation;
disabled?: boolean;
}

const ProjectDetails = ({
projectId = "",
attestation = undefined,
action = undefined,
disabled = false,
}: IProjectDetailsProps): JSX.Element => {
const metadata = useProjectMetadata(attestation?.metadataPtr);

Expand All @@ -37,7 +34,7 @@ const ProjectDetails = ({
const appState = useAppState();

return (
<div className={clsx("relative dark:text-white", disabled && "opacity-30")}>
<div className="relative dark:text-white">
<div className="mb-7">
<Navigation projectName={attestation?.name ?? "project name"} />
</div>
Expand Down
12 changes: 1 addition & 11 deletions packages/interface/src/pages/projects/[projectId]/Project.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { type GetServerSideProps } from "next";
import { useMemo } from "react";

import { ReviewBar } from "~/features/applications/components/ReviewBar";
import { useApprovedApplications } from "~/features/applications/hooks/useApprovedApplications";
import ProjectDetails from "~/features/projects/components/ProjectDetails";
import { useProjectById } from "~/features/projects/hooks/useProjects";
import { LayoutWithSidebar } from "~/layouts/DefaultLayout";
Expand All @@ -15,22 +13,14 @@ export interface IProjectDetailsProps {

const ProjectDetailsPage = ({ projectId = "" }: IProjectDetailsProps): JSX.Element => {
const projects = useProjectById(projectId);
const approved = useApprovedApplications();
const { name } = projects.data?.[0] ?? {};
const appState = useAppState();

const approvedById = useMemo(
() => new Map(approved.data?.map(({ refUID }) => [refUID, true]) ?? []),
[approved.data],
);

const disabled = useMemo(() => approvedById.get(projectId), [approvedById, projectId]);

return (
<LayoutWithSidebar eligibilityCheck showBallot showInfo sidebar="left" title={name}>
{appState === EAppState.APPLICATION && <ReviewBar projectId={projectId} />}

<ProjectDetails attestation={projects.data?.[0]} disabled={!disabled} projectId={projectId} />
<ProjectDetails attestation={projects.data?.[0]} projectId={projectId} />
</LayoutWithSidebar>
);
};
Expand Down
Loading