Skip to content
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
19 changes: 0 additions & 19 deletions .github/workflows/web_cd.yaml

This file was deleted.

6 changes: 1 addition & 5 deletions apps/web/netlify.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
[build]
command = "pnpm -F @hypr/web build"
publish = "dist/client"
publish = "apps/web/dist/client"

[build.environment]
VITE_APP_URL = "https://hyprnote.com"
NODE_VERSION = "22"

[[edge_functions]]
function = "og"
path = "/og"

[images]
# https://docs.netlify.com/build/image-cdn/overview/#remote-path
remote_images = [
Expand Down
136 changes: 84 additions & 52 deletions apps/web/netlify/edge-functions/og.tsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,107 @@
// deno-lint-ignore no-import-prefix
import { ImageResponse } from "https://deno.land/x/og_edge@0.0.6/mod.ts";
// deno-lint-ignore no-import-prefix
import { z } from "https://deno.land/x/zod@v3.23.8/mod.ts";

export default function handler(req: Request) {
const url = new URL(req.url);
const title = url.searchParams.get("title") || "Hyprnote";
const description = url.searchParams.get("description") || "AI Meeting Notes";
const templateSchema = z.object({
type: z.literal("meeting"),
title: z.string(),
headers: z.array(z.string()),
});

const OGSchema = z.discriminatedUnion("type", [templateSchema]);

function parseSearchParams(url: URL): z.infer<typeof OGSchema> | null {
const type = url.searchParams.get("type");
if (!type) {
return null;
}

return new ImageResponse(
(
const title = url.searchParams.get("title");
const headers = url.searchParams.getAll("headers");

const result = OGSchema.safeParse({ type, title, headers });
return result.success ? result.data : null;
}

function renderTemplate(params: z.infer<typeof templateSchema>) {
return (
<div
style={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
padding: "80px",
}}
>
<div
style={{
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
background: "white",
borderRadius: "24px",
padding: "80px",
width: "100%",
height: "100%",
}}
>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
background: "white",
borderRadius: "24px",
padding: "80px",
width: "100%",
height: "100%",
fontSize: 56,
fontWeight: 700,
color: "#1a202c",
marginBottom: "40px",
}}
>
<div
style={{
fontSize: 64,
fontWeight: 700,
color: "#1a202c",
textAlign: "center",
marginBottom: "24px",
}}
>
{title}
</div>
<div
style={{
fontSize: 32,
color: "#718096",
textAlign: "center",
}}
>
{description}
</div>
<div
style={{
position: "absolute",
bottom: "80px",
fontSize: 36,
fontWeight: 700,
color: "#667eea",
}}
>
Hyprnote
</div>
{params.title}
</div>
<div style={{ display: "flex", flexDirection: "column", gap: "20px" }}>
{params.headers.map((header, i) => (
<div
key={i}
style={{
fontSize: 28,
color: "#4a5568",
display: "flex",
alignItems: "center",
}}
>
<div
style={{
width: "8px",
height: "8px",
borderRadius: "50%",
background: "#667eea",
marginRight: "16px",
}}
/>
{header}
</div>
))}
</div>
</div>
),
</div>
);
}

export default function handler(req: Request) {
const url = new URL(req.url);
const params = parseSearchParams(url);

if (!params) {
return new Response(JSON.stringify({ error: "invalid_parameters" }), {
status: 400,
headers: { "Content-Type": "application/json" },
});
}

// https://unpic.pics/og-edge
return new ImageResponse(renderTemplate(params));
}

// https://docs.netlify.com/build/edge-functions/declarations/#declare-edge-functions-inline
export const config = {
path: "/og",
cache: "manual",
Expand Down
Loading