Skip to content

Commit

Permalink
Merge pull request #315 from privacy-scaling-explorations/chore/do-no…
Browse files Browse the repository at this point in the history
…t-blur

chore: do not blur projects which are not approved yet
  • Loading branch information
ctrlc03 authored Sep 9, 2024
2 parents 5e6efc8 + e62b42d commit 196f646
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
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

0 comments on commit 196f646

Please sign in to comment.