import { ImageResponse } from 'next/og'; import { BG_IMAGE_BASE_64, loadGoogleFont } from '../../lib/utils'; import { SembleLogoFull } from './SembleLogo'; import { abbreviateNumber, truncateText } from '@/lib/utils/text'; interface Props { name: string; linkCount: number; author: { name: string; handle?: string | null; avatarUrl?: string | null; } | null; // The board's saved thumbnail, as a data URL thumbnail: string | null; } const W = 1200; const H = 630; // Where the board's panel starts, and the thumbnail's frame inside it const PANEL_LEFT = 560; const PANEL_WIDTH = W - PANEL_LEFT + 40; const THUMB_WIDTH = 620; const THUMB_HEIGHT = 510; const THUMB_INSET = 48; // The board: an off-white page under a graph-paper grid const BOARD_BG = '#f8f9fa'; const GRID_LINE = '#e9ecef'; const GRID_GAP = 26; // Satori tiles neither gradients nor images, so the grid is an SVG pattern function GridLines() { return ( ); } // The details on the webapp's OG paper at left, and the board on its grid at // right, running off the card's edges like a window onto the canvas export default async function CanvasOpenGraph(props: Props) { const author = props.author; return new ImageResponse(
Canvas
{props.name}
{props.linkCount > 0 && ({abbreviateNumber(props.linkCount)}
{props.linkCount > 1 ? 'links' : 'link'}
{author.handle ? `@${truncateText(author.handle, 30)}` : truncateText(author.name, 30)}