import type { LogEntry } from "@codeflash/types";
import type { State } from "../root";

export const handleAddLogForDemo = (state: State, log: LogEntry): State => {
  const demoTask = state.demoOptTask;
  if (!demoTask) {
    return state;
  }

  return {
    ...state,
    demoOptTask: {
      ...demoTask,
      logs: [...demoTask.logs, log],
    },
  };
};
