on master help sign in
Merge pull request #1005 from urbit/t/fix-roller-batch-timer

ux: show countdown to next roll

commit0872827065809a577521054472c5c941dbbb152b authorHunter Miller <hunter@hmiller.dev> dateMon 21 Mar 2022, 10:39 (5 years ago) parentbe08dee51bb890
2 files changed+2−5
src/lib/useRoller.ts+2−1 src/store/rollerStore.ts−4
src/lib/useRoller.ts+2−1
@@ -41,6 +41,7 @@ import { useWalletConnect } from './useWalletConnect';
4141import { PendingL1Txn } from './types/PendingL1Transaction';
4242import { TRANSACTION_PROGRESS } from './reticket';
4343import { useRollerOptions } from './useRollerOptions';
44+import { useTimerStore } from 'store/timerStore';
4445
4546interface UpdateParams {
4647 point: number;
@@ -69,7 +70,6 @@ export default function useRoller() {
6970 point,
7071 points,
7172 nextQuotaTime,
72− setNextBatchTime,
7373 setNextQuotaTime,
7474 setPendingTransactions,
7575 setModalText,
@@ -78,6 +78,7 @@ export default function useRoller() {
7878 storePendingL1Txn,
7979 deletePendingL1Txn,
8080 } = useRollerStore();
81+ const { setNextBatchTime } = useTimerStore();
8182 const [config, setConfig] = useState<Config | null>(null);
8283
8384 const { options } = useRollerOptions();
src/store/rollerStore.ts−4
@@ -22,7 +22,6 @@ export const EMPTY_POINT = new Point({
2222
2323export interface RollerStore {
2424 loading: boolean;
25− nextBatchTime: number;
2625 nextQuotaTime: number;
2726 pendingTransactions: PendingTransaction[];
2827 point: Point;
@@ -34,7 +33,6 @@ export interface RollerStore {
3433 ethBalance: BN;
3534 setLoading: (loading: boolean) => void;
3635 setModalText: (modalText: string) => void;
37− setNextBatchTime: (nextBatchTime: number) => void;
3836 setNextQuotaTime: (nextQuotaTime: number) => void;
3937 setPendingTransactions: (pendingTransactions: PendingTransaction[]) => void;
4038 setPoint: (point: number) => void;
@@ -47,7 +45,6 @@ export interface RollerStore {
4745
4846export const useRollerStore = create<RollerStore>(set => ({
4947 loading: false,
50− nextBatchTime: new Date().getTime() + HOUR,
5148 nextQuotaTime: new Date().getTime() + 24 * HOUR,
5249 pendingTransactions: [],
5350 point: EMPTY_POINT,
@@ -57,7 +54,6 @@ export const useRollerStore = create<RollerStore>(set => ({
5754 recentlyCompleted: 0,
5855 ethBalance: toBN(0),
5956 setLoading: (loading: boolean) => set(() => ({ loading })),
60− setNextBatchTime: (nextBatchTime: number) => set(() => ({ nextBatchTime })),
6157 setNextQuotaTime: (nextQuotaTime: number) => set(() => ({ nextQuotaTime })),
6258 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
6359 set(state => {