fixed issue with duplicate programs (#447)

This commit is contained in:
Minzenkatze 2023-03-26 08:42:15 +02:00 committed by GitHub
parent 9353129e84
commit 3c18fd7a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,7 +10,7 @@ import { Player } from "@player";
import { Settings } from "../../Settings/Settings";
import { Programs } from "../Programs";
import { CreateProgramWork } from "../../Work/CreateProgramWork";
import { CreateProgramWork, isCreateProgramWork } from "../../Work/CreateProgramWork";
import { useRerender } from "../../ui/React/hooks";
export const ProgramsSeen: string[] = [];
@ -91,6 +91,9 @@ export function ProgramsRoot(): React.ReactElement {
sx={{ my: 1, width: "100%" }}
onClick={(event) => {
if (!event.isTrusted) return;
if (isCreateProgramWork(Player.currentWork)) {
Player.finishWork(true);
}
Player.startWork(new CreateProgramWork({ singularity: false, programName: program.name }));
Player.startFocusing();
Router.toPage(Page.Work);