| 1 | import { ImageResponse } from "next/og"; |
| 2 | import { |
| 3 | loadOgAssets, |
| 4 | OgFrame, |
| 5 | NextMark, |
| 6 | OgBadge, |
| 7 | OG_HANDLE, |
| 8 | OG_NAME, |
| 9 | OG_SIZE, |
| 10 | truncate, |
| 11 | } from "@/lib/og"; |
| 12 | import NestJS from "@/icons/nest |
| 13 | import Prisma from "@/icons/prisma |
| 14 | import Grafana from "@/icons/grafana |
| 15 | import Flutter from "@/icons/flutter |
| 16 | import { EffectTS } |
| 17 | import en from "@/translations/en.json |
| 18 | import de from "@/translations/de.json |
| 19 | |
| 20 | export const runtime = |
| 21 | export const contentType = |
| 22 | export const size = |
| 23 | export const alt = |
| 24 | |
| 25 | const MESSAGES: Record |
| 26 | |
| 27 | const ICON_SIZE = 26 |
| 28 | |
| 29 | const STACK = [ |
| 30 | { name: "Next.js", |
| 31 | { name: "Nest.js", |
| 32 | { name: "Prisma", |
| 33 | { name: "Effect", |
| 34 | { name: "Grafana", |
| 35 | ]; |
| 36 | |
| 37 | const LEARNING = { |
| 38 | |
| 39 | const BIRTH_DATE = " |
| 40 | |
| 41 | function age(): number |
| 42 | return Math.floor |
| 43 | (Date.now() |
| 44 | (1000 * 60 * |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | export default async function |
| 49 | params: Promise |
| 50 | }) { |
| 51 | const { locale |
| 52 | const messages = |
| 53 | |
| 54 | const headline = |
| 55 | const description = |
| 56 | messages.HomePage.description |
| 57 | 170, |
| 58 | ); |
| 59 | |
| 60 | const currently = |
| 61 | const learning = |
| 62 | |
| 63 | const boldText = |
| 64 | const regularText = |
| 65 | OG_HANDLE + |
| 66 | description + |
| 67 | currently + |
| 68 | learning + |
| 69 | STACK.map((tech |
| 70 | LEARNING.name + |
| 71 | ",." + |
| 72 | "EnglishDeutsch"; |
| 73 | |
| 74 | const [fonts, |
| 75 | |
| 76 | return new ImageResponse |
| 77 | ( |
| 78 | <OgFrame avatar={ |
| 79 | <div |
| 80 | style={{ display: |
| 81 | > |
| 82 | <span |
| 83 | style={{ |
| 84 | fontSize: 64, |
| 85 | fontWeight: 700, |
| 86 | color: "#ffffff", |
| 87 | lineHeight: 1.15, |
| 88 | }} |
| 89 | > |
| 90 | {headline} |
| 91 | </span> |
| 92 | <span |
| 93 | style={{ |
| 94 | fontSize: 32, |
| 95 | color: "#9ca3af", |
| 96 | lineHeight: 1.4, |
| 97 | marginTop: 26, |
| 98 | }} |
| 99 | > |
| 100 | {description} |
| 101 | </span> |
| 102 | {/* The "currently working with ..." sentence from page.tsx, with the |
| 103 | same inline badges. Satori has no inline flow, so the sentence is |
| 104 | a wrapping flex row and each badge keeps its comma attached. */} |
| 105 | <div |
| 106 | style={{ |
| 107 | display: "flex", |
| 108 | flexDirection: "row", |
| 109 | flexWrap: "wrap", |
| 110 | alignItems: "center", |
| 111 | fontSize: 30, |
| 112 | color: "#9ca3af", |
| 113 | rowGap: 12, |
| 114 | marginTop: 38, |
| 115 | }} |
| 116 | > |
| 117 | <span style={{ |
| 118 | {STACK.map(( |
| 119 | <div |
| 120 | key={name} |
| 121 | style={{ |
| 122 | display: "flex", |
| 123 | flexDirection: "row", |
| 124 | alignItems: "center", |
| 125 | marginRight: 10, |
| 126 | }} |
| 127 | > |
| 128 | <OgBadge> |
| 129 | <Icon |
| 130 | width={ICON_SIZE} |
| 131 | height={ICON_SIZE} |
| 132 | style={{ marginRight: |
| 133 | /> |
| 134 | {name} |
| 135 | </OgBadge> |
| 136 | {index < STACK |
| 137 | </div> |
| 138 | ))} |
| 139 | <span style={{ |
| 140 | <div |
| 141 | style={{ |
| 142 | display: "flex", |
| 143 | flexDirection: "row", |
| 144 | alignItems: "center", |
| 145 | }} |
| 146 | > |
| 147 | <OgBadge> |
| 148 | <LEARNING.Icon |
| 149 | width={ICON_SIZE} |
| 150 | height={ICON_SIZE} |
| 151 | style={{ marginRight: |
| 152 | /> |
| 153 | {LEARNING.name} |
| 154 | </OgBadge> |
| 155 | <span>.</span> |
| 156 | </div> |
| 157 | </div> |
| 158 | </div> |
| 159 | </OgFrame> |
| 160 | ), |
| 161 | { |
| 162 | ...size, |
| 163 | ...(fonts ? |
| 164 | }, |
| 165 | ); |
| 166 | } |