Skip to content

Commit

Permalink
Show prompt when template isn't selected instead of generating (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen authored Oct 10, 2023
1 parent 21e91d1 commit 5e77bff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const Generator = props => {
<DatePicker
name="Päivämäärä"
value={generatorStore.date}
onChange={(event, value) => generatorStore.setDate(value)}
onChange={(_, value) => generatorStore.setDate(value)}
container="inline"
/>
</Column>
Expand Down Expand Up @@ -222,7 +222,7 @@ const Generator = props => {
<Row>
<TextField
data-cy="routeFilterInput"
onChange={(event, value) => commonStore.setRouteFilter(value)}
onChange={(_, value) => commonStore.setRouteFilter(value)}
value={commonStore.routeFilter}
hintText="Esim. 7*"
fullWidth
Expand All @@ -249,8 +249,13 @@ const Generator = props => {
!generatorStore.buildId ||
(generatorStore.component === 'TerminalPoster' && generatorStore.terminalId === '')
}
onClick={() => {
if (commonStore.templateIsDirty) {
onClick={async () => {
if ((await commonStore.currentTemplate) === undefined) {
commonStore.showConfirm(
'Sommittelua ei ole valittu, generointia ei voida aloittaa !',
false,
);
} else if (commonStore.templateIsDirty) {
commonStore.showConfirm(
'Sommittelussa on tallentamattomia muutoksia. Julisteet generoidaan tallennetulla versiolla. Haluatko jatkaa?',
generatorStore.generate,
Expand Down

0 comments on commit 5e77bff

Please sign in to comment.