From a12acad4c0d2f66ddd8fee2f9184e6d83eeed1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Ba=C5=BEant?= Date: Thu, 23 Jan 2025 15:38:51 +0100 Subject: [PATCH] feat(suite-native): Introduce module-trading --- suite-native/module-trading/package.json | 23 ++++++++++++++++++ suite-native/module-trading/redux.d.ts | 7 ++++++ suite-native/module-trading/src/index.ts | 0 .../src/navigation/TradingStackNavigator.tsx | 24 +++++++++++++++++++ .../TradingStackNavigator.comp.test.tsx | 10 ++++++++ .../src/screens/TradingScreen.tsx | 10 ++++++++ suite-native/module-trading/tsconfig.json | 10 ++++++++ suite-native/navigation/src/navigators.ts | 5 ++++ suite-native/navigation/src/routes.ts | 4 ++++ suite-native/state/src/index.ts | 1 + yarn.lock | 1 + 11 files changed, 95 insertions(+) create mode 100644 suite-native/module-trading/package.json create mode 100644 suite-native/module-trading/redux.d.ts create mode 100644 suite-native/module-trading/src/index.ts create mode 100644 suite-native/module-trading/src/navigation/TradingStackNavigator.tsx create mode 100644 suite-native/module-trading/src/navigation/__tests__/TradingStackNavigator.comp.test.tsx create mode 100644 suite-native/module-trading/src/screens/TradingScreen.tsx create mode 100644 suite-native/module-trading/tsconfig.json diff --git a/suite-native/module-trading/package.json b/suite-native/module-trading/package.json new file mode 100644 index 00000000000..f35d97839fb --- /dev/null +++ b/suite-native/module-trading/package.json @@ -0,0 +1,23 @@ +{ + "name": "@suite-native/module-trading", + "version": "1.0.0", + "private": true, + "license": "See LICENSE.md in repo root", + "sideEffects": false, + "main": "src/index", + "scripts": { + "depcheck": "yarn g:depcheck", + "type-check": "yarn g:tsc --build", + "test:unit": "yarn g:jest -c ../../jest.config.native.js" + }, + "dependencies": { + "@react-navigation/native-stack": "6.11.0", + "@reduxjs/toolkit": "1.9.5", + "@suite-native/navigation": "workspace:*", + "@suite-native/test-utils": "workspace:*", + "@trezor/styles": "workspace:*", + "react": "18.2.0", + "react-native": "0.76.1", + "react-native-reanimated": "^3.16.7" + } +} diff --git a/suite-native/module-trading/redux.d.ts b/suite-native/module-trading/redux.d.ts new file mode 100644 index 00000000000..df9a0c3f969 --- /dev/null +++ b/suite-native/module-trading/redux.d.ts @@ -0,0 +1,7 @@ +import { AsyncThunkAction } from '@reduxjs/toolkit'; + +declare module 'redux' { + export interface Dispatch { + >(thunk: TThunk): ReturnType; + } +} diff --git a/suite-native/module-trading/src/index.ts b/suite-native/module-trading/src/index.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suite-native/module-trading/src/navigation/TradingStackNavigator.tsx b/suite-native/module-trading/src/navigation/TradingStackNavigator.tsx new file mode 100644 index 00000000000..0d7be891a0f --- /dev/null +++ b/suite-native/module-trading/src/navigation/TradingStackNavigator.tsx @@ -0,0 +1,24 @@ +import { createNativeStackNavigator } from '@react-navigation/native-stack'; + +import { + stackNavigationOptionsConfig, + TradingStackParamList, + TradingStackRoutes, +} from '@suite-native/navigation'; + +import { TradingScreen } from '../screens/TradingScreen'; + +const TradingStack = createNativeStackNavigator(); + +export const TradingStackNavigator = () => ( + + + +); diff --git a/suite-native/module-trading/src/navigation/__tests__/TradingStackNavigator.comp.test.tsx b/suite-native/module-trading/src/navigation/__tests__/TradingStackNavigator.comp.test.tsx new file mode 100644 index 00000000000..7f300814a22 --- /dev/null +++ b/suite-native/module-trading/src/navigation/__tests__/TradingStackNavigator.comp.test.tsx @@ -0,0 +1,10 @@ +import { renderWithStore, waitFor } from '@suite-native/test-utils'; + +import { TradingStackNavigator } from '../TradingStackNavigator'; + +describe('TradingStackNavigator', () => { + it('should render', async () => { + const { getByText } = renderWithStore(); + await waitFor(() => expect(getByText('Trading placeholder')).toBeDefined()); + }); +}); diff --git a/suite-native/module-trading/src/screens/TradingScreen.tsx b/suite-native/module-trading/src/screens/TradingScreen.tsx new file mode 100644 index 00000000000..5c6f28cc0e5 --- /dev/null +++ b/suite-native/module-trading/src/screens/TradingScreen.tsx @@ -0,0 +1,10 @@ +import { Screen } from '@suite-native/navigation'; +import { Card, Text } from '@suite-native/atoms'; + +export const TradingScreen = () => ( + + + Trading placeholder + + +); diff --git a/suite-native/module-trading/tsconfig.json b/suite-native/module-trading/tsconfig.json new file mode 100644 index 00000000000..9e0b9c1ee12 --- /dev/null +++ b/suite-native/module-trading/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { "outDir": "libDev" }, + "references": [ + { "path": "../navigation" }, + { "path": "../test-utils" }, + { "path": "../../packages/styles" } + ], + "include": [".", "**/*.json"] +} diff --git a/suite-native/navigation/src/navigators.ts b/suite-native/navigation/src/navigators.ts index 5689ce9bd15..d7c9faf07fb 100644 --- a/suite-native/navigation/src/navigators.ts +++ b/suite-native/navigation/src/navigators.ts @@ -28,6 +28,7 @@ import { RootStackRoutes, SendStackRoutes, SettingsStackRoutes, + TradingStackRoutes, } from './routes'; import { NavigateParameters } from './types'; @@ -222,3 +223,7 @@ export type RootStackParamList = { }; [RootStackRoutes.SettingsScreenStack]: NavigatorScreenParams; }; + +export type TradingStackParamList = { + [TradingStackRoutes.Trading]: undefined; +}; diff --git a/suite-native/navigation/src/routes.ts b/suite-native/navigation/src/routes.ts index b720e01d290..e7f0e620242 100644 --- a/suite-native/navigation/src/routes.ts +++ b/suite-native/navigation/src/routes.ts @@ -124,3 +124,7 @@ export enum SettingsStackRoutes { SettingsFAQ = 'SettingsFAQ', SettingsCoinEnabling = 'SettingsCoinEnabling', } + +export enum TradingStackRoutes { + Trading = 'Trading', +} diff --git a/suite-native/state/src/index.ts b/suite-native/state/src/index.ts index 5b121d4634d..65d3a26c9bd 100644 --- a/suite-native/state/src/index.ts +++ b/suite-native/state/src/index.ts @@ -1,2 +1,3 @@ export * from './StoreProvider'; export * from './appSlice'; +export * from './store'; diff --git a/yarn.lock b/yarn.lock index 717b789cdb0..7448e64c11c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10953,6 +10953,7 @@ __metadata: "@react-navigation/native-stack": "npm:6.11.0" "@reduxjs/toolkit": "npm:1.9.5" "@suite-native/navigation": "workspace:*" + "@suite-native/test-utils": "workspace:*" "@trezor/styles": "workspace:*" react: "npm:18.2.0" react-native: "npm:0.76.1"