Skip to content
← Public packages

@kentcdodds/photo-portfolio

A fast, photo-first portfolio site you update by chatting with your agent: galleries, about, contact, and one-step rollback.

FollowFork

Files

types.ts

106 lines · 2.6 KB · TypeScript
/** Image encodings the site serves. WebP first, JPEG as the universal fallback. */
export type ImageFormat = 'webp' | 'jpeg'

export type PhotoVariant = {
	width: number
	height: number
	format: ImageFormat
	bytes: number
}

/** Basic EXIF facts kept after processing. GPS and serial numbers are never read. */
export type PhotoCredits = {
	artist?: string
	copyright?: string
	camera?: string
	lens?: string
	exposure?: string
	takenAt?: string
}

/**
 * One processed photo. `stored` photos live in package storage (served from
 * `/media/...`); `bundled` photos are the sample images shipped in `public/samples`.
 */
export type Photo = {
	id: string
	source: 'stored' | 'bundled'
	/** Oriented pixel size of the largest variant. */
	width: number
	height: number
	alt: string
	caption?: string
	/** BlurHash string for clients that decode it. */
	blurhash: string
	/** Tiny JPEG data URI painted behind the image while it loads. */
	lqip: string
	variants: Array<PhotoVariant>
	credits?: PhotoCredits
	addedAt: string
}

export type Gallery = {
	id: string
	slug: string
	title: string
	description?: string
	coverPhotoId: string
	featured: boolean
	photos: Array<Photo>
	createdAt: string
	updatedAt: string
}

export const socialPlatforms = [
	'instagram',
	'facebook',
	'tiktok',
	'youtube',
	'vimeo',
	'x',
	'threads',
	'pinterest',
	'linkedin',
	'behance',
	'website',
] as const

export type SocialPlatform = (typeof socialPlatforms)[number]

export type ThemeMode = 'auto' | 'light' | 'dark'

/** Everything about the photographer and the site. Lives in package storage, never in agent memory. */
export type SiteConfig = {
	siteName: string
	tagline: string
	photographerName: string
	/** Markdown. */
	bio: string
	headshot?: Photo
	contactEmail: string
	phone?: string
	location?: string
	social: Partial<Record<SocialPlatform, string>>
	/** Calendly, cal.com, or any booking page. */
	bookingUrl?: string
	bookingLabel: string
	/** `#rrggbb` */
	accentColor: string
	theme: ThemeMode
	seoDescription: string
	/** Canonical public origin, e.g. `https://janedoe.photo`. Used for canonical links, Open Graph, and sitemap.xml. */
	siteUrl?: string
	/** Email the owner (via Kody) when someone sends the contact form. */
	notifyOnInquiry: boolean
	/** Write `© year photographerName` into the JPEG files' EXIF Artist/Copyright. */
	embedCopyright: boolean
	/** Show camera, lens, and exposure under photos in the lightbox. */
	showCameraDetails: boolean
}

/** The whole site: config plus the ordered gallery manifest. Drafts, live, and versions all use this shape. */
export type SiteContent = {
	config: SiteConfig
	galleries: Array<Gallery>
	updatedAt: string
}