Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ export default function ExperimentSafetyContainer(
props: ExperimentSafetyContainerProps
) {
const [initialState] = useState(
new ExperimentSafetySubmissionState(props.experimentSafety)
new ExperimentSafetySubmissionState(
props.experimentSafety,
props.previewMode
)
);
const eventHandlers = useEventHandlers(TemplateGroupId.PROPOSAL_ESI);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function GenericTemplateContainer(props: {
previewMode?: boolean;
}) {
const [initialState] = useState(
new GenericTemplateSubmissionState(props.genericTemplate)
new GenericTemplateSubmissionState(props.genericTemplate, props.previewMode)
);

const eventHandlers = useEventHandlers(TemplateGroupId.GENERIC_TEMPLATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function SampleDeclarationContainer(props: {
sampleEditDone?: () => void;
previewMode?: boolean;
}) {
const [initialState] = useState(new SampleSubmissionState(props.sample));
const [initialState] = useState(
new SampleSubmissionState(props.sample, props.previewMode)
);

const eventHandlers = useEventHandlers(TemplateGroupId.SAMPLE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export default function ShipmentContainer(props: {
onDirtyStateChange?: (isDirty: boolean) => void;
previewMode?: boolean;
}) {
const [initialState] = useState(new ShipmentSubmissionState(props.shipment));
const [initialState] = useState(
new ShipmentSubmissionState(props.shipment, props.previewMode)
);
const eventHandlers = useEventHandlers(TemplateGroupId.SHIPMENT);
const customEventHandlers =
createCustomEventHandlers<ShipmentSubmissionState>((state, action) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function VisitRegistrationContainer(
props: VisitRegistrationContainerProps
) {
const [initialState] = useState(
new VisitRegistrationSubmissionState(props.registration)
new VisitRegistrationSubmissionState(props.registration, props.previewMode)
);

const eventHandlers = useEventHandlers(TemplateGroupId.VISIT_REGISTRATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { QuestionarySubmissionState } from '../QuestionarySubmissionState';

export class ExperimentSafetySubmissionState extends QuestionarySubmissionState {
[immerable] = true;
constructor(public experimentSafety: ExperimentSafetyWithQuestionary) {
super(TemplateGroupId.PROPOSAL_ESI, experimentSafety);
constructor(
public experimentSafety: ExperimentSafetyWithQuestionary,
public previewMode: boolean | undefined
) {
super(TemplateGroupId.PROPOSAL_ESI, experimentSafety, previewMode);
this.stepIndex = this.getInitialStepIndex();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import { GenericTemplateWithQuestionary } from './GenericTemplateWithQuestionary
import { QuestionarySubmissionState } from '../QuestionarySubmissionState';
export class GenericTemplateSubmissionState extends QuestionarySubmissionState {
[immerable] = true;
constructor(public genericTemplate: GenericTemplateWithQuestionary) {
super(TemplateGroupId.GENERIC_TEMPLATE, genericTemplate);
constructor(
public genericTemplate: GenericTemplateWithQuestionary,
public previewMode: boolean | undefined
) {
super(TemplateGroupId.GENERIC_TEMPLATE, genericTemplate, previewMode);
this.stepIndex = this.getInitialStepIndex();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import { SampleWithQuestionary } from './SampleWithQuestionary';
import { QuestionarySubmissionState } from '../QuestionarySubmissionState';
export class SampleSubmissionState extends QuestionarySubmissionState {
[immerable] = true;
constructor(public sample: SampleWithQuestionary) {
super(TemplateGroupId.SAMPLE, sample);
constructor(
public sample: SampleWithQuestionary,
public previewMode: boolean | undefined
) {
super(TemplateGroupId.SAMPLE, sample, previewMode);
this.stepIndex = this.getInitialStepIndex();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import { QuestionarySubmissionState } from '../QuestionarySubmissionState';
export class ShipmentSubmissionState extends QuestionarySubmissionState {
[immerable] = true;

constructor(public shipment: ShipmentWithQuestionary) {
super(TemplateGroupId.SHIPMENT, shipment);
constructor(
public shipment: ShipmentWithQuestionary,
public previewMode: boolean | undefined
) {
super(TemplateGroupId.SHIPMENT, shipment, previewMode);
this.stepIndex = this.getInitialStepIndex();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { QuestionarySubmissionState } from '../QuestionarySubmissionState';

export class VisitRegistrationSubmissionState extends QuestionarySubmissionState {
[immerable] = true;
constructor(public registration: RegistrationWithQuestionary) {
super(TemplateGroupId.VISIT_REGISTRATION, registration);
constructor(
public registration: RegistrationWithQuestionary,
public isPreviewMode: boolean | undefined
) {
super(TemplateGroupId.VISIT_REGISTRATION, registration, isPreviewMode);
this.stepIndex = this.getInitialStepIndex();
}

Expand Down
Loading