Skip to content

Commit 6293cbf

Browse files
committed
new set of screens for gnomobile
Signed-off-by: Iuri Pereira <[email protected]>
1 parent 67d4175 commit 6293cbf

File tree

53 files changed

+3468
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3468
-217
lines changed

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"styled-components.vscode-styled-components",
4+
"golang.go"
5+
]
6+
}

gnoboard/.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:react/recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"prettier",
7+
"plugin:storybook/recommended"
8+
],
9+
"overrides": [],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"plugins": ["react", "@typescript-eslint"],
16+
"rules": { "react/react-in-jsx-scope": "off" },
17+
"settings": {
18+
"react": {
19+
"version": "detect"
20+
},
21+
"import/resolver": {
22+
"typescript": {}
23+
}
24+
}
25+
}

gnoboard/.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Add files here to ignore them from prettier formatting
2+
build
3+
dist
4+
coverage

gnoboard/.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"tabWidth": 2,
4+
"printWidth": 140,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"jsxSingleQuote": true,
8+
"bracketSpacing": true,
9+
"useTabs": false
10+
}

gnoboard/App.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
import React from "react";
1+
import { useGno } from '@gno/hooks/use-gno';
2+
import Loading from '@gno/screens/loading';
3+
import CustomRouter from '@gno/router/custom-router';
4+
import { useEffect, useState } from 'react';
25

3-
import HomeScreen from "@gno/screens/home";
4-
import SettingsScreen from "@gno/screens/settings";
5-
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
6-
import { NavigationContainer } from "@react-navigation/native";
7-
import "fast-text-encoding";
6+
export default function App() {
7+
const gno = useGno();
8+
const [loading, setLoading] = useState<string | undefined>(undefined);
89

9-
const Tab = createBottomTabNavigator();
10+
useEffect(() => {
11+
setLoading('Initializing bridge...');
12+
gno
13+
.initBridge()
14+
.catch((error) => console.log(error))
15+
.finally(() => setLoading(undefined));
16+
}, []);
1017

11-
export default function App() {
12-
return (
13-
<NavigationContainer>
14-
<Tab.Navigator>
15-
<Tab.Screen name="Home" component={HomeScreen} />
16-
<Tab.Screen name="Settings" component={SettingsScreen} />
17-
</Tab.Navigator>
18-
</NavigationContainer>
19-
);
18+
if (loading) {
19+
return <Loading message={loading} />;
20+
}
21+
22+
return <CustomRouter />;
2023
}

gnoboard/REAME.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
Experimental mobile app for GNO
44

5-
65
## 🗂️ Directory layout
76

8-
| directory | description |
9-
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
10-
| [src/native_modules/](./src/native_modules) | Native interface code |
11-
| [src/components](./src/components) | React Native components |
12-
| [src/navigation/](./src/navigation) | Gnoboard + react-native-navigation |
13-
| [src/screens/](./src/screens) | App screens |
14-
| [src/store/](./src/store) | Redux store |
7+
| directory | description |
8+
| ------------------------------------------- | ---------------------------------- |
9+
| [src/native_modules/](./src/native_modules) | Native interface code |
10+
| [src/components](./src/components) | React Native components |
11+
| [src/navigation/](./src/navigation) | Gnoboard + react-native-navigation |
12+
| [src/screens/](./src/screens) | App screens |
13+
| [src/store/](./src/store) | Redux store |

gnoboard/app.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
"resizeMode": "contain",
1212
"backgroundColor": "#ffffff"
1313
},
14-
"assetBundlePatterns": [
15-
"**/*"
16-
],
14+
"assetBundlePatterns": ["**/*"],
1715
"ios": {
1816
"supportsTablet": true,
1917
"bundleIdentifier": "land.gno.gnoboard"

gnoboard/babel.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
module.exports = function(api) {
1+
module.exports = function (api) {
22
api.cache(true);
33
return {
4-
presets: ["babel-preset-expo"],
4+
presets: ['babel-preset-expo'],
55
plugins: [
66
[
7-
"module-resolver",
7+
'module-resolver',
88
{
9-
root: ["./src"],
10-
extensions: [".ios.js", ".android.js", ".js", ".ts", ".tsx", ".json"],
9+
root: ['./src'],
10+
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
1111
alias: {
12-
"@gno": "./src/",
12+
'@gno': './src/',
1313
},
1414
},
1515
],

gnoboard/ios/Podfile.lock

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ PODS:
476476
- RNScreens (3.22.1):
477477
- React-Core
478478
- React-RCTImage
479+
- RNSVG (13.14.0):
480+
- React-Core
479481
- SocketRocket (0.6.1)
480482
- SwiftNIO (2.40.0):
481483
- _NIODataStructures (= 2.40.0)
@@ -662,6 +664,7 @@ DEPENDENCIES:
662664
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
663665
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
664666
- RNScreens (from `../node_modules/react-native-screens`)
667+
- RNSVG (from `../node_modules/react-native-svg`)
665668
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
666669

667670
SPEC REPOS:
@@ -793,6 +796,8 @@ EXTERNAL SOURCES:
793796
:path: "../node_modules/react-native/ReactCommon"
794797
RNScreens:
795798
:path: "../node_modules/react-native-screens"
799+
RNSVG:
800+
:path: "../node_modules/react-native-svg"
796801
Yoga:
797802
:path: "../node_modules/react-native/ReactCommon/yoga"
798803

@@ -833,14 +838,14 @@ SPEC CHECKSUMS:
833838
React-Core: 34da8c952844e21f5a69bf46438fb6bf063900d0
834839
React-CoreModules: 621243df8863055ff30f3bb2ff71573ffa7b16c8
835840
React-cxxreact: 4ad1cc861e32fb533dad6ff7a4ea25680fa1c994
836-
React-debug: 06f921e33f3f940a392052012cfb256051c9a275
841+
React-debug: 944ecd3a5238830b28aeaee9de8d219b6f4faa04
837842
React-hermes: 37377d0a56aa0cf55c65248271866ce3268cde3f
838843
React-jsi: 6de8b0ccc6b765b58e4eee9ee38049dbeaf5c221
839844
React-jsiexecutor: c7f826e40fa9cab5d37cab6130b1af237332b594
840845
React-jsinspector: aaed4cf551c4a1c98092436518c2d267b13a673f
841846
React-logger: da1ebe05ae06eb6db4b162202faeafac4b435e77
842847
react-native-safe-area-context: 36cc67648134e89465663b8172336a19eeda493d
843-
React-NativeModulesApple: 746d5d0dd491886547c9070ab2d0e9faf12e79f2
848+
React-NativeModulesApple: 0a007522c94482db6882f4de273e013543e63fb7
844849
React-perflogger: 496a1a3dc6737f964107cb3ddae7f9e265ddda58
845850
React-RCTActionSheet: 02904b932b50e680f4e26e7a686b33ebf7ef3c00
846851
React-RCTAnimation: e44fe5053708c5be762943087c78dc5a6a3c645c
@@ -854,10 +859,11 @@ SPEC CHECKSUMS:
854859
React-RCTVibration: 35eec7201c8ffdaccdd908a5ec874b7055f975f3
855860
React-rncore: 46133d523155fc84572338bd6a7c461c1d873efc
856861
React-runtimeexecutor: d465ba0c47ef3ed8281143f59605cacc2244d5c7
857-
React-runtimescheduler: 353534caf9e86a801060c8c206f1030e693398c4
858-
React-utils: e7b50b9df8e6b38bef66cc5305bb690c7e9bbbe8
859-
ReactCommon: 18bd1d7ca7ad6771a9168d3ab7ccf696593e424b
862+
React-runtimescheduler: 773a8053cd5e150da13865cceea7bb50259802d7
863+
React-utils: 246812d2f34a5ecb2bae89f3d864076e1b468366
864+
ReactCommon: ee2218cdfd45c34f74ce8ed881f8626ec460a84e
860865
RNScreens: 50ffe2fa2342eabb2d0afbe19f7c1af286bc7fb3
866+
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
861867
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
862868
SwiftNIO: 829958aab300642625091f82fc2f49cb7cf4ef24
863869
SwiftNIOConcurrencyHelpers: 697370136789b1074e4535eaae75cbd7f900370e

gnoboard/ios/gnoboard.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
"${BUILT_PRODUCTS_DIR}/Logging/Logging.framework",
328328
"${BUILT_PRODUCTS_DIR}/RCT-Folly/folly.framework",
329329
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
330+
"${BUILT_PRODUCTS_DIR}/RNSVG/RNSVG.framework",
330331
"${BUILT_PRODUCTS_DIR}/RNScreens/RNScreens.framework",
331332
"${BUILT_PRODUCTS_DIR}/React-Codegen/React_Codegen.framework",
332333
"${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
@@ -390,6 +391,7 @@
390391
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework",
391392
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/folly.framework",
392393
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
394+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNSVG.framework",
393395
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNScreens.framework",
394396
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React_Codegen.framework",
395397
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework",

gnoboard/ios/gnoboard/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"version": 1,
1212
"author": "expo"
1313
}
14-
}
14+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"info" : {
3-
"version" : 1,
4-
"author" : "expo"
2+
"info": {
3+
"version": 1,
4+
"author": "expo"
55
}
66
}

gnoboard/ios/gnoboard/Images.xcassets/SplashScreen.imageset/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"version": 1,
1919
"author": "expo"
2020
}
21-
}
21+
}

gnoboard/ios/gnoboard/Images.xcassets/SplashScreenBackground.imageset/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"version": 1,
1919
"author": "expo"
2020
}
21-
}
21+
}

gnoboard/package.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
"main": "node_modules/expo/AppEntry.js",
55
"scripts": {
66
"start": "expo start",
7-
"android": "expo run:android",
8-
"ios": "expo run:ios",
9-
"web": "expo start --web"
7+
"android": "npx react-native run-android",
8+
"ios": "npx react-native run-ios",
9+
"web": "expo start --web",
10+
"lint": "eslint src/**/*.{ts,tsx}",
11+
"lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx,json}'",
12+
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
1013
},
1114
"dependencies": {
1215
"@bufbuild/protobuf": "^1.3.1",
@@ -15,22 +18,37 @@
1518
"@react-navigation/bottom-tabs": "^6.5.8",
1619
"@react-navigation/native": "^6.1.7",
1720
"@react-navigation/native-stack": "^6.9.13",
21+
"buffer": "^6.0.3",
1822
"expo": "~49.0.7",
1923
"expo-splash-screen": "~0.20.5",
2024
"expo-status-bar": "~1.6.0",
2125
"fast-text-encoding": "^1.0.6",
2226
"react": "18.2.0",
2327
"react-native": "0.72.4",
2428
"react-native-safe-area-context": "4.6.3",
25-
"react-native-screens": "~3.22.0"
29+
"react-native-screens": "~3.22.0",
30+
"react-native-svg": "^13.14.0",
31+
"styled-components": "^6.0.8"
2632
},
2733
"devDependencies": {
2834
"@babel/core": "^7.20.0",
2935
"@tsconfig/react-native": "^3.0.2",
3036
"@types/jest": "^29.5.3",
3137
"@types/react": "^18.2.20",
3238
"@types/react-test-renderer": "^18.0.0",
39+
"@typescript-eslint/eslint-plugin": "^6.7.2",
40+
"@typescript-eslint/parser": "^6.7.2",
3341
"babel-plugin-module-resolver": "^5.0.0",
42+
"eslint": "^8.49.0",
43+
"eslint-config-prettier": "^9.0.0",
44+
"eslint-import-resolver-typescript": "^3.6.0",
45+
"eslint-plugin-import": "^2.28.1",
46+
"eslint-plugin-prettier": "^5.0.0",
47+
"eslint-plugin-react": "^7.33.2",
48+
"eslint-plugin-react-hooks": "^4.6.0",
49+
"eslint-plugin-storybook": "^0.6.14",
50+
"lint-staged": "^14.0.1",
51+
"prettier": "3.0.3",
3452
"typescript": "^5.1.6"
3553
},
3654
"private": true

gnoboard/src/components/button/index.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { ActivityIndicator, TouchableOpacity, Text, View } from 'react-native';
3+
import { StyleSheet } from 'react-native';
4+
import { colors } from '@gno/styles/colors';
5+
6+
const styles = StyleSheet.create({
7+
button: {
8+
backgroundColor: colors.blue,
9+
borderRadius: 4,
10+
marginVertical: 8,
11+
padding: 8,
12+
},
13+
buttonText: {
14+
color: colors.white,
15+
fontSize: 16,
16+
fontWeight: 'bold',
17+
textAlign: 'center',
18+
},
19+
});
20+
21+
type Props = {
22+
title: string;
23+
onPress: () => void;
24+
loading?: boolean;
25+
};
26+
27+
const Button: React.FC<Props> = ({ title, onPress, loading = false }) => {
28+
return (
29+
<TouchableOpacity onPress={onPress}>
30+
<View style={styles.button}>
31+
{loading ? (
32+
<ActivityIndicator size='small' />
33+
) : (
34+
<Text style={styles.buttonText}>{title}</Text>
35+
)}
36+
</View>
37+
</TouchableOpacity>
38+
);
39+
};
40+
41+
export default Button;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Button from '@gno/components/buttons';
2+
import { GnoAccount } from '@gno/native_modules/types';
3+
4+
interface SideMenuAccountItemProps {
5+
account: GnoAccount;
6+
changeAccount: (account: GnoAccount) => void;
7+
}
8+
9+
const SideMenuAccountItem = (props: SideMenuAccountItemProps) => {
10+
const { account, changeAccount } = props;
11+
return <Button title={account.name} onPress={() => changeAccount(account)} />;
12+
};
13+
14+
export default SideMenuAccountItem;

0 commit comments

Comments
 (0)