From d006be251c18ac8790cb907c07ab06376d849f14 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 6 Sep 2025 15:16:02 +0200 Subject: [PATCH 01/10] Create a per-user admin page to inspect users Add page to allow admins to inspect all of the details stored on the server of a user account. For now this is just the UserDetails, but in the future this is planned to be expanded to also show sessions and logs. --- components/TableUsers.vue | 21 +++---- pages/{admin.vue => admin/index.vue} | 0 pages/admin/users/[id].vue | 94 ++++++++++++++++++++++++++++ server/api/users/[id]/details.get.ts | 34 ++++++++++ server/utils/user.ts | 20 +++++- shared/types/api.ts | 22 +++---- stores/users.ts | 11 ++++ 7 files changed, 176 insertions(+), 26 deletions(-) rename pages/{admin.vue => admin/index.vue} (100%) create mode 100644 pages/admin/users/[id].vue create mode 100644 server/api/users/[id]/details.get.ts diff --git a/components/TableUsers.vue b/components/TableUsers.vue index 7e8d006..789f902 100644 --- a/components/TableUsers.vue +++ b/components/TableUsers.vue @@ -17,7 +17,12 @@ {{ user.id }} - {{ user.name }} + + + (empty) + + Date: Sat, 6 Sep 2025 16:50:41 +0200 Subject: [PATCH 05/10] Render multi-line diff entries Rework the rendering of the DiffEntry component to properly show multiline entries as spanning multiple lines. --- components/CardEventSlot.vue | 2 +- components/DiffEntry.vue | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/components/CardEventSlot.vue b/components/CardEventSlot.vue index 7a15a5e..baa2e3a 100644 --- a/components/CardEventSlot.vue +++ b/components/CardEventSlot.vue @@ -13,7 +13,7 @@

Host: {{ event.host }}

-

{{ event?.description ?? "No description provided" }}

+

{{ event?.description ?? "No description provided" }}

At {{ locations.map(location => location?.name ?? "unknown").join(" + ") }}

diff --git a/components/DiffEntry.vue b/components/DiffEntry.vue index 70c2fb0..142f12f 100644 --- a/components/DiffEntry.vue +++ b/components/DiffEntry.vue @@ -15,7 +15,12 @@ :key="index" :class="type" > - {{ text }} +
+ {{ { "removed": "- ", "added": "+ "}[type] }} +
+
+ {{ text }} +
@@ -33,20 +38,20 @@ defineProps<{ grid-template-columns: 5rem 1fr; column-gap: 1rem; } -.removed { +:is(.removed, .added) { + display: flex; grid-column: 2 / 2; + white-space: pre-wrap; +} +:is(.removed, .added) .symbol { + display: block; + font-family: monospace; + flex: 0 0 auto; +} +.removed { color: color-mix(in srgb, CanvasText, red 40%); } -.removed::before { - content: "- "; - font-family: monospace; -} .added { - grid-column: 2 / 2; color: color-mix(in srgb, CanvasText, green 40%); } -.added::before { - content: "+ "; - font-family: monospace; -} From 96681bfd37ce11a9011ab4f66b11e7e7e886992a Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 6 Sep 2025 16:51:31 +0200 Subject: [PATCH 06/10] Strike through the removed part of diff entries Communicate better that the part marked with - is the removed part by striking out the text. --- components/DiffEntry.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/DiffEntry.vue b/components/DiffEntry.vue index 142f12f..b644248 100644 --- a/components/DiffEntry.vue +++ b/components/DiffEntry.vue @@ -51,6 +51,9 @@ defineProps<{ .removed { color: color-mix(in srgb, CanvasText, red 40%); } +.removed .content{ + text-decoration-line: line-through; +} .added { color: color-mix(in srgb, CanvasText, green 40%); } From 37edf122a138e75c676d735c84af6b8ab4b9414a Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 6 Sep 2025 18:52:47 +0200 Subject: [PATCH 07/10] 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. --- assets/global.css | 4 ++++ components/CardEvent.vue | 2 +- components/CardShift.vue | 2 +- components/TableScheduleEvents.vue | 14 +++++++------- components/TableScheduleLocations.vue | 14 +++++++------- components/TableScheduleRoles.vue | 14 +++++++------- components/TableScheduleShifts.vue | 14 +++++++------- server/generate-demo-schedule.ts | 15 +++++++++------ 8 files changed, 43 insertions(+), 36 deletions(-) diff --git a/assets/global.css b/assets/global.css index 5ac8620..3d4e0c0 100644 --- a/assets/global.css +++ b/assets/global.css @@ -83,3 +83,7 @@ label>* { label + label { margin-block-start: 0.5rem; } + +.preWrap { + white-space: pre-wrap; +} diff --git a/components/CardEvent.vue b/components/CardEvent.vue index 6a4d5a0..4082abc 100644 --- a/components/CardEvent.vue +++ b/components/CardEvent.vue @@ -8,7 +8,7 @@

Host: {{ event.host }}

-

{{ event.description ?? "No description provided" }}

+

{{ event.description ?? "No description provided" }}

{{ event.interested }} interested

diff --git a/components/CardShift.vue b/components/CardShift.vue index ac5c4e9..333be36 100644 --- a/components/CardShift.vue +++ b/components/CardShift.vue @@ -5,7 +5,7 @@ @@ -63,10 +63,10 @@ > - + />