Remove unused dialogue handling functions and related code in App.tsx
This commit is contained in:
105
src/app/App.tsx
105
src/app/App.tsx
@@ -4258,33 +4258,6 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyProjectDialogues = (
|
|
||||||
nextDialogues: typeof editorState.projectDocument.dialogues,
|
|
||||||
label: string,
|
|
||||||
successMessage: string
|
|
||||||
) => {
|
|
||||||
if (
|
|
||||||
areProjectDialogueLibrariesEqual(
|
|
||||||
editorState.projectDocument.dialogues,
|
|
||||||
nextDialogues
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
store.executeCommand(
|
|
||||||
createSetProjectDialoguesCommand({
|
|
||||||
label,
|
|
||||||
dialogues: nextDialogues
|
|
||||||
})
|
|
||||||
);
|
|
||||||
setStatusMessage(successMessage);
|
|
||||||
} catch (error) {
|
|
||||||
setStatusMessage(getErrorMessage(error));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const applyProjectSequences = (
|
const applyProjectSequences = (
|
||||||
nextSequences: ProjectSequenceLibrary,
|
nextSequences: ProjectSequenceLibrary,
|
||||||
label: string,
|
label: string,
|
||||||
@@ -4345,22 +4318,6 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateProjectDialogues = (
|
|
||||||
label: string,
|
|
||||||
successMessage: string,
|
|
||||||
mutate: (dialogues: typeof editorState.projectDocument.dialogues) => void
|
|
||||||
) => {
|
|
||||||
try {
|
|
||||||
const nextDialogues = cloneProjectDialogueLibrary(
|
|
||||||
editorState.projectDocument.dialogues
|
|
||||||
);
|
|
||||||
mutate(nextDialogues);
|
|
||||||
applyProjectDialogues(nextDialogues, label, successMessage);
|
|
||||||
} catch (error) {
|
|
||||||
setStatusMessage(getErrorMessage(error));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateProjectSequences = (
|
const updateProjectSequences = (
|
||||||
label: string,
|
label: string,
|
||||||
successMessage: string,
|
successMessage: string,
|
||||||
@@ -4744,33 +4701,6 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddProjectDialogue = () => {
|
|
||||||
const nextDialogue = createProjectDialogue();
|
|
||||||
|
|
||||||
updateProjectDialogues(
|
|
||||||
"Add project dialogue",
|
|
||||||
"Added project dialogue.",
|
|
||||||
(dialogues) => {
|
|
||||||
dialogues.dialogues[nextDialogue.id] = nextDialogue;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
setSelectedDialogueId(nextDialogue.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteProjectDialogue = (dialogueId: string) => {
|
|
||||||
updateProjectDialogues(
|
|
||||||
"Delete project dialogue",
|
|
||||||
"Deleted project dialogue.",
|
|
||||||
(dialogues) => {
|
|
||||||
delete dialogues.dialogues[dialogueId];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedDialogueId === dialogueId) {
|
|
||||||
setSelectedDialogueId(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const resolveSequenceControlTargetOption = (targetKey: string) =>
|
const resolveSequenceControlTargetOption = (targetKey: string) =>
|
||||||
getProjectScheduleTargetOptionByKey(projectScheduleTargetOptions, targetKey);
|
getProjectScheduleTargetOptionByKey(projectScheduleTargetOptions, targetKey);
|
||||||
|
|
||||||
@@ -4900,41 +4830,6 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateProjectDialogue = (
|
|
||||||
dialogueId: string,
|
|
||||||
label: string,
|
|
||||||
successMessage: string,
|
|
||||||
mutate: (dialogue: ProjectDialogue) => void
|
|
||||||
) => {
|
|
||||||
updateProjectDialogues(label, successMessage, (dialogues) => {
|
|
||||||
const dialogue = dialogues.dialogues[dialogueId];
|
|
||||||
|
|
||||||
if (dialogue === undefined) {
|
|
||||||
throw new Error("Selected dialogue no longer exists.");
|
|
||||||
}
|
|
||||||
|
|
||||||
mutate(dialogue);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateProjectDialogueLine = (
|
|
||||||
dialogueId: string,
|
|
||||||
lineId: string,
|
|
||||||
label: string,
|
|
||||||
successMessage: string,
|
|
||||||
mutate: (line: ProjectDialogueLine) => void
|
|
||||||
) => {
|
|
||||||
updateProjectDialogue(dialogueId, label, successMessage, (dialogue) => {
|
|
||||||
const line = dialogue.lines.find((candidate) => candidate.id === lineId);
|
|
||||||
|
|
||||||
if (line === undefined) {
|
|
||||||
throw new Error("Selected dialogue line no longer exists.");
|
|
||||||
}
|
|
||||||
|
|
||||||
mutate(line);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAddProjectSequenceControlEffect = (
|
const handleAddProjectSequenceControlEffect = (
|
||||||
sequenceId: string,
|
sequenceId: string,
|
||||||
targetKey: string,
|
targetKey: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user