import { ParsedRequest } from './types' import { getTemplateCss } from './template-css' export function getChallengeHtml(parsedReq: ParsedRequest) { const { theme, fontSize, question, creatorName, creatorAvatarUrl, challengerAmount, challengerOutcome, creatorAmount, creatorOutcome, acceptedName, acceptedAvatarUrl, } = parsedReq const MAX_QUESTION_CHARS = 78 const truncatedQuestion = question.length > MAX_QUESTION_CHARS ? question.slice(0, MAX_QUESTION_CHARS) + '...' : question const hideAvatar = creatorAvatarUrl ? '' : 'hidden' const hideAcceptedAvatar = acceptedAvatarUrl ? '' : 'hidden' const accepted = acceptedName !== '' return ` Generated Image
${truncatedQuestion}

${creatorName}

${'M$' + creatorAmount}
${'on'}
${creatorOutcome}
VS

You

${acceptedName}

${'M$' + challengerAmount}
${'on'}
${challengerOutcome}
` }