Add long-form article editor (NIP-23)

- ArticleEditor with title, markdown body, summary, cover image, tags
- write/preview toggle with markdown rendering via marked
- Auto-save draft to localStorage
- Publish as kind 30023 with NIP-23 tags (d, title, published_at, etc.)
- 'write article' button in sidebar when logged in
- Article preview prose styles in CSS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jure
2026-03-08 19:04:43 +01:00
parent 366731f9d7
commit bf1d68bb93
9 changed files with 291 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ const NAV_ITEMS = [
] as const;
export function Sidebar() {
const { currentView, setView, sidebarCollapsed, toggleSidebar } = useUIStore();
const { currentView, setView, sidebarCollapsed, toggleSidebar, openThread, goBack } = useUIStore();
const { connected, notes } = useFeedStore();
const { loggedIn, profile, npub, logout } = useUserStore();
const [showLogin, setShowLogin] = useState(false);
@@ -43,6 +43,19 @@ export function Sidebar() {
{/* Nav */}
<nav className="flex-1 overflow-y-auto py-2">
{loggedIn && !sidebarCollapsed && (
<button
onClick={() => setView("article-editor")}
className={`w-full text-left px-3 py-1.5 flex items-center gap-2 text-[12px] transition-colors mb-1 ${
currentView === "article-editor"
? "text-accent bg-accent/8"
: "text-text-muted hover:text-text hover:bg-bg-hover"
}`}
>
<span className="w-4 text-center text-[14px]"></span>
<span>write article</span>
</button>
)}
{NAV_ITEMS.map((item) => (
<button
key={item.id}