init elas atelier

This commit is contained in:
2026-05-14 08:24:41 +02:00
parent 3b704a24a7
commit 38f33cacb1
19 changed files with 1436 additions and 657 deletions
+16 -12
View File
@@ -16,7 +16,7 @@ interface Props {
editSlug?: string;
}
const narlblogTheme = EditorView.theme({
const salonTheme = EditorView.theme({
'&': {
backgroundColor: 'var(--crust)',
color: 'var(--text)',
@@ -121,8 +121,8 @@ export default function Editor({ editSlug }: Props) {
closeBrackets(),
markdown({ base: markdownLanguage, codeLanguages: languages }),
EditorView.lineWrapping,
narlblogTheme,
cmPlaceholder('# Hello World\nWrite your markdown here...'),
salonTheme,
cmPlaceholder('# A title for the work\n\n![alt text](/uploads/your-image.jpg "optional caption")\n\nNotes, context, materials...'),
EditorView.updateListener.of(update => {
if (!update.docChanged) return;
if (previewTimerRef.current) clearTimeout(previewTimerRef.current);
@@ -229,7 +229,11 @@ export default function Editor({ editSlug }: Props) {
async function handleSave() {
const content = viewRef.current?.state.doc.toString() || '';
if (!title.trim() || !slug || !content) {
showAlertMsg('Title, slug, and content are required.', 'error');
showAlertMsg('Title, slug, and body are required.', 'error');
return;
}
if (!/!\[[^\]]*\]\([^)]+\)/.test(content)) {
showAlertMsg('A gallery work must include at least one image — insert via the Assets panel or type "!".', 'error');
return;
}
const tags = tagsInput
@@ -260,7 +264,7 @@ export default function Editor({ editSlug }: Props) {
async function handleDelete() {
const target = originalSlug || slug;
if (!confirm(`Delete post "${target}" permanently?`)) return;
if (!confirm(`Remove work "${target}" from the catalogue permanently?`)) return;
try {
await deletePost(target);
window.location.href = '/admin';
@@ -293,8 +297,8 @@ export default function Editor({ editSlug }: Props) {
Delete
</button>
)}
<button onClick={handleSave} className="bg-mauve text-crust font-bold py-3 px-8 rounded-lg hover:bg-pink transition-all transform hover:scale-105 whitespace-nowrap">
Save Post
<button onClick={handleSave} className="bg-mauve text-rosewater font-bold py-3 px-8 rounded-lg hover:bg-red transition-all transform hover:scale-105 whitespace-nowrap">
Save work
</button>
{originalSlug && (
<a
@@ -304,7 +308,7 @@ export default function Editor({ editSlug }: Props) {
className="bg-blue text-crust font-bold py-3 px-8 rounded-lg hover:bg-sky transition-all transform hover:scale-105 whitespace-nowrap inline-flex items-center justify-center gap-2"
>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
View Post
View work
</a>
)}
</div>
@@ -319,7 +323,7 @@ export default function Editor({ editSlug }: Props) {
value={title}
onChange={e => setTitle(e.target.value)}
required
placeholder="My Awesome Post"
placeholder="Untitled (charcoal on paper)"
className="w-full bg-crust border border-surface1 rounded-lg px-4 py-3 text-text focus:outline-none focus:border-mauve transition-colors"
/>
</div>
@@ -357,7 +361,7 @@ export default function Editor({ editSlug }: Props) {
type="text"
value={tagsInput}
onChange={e => setTagsInput(e.target.value)}
placeholder="rust, astro, design"
placeholder="oil, paper, 2026, study"
className="w-full bg-crust border border-surface1 rounded-lg px-4 py-3 text-text focus:outline-none focus:border-mauve transition-colors"
/>
</div>
@@ -379,7 +383,7 @@ export default function Editor({ editSlug }: Props) {
value={summary}
onChange={e => setSummary(e.target.value)}
rows={2}
placeholder="A brief description of this post for the frontpage..."
placeholder="A short caption for the catalogue index..."
className="w-full bg-crust border border-surface1 rounded-lg px-4 py-3 text-text focus:outline-none focus:border-mauve transition-colors resize-none"
/>
</div>
@@ -387,7 +391,7 @@ export default function Editor({ editSlug }: Props) {
{/* Editor Toolbar */}
<div className="flex flex-col md:flex-row justify-between items-start md:items-end gap-2">
<div className="flex items-center gap-3">
<label className="block text-sm font-medium text-subtext1 italic">Tip: Type '/' to browse assets</label>
<label className="block text-sm font-medium text-subtext1 italic">Type '/' or '!' to insert an image · at least one image is required</label>
</div>
<div className="flex items-center gap-2">
<button