forked from input-output-hk/daedalus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DDW-1186] Shows 'To be defined' if date of the next fund is in the p…
…ast (input-output-hk#3105) * [DDW-1216] Use new Catalyst API * [DDW-1216] Add changelog entry * [DDW-1186] Now showing 'To be defined' if date of the next fund coming from API is in the past * [DDW-1186] Changed JP translation * [DDW-1186] Apply the latest requirements on showing "To be defined" * [DDW-1186] Implement Catalyst testing utilities * [DDW-1186] Fix handling of URL override for Catalyst * [DDW-1186] Implement time machine for Catalyst voting testing * [DDW-1186] Fix time machine --------- Co-authored-by: Marcin Mazurek <marcin.mazurek@iohk.io>
- Loading branch information
1 parent
2990883
commit 43b2b5e
Showing
15 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
source/renderer/app/containers/voting/VotingRegistrationPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import timeMachine from 'timemachine'; | ||
|
||
// https://github.com/schickling/timemachine/issues/8 | ||
timeMachine.reset(); | ||
|
||
const TIME_MACHINE_SESSION_STORAGE_KEY = 'time_machine_date'; | ||
|
||
export class PersistentTimeMachine { | ||
private _isInitialized = false; | ||
|
||
init() { | ||
const dateString = sessionStorage.getItem(TIME_MACHINE_SESSION_STORAGE_KEY); | ||
if (dateString !== null) { | ||
timeMachine.config({ | ||
dateString, | ||
}); | ||
} | ||
this._isInitialized = true; | ||
} | ||
|
||
enable(dateString: string) { | ||
this._ensureIsInitialized(); | ||
timeMachine.config({ | ||
dateString, | ||
}); | ||
sessionStorage.setItem(TIME_MACHINE_SESSION_STORAGE_KEY, dateString); | ||
window.location.reload(); | ||
} | ||
|
||
disable() { | ||
this._ensureIsInitialized(); | ||
timeMachine.reset(); | ||
sessionStorage.removeItem(TIME_MACHINE_SESSION_STORAGE_KEY); | ||
window.location.reload(); | ||
} | ||
|
||
private _ensureIsInitialized() { | ||
if (!this._isInitialized) { | ||
throw new Error('Time machine must be initialized before use'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { generateMnemonic } from './crypto'; | ||
import { PersistentTimeMachine } from './PersistentTimeMachine'; | ||
|
||
const timeMachine = new PersistentTimeMachine(); | ||
timeMachine.init(); | ||
|
||
export default { | ||
crypto: { | ||
generateMnemonic, | ||
}, | ||
timeMachine, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters