forked from deriv-com/deriv-app
-
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.
Kate / DTRA-396 / [Package 6] Tech debt (deriv-com#10018)
* feat: add key files from prev tech tebt branch * feat: add digits file from prev branch * feat: add contract types file from prev branch * feat: add trade params mobile from prev branch * fix: remove duplicates * Maryia/dtra-401/TS migration: multiplier components (#34) * chore: migrate cancel-deal to ts * chore: migrate expiration & expiration modal * chore: migrated multiplier * chore: migrate stop-loss * chore: migrate take-profit * chore: migrate widgets * build: trigger build with empty commit * Kate / DTRA-398 / TS migration: Widget components in Trader package (#33) * refactor: ts of contract replay widget * refactor: ts of mobile widgets * refactor: ts of chart widgets * refactor: ts of top widgets * refactor: ts of top widgets * refactor: types for widgets * refactor: apply suggestions * refactor: add position prop * fix: extention of the imported file * chore: replace some localizes (#36) * Kate / DTRA-400 / [Refactoring]: delete duplicated unused files from Markers folder in Trader package and migrate to TS marker.jsx (#37) * refactor: marker folder * fix: change file extension in test * Kate / DTRA-404 / [Refactoring]: Divide trade-categories.tsx file and cover changes with tests (#35) * refactor: add rise fall description * refactor: separate stay end high contract description * refactor: separate description of digits contracts * refactor: separate asian reset runhighlow touch contracts * refactor: separate callputspread lb tickhighlow and vanilla contracts * refactor: separate multipliers contract * refactor: add unit tests for contract descriptions * refactor: add more tests * refactor: add tests for touch ans vanilla contracts * refactor: tests for trade categories * refactor: contract description structure * refactor: apply suggestions * refactor: add missing test case * Maryia/DTRA-403/feat: migrate Routes files in Trader package to TS (#38) * feat: migrate routes files to ts * fix: routes extension * refactor: for consistency * refactor: import order * refactor: renamed prop types * refactor: type for consistency * refactor: remove index as key * fix: ts migrate settingsmodal and remove unused file (#39) * fix: ts migrate settingsmodal and remove unused file * fix: failing tests * Kate/ fix: code smells (#40) * fix: code smells * chore: empty commit * fix: function arguments * refactor: tests * fix: codesmells * refactor: code smells * chore: change optional chaining * refactor: tests * refactor: tests for widgets component * fix: tests * fix: conflicts * fix: more conflicts * fix: tests * refactor: add more test cases * fix: types in tests * fix: test extention * fix: return turbos back to types * fix: revert unplanned files * fix: code smells (#42) * fix: test extention * fix: bug with inserting objecting into the backticks * fix: file extention after ts migration * chore: sort imports * chore: revert file * chore: revert wallet changes * chore: remove extra file * chore: apply nit * fix: language switching issue with the chart --------- Co-authored-by: Maryia <103177211+maryia-deriv@users.noreply.github.com> Co-authored-by: henry-deriv <118344354+henry-deriv@users.noreply.github.com>
- Loading branch information
1 parent
cca82aa
commit 5714dce
Showing
107 changed files
with
1,515 additions
and
1,271 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
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
16 changes: 0 additions & 16 deletions
16
packages/trader/src/App/Components/Routes/binary-routes.jsx
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/trader/src/App/Components/Routes/binary-routes.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,20 @@ | ||
import React from 'react'; | ||
import { Switch } from 'react-router-dom'; | ||
import getRoutesConfig from 'App/Constants/routes-config'; | ||
import { TBinaryRoutesProps, TRouteConfig } from 'Types'; | ||
import RouteWithSubRoutes from './route-with-sub-routes'; | ||
|
||
const BinaryRoutes = (props: TBinaryRoutesProps) => ( | ||
<React.Suspense fallback={<div />}> | ||
<Switch> | ||
{getRoutesConfig().map((route: TRouteConfig, index) => ( | ||
/* Index is the only thing that can be used for the key here because the only other property | ||
that can be used as a key and available in every route is a localized title returned from getTitle() which, | ||
when used, causes severe bugs upon switching between languages! */ | ||
<RouteWithSubRoutes key={index} {...route} {...props} /> | ||
))} | ||
</Switch> | ||
</React.Suspense> | ||
); | ||
|
||
export default BinaryRoutes; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { matchPath, RouteProps } from 'react-router'; | ||
import { routes } from '@deriv/shared'; | ||
import { TRouteConfig } from 'Types'; | ||
|
||
export const normalizePath = (path = '') => (path.startsWith('/') ? path : `/${path || ''}`); // Default to '/' | ||
|
||
export const findRouteByPath = (path: string, routes_config?: TRouteConfig[]): RouteProps | undefined => { | ||
let result: RouteProps | undefined; | ||
|
||
routes_config?.some(route_info => { | ||
let match_path; | ||
try { | ||
match_path = matchPath(path, route_info); | ||
} catch (e: unknown) { | ||
if (/undefined/.test((e as Error).message)) { | ||
return undefined; | ||
} | ||
} | ||
|
||
if (match_path) { | ||
result = route_info; | ||
return true; | ||
} else if (route_info.routes) { | ||
result = findRouteByPath(path, route_info.routes); | ||
return result; | ||
} | ||
return false; | ||
}); | ||
|
||
return result; | ||
}; | ||
|
||
export const isRouteVisible = (route?: TRouteConfig, is_logged_in?: boolean) => | ||
!(route?.is_authenticated && !is_logged_in); | ||
|
||
export const getPath = (route_path: string, params: { [key: string]: string } = {}) => | ||
Object.keys(params).reduce((p, name) => p.replace(`:${name}`, params[name]), route_path); | ||
|
||
export const getContractPath = (contract_id = '') => getPath(routes.contract, { contract_id }); |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import BinaryLink from './binary-link'; | ||
import RouteWithSubRoutes from './route-with-sub-routes'; | ||
import BinaryRoutes from './binary-routes'; | ||
|
||
export * from './helpers'; | ||
export { BinaryLink, RouteWithSubRoutes }; | ||
export default BinaryRoutes; |
Oops, something went wrong.