Messages : types, réponses, sauts de ligne, data volume
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- HomeMessages : type pill (Réaction/Question/Suggestion/Retour) + sélecteur dans le formulaire (sans Réaction)
- HomeMessages : white-space: pre-line sur les messages
- Page /messages : type pill + white-space: pre-line (idem home)
- Admin : badge type coloré + sélecteur d'édition + formulaire réponse
- API : type et reply dans PUT ; readDataYaml/writeDataYaml (data/ volume Docker)
- main.css : overrides light mode text-white/55, /75, /90

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-03-19 05:56:11 +01:00
parent c52fa6007d
commit b9e6b4a96c
10 changed files with 314 additions and 48 deletions

View File

@@ -1,3 +1,5 @@
const EMPTY = { messages: [] as any[] }
export default defineEventHandler(async (event) => {
const id = Number(getRouterParam(event, 'id'))
@@ -5,8 +7,15 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'ID invalide' })
}
const body = await readBody<{ text?: string; published?: boolean; author?: string }>(event)
const data = await readYaml<{ messages: any[] }>('messages.yml')
const body = await readBody<{
text?: string
published?: boolean
author?: string
type?: string
reply?: string | null
}>(event)
const data = await readDataYaml<{ messages: any[] }>('messages.yml', EMPTY)
const message = data.messages.find(m => m.id === id)
if (!message) {
@@ -16,9 +25,14 @@ export default defineEventHandler(async (event) => {
if (body.text !== undefined) message.text = body.text
if (body.published !== undefined) message.published = body.published
if (body.author !== undefined) message.author = body.author
if (body.type !== undefined) message.type = body.type
if ('reply' in body) {
message.reply = body.reply
? { text: body.reply, publishedAt: new Date().toISOString() }
: null
}
await writeYaml('messages.yml', data)
gitSyncContent(`Mise à jour message #${id}`, ['site/messages.yml'])
await writeDataYaml('messages.yml', data)
return { ok: true }
})