-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into issue-#1448
- Loading branch information
Showing
51 changed files
with
454 additions
and
142 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
Binary file modified
BIN
+7.19 KB
(120%)
e2e/screenshots/simulator/recurring/Recurring_limit_range/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-25 Bytes
(100%)
...screenshots/simulator/recurring/Recurring_range_limit/simulator-input-price.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.29 KB
(100%)
e2e/screenshots/strategy/disposable/Disposable_buy_limit/undercut/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+852 Bytes
(100%)
e2e/screenshots/strategy/disposable/Disposable_buy_range/create/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
e2e/screenshots/strategy/disposable/Disposable_buy_range/duplicate/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-20 Bytes
(100%)
e2e/screenshots/strategy/overlapping/Overlapping/create/my-strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+273 Bytes
(100%)
e2e/screenshots/strategy/overlapping/Overlapping/withdraw/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+611 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_limit_limit/deposit/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-849 Bytes
(99%)
e2e/screenshots/strategy/recurring/Recurring_limit_range/create/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_limit_range/create/my-strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+705 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_limit_range/deposit/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+481 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_limit_range/renew/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-132 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_range_limit/renew/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+863 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_range_range/create/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-833 Bytes
(99%)
e2e/screenshots/strategy/recurring/Recurring_range_range/duplicate/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,97 @@ | ||
import { FormEvent, useLayoutEffect, useRef, useState } from 'react'; | ||
import { lsService } from 'services/localeStorage'; | ||
import { Button } from 'components/common/button'; | ||
import { Warning } from 'components/common/WarningMessageWithIcon'; | ||
import { defaultConfig } from 'config'; | ||
import { AppConfigSchema } from 'config/configSchema'; | ||
import { AppConfig } from 'config/types'; | ||
import * as v from 'valibot'; | ||
|
||
const formatConfig = (config?: Partial<AppConfig>) => | ||
JSON.stringify(config, undefined, 4); | ||
|
||
export const DebugConfig = () => { | ||
const savedConfigOverride = formatConfig(lsService.getItem('configOverride')); | ||
const [configOverride, setConfigOverride] = useState(savedConfigOverride); | ||
const [error, setError] = useState(''); | ||
const textAreaRef = useRef<HTMLTextAreaElement>(null); | ||
|
||
const errorMessage = 'Failed parsing JSON file'; | ||
const saveConfigOverride = (configOverride?: string) => { | ||
try { | ||
if (!configOverride) { | ||
setConfigOverride(''); | ||
lsService.removeItem('configOverride'); | ||
} else { | ||
const parsedConfig = JSON.parse(configOverride || ''); | ||
v.parse(v.partial(AppConfigSchema), parsedConfig); | ||
lsService.setItem('configOverride', parsedConfig); | ||
} | ||
setError(''); | ||
window?.location.reload(); | ||
} catch (error) { | ||
setError(errorMessage); | ||
} | ||
}; | ||
|
||
const handleConfigChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
setConfigOverride(e.target.value); | ||
}; | ||
|
||
useLayoutEffect(() => { | ||
if (!textAreaRef.current) return; | ||
textAreaRef.current.style.height = 'inherit'; // to reduce on delete | ||
const defaultHeight = 5; // px | ||
const newHeight = Math.max(textAreaRef.current.scrollHeight, defaultHeight); // px | ||
textAreaRef.current.style.height = `${newHeight}px`; | ||
}, [configOverride]); | ||
|
||
const handleLoadDefault = () => { | ||
const parsedDefaultConfig = formatConfig(defaultConfig); | ||
setConfigOverride(parsedDefaultConfig); | ||
}; | ||
|
||
const submit = (e: FormEvent) => { | ||
e.preventDefault(); | ||
saveConfigOverride(configOverride); | ||
}; | ||
|
||
const reset = (e: FormEvent) => { | ||
e.preventDefault(); | ||
saveConfigOverride(); | ||
}; | ||
|
||
return ( | ||
<form | ||
onSubmit={submit} | ||
onReset={reset} | ||
className="rounded-18 bg-background-900 flex flex-col items-center space-y-20 p-20" | ||
> | ||
<h2 className="text-center">Set Config</h2> | ||
<label htmlFor="custom-config-json">Config Override</label> | ||
|
||
<div className="w-full"> | ||
<textarea | ||
ref={textAreaRef} | ||
id="custom-config-json" | ||
placeholder="Enter config file overrides in JSON format" | ||
value={configOverride} | ||
onChange={handleConfigChange} | ||
className="rounded-18 w-full break-all bg-black px-16 py-8" | ||
/> | ||
</div> | ||
{!!error && ( | ||
<Warning isError message={error} htmlFor="custom-config-json" /> | ||
)} | ||
<Button data-testid="save-config" type="submit" fullWidth> | ||
Save | ||
</Button> | ||
<Button type="button" onClick={handleLoadDefault} fullWidth> | ||
Load Default Config | ||
</Button> | ||
<Button type="reset" fullWidth> | ||
Reset | ||
</Button> | ||
</form> | ||
); | ||
}; |
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
18 changes: 18 additions & 0 deletions
18
src/components/strategies/overview/strategyBlock/StrategyBlockInfo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { FC } from 'react'; | ||
import { StrategyWithFiat } from 'libs/queries'; | ||
import { StrategyBlockRoi } from 'components/strategies/overview/strategyBlock/StrategyBlockRoi'; | ||
import { StrategyBlockBudget } from 'components/strategies/overview/strategyBlock/StrategyBlockBudget'; | ||
|
||
interface Props { | ||
strategy: StrategyWithFiat; | ||
showStrategyRoi?: boolean; | ||
} | ||
|
||
export const StrategyBlockInfo: FC<Props> = ({ strategy, showStrategyRoi }) => { | ||
return ( | ||
<> | ||
{!!showStrategyRoi && <StrategyBlockRoi strategy={strategy} />} | ||
<StrategyBlockBudget strategy={strategy} fullWidth={!showStrategyRoi} /> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.