Skip to content

Commit

Permalink
feat(suite-native): Introduce module-trading
Browse files Browse the repository at this point in the history
  • Loading branch information
jbazant committed Jan 23, 2025
1 parent fa094b8 commit a12acad
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 0 deletions.
23 changes: 23 additions & 0 deletions suite-native/module-trading/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
7 changes: 7 additions & 0 deletions suite-native/module-trading/redux.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { AsyncThunkAction } from '@reduxjs/toolkit';

declare module 'redux' {
export interface Dispatch {
<TThunk extends AsyncThunkAction<any, any, any>>(thunk: TThunk): ReturnType<TThunk>;
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -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<TradingStackParamList>();

export const TradingStackNavigator = () => (
<TradingStack.Navigator
initialRouteName={TradingStackRoutes.Trading}
screenOptions={stackNavigationOptionsConfig}
>
<TradingStack.Screen
options={{ title: TradingStackRoutes.Trading }}
name={TradingStackRoutes.Trading}
component={TradingScreen}
/>
</TradingStack.Navigator>
);
Original file line number Diff line number Diff line change
@@ -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(<TradingStackNavigator />);
await waitFor(() => expect(getByText('Trading placeholder')).toBeDefined());
});
});
10 changes: 10 additions & 0 deletions suite-native/module-trading/src/screens/TradingScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Screen } from '@suite-native/navigation';
import { Card, Text } from '@suite-native/atoms';

export const TradingScreen = () => (
<Screen>
<Card>
<Text>Trading placeholder</Text>
</Card>
</Screen>
);
10 changes: 10 additions & 0 deletions suite-native/module-trading/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": { "outDir": "libDev" },
"references": [
{ "path": "../navigation" },
{ "path": "../test-utils" },
{ "path": "../../packages/styles" }
],
"include": [".", "**/*.json"]
}
5 changes: 5 additions & 0 deletions suite-native/navigation/src/navigators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
RootStackRoutes,
SendStackRoutes,
SettingsStackRoutes,
TradingStackRoutes,
} from './routes';
import { NavigateParameters } from './types';

Expand Down Expand Up @@ -222,3 +223,7 @@ export type RootStackParamList = {
};
[RootStackRoutes.SettingsScreenStack]: NavigatorScreenParams<SettingsStackParamList>;
};

export type TradingStackParamList = {
[TradingStackRoutes.Trading]: undefined;
};
4 changes: 4 additions & 0 deletions suite-native/navigation/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@ export enum SettingsStackRoutes {
SettingsFAQ = 'SettingsFAQ',
SettingsCoinEnabling = 'SettingsCoinEnabling',
}

export enum TradingStackRoutes {
Trading = 'Trading',
}
1 change: 1 addition & 0 deletions suite-native/state/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './StoreProvider';
export * from './appSlice';
export * from './store';
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a12acad

Please sign in to comment.