Skip to content

Commit 1c42c7f

Browse files
authored
feat: optimizations and clean up (#431)
* Add image optimization and image fallback * Add fonts optimization * Replace images with code with actual code blocks * Fix mpz project banner not loading #432 * Fix Replace text loading with skeletons #428 * Remove unused files
1 parent 313c85e commit 1c42c7f

Some content is hidden

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

46 files changed

+465
-242
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ yarn-error.log*
4646
!.yarn/sdks
4747
!.yarn/versions
4848
.pnp.*
49+
50+
# TypeScript
51+
*.tsbuildinfo
52+
tsconfig.tsbuildinfo

app/[lang]/blog/[slug]/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button"
55
import { Label } from "@/components/ui/label"
66
import { Markdown } from "@/components/ui/markdown"
77
import { getArticles, getArticleById } from "@/lib/blog"
8-
import { cn } from "@/lib/utils"
8+
import { cn, getBackgroundImage } from "@/lib/utils"
99
import { Metadata } from "next"
1010
import Link from "next/link"
1111
import { notFound } from "next/navigation"
@@ -57,7 +57,7 @@ export default function BlogArticle({ params }: any) {
5757
notFound()
5858
}
5959

60-
const imageUrl = (post?.image ?? "")?.length > 0 ? post?.image : undefined
60+
const imageUrl = getBackgroundImage(post?.image)
6161

6262
const imageAsCover = true
6363

@@ -77,7 +77,10 @@ export default function BlogArticle({ params }: any) {
7777
: "bg-cover-gradient"
7878
)}
7979
style={{
80-
backgroundImage: imageAsCover ? `url(${imageUrl})` : undefined,
80+
backgroundImage:
81+
imageAsCover && imageUrl?.length > 0
82+
? `url(${imageUrl})`
83+
: undefined,
8184
}}
8285
/>
8386
<div className="flex items-start justify-center z-0 bg-cover border-tuatara-300 border-b w-full">

app/[lang]/blog/page.tsx

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
dehydrate,
1010
} from "@tanstack/react-query"
1111
import ArticlesList from "@/components/blog/ArticlesList"
12+
import { Skeleton } from "@/components/skeleton"
1213

1314
export const dynamic = "force-dynamic"
1415

@@ -24,6 +25,40 @@ interface BlogPageProps {
2425
searchParams?: { [key: string]: string | string[] | undefined }
2526
}
2627

28+
const LoadingSkeleton = () => {
29+
return (
30+
<>
31+
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4 lg:gap-6 items-stretch">
32+
<Skeleton.Card className="h-full" />
33+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-6 lg:col-span-2 h-full">
34+
<Skeleton.Card size="md" className="max-h-[200px]" />
35+
<Skeleton.Card size="md" className="max-h-[200px]" />
36+
<Skeleton.Card size="md" className="max-h-[200px]" />
37+
<Skeleton.Card size="md" className="max-h-[200px]" />
38+
</div>
39+
</div>
40+
<div className="flex flex-col gap-5 lg:gap-14">
41+
<div className="grid grid-cols-[80px_1fr] lg:grid-cols-[120px_1fr] items-center gap-4 lg:gap-10">
42+
<Skeleton.Circle size="full" />
43+
<div className="flex flex-col gap-2">
44+
<Skeleton.Line size="lg" />
45+
<Skeleton.Line size="md" />
46+
<Skeleton.Line size="xs" />
47+
</div>
48+
</div>
49+
<div className="grid grid-cols-[80px_1fr] lg:grid-cols-[120px_1fr] items-center gap-4 lg:gap-10">
50+
<Skeleton.Circle size="full" />
51+
<div className="flex flex-col gap-2">
52+
<Skeleton.Line size="lg" />
53+
<Skeleton.Line size="md" />
54+
<Skeleton.Line size="xs" />
55+
</div>
56+
</div>
57+
</div>
58+
</>
59+
)
60+
}
61+
2762
const BlogPage = async ({ params: { lang }, searchParams }: BlogPageProps) => {
2863
const { t } = await useTranslation(lang, "blog-page")
2964
const tag = searchParams?.tag as string | undefined
@@ -71,13 +106,13 @@ const BlogPage = async ({ params: { lang }, searchParams }: BlogPageProps) => {
71106
</div>
72107

73108
<AppContent className="flex flex-col gap-10 lg:gap-16 pb-10 lg:py-10 lg:max-w-[978px]">
74-
<Suspense
75-
fallback={
76-
<div className="flex justify-center py-10">Loading articles...</div>
77-
}
78-
>
109+
<Suspense fallback={<LoadingSkeleton />}>
79110
<HydrationBoundary state={dehydrate(queryClient)}>
80-
<ArticlesList lang={lang} tag={tag} />
111+
<ArticlesList
112+
lang={lang}
113+
tag={tag}
114+
fallback={<LoadingSkeleton />}
115+
/>
81116
</HydrationBoundary>
82117
</Suspense>
83118
</AppContent>

app/[lang]/devcon-7/sections/Devcon7Slider.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ export const Devcon7Slider = () => {
7070
return (
7171
<AnySlider {...settings}>
7272
{images.map((image, index) => (
73-
<div
74-
key={index}
75-
className="relative h-[320px] w-full bg-cover bg-center overflow-hidden"
76-
style={{ backgroundImage: `url(${image})` }}
77-
>
73+
<div key={index} className="relative h-[320px] w-full overflow-hidden">
7874
<Image
7975
src={image}
8076
alt={`Devcon 7 Overview ${index + 1}`}
8177
fill
82-
className="object-cover w-full"
78+
className="object-cover"
79+
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
80+
priority={index < 2}
81+
quality={85}
82+
loading={index < 2 ? "eager" : "lazy"}
8383
/>
8484
</div>
8585
))}

app/layout.tsx

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,30 @@ const inter = Inter({
1111
subsets: ["latin"],
1212
variable: "--font-inter",
1313
weight: ["400", "500", "600", "700"],
14+
display: "swap",
15+
preload: true,
16+
fallback: ["system-ui", "sans-serif"],
17+
adjustFontFallback: true,
1418
})
1519

1620
const display = Space_Grotesk({
1721
subsets: ["latin"],
1822
variable: "--font-display",
1923
weight: ["400", "500", "600", "700"],
24+
display: "swap",
25+
preload: true,
26+
fallback: ["system-ui", "sans-serif"],
27+
adjustFontFallback: true,
2028
})
2129

2230
const sans = DM_Sans({
2331
subsets: ["latin"],
2432
variable: "--font-sans",
2533
weight: ["400", "500", "600", "700"],
34+
display: "swap",
35+
preload: true,
36+
fallback: ["system-ui", "sans-serif"],
37+
adjustFontFallback: true,
2638
})
2739

2840
const fonts = [inter, display, sans]
@@ -31,25 +43,46 @@ export async function generateStaticParams() {
3143
return languages.map((language) => ({ language }))
3244
}
3345

34-
export const viewport: Viewport = {
35-
width: "device-width",
36-
initialScale: 1,
37-
maximumScale: 1,
38-
userScalable: false,
39-
}
40-
4146
export const metadata: Metadata = {
42-
metadataBase: new URL("https://pse.dev"),
4347
title: {
4448
default: siteConfig.name,
45-
template: `%s - ${siteConfig.name}`,
49+
template: `%s | ${siteConfig.name}`,
4650
},
4751
description: siteConfig.description,
48-
icons: {
49-
icon: "/favicon.svg",
50-
shortcut: "/favicon.svg",
51-
apple: "/apple-touch-icon.png",
52-
},
52+
keywords: [
53+
"Privacy & Scaling Explorations",
54+
"Zero Knowledge Proofs",
55+
"ZK Proofs",
56+
"Cryptography",
57+
"Ethereum",
58+
"Blockchain",
59+
"Privacy",
60+
"Scaling",
61+
"Open Source",
62+
"Research",
63+
"Development",
64+
"zkEVM",
65+
"Rollups",
66+
"Account Abstraction",
67+
"Fully Homomorphic Encryption",
68+
"Multi-Party Computation",
69+
"Programmable Cryptography",
70+
"Ethereum Foundation",
71+
"Cryptographic Research",
72+
"Privacy Tools",
73+
"Scaling Solutions",
74+
"Cryptographic Primitives",
75+
"Zero Knowledge",
76+
"ZK Technology",
77+
"Cryptographic Infrastructure",
78+
],
79+
authors: [
80+
{
81+
name: "Privacy + Scaling Explorations",
82+
url: "https://pse.dev",
83+
},
84+
],
85+
creator: "Privacy + Scaling Explorations",
5386
openGraph: {
5487
images: [
5588
{
@@ -71,16 +104,24 @@ export const metadata: Metadata = {
71104
},
72105
}
73106

107+
export const viewport: Viewport = {
108+
themeColor: [
109+
{ media: "(prefers-color-scheme: light)", color: "white" },
110+
{ media: "(prefers-color-scheme: dark)", color: "black" },
111+
],
112+
}
113+
74114
interface RootLayoutProps {
75115
children: React.ReactNode
76-
params?: any
77116
}
78117

79118
export default function RootLayout({ children }: RootLayoutProps) {
80119
return (
81120
<QueryClientProviderLayout>
82121
<html lang="en" className={fonts.map((font) => font.className).join(" ")}>
83-
<body>{children}</body>
122+
<body className="min-h-screen bg-background antialiased">
123+
{children}
124+
</body>
84125
</html>
85126
</QueryClientProviderLayout>
86127
)

app/not-found.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import "@/styles/globals.css"
44
import React from "react"
55
import Image from "next/image"
66
import Link from "next/link"
7+
import { Metadata } from "next"
8+
import { AppContent } from "@/components/ui/app-content"
79

810
import { LangProps } from "@/types/common"
911
import { fontDisplay, fontSans } from "@/lib/fonts"
@@ -13,6 +15,10 @@ import { TailwindIndicator } from "@/components/tailwind-indicator"
1315

1416
import { useTranslation } from "./i18n/client"
1517

18+
export const metadata: Metadata = {
19+
title: "404: Page Not Found",
20+
}
21+
1622
export default function NotFound({ lang }: LangProps["params"]) {
1723
const { t } = useTranslation(lang, "common")
1824

articles/announcing-the-pse-grants-program.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

articles/bls-wallet-bundling-up-data-privacy-scaling-explorations.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,30 @@ BLS Wallet bundles can contain both simple transactions (“send money from acco
6363

6464
An operation must contain the nonce of the smart contract wallet, a BLS signature, and the action(s) to be executed including the address of the smart contract to be called and the function to call.
6565

66-
![](https://miro.medium.com/max/1400/0*cFBuQg8ulyjy6Q49)
66+
```js
67+
const bundle = wallet.sign({
68+
nonce: await wallet.Nonce(),
69+
// All actions in this operation are atomic
70+
actions: [
71+
{
72+
ethValue: 0,
73+
contractAddress: erc20Contract.address,
74+
encodedFunction: erc20Contract.address.interface.encodeFunctionData(
75+
"approve",
76+
[dexContract.address, amount]
77+
),
78+
},
79+
{
80+
ethValue: 0,
81+
contractAddress: dexContract.address,
82+
encodedFunction: dexContract.address.interface.encodeFunctionData(
83+
"swap",
84+
[erc20Contract.address, amount, otherERC20Contract.address]
85+
),
86+
},
87+
],
88+
})
89+
```
6790

6891
Example of a single operation bundle
6992

articles/building-a-zk-proof-of-solvency-for-uniswap-v3-lp-nfts.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

articles/hello-world-the-first-signs-of-practical-io.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ While all of these differences (except for the first one) are introduced to redu
4646

4747
In our benchmarking scenario, the obfuscator sets a [public circuit](https://github.com/MachinaIO/diamond-io/blob/e7e87dd8422db0f8ccf634fdb3c658c2c1eef82e/dio/src/circuit.rs) $C$ with variable arithmetic depth (addition and multiplication layers) and variable input size. As part of the obfuscation algorithm, the obfuscator samples a binary vector hardcoded key $k$ and embeds it inside the obfuscated circuit. The obfuscated circuit is then published such that any evaluator can run it over their dynamically chosen input $x$ to obtain $C(k, x)$ without any interaction with the obfuscator and without learning $k$ (beyond what could be inferred from $C(k, x)$).
4848

49-
```
49+
```js
5050
// public circuit C
5151
let mut public_circuit = PolyCircuit::new();
5252

0 commit comments

Comments
 (0)