diff --git a/src/ControlPanel.ts b/src/ControlPanel.ts index 5e2e061..7f3a317 100644 --- a/src/ControlPanel.ts +++ b/src/ControlPanel.ts @@ -1,4 +1,4 @@ -import { parseLocation, uniqId, waitForLoad } from './utils'; +import { parseLocation, timestamp, uniqId, waitForLoad } from './utils'; import { Scheduler } from './Scheduler'; import { BuildingPageController } from './Page/BuildingPageController'; import { UpgradeBuildingTask } from './Task/UpgradeBuildingTask'; @@ -20,6 +20,7 @@ import { calcGatheringTimings } from './Core/GatheringTimings'; import { DataStorage } from './DataStorage'; import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetectors'; import { debounce } from 'debounce'; +import { ExecutionState } from './State/ExecutionState'; interface QuickAction { label: string; @@ -48,6 +49,8 @@ export class ControlPanel { const scheduler = this.scheduler; const quickActions: QuickAction[] = []; + const executionState = new ExecutionState(); + const state = { name: 'Dashboard', version: this.version, @@ -56,10 +59,13 @@ export class ControlPanel { taskList: [], actionList: [], quickActions: quickActions, + pauseSeconds: 0, refresh() { this.taskList = scheduler.getTaskItems(); this.actionList = scheduler.getActionItems(); + const { pauseTs } = executionState.getExecutionSettings(); + this.pauseSeconds = pauseTs - timestamp(); this.refreshVillages(); }, @@ -78,6 +84,10 @@ export class ControlPanel { } } }, + + pause() { + executionState.setExecutionSettings({ pauseTs: timestamp() + 120 }); + }, }; state.refresh(); diff --git a/src/DashboardView/Header.vue b/src/DashboardView/Header.vue index 6a29bea..c5b0597 100644 --- a/src/DashboardView/Header.vue +++ b/src/DashboardView/Header.vue @@ -3,6 +3,9 @@