diff --git a/src/admin.tsx b/src/admin.tsx index 68cb633..54dac0d 100644 --- a/src/admin.tsx +++ b/src/admin.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { MysteryGraphEditor } from './mysteryGraph' type Pose = { poseKey: string; assetId: string; url: string } -type Npc = { id: string; key: string; name: string; role: string; defaultPose: string | null; poses: Pose[]; inUse: boolean } +type Npc = { id: string; key: string; name: string; role: string; defaultPose: string | null; phoneNumber: string | null; email: string | null; poses: Pose[]; inUse: boolean } type Mystery = { id: string; slug: string; title: string; nodes: number } async function json(url: string, init?: RequestInit): Promise { @@ -172,15 +172,18 @@ function NpcEditor({ npc, onChanged, setStatus }: { npc: Npc; onChanged: (key?: const [name, setName] = useState(npc.name) const [role, setRole] = useState(npc.role) const [defaultPose, setDefaultPose] = useState(npc.defaultPose || '') + const [phoneNumber, setPhoneNumber] = useState(npc.phoneNumber || '') + const [email, setEmail] = useState(npc.email || '') const [poseKey, setPoseKey] = useState('') const [busy, setBusy] = useState(false) const fileRef = useRef(null) const dirty = name !== npc.name || role !== npc.role || (defaultPose || null) !== npc.defaultPose + || (phoneNumber || null) !== npc.phoneNumber || (email || null) !== npc.email const save = async () => { setBusy(true) try { - await json(`/api/admin/npcs/${npc.id}`, { method: 'PATCH', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ name, role, defaultPose: defaultPose || null }) }) + await json(`/api/admin/npcs/${npc.id}`, { method: 'PATCH', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ name, role, defaultPose: defaultPose || null, phoneNumber: phoneNumber || null, email: email || null }) }) await onChanged(npc.key); setStatus(`Saved ${name}`) } catch (error) { setStatus(String((error as Error).message || error)) } finally { setBusy(false) } } @@ -213,6 +216,8 @@ function NpcEditor({ npc, onChanged, setStatus }: { npc: Npc; onChanged: (key?:
setName(event.target.value)} />
setRole(event.target.value)} placeholder="Glitch University ยท Investigative Method" />
+
setPhoneNumber(event.target.value)} placeholder="55501" />
+
setEmail(event.target.value)} placeholder="hunter@glitch.university" />
setLabel(e.target.value)} onBlur={() => label !== node.label && onPatch({ label })} /> @@ -197,6 +204,9 @@ function NodeInspector({ node, graph, templates, audioAssets, onPatch, onSetEntr setComponentKey(e.target.value)} onBlur={() => componentKey !== (node.componentKey || '') && onPatch({ componentKey })} /> {node.nodeType === 'cutscene' && {CUTSCENE_COMPONENT_KEYS.map(k => } } + {node.nodeType === 'merit' && } + {node.nodeType === 'phone' &&

Add a terminal per contact, pick the NPC you reach by dialing their number, then wire it to the dialogue that answers.

} {(node.nodeType === 'dialogue' || node.nodeType === 'cutscene') && } {(node.nodeType === 'dialogue' || node.hasUtterances) && }