Support multiline descriptions for entities

Use a textarea for editing the description and preserve linebreaks
when it's displayed in the UI using a new preWrap class for this
purpose.
This commit is contained in:
Hornwitser 2025-09-06 18:52:47 +02:00
parent 96681bfd37
commit 37edf122a1
8 changed files with 43 additions and 36 deletions

View file

@ -9,7 +9,7 @@ const locations = [
{
id: 1,
name: "Stage",
description: "Inside the main building.",
description: "Inside the main building.\n\nMind the gap.",
updatedAt: "d-1 18:21",
},
{
@ -43,7 +43,7 @@ let eventId = 1;
const events = [
{
name: "Arcade",
description: "Play retro games!",
description: "Play retro games!\n\nWe have anything from C64 to PS5.",
slots: [
"d1 12:00 4h clubhouse",
"d2 12:00 4h clubhouse",
@ -158,13 +158,14 @@ const events = [
const idMedic = 1;
const idSecurity = 2;
const roles = [
{ id: idMedic, name: "Medic", updatedAt: "d-2 12:34" },
{ id: idSecurity, name: "Security", updatedAt: "d-2 12:39" },
{ id: idMedic, name: "Medic", description: "Helping those in need.\n\nAsk lead if in doubt.", updatedAt: "d-2 12:34" },
{ id: idSecurity, name: "Security", description: "Keeping the con safe", updatedAt: "d-2 12:39" },
]
const shifts = [
{
name: "Medic Early",
description: "Not much happens early.\n\nPrefer strolling outside to be visible.",
roleId: idMedic,
slots: [
"d1 12:00 4h",
@ -357,16 +358,18 @@ export function generateDemoSchedule(): ApiSchedule {
})
),
roles: roles.map(
({ id, name, updatedAt }) => ({
({ id, name, description, updatedAt }) => ({
id,
name,
description,
updatedAt: toIso(toDate(origin, ...(updatedAt.split(" ")) as [string, string])),
})
),
shifts: shifts.map(
({ id, name, roleId, slots }) => ({
({ id, name, description, roleId, slots }) => ({
id,
name,
description,
roleId,
slots: slots.map(shorthand => toShift(origin, shorthand, shiftSlotIdToAssigned)),
updatedAt: toIso(toDate(origin, "d-1", "13:23")),