| 1 | export { theme } from "../tags/question-layout.marko"; |
| 2 | export interface Input { |
| 3 | question: Question; |
| 4 | isDiscord: boolean; |
| 5 | } |
| 6 | |
| 7 | server export function meta({ question, isDiscord }) { |
| 8 | if (question.type === "normal") { |
| 9 | return { |
| 10 | title: "question permalink", |
| 11 | openGraph: { |
| 12 | title: isDiscord |
| 13 | ? undefined |
| 14 | : `question at ${formatQuestionTimestamp(question.date)}`, |
| 15 | image: `https://paperclover.net/q+a/${question.id}.png`, |
| 16 | }, |
| 17 | twitter: { card: "summary_large_image" }, |
| 18 | themeColor: isDiscord |
| 19 | ? question.date.getTime() > transitionDate |
| 20 | ? "#8c78ff" |
| 21 | : "#58ff71" |
| 22 | : undefined, |
| 23 | }; |
| 24 | } |
| 25 | return { title: "question permalink" }; |
| 26 | } |
| 27 | |
| 28 | <const/{ question }=input> |
| 29 | <const/{ type }=question> |
| 30 | |
| 31 | <question-layout> |
| 32 | <if=type == "normal"> |
| 33 | <p>this page is a permalink to the following question:</p> |
| 34 | <question ...{ question }/> |
| 35 | </if> |
| 36 | <else if=type == "pending"> |
| 37 | <p> |
| 38 | this page is a permalink to a question that has not yet been answered. |
| 39 | </p> |
| 40 | <p><a href="/q+a">read questions with existing responses</a>.</p> |
| 41 | </else> |
| 42 | <else if=type == "reject"> |
| 43 | <p> |
| 44 | this page is a permalink to a question, but the question was deleted |
| 45 | instead of answered. maybe it was sent multiple times, or maybe the |
| 46 | question was not a question. who knows. |
| 47 | </p> |
| 48 | <p>sorry, sister</p> |
| 49 | <p><a href="/q+a">all questions</a></p> |
| 50 | </else> |
| 51 | <else> |
| 52 | <p>oh dear, this question is in an invalid state</p> |
| 53 | <pre>${JSON.stringify(question, null, 2)}</pre> |
| 54 | </else> |
| 55 | |
| 56 | <a href="/q+a">view more questions</a> |
| 57 | </question-layout> |
| 58 | |
| 59 | import type { Question } from "#src/q+a/models/questions.ts"; |
| 60 | import { transitionDate } from "#src/q+a/tags/question.marko"; |
| 61 | import { formatQuestionTimestamp } from "#src/q+a/format.ts"; |