'use client'; import type { JournalBlock, MapItem } from '@/lib/journal'; import { isValidCoordinate } from '@/lib/journal'; import type { AlbumAssetRef } from '@/lib/journalAlbum'; import type AlbumPicker from '../AlbumPicker'; import { IconCamera, IconChevronUp, IconChevronDown, IconPlus, IconMap, IconFolder, IconX, } from '../Icons'; import { isLegacyAssetRef } from './blockOps'; /** What the asset picker is opened for: its title, and where the pick goes. */ export interface AssetPickTarget { title: string; onSelect: (assetId: string) => void; } interface BlockFieldsProps { block: JournalBlock; onChange: (block: JournalBlock) => void; onPickAsset: (target: AssetPickTarget) => void; onPickAlbum: (onSelect: (albumId: string) => void) => void; /** Assets of the albums referenced by album blocks, as loaded so far. */ albumAssets: Record; /** The picker's album list, once fetched — used for the album's name. */ albumList: Parameters[0]['albums'] | null; mapEnabled?: boolean; } /** * The form of one block in the journal editor, one branch per block type * (#555). Every edit goes out through `onChange` as a whole new block; the * editor owns the block list and its order. */ export function BlockFields({ block, onChange, onPickAsset, onPickAlbum, albumAssets, albumList, mapEnabled, }: BlockFieldsProps) { return (
{block.type === 'heading' && (
onChange({ ...block, text: e.target.value })} />
)} {block.type === 'paragraph' && (