Skip to content

Commit

Permalink
Rework save/submit button logic
Browse files Browse the repository at this point in the history
  • Loading branch information
smartspot2 committed Mar 10, 2024
1 parent 5e354f4 commit c4b39b3
Showing 1 changed file with 31 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,11 @@ export function CreateStage({ profile, initialSlots, nextStage }: CreateStagePro
</div>
</div>
<div className="matcher-sidebar-tiling-bottom">
<button className="secondary-btn" onClick={saveTiledEvents}>
Save
</button>
{curCreatedTimes.length > 0 && (
<button className="primary-btn" onClick={saveTiledEvents}>
Save
</button>
)}
</div>
</div>
);
Expand Down Expand Up @@ -677,12 +679,12 @@ export function CreateStage({ profile, initialSlots, nextStage }: CreateStagePro
</div>
<div className="matcher-sidebar-create-bottom">
<div className="matcher-sidebar-create-bottom-row">
<button className="secondary-btn" onClick={saveEvent}>
Save
</button>
<button className="secondary-btn" onClick={cancelEvent}>
Cancel
</button>
<button className="primary-btn" onClick={saveEvent}>
Save
</button>
</div>
<div className="matcher-sidebar-create-bottom-row">
<button className="danger-btn" onClick={deleteEvent}>
Expand Down Expand Up @@ -746,9 +748,6 @@ export function CreateStage({ profile, initialSlots, nextStage }: CreateStagePro
<input type="checkbox" onChange={toggleCreatingTiledEvents} ref={tileRefs.toggle} />
Create tiled events
</label>
<button className="primary-btn" onClick={() => setShowConfirmModal(true)}>
Submit
</button>
</div>
</div>
<div className="coordinator-sidebar-right">
Expand All @@ -767,11 +766,30 @@ export function CreateStage({ profile, initialSlots, nextStage }: CreateStagePro
</div>
<div className="matcher-body-footer-right">
<div className="matcher-unsaved-changes-container">
{edited && <span className="matcher-unsaved-changes">You have unsaved changes!</span>}
{edited && curCreatedTimes.length === 0 && (
<button className="primary-btn" onClick={() => setShowConfirmModal(true)}>
Submit
</button>
)}
</div>
<button className="primary-btn" onClick={nextStage} disabled={edited}>
Continue
</button>
{edited || curCreatedTimes.length > 0 ? (
<div className="matcher-tooltip-container">
<Tooltip
placement="top"
source={
<button className="primary-btn" disabled={true}>
Continue
</button>
}
>
<div className="matcher-tiling-tooltip-body">You have unsaved changes!</div>
</Tooltip>
</div>
) : (
<button className="primary-btn" onClick={nextStage}>
Continue
</button>
)}
</div>
{showConfirmModal && slotConfirmModal}
</React.Fragment>
Expand Down

0 comments on commit c4b39b3

Please sign in to comment.