Remove speakerName handling in NpcDialoguesPanel

This commit is contained in:
2026-04-15 10:09:50 +02:00
parent 3a3bc72510
commit 364e21df5f

View File

@@ -13,11 +13,6 @@ interface NpcDialoguesPanelProps {
onSetDialogueTitle(dialogueId: string, title: string): void; onSetDialogueTitle(dialogueId: string, title: string): void;
onAddDialogueLine(dialogueId: string): void; onAddDialogueLine(dialogueId: string): void;
onDeleteDialogueLine(dialogueId: string, lineId: string): void; onDeleteDialogueLine(dialogueId: string, lineId: string): void;
onSetDialogueLineSpeaker(
dialogueId: string,
lineId: string,
speakerName: string | null
): void;
onSetDialogueLineText(dialogueId: string, lineId: string, text: string): void; onSetDialogueLineText(dialogueId: string, lineId: string, text: string): void;
} }
@@ -44,7 +39,6 @@ export function NpcDialoguesPanel({
onSetDialogueTitle, onSetDialogueTitle,
onAddDialogueLine, onAddDialogueLine,
onDeleteDialogueLine, onDeleteDialogueLine,
onSetDialogueLineSpeaker,
onSetDialogueLineText onSetDialogueLineText
}: NpcDialoguesPanelProps) { }: NpcDialoguesPanelProps) {
const selectedDialogue = const selectedDialogue =
@@ -61,9 +55,9 @@ export function NpcDialoguesPanel({
? null ? null
: dialogues.find((dialogue) => dialogue.id === resolvedDefaultDialogueId) ?? null; : dialogues.find((dialogue) => dialogue.id === resolvedDefaultDialogueId) ?? null;
const [titleDraft, setTitleDraft] = useState(selectedDialogue?.title ?? ""); const [titleDraft, setTitleDraft] = useState(selectedDialogue?.title ?? "");
const [lineDrafts, setLineDrafts] = useState< const [lineDrafts, setLineDrafts] = useState<Record<string, { text: string }>>(
Record<string, { speakerName: string; text: string }> {}
>({}); );
useEffect(() => { useEffect(() => {
setTitleDraft(selectedDialogue?.title ?? ""); setTitleDraft(selectedDialogue?.title ?? "");
@@ -74,7 +68,6 @@ export function NpcDialoguesPanel({
selectedDialogue.lines.map((line) => [ selectedDialogue.lines.map((line) => [
line.id, line.id,
{ {
speakerName: line.speakerName ?? "",
text: line.text text: line.text
} }
]) ])
@@ -95,7 +88,6 @@ export function NpcDialoguesPanel({
(() => { (() => {
const line = dialogue.lines.find((candidate) => candidate.id === lineId); const line = dialogue.lines.find((candidate) => candidate.id === lineId);
return { return {
speakerName: line?.speakerName ?? "",
text: line?.text ?? "" text: line?.text ?? ""
}; };
})(); })();
@@ -224,33 +216,6 @@ export function NpcDialoguesPanel({
x x
</button> </button>
</div> </div>
<label className="form-field">
<span className="label">Speaker</span>
<input
className="text-input"
type="text"
placeholder="Optional"
value={draft.speakerName}
onChange={(event) => {
const nextSpeakerName = event.currentTarget.value;
setLineDrafts((current) => ({
...current,
[line.id]: {
...draft,
speakerName: nextSpeakerName
}
}));
}}
onBlur={() =>
onSetDialogueLineSpeaker(
selectedDialogue.id,
line.id,
draft.speakerName
)
}
/>
</label>
<label className="form-field"> <label className="form-field">
<span className="label">Text</span> <span className="label">Text</span>
<textarea <textarea