-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yashim/feat: add mock server integration phase1 (#9003)
* feat: add mock server integration * refactor: use session instead of client * fix: persistent mock server enable state * chore: draft * feat: add mock server control panel UI * feat: add clear all functionality * feat: completed login mock * fix: tests * fix: code * feat: add feature toggle * feat: end of day commit * fix: review comments + tests * chore: used deriv-api * fix: typescript error * chore: update package lock --------- Co-authored-by: Dev Sans <yashimwong@gmail.com>
- Loading branch information
1 parent
d9815f4
commit cb17414
Showing
27 changed files
with
69,323 additions
and
23,385 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,32 @@ | ||
import React from 'react'; | ||
import MockDialog from './mock-dialog'; | ||
import { useLocalStorageData } from '@deriv/hooks'; | ||
|
||
const DevTools = () => { | ||
const [show_mockserver_panel, setShowMockServerPanel] = useLocalStorageData<boolean>( | ||
'show_mockserver_panel', | ||
false | ||
); | ||
|
||
React.useEffect(() => { | ||
const handleShortcutKey = (event: globalThis.KeyboardEvent) => { | ||
if (event.ctrlKey && event.key === '0') { | ||
setShowMockServerPanel(prev => !prev); | ||
} | ||
}; | ||
|
||
window.addEventListener('keydown', handleShortcutKey); | ||
|
||
return () => { | ||
window.removeEventListener('keydown', handleShortcutKey); | ||
}; | ||
}, [setShowMockServerPanel]); | ||
|
||
if (show_mockserver_panel) { | ||
return <MockDialog />; | ||
} | ||
|
||
return <React.Fragment />; | ||
}; | ||
|
||
export default DevTools; |
69 changes: 69 additions & 0 deletions
69
packages/core/src/App/Components/dev-tools/mock-dialog.scss
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,69 @@ | ||
.mock-dialog { | ||
position: absolute; | ||
bottom: 4.6rem; | ||
right: 1rem; | ||
width: 34rem; | ||
border-radius: $BORDER_RADIUS; | ||
padding: 1.2rem 1.6rem; | ||
background-color: var(--general-main-1); | ||
box-shadow: 0 20px 13px rgba(0, 0, 0, 0.01), 0 4px 3px rgba(0, 0, 0, 0.02); | ||
border: 1px solid var(--general-hover); | ||
z-index: 69420; | ||
|
||
&__title { | ||
margin-bottom: 1.4rem; | ||
} | ||
|
||
&__status { | ||
border-radius: 4px; | ||
border: 2px solid; | ||
padding: 0.8rem 1.2rem; | ||
margin-bottom: 2.4rem; | ||
|
||
&--online { | ||
} | ||
&--connecting { | ||
} | ||
&--offline { | ||
background-color: #f3f4f6; | ||
border-color: #e5e7eb; | ||
|
||
.dc-text { | ||
color: #6b7280; | ||
} | ||
} | ||
} | ||
|
||
&__form { | ||
display: flex; | ||
min-height: 40rem; | ||
flex-direction: column; | ||
gap: 2rem; | ||
|
||
&--dropdown-container { | ||
display: inline-flex; | ||
gap: 1rem; | ||
|
||
button { | ||
height: unset; | ||
} | ||
} | ||
|
||
&--input { | ||
margin-bottom: unset; | ||
} | ||
|
||
&--submit-container { | ||
display: flex; | ||
justify-content: end; | ||
gap: 1rem; | ||
|
||
button:disabled { | ||
cursor: not-allowed; | ||
span { | ||
color: #9ca3af; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.