// Toolbar — top strip with title, undo/redo, background popover, add-node menu, // add-note button, save/load, and screenshot. const { useState: useStateTB, useRef: useRefTB, useEffect: useEffectTB } = React; function Toolbar({ title, setTitle, subtitle, setSubtitle, defaultCurrency, setDefaultCurrency, showTitleOnCanvas, setShowTitleOnCanvas, bgPattern, setBgPattern, bgColor, setBgColor, showSeq, setShowSeq, showNotes, setShowNotes, showAnnotations, setShowAnnotations, canUndo, canRedo, onUndo, onRedo, onAddNode, onAddNote, onShotMode, onSaveProject, onLoadProject, onLoadDemo, onClear, onShowSchedule, onAutoGroupByDate, onAutoConnectByTime, }){ const [bgOpen, setBgOpen] = useStateTB(false); const [moreOpen, setMoreOpen] = useStateTB(false); const [fileOpen, setFileOpen] = useStateTB(false); const [addOpen, setAddOpen] = useStateTB(false); const [curOpen, setCurOpen] = useStateTB(false); const bgRef = useRefTB(null); const moreRef = useRefTB(null); const fileRef = useRefTB(null); const addRef = useRefTB(null); const curRef = useRefTB(null); useEffectTB(()=>{ const onDoc = (e)=>{ if (bgRef.current && !bgRef.current.contains(e.target)) setBgOpen(false); if (moreRef.current && !moreRef.current.contains(e.target)) setMoreOpen(false); if (fileRef.current && !fileRef.current.contains(e.target)) setFileOpen(false); if (addRef.current && !addRef.current.contains(e.target)) setAddOpen(false); if (curRef.current && !curRef.current.contains(e.target)) setCurOpen(false); }; document.addEventListener('mousedown', onDoc); return ()=>document.removeEventListener('mousedown', onDoc); },[]); return (
setTitle(e.target.value)} placeholder="Itinerary / Business trip title (e.g. : Osaka Meeting1 night2Day)"/>
{bgOpen && (
Pattern
{BG_PATTERNS.map(p=>(
Background color
{BG_COLORS.map(c=>(
Subtitle
setSubtitle(e.target.value)} style={{border:'1px solid var(--line)', background:'var(--paper)', borderRadius:8, padding:'6px 10px', fontSize:13, fontFamily:'inherit', outline:'none', color:'inherit'}}/>
)}
{/* (Sequence-swap toggle removed — numbering is auto-derived from each node's arrival/departure times.) */} {/* Currency picker — sets the symbol auto-prefixed onto bare numbers in the cost field. Existing entries with explicit symbols are preserved verbatim and surface as separate per-currency totals in the SummaryBar. */}
{curOpen && (
Currency (auto-prefix)
Bare numbers get this symbol auto-attached on blur.
Costs you typed with an explicit symbol (e.g. ¥, ) are preserved as-is.
{(window.CURRENCIES || []).map(c=>( ))}
)}
{/* Schedule view */}
{/* Add menu — picks a node type. The "+ node" main button defaults to a generic pin; the chevron opens the type picker for stations / airports / hotels / etc. */}
{addOpen && (
Place type
{NODE_TYPES.map(t=>( ))}
)}
{fileOpen && (
)}
{moreOpen && (
Auto by time
Load sample
)}
); } window.Toolbar = Toolbar;