Skip to content

Commit

Permalink
feat: do not submit if any of entry descriptions starts with !
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat committed Dec 12, 2022
1 parent d172ead commit a092351
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Summary } from './Summary';
import { core, init } from './core';
import { Settings } from './Settings';
import { IntervalBasedCronScheduler, parseCronExpression } from 'cron-schedule';
import { ask } from '@tauri-apps/api/dialog';
import { ask, message } from '@tauri-apps/api/dialog';
import Egg from './Egg';

function App() {
Expand Down Expand Up @@ -115,6 +115,20 @@ function App() {
</button>
<button
onClick={async () => {
const entries = parseEntries(store.get('entries'));
for (const entry of entries) {
if (
entry.description.startsWith('!') ||
entry.description.match(/^[A-Z][A-Z0-9]*-\d+ !/)
) {
await message(
`There is an entry with a description starting with question mark:
"${entry.description}"
Please update it to continue.`,
);
return;
}
}
if (await ask('Really?')) {
await core.submit();
}
Expand Down

0 comments on commit a092351

Please sign in to comment.