Skip to content

Commit a1698ba

Browse files
authored
Merge pull request #210 from privacy-scaling-explorations/frontend-fixes-and-refactor
frontend updates and fixes
2 parents 0e69a9d + fac0687 commit a1698ba

File tree

453 files changed

+1028
-2019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

453 files changed

+1028
-2019
lines changed

app/[lang]/projects/[id]/page.tsx

Lines changed: 16 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
import { Metadata, ResolvingMetadata } from "next"
2-
import Link from "next/link"
3-
import { projects } from "@/data/projects"
1+
import { Metadata } from "next"
42

5-
import { siteConfig } from "@/config/site"
6-
import { ProjectInterface, ProjectStatus } from "@/lib/types"
7-
import { AppContent } from "@/components/ui/app-content"
8-
import { Markdown, createMarkdownElement } from "@/components/ui/markdown"
9-
import { WikiCard } from "@/components/cards/wiki-card"
10-
import { Divider } from "@/components/divider"
11-
import { Icons } from "@/components/icons"
12-
import DiscoverMoreProjects from "@/components/project/discover-more-projects"
13-
import { ProjectTags } from "@/components/project/project-detail-tags"
14-
import ProjectExtraLinks from "@/components/project/project-extra-links"
15-
import { ProjectLinkIconMap } from "@/components/project/project-links"
16-
import { WikiSideNavigation } from "@/components/wiki-side-navigation"
17-
import { useTranslation } from "@/app/i18n"
3+
import { getProjectById } from "@/lib/projectsUtils"
4+
import { ProjectInterface } from "@/lib/types"
185
import { LocaleTypes } from "@/app/i18n/settings"
196

7+
import { ProjectContent } from "../sections/ProjectContent"
8+
209
type PageProps = {
2110
params: { id: string; lang: string }
2211
searchParams: { [key: string]: string | string[] | undefined }
@@ -27,21 +16,18 @@ export interface ProjectProps {
2716
lang: LocaleTypes
2817
}
2918

30-
export async function generateMetadata(
31-
{ params }: PageProps,
32-
parent: ResolvingMetadata
33-
): Promise<Metadata> {
34-
const currProject = projects.filter(
35-
(project) => String(project.id) === params.id
36-
)[0]
37-
38-
const imageUrl = currProject.image
39-
? `/project-banners/${currProject.image}`
40-
: "/og-image.png"
19+
export async function generateMetadata({
20+
params,
21+
}: PageProps): Promise<Metadata> {
22+
const { project, content } = getProjectById(params.id)
23+
const imageUrl =
24+
(project?.image ?? "")?.length > 0
25+
? `/project-banners/${project?.image}`
26+
: "/og-image.png"
4127

4228
return {
43-
title: currProject.name,
44-
description: currProject.tldr,
29+
title: project?.name,
30+
description: content?.tldr,
4531
openGraph: {
4632
images: [
4733
{
@@ -55,125 +41,7 @@ export async function generateMetadata(
5541
}
5642

5743
export default async function ProjectDetailPage({ params }: PageProps) {
58-
const currProject: ProjectInterface = projects.filter(
59-
(project) => String(project.id) === params.id
60-
)[0]
6144
const lang = params?.lang as LocaleTypes
62-
const { t } = await useTranslation(lang, "common")
63-
const { t: projectTranslation } = await useTranslation(
64-
lang,
65-
"projects/" + currProject.id
66-
)
67-
68-
const hasSocialLinks = Object.keys(currProject?.links ?? {}).length > 0
69-
70-
const editPageURL = siteConfig?.editProjectPage(currProject.id, lang)
71-
72-
return (
73-
<section className="bg-project-page-gradient">
74-
<Divider.Section className="flex flex-col items-center">
75-
<AppContent className="flex flex-col gap-12 py-16">
76-
<div className="grid grid-cols-1 gap-10 lg:grid-cols-[140px_1fr_290px] lg:items-start lg:gap-12">
77-
<div className="sticky top-20">
78-
<WikiSideNavigation
79-
className="hidden md:block"
80-
content={projectTranslation("description")}
81-
/>
82-
</div>
83-
84-
<div className="flex flex-col items-center justify-center w-full gap-5 ">
85-
<div className="w-full ">
86-
<div className="flex flex-col">
87-
<div className="flex flex-col gap-6 text-left">
88-
<Link
89-
className="flex items-center gap-2 text-tuatara-950/80 hover:text-tuatara-950"
90-
href={`/${lang}/projects`}
91-
>
92-
<Icons.arrowLeft />
93-
<span className="font-sans text-base">
94-
{t("projectLibrary")}
95-
</span>
96-
</Link>
97-
<div className="flex flex-col gap-2">
98-
<h1 className="py-2 text-3xl font-bold leading-[110%] md:text-5xl">
99-
{currProject.name}
100-
</h1>
101-
<p className="py-2 leading-[150%] text-slate-600">
102-
{projectTranslation("tldr")}
103-
</p>
104-
</div>
105-
</div>
106-
{hasSocialLinks && (
107-
<div className="flex flex-wrap items-center justify-start gap-6 pt-4">
108-
{Object?.entries(currProject.links ?? {})?.map(
109-
([key, value]) => {
110-
return (
111-
<Link
112-
key={key}
113-
href={value ?? ""}
114-
target="_blank"
115-
rel="noreferrer"
116-
className="group"
117-
>
118-
<div className="flex items-center gap-2">
119-
{ProjectLinkIconMap?.[key]}
120-
<p className="capitalize duration-200 text-slate-600 group-hover:text-orange">
121-
{key}
122-
</p>
123-
</div>
124-
</Link>
125-
)
126-
}
127-
)}
128-
</div>
129-
)}
130-
<div className="mt-10 hidden h-[1px] w-full bg-anakiwa-300 md:block"></div>
131-
</div>
132-
133-
<div className="flex flex-col w-full gap-6 mt-6 md:mt-10">
134-
<div className="flex flex-col w-full gap-4 text-base font-normal leading-relaxed">
135-
<Markdown
136-
components={{
137-
p: ({ node, ...props }) =>
138-
createMarkdownElement("p", {
139-
className:
140-
"text-tuatara-700 font-sans text-lg font-normal",
141-
...props,
142-
}),
143-
}}
144-
>
145-
{projectTranslation("description")}
146-
</Markdown>
147-
<ProjectTags project={currProject} lang={lang} />
148-
</div>
149-
<ProjectExtraLinks project={currProject} lang={lang} />
150-
</div>
151-
</div>
152-
</div>
153-
<WikiCard
154-
className="lg:sticky lg:top-20"
155-
project={currProject}
156-
lang={lang}
157-
/>
158-
<div className="lg:col-start-2">
159-
<Link
160-
href={editPageURL}
161-
target="_blank"
162-
rel="noreferrer"
163-
passHref
164-
className="inline-flex items-center self-start gap-2 px-4 py-2 duration-200 bg-white border-2 rounded-md group border-tuatara-950 hover:bg-tuatara-950 hover:text-white"
165-
>
166-
<Icons.edit />
167-
<span className="text-sm duration-200 text-tuatara-950 group-hover:text-white">
168-
{t("editThisPage")}
169-
</span>
170-
</Link>
171-
</div>
172-
</div>
173-
</AppContent>
17445

175-
<DiscoverMoreProjects project={currProject} lang={lang} />
176-
</Divider.Section>
177-
</section>
178-
)
46+
return <ProjectContent lang={lang} id={params?.id} />
17947
}

app/[lang]/projects/page.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Metadata } from "next"
2-
import Image from "next/image"
32

43
import { Divider } from "@/components/divider"
54
import { PageHeader } from "@/components/page-header"
@@ -11,7 +10,7 @@ import { useTranslation } from "@/app/i18n"
1110
export const metadata: Metadata = {
1211
title: "Project Library",
1312
description:
14-
"PSE is home to many projects, from cryptography research to developer tools, protocols, and proof-of-concept applications.",
13+
"PSE supports projects working on theoretical cryptography research, protocol development, open source tooling, experimental applications, and more.",
1514
}
1615

1716
export default async function ProjectsPage({ params: { lang } }: any) {
@@ -22,26 +21,14 @@ export default async function ProjectsPage({ params: { lang } }: any) {
2221
<PageHeader
2322
title={t("title")}
2423
subtitle={t("subtitle")}
25-
image={
26-
<div className="mx-auto lg:absolute lg:right-36">
27-
<Image
28-
width={280}
29-
height={280}
30-
className="mx-auto w-[160px] md:w-[180px] lg:ml-auto lg:w-[200px] xl:w-[260px]"
31-
src="/icons/lens.webp"
32-
alt="lens icon"
33-
/>
34-
</div>
35-
}
24+
showDivider={false}
3625
>
3726
<ProjectFiltersBar lang={lang} />
3827
</PageHeader>
3928

4029
<div className="w-full bg-white pb-28">
4130
<div className="container flex flex-col py-8 gap-14">
42-
<div>
43-
<ProjectResultBar lang={lang} />
44-
</div>
31+
<ProjectResultBar lang={lang} />
4532
<ProjectList lang={lang} />
4633
</div>
4734
</div>

0 commit comments

Comments
 (0)