import Link from "next/link"; import { formatDate, formatTime, formatTimeZone, } from "@urbit/foundation-design-system"; export function Name({ children, className }) { return {children}; } export function Patp({ children, className }) { return ( {children} ); } // Used to render a human name alongside their @p export function Person({ name, patp, nameClassNames, patpClassNames, className, }) { return ( <> {patp && name ? ( <> {name}{" "} {patp} ) : patp ? ( {patp} ) : name ? ( {name} ) : null} ); } // This goes inside a

tag export function ReadableList({ children, serial = ",", conjunction = "and" }) { return ( <> {children.map((Child, index) => { if (index < children.length - 2) { return ( <> {Child} {serial} ); } else if (index < children.length - 1) { return ( <> {Child} {conjunction}{" "} ); } return <>{Child}; })} ); } export function ShowOrHide({ children, condition }) { if (condition) { return children; } return null; } export function DateRange({ starts, ends, className, short }) { // For events which have no end datetime if (!ends.isValid) { return (

{`${formatDate(starts)} • ${formatTime(starts)} ${formatTimeZone( starts )}`}

); } // For events which start and end on the same day if (starts.hasSame(ends, "day")) { return (

{`${formatDate(starts)} • ${formatTime(starts)} to ${formatTime( ends )} ${formatTimeZone(starts)}`}

); } // For multi-day events return (

{`${starts.toFormat( "cccc, LLLL d" )} to ${formatDate(ends)}`}

); }