Skip to content

Commit

Permalink
feat: gno dapp (#1420)
Browse files Browse the repository at this point in the history
* feat: allow for specialized apps

Signed-off-by: Norman Meier <[email protected]>

* chore: use teritori-dapp as default

Signed-off-by: Norman Meier <[email protected]>

* fix: teritori-dapp import

Signed-off-by: Norman Meier <[email protected]>

* feat: configure gno dapp

Signed-off-by: Norman Meier <[email protected]>

* feat: improve gno app

Signed-off-by: Norman Meier <[email protected]>

* feat: improve gno dapp

Signed-off-by: Norman Meier <[email protected]>

* feat: per-app netlify config

Signed-off-by: Norman Meier <[email protected]>

* fix: remove root netlify.toml

Signed-off-by: Norman Meier <[email protected]>

* fix: sed fail

Signed-off-by: Norman Meier <[email protected]>

* fix: hard noobing

Signed-off-by: Norman Meier <[email protected]>

* fix: restore teritori-dapp

Signed-off-by: Norman Meier <[email protected]>

* fix: rm root netlify again

Signed-off-by: Norman Meier <[email protected]>

* chore: fix-typo

Signed-off-by: Norman Meier <[email protected]>

* fix: teritori-dapp index

Signed-off-by: Norman Meier <[email protected]>

* feat: custom home

Signed-off-by: Norman Meier <[email protected]>

* fix: commit fail

Signed-off-by: Norman Meier <[email protected]>

* fix: teritori-dapp home config

Signed-off-by: Norman Meier <[email protected]>

* fix: include RedirectHome screen

Signed-off-by: Norman Meier <[email protected]>

* fix: home config

Signed-off-by: Norman Meier <[email protected]>

---------

Signed-off-by: Norman Meier <[email protected]>
  • Loading branch information
n0izn0iz authored Nov 25, 2024
1 parent 16b2f01 commit 2470e80
Show file tree
Hide file tree
Showing 27 changed files with 746 additions and 555 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,16 @@ module.exports = {
},
files: ["packages/components/navigation/**"],
},
{
rules: {
"no-restricted-imports": [
"error",
{
patterns: [disallowScriptsImports],
},
],
},
files: ["packages/dapp-root/**", "apps/**"],
},
],
};
247 changes: 0 additions & 247 deletions Root.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions apps/gno-dapp/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AppConfig } from "@/context/AppConfigProvider";
import AppRoot from "@/dapp-root/App";

const config: AppConfig = {
disableBuyTokensButton: true,
disableDAppStore: true,
forceNetworkList: ["gno-test5", "gno-portal"],
forceDAppsList: ["feed", "organizations"],
defaultNetworkId: "gno-test5",
homeScreen: "Feed",
};

export const App: React.FC = () => {
return <AppRoot config={config} />;
};
8 changes: 8 additions & 0 deletions apps/gno-dapp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from "expo";

import { App } from "./App";

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
9 changes: 9 additions & 0 deletions apps/gno-dapp/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build]
command = 'sed -i "s/teritori-dapp/gno-dapp/" package.json && npm i -g sharp-cli && npx expo-optimize && npx expo export -p web'
publish = '/dist'
[build.environment]
NODE_OPTIONS = "--max_old_space_size=4096"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
11 changes: 11 additions & 0 deletions apps/teritori-dapp/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { AppConfig } from "@/context/AppConfigProvider";
import AppRoot from "@/dapp-root/App";

const config: AppConfig = {
defaultNetworkId: "teritori",
homeScreen: "Home",
};

export const App: React.FC = () => {
return <AppRoot config={config} />;
};
8 changes: 8 additions & 0 deletions apps/teritori-dapp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from "expo";

import { App } from "./App";

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teritori-dapp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"main": "apps/teritori-dapp/index.js",
"scripts": {
"start": "expo start",
"android": "expo run:android",
Expand Down
40 changes: 24 additions & 16 deletions packages/components/NetworkSelector/NetworkSelectorMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { LegacyTertiaryBox } from "../boxes/LegacyTertiaryBox";
import { TertiaryButton } from "../buttons/TertiaryButton";
import { NetworksListModal } from "../modals/NetworksListModal";

import { useAppConfig } from "@/context/AppConfigProvider";

export const NetworkSelectorMenu: FC<{
forceNetworkId?: string;
forceNetworkKind?: NetworkKind;
Expand All @@ -46,6 +48,7 @@ export const NetworkSelectorMenu: FC<{
const [networksModalVisible, setNetworksModalVisible] = useState(false);
const enabledNetworks = useEnabledNetworks();
const isMobile = useIsMobile();
const { forceNetworkList } = useAppConfig();

const onPressNetwork = (networkId: string) => {
onSelect();
Expand Down Expand Up @@ -136,22 +139,27 @@ export const NetworkSelectorMenu: FC<{
</TouchableOpacity>
);
})}
<TertiaryButton
text="Manage"
size="XS"
squaresBackgroundColor={neutral17}
style={{ marginBottom: layout.spacing_x2 }}
onPress={() => {
setNetworksModalVisible(true);
}}
fullWidth
/>
<NetworksListModal
isVisible={networksModalVisible}
onClose={() => {
setNetworksModalVisible(false);
}}
/>
{!forceNetworkList && (
<>
{" "}
<TertiaryButton
text="Manage"
size="XS"
squaresBackgroundColor={neutral17}
style={{ marginBottom: layout.spacing_x2 }}
onPress={() => {
setNetworksModalVisible(true);
}}
fullWidth
/>
<NetworksListModal
isVisible={networksModalVisible}
onClose={() => {
setNetworksModalVisible(false);
}}
/>
</>
)}
</LegacyTertiaryBox>
);
};
Loading

0 comments on commit 2470e80

Please sign in to comment.