Right-slide panel that renders a resource's edit form. Driven by the URL: ?new=1 opens a fresh form, ?edit=<id> hydrates with the current item. POSTs back to the same URL with _action (save | delete | <action key>); the route handler in step 7 dispatches. - FieldRenderer.astro: dispatches on field.kind, wraps each field with label + helper text + error state. - fields/*.astro: one component per kind — Text, Textarea, Markdown (with Write/Preview toggle), Select, SelectAsync, MultiSelectAsync, MultiText (with add/remove), Date, Datetime, Number, Readonly. - ResourceEditPanel.astro: header (title + close X), scrollable body, sticky footer (save + per-resource secondary actions + destructive delete when ops.delete is defined and item exists). Scrim closes on click, Esc, or the close link. Confirm-before-submit honours action.confirmText. Embedded sub-form sections render a placeholder until step 8 wires the pulse renderer. - admin.css: panel chrome + scrim + slide-in keyframes, full field styling for every kind, mobile full-screen modal collapse. - preview.astro: exercises every field kind so the panel can be eyeballed in a logged-in session. Try /admin/preview?new=1 and /admin/preview?edit=<id>. Autosave deferred to Phase 2 per the approved deltas. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23 lines
432 B
Text
23 lines
432 B
Text
---
|
|
import type { TextField } from '../../resource-types';
|
|
|
|
interface Props {
|
|
field: TextField;
|
|
value: unknown;
|
|
}
|
|
|
|
const { field, value } = Astro.props;
|
|
const v = value == null ? '' : String(value);
|
|
---
|
|
|
|
<input
|
|
type="text"
|
|
id={`f-${field.key}`}
|
|
name={field.key}
|
|
class="bs-input"
|
|
value={v}
|
|
placeholder={field.placeholder ?? ''}
|
|
maxlength={field.maxLength}
|
|
required={field.required}
|
|
readonly={field.readOnly}
|
|
/>
|