Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kate / DTRA-325 / TS migration: Form/TradeParams/Duration files in Trader package #43

Merged
merged 13 commits into from
Oct 25, 2023

Conversation

kate-deriv
Copy link
Owner

@kate-deriv kate-deriv commented Oct 20, 2023

Changes:

  • TS migration and refactoring of:
    --advanced-duration.jsx file
    --duration-mobile.jsx file
    --duration-toggle.jsx file
    --duration-wrapper.jsx file
    --duration.jsx file
    --expiry-text.jsx file
    --index.js file
    --simple-duration.jsx file
  • Screenshot of tests (locally):

Screenshots:

Screenshot 2023-10-23 at 16 36 07

<Icon
icon='IcChevronDown'
className={icon_className}
classNamePath={'advanced-simple-toggle__icon-path'}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In <Icon /> there is no such prop as classNamePath.

@@ -91,7 +133,7 @@ const AdvancedDuration = observer(
/>
)}
{advanced_duration_unit === 't' && contract_expiry_type === 'tick' && (
<RangeSlider name='duration' ticks={10} value={duration_t} {...shared_input_props} />
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<RangeSlider /> do not have such prop as ticks

@@ -107,7 +149,7 @@ const AdvancedDuration = observer(
classNameInput='trade-container__input'
current_focus={current_focus}
error_messages={validation_errors.duration}
label={duration_units_list.length === 1 ? duration_units_list[0].text : null}
label={duration_units_list.length === 1 ? duration_units_list[0].text : undefined}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In <InputField /> label's type is string or undefined

setDurationTabIdx(index);
const { value: unit } = duration_units_list[index];
setSelectedDuration(unit, duration_values[`${unit}_duration`]);
setSelectedDuration(unit, duration_values[`${unit as 't' | 's' | 'm' | 'h' | 'd'}_duration`]);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duration_values keys are t_duration ant etc (line 307), so it's not possible to use something like keyof typeof duration_values

@@ -27,7 +30,6 @@ const DurationWrapper = observer(() => {
expiry_epoch,
expiry_time,
start_date,
market_open_times,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non of the children were using market_open_times

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kate-deriv could this be used in order to trigger the re-render of AdvancedDuration and Duration when this prop gets updated? Please check if the component is still re-rendered properly without it :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you are right, I noticed that Expiry text is not updated properly without receiving market_open_times. Should I add some comment that this prop is needed to trigger re-render?

packages/components/src/components/dropdown/dropdown.tsx Outdated Show resolved Hide resolved
@@ -27,7 +30,6 @@ const DurationWrapper = observer(() => {
expiry_epoch,
expiry_time,
start_date,
market_open_times,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kate-deriv could this be used in order to trigger the re-render of AdvancedDuration and Duration when this prop gets updated? Please check if the component is still re-rendered properly without it :)

Copy link
Collaborator

@maryia-deriv maryia-deriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job👍🏻

@kate-deriv kate-deriv merged commit 3c97d7a into kate/DTRA-420/ts_migration_7 Oct 25, 2023
1 check failed
kate-deriv added a commit that referenced this pull request Dec 12, 2023
…ctoring (binary-com#10848)

* chore: empty commit

* Kate / DTRA-325 / TS migration: Form/TradeParams/Duration files in Trader package (#43)

* refactor: ts of expity text

* refactor: ts of duration toggle

* refactor: ts of simple duration

* fix: types

* feat: ts of duration wrapper

* refactor: ts of daration

* refactor: add ts for advanced duration

* refactor: ts of duration mobile

* refactor: unit test

* refactor: apply suggestions

* chore: add fallback for simple duration unit

* refactor: apply suggestions

* chore: refactor type

* refactor: remove code smells

* Kate / DTRA-421 / TS migration: Contract + ContractReplay in Trader package (#44)

* refactor: ts of contract file

* refactor: ts of contract replay

* refactor: add more types for contract store

* chore: expand type

* refactor: apply suggestions

* refactor: separate replay chart from contract replay

* refactor: add ternary rendering

* fix: revert latest changes

* refactor: remove code smells

* Maryia/DTRA-324/refactor: TS migration of trade.jsx and refactoring (#45)

* chore: migrate trade to ts

* chore: remove unnecessary line

* chore: migrate to ts - test and init-store

* chore: remove unused test component

* chore: more files to ts

* chore: add types to trade

* chore: trade-chart to ts

* refactor: is_mobile

* chore: add types to SmartChartSwitcher

* chore: ToolbarWidgetsBeta to ts

* fix: a type

* fix: ws type

* chore: remove unused setting

* refactor: alphabetical order

* chore: index.js to index.ts

* refactor: address comments

* chore: remove code smells

* chore: change type

* refactor: apply suggestions

* fix: add missing string

* refactor: apply suggestions

* chore: add math trunc method

* chore: remove extra ui mocked prop

---------

Co-authored-by: Maryia <103177211+maryia-deriv@users.noreply.github.com>
kate-deriv pushed a commit that referenced this pull request Apr 29, 2024
…ce (binary-com#14723)

* chore: [UPM-923]/evgeniy/error message for passkey not supported device

* fix: read of undefined

* chore: added new button text and action for not supported

* fix: error variable name

* chore: update content in passkey-config (#42)

* fix: content for unsupported error

* Suisin/solve passkey header issue (#43)

* chore: fix header not bold issue

* chore: update passkey creation fail content

* chore: refactor error content

* chore: added comment to remove is_tour_open

* chore: remove close icon for error modal

* chore: remove close icon for error modal

---------

Co-authored-by: Sui Sin <103026762+suisin-deriv@users.noreply.github.com>
kate-deriv pushed a commit that referenced this pull request Aug 28, 2024
…binary-com#16135)

* [WALL] george / WALL-4519 / Support XRP Deposits and Withdrawals in Wallets (#42)

* refactor(wallets): ♻️ refactor wallets deposit/withdraw visibility

* fix(wallets): 🚑 fix playwright tests

* feat(wallets): ✨ add UI elements for XRP integration (#43)

* feat(wallets): ✨ add UI elements for XRP integration

* style: 💄 remove dark background

* fix: 🚑 prevent crypto_config call for doughflow providers

* fix: hardcode min withdrawal value for xrp

* fix: withdrawalCryptoValidator min value

* fix: withdrawalCryptoValidators min withdrawal value

* fix: get min value from fractional digits

---------

Co-authored-by: lubega-deriv <lubega@deriv.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants