Add error handling and storage safety checks to admin
Show inline error banners when card save/delete fails instead of crashing. Prevent writes to local filesystem on Vercel where it would silently fail by validating BLOB_READ_WRITE_TOKEN presence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+18
-3
@@ -29,7 +29,7 @@ export function renderLogin(message = "") {
|
||||
);
|
||||
}
|
||||
|
||||
export function renderAdmin(cards: BoardCard[], options: { storageMode: string }) {
|
||||
export function renderAdmin(cards: BoardCard[], options: { storageMode: string; message?: string }) {
|
||||
const sorted = [...cards].sort((a, b) => Date.parse(b.updatedAt) - Date.parse(a.updatedAt));
|
||||
|
||||
return pageShell(
|
||||
@@ -52,6 +52,12 @@ export function renderAdmin(cards: BoardCard[], options: { storageMode: string }
|
||||
</aside>
|
||||
</header>
|
||||
|
||||
${
|
||||
options.message
|
||||
? `<section class="noticeBanner">${escapeHtml(options.message)}</section>`
|
||||
: ""
|
||||
}
|
||||
|
||||
<section class="workbench">
|
||||
<form class="editor" method="post" action="/admin/cards" enctype="multipart/form-data">
|
||||
<p class="stamp">New card</p>
|
||||
@@ -201,7 +207,8 @@ textarea {
|
||||
.mast,
|
||||
.editor,
|
||||
.cardEditor,
|
||||
.empty {
|
||||
.empty,
|
||||
.noticeBanner {
|
||||
border: 2px solid var(--color-line);
|
||||
background: var(--color-panel);
|
||||
box-shadow: var(--shadow-hard);
|
||||
@@ -283,10 +290,18 @@ h1 {
|
||||
|
||||
.editor,
|
||||
.cardEditor,
|
||||
.empty {
|
||||
.empty,
|
||||
.noticeBanner {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.noticeBanner {
|
||||
margin-top: 28px;
|
||||
color: var(--color-ink);
|
||||
font-family: var(--font-mono);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.editor {
|
||||
position: sticky;
|
||||
top: 18px;
|
||||
|
||||
Reference in New Issue
Block a user