From ec83b99682f1bc7cef8bc4d40549889b9727720b Mon Sep 17 00:00:00 2001 From: sachin-into <154645503+sachin-into@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:17:44 +0545 Subject: [PATCH] fix(mini-mode): navigation (#960) * fix(DAppStore): Fix navigation in DAppsList component, disallow external apps Since the native wallet is only available in app and not in the web * modified Navigater component and placed normal and mini navigator on same stack fixed dapp store apps onPress navigation * fix: getNav on platform specific * removed view seed screen from normal navigation screen * feat(DAppStore): update import paths in getFromFile.ts (fix/mini-navigation) * feat(DAppStore): update DApp title in getFromFile query - Update the title of the DApp "toriwallet" to "Teritori OS Wallet" in the getFromFile query. * feat(DAppStore): hide Osmosis in Teritori OS Mobile mode * feat(DAppStore): show native wallet only on mobile. In the web show wallet manager * fix rebase conflict * fixed unused exports --------- Co-authored-by: Eng. Juan Combetto --- assets/icons/feed-gray.svg | 4 + packages/components/navigation/Navigator.tsx | 33 +++- ...deNavigator.tsx => getMiniModeScreens.tsx} | 62 +------- ...Navigator.tsx => getNormalModeScreens.tsx} | 18 +-- .../navigation/platformSpecific.web.tsx | 4 +- packages/components/navigation/util.tsx | 7 +- .../screens/DAppStore/query/getFromFile.ts | 142 ++++++++++-------- packages/screens/Mini/About/AboutScreen.tsx | 2 +- packages/screens/Mini/Chat/MiniChatScreen.tsx | 2 +- .../ConnectLedger/ConnectLedgerScreen.tsx | 3 +- .../screens/Mini/Conversation/ChatHeader.tsx | 2 +- .../Mini/DAppStore/DAppStoreScreen.tsx | 50 +++++- .../Mini/DAppStore/component/DAppsList.tsx | 33 ++-- .../screens/Mini/Wallet/SendingToriScreen.tsx | 7 +- .../Mini/components/AppBar/CustomAppBar.tsx | 2 +- .../Mini/components/SettingMenuItems.tsx | 4 +- .../screens/Wallet/Screens/NativeWallet.tsx | 2 +- .../screens/Wallet/Screens/SucessScreen.tsx | 4 +- packages/scripts/validateNetworks.ts | 7 +- packages/utils/navigation.ts | 6 +- 20 files changed, 227 insertions(+), 167 deletions(-) create mode 100644 assets/icons/feed-gray.svg rename packages/components/navigation/{MiniModeNavigator.tsx => getMiniModeScreens.tsx} (87%) rename packages/components/navigation/{NormalModeNavigator.tsx => getNormalModeScreens.tsx} (97%) diff --git a/assets/icons/feed-gray.svg b/assets/icons/feed-gray.svg new file mode 100644 index 0000000000..06a88f441f --- /dev/null +++ b/assets/icons/feed-gray.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/components/navigation/Navigator.tsx b/packages/components/navigation/Navigator.tsx index 129e89c27b..88cea43b2b 100644 --- a/packages/components/navigation/Navigator.tsx +++ b/packages/components/navigation/Navigator.tsx @@ -1,13 +1,34 @@ -import { MiniModeNavigator } from "./MiniModeNavigator"; -import { NormalModeNavigator } from "./NormalModeNavigator"; +import { Platform } from "react-native"; + +import { Sidebar } from "./Sidebar"; +import { getMiniModeScreens } from "./getMiniModeScreens"; +import { getNormalModeScreens } from "./getNormalModeScreens"; +import { getNav } from "./util"; import { useAppMode } from "@/hooks/useAppMode"; +import { useOnboardedStatus } from "@/hooks/useOnboardStatus"; +import { AppMode } from "@/utils/types/app-mode"; -export const Navigator = () => { +export const Navigator: React.FC = () => { const [appMode] = useAppMode(); + const [isLoading] = useOnboardedStatus(); + + const { Nav, navigatorScreenOptions } = getNav(appMode as AppMode); - if (appMode === "mini") { - return ; + if (isLoading && appMode === "mini") { + return null; } - return ; + + return ( + + Platform.OS === "web" || appMode === "mini" ? null : + } + screenOptions={navigatorScreenOptions as any} // FIXME: upgrade to expo-router + > + {getNormalModeScreens({ appMode: appMode as AppMode })} + {appMode === "mini" ? getMiniModeScreens() : null} + + ); }; diff --git a/packages/components/navigation/MiniModeNavigator.tsx b/packages/components/navigation/getMiniModeScreens.tsx similarity index 87% rename from packages/components/navigation/MiniModeNavigator.tsx rename to packages/components/navigation/getMiniModeScreens.tsx index 414cdb37df..f1fa555125 100644 --- a/packages/components/navigation/MiniModeNavigator.tsx +++ b/packages/components/navigation/getMiniModeScreens.tsx @@ -10,9 +10,6 @@ import { RootStackParamList } from "../../utils/navigation"; import { neutral00, secondaryColor } from "../../utils/style/colors"; import { TabBarIcon } from "../TabBarIcon"; -import { useOnboardedStatus } from "@/hooks/useOnboardStatus"; -import { FeedPostViewScreen } from "@/screens/FeedPostView/FeedPostViewScreen"; -import { NFTDetailScreen } from "@/screens/Marketplace/NFTDetailScreen"; import AboutScreen from "@/screens/Mini/About/AboutScreen"; import AddAddressBookScreen from "@/screens/Mini/AddressBook/AddAddressBookScreen"; import AddressBookScreen from "@/screens/Mini/AddressBook/AddressBookScreen"; @@ -49,12 +46,8 @@ import SelectTokenScreen from "@/screens/Mini/Wallet/SelectTokenScreen"; import SendToriScreen from "@/screens/Mini/Wallet/SendToriScreen"; import SendingToriScreen from "@/screens/Mini/Wallet/SendingToriScreen"; import TransactionDetailScreen from "@/screens/Mini/Wallet/TransactionDetailScreen"; -import { CreatePassword } from "@/screens/Wallet/Screens/CreatePassword"; import { CreatePasswordWallet } from "@/screens/Wallet/Screens/CreatePasswordWallet"; import { CreateWalletScreen } from "@/screens/Wallet/Screens/CreateWalletScreen"; -import { ImportWallet } from "@/screens/Wallet/Screens/ImportWallet"; -import NativeWallet from "@/screens/Wallet/Screens/NativeWallet"; -import { SuccessScreen } from "@/screens/Wallet/Screens/SucessScreen"; const Stack = createNativeStackNavigator(); const Tab = createBottomTabNavigator(); @@ -94,15 +87,9 @@ const MainTab = () => { ); }; -export const MiniModeNavigator = () => { - const [isLoading, isOnboarded] = useOnboardedStatus(); - - if (isLoading) return null; - +export const getMiniModeScreens = () => { return ( - + <> { title: "", }} /> - null, title: "Wallet Create" }} - /> + null }} component={MainTab} /> - null, - title: "Import Wallet with Seed", - }} - /> + { title: "Create Password", }} /> - null, - title: "Create Password", - }} - /> + { title: "Chat", }} /> - null, - title: "All Set", - }} - /> + { title: "", }} /> - null, title: "Feed", animation: "fade" }} - /> - null, title: "NFT" }} - /> - + ); }; diff --git a/packages/components/navigation/NormalModeNavigator.tsx b/packages/components/navigation/getNormalModeScreens.tsx similarity index 97% rename from packages/components/navigation/NormalModeNavigator.tsx rename to packages/components/navigation/getNormalModeScreens.tsx index a0d68ec52d..a30b603946 100644 --- a/packages/components/navigation/NormalModeNavigator.tsx +++ b/packages/components/navigation/getNormalModeScreens.tsx @@ -1,9 +1,7 @@ import React from "react"; -import { Platform } from "react-native"; -import { Sidebar } from "./Sidebar"; import { platformScreens } from "./platformSpecific"; -import { Nav, navigatorScreenOptions, screenTitle } from "./util"; +import { getNav, screenTitle } from "./util"; import { AdministrationDashboardScreen } from "@/screens/AdministrationDashboard/AdministrationDashboardScreen"; import { AllProjectAdministrationDashScreen } from "@/screens/AllProjectAdministrationDash/AllProjectAdministrationDashScreen"; @@ -60,19 +58,19 @@ import NativeWallet from "@/screens/Wallet/Screens/NativeWallet"; import { SuccessScreen } from "@/screens/Wallet/Screens/SucessScreen"; import { WalletManagerScreen } from "@/screens/WalletManager/WalletManagerScreen"; import { WalletManagerWalletsScreen } from "@/screens/WalletManager/WalletsScreen"; +import { AppMode } from "@/utils/types/app-mode"; + +export const getNormalModeScreens = ({ appMode }: { appMode: AppMode }) => { + const { Nav } = getNav(appMode); -export const NormalModeNavigator: React.FC = () => { return ( - (Platform.OS === "web" ? null : )} - screenOptions={navigatorScreenOptions as any} // FIXME: upgrade to expo-router - > + <> null, title: screenTitle("Home") }} /> + { }} /> {platformScreens} - + ); }; diff --git a/packages/components/navigation/platformSpecific.web.tsx b/packages/components/navigation/platformSpecific.web.tsx index c0c830df9a..981380041f 100644 --- a/packages/components/navigation/platformSpecific.web.tsx +++ b/packages/components/navigation/platformSpecific.web.tsx @@ -1,9 +1,11 @@ // axelar libs imported by the bridge screen are breaking the ios CI -import { Nav, screenTitle } from "./util"; +import { getNav, screenTitle } from "./util"; import { RiotGameBridgeScreen } from "@/screens/RiotGame/RiotGameBridgeScreen"; +const { Nav } = getNav("normal"); + export const platformScreens: JSX.Element = ( <> { - if (Platform.OS === "web") { +export const getNav = (appMode: AppMode) => { + if (Platform.OS === "web" || appMode === "mini") { return { Nav: createNativeStackNavigator(), navigatorScreenOptions: {}, @@ -26,5 +27,3 @@ const getNav = () => { }; export const screenTitle = (title: string) => "Teritori - " + title; - -export const { Nav, navigatorScreenOptions } = getNav(); diff --git a/packages/screens/DAppStore/query/getFromFile.ts b/packages/screens/DAppStore/query/getFromFile.ts index f325dc3004..9b9d0a0302 100644 --- a/packages/screens/DAppStore/query/getFromFile.ts +++ b/packages/screens/DAppStore/query/getFromFile.ts @@ -1,47 +1,46 @@ import { Platform } from "react-native"; -import BookMarkIcon from "../../../../assets/icons/bookmark.svg"; -import dao from "../../../../assets/icons/dao.svg"; -import socialFeed from "../../../../assets/icons/feed.svg"; -import freelance from "../../../../assets/icons/freelanceservice.svg"; -import governance from "../../../../assets/icons/governance.svg"; -import checklogo from "../../../../assets/icons/greenCheck.svg"; -import launchpad from "../../../../assets/icons/launchpad.svg"; -import leap from "../../../../assets/icons/leap-cosmos-logo.svg"; -import marketplace from "../../../../assets/icons/marketplace.svg"; -import messages from "../../../../assets/icons/messages.svg"; -import multisig from "../../../../assets/icons/multisig.svg"; -import osmosisSVG from "../../../../assets/icons/networks/osmosis.svg"; -import teritoriSVG from "../../../../assets/icons/networks/teritori.svg"; -import pathwar from "../../../../assets/icons/pathwar.svg"; -import otherAppsIcon from "../../../../assets/icons/random-goods-icon.svg"; -import riot from "../../../../assets/icons/rioters-game.svg"; -import staking from "../../../../assets/icons/staking.svg"; -import tnsService from "../../../../assets/icons/tns-service.svg"; -import wallet from "../../../../assets/icons/wallet.svg"; -import axelarLogo from "../../../../assets/logos/Axelar-logo.svg"; -import mapOfZones from "../../../../assets/logos/MoZ-icon.svg"; -import astroportLogo from "../../../../assets/logos/astroport.svg"; -import calcfinance from "../../../../assets/logos/calc-finance.jpg"; -import coinHallLogo from "../../../../assets/logos/coinhall.svg"; -import mintscanLogo from "../../../../assets/logos/cosmostation-val.png"; -import daodao from "../../../../assets/logos/daodao.png"; -import kjnodes from "../../../../assets/logos/kjnodes-logo.svg"; -import kujirapod from "../../../../assets/logos/kujira-network.svg"; -import nodesguruLogo from "../../../../assets/logos/nodeguru-val.svg"; -import pingpubLogo from "../../../../assets/logos/pingpub-val.svg"; -import pulsarLogo from "../../../../assets/logos/pulsar-logo.svg"; -import radyium from "../../../../assets/logos/raydium.png"; -import restake from "../../../../assets/logos/restake.png"; -import skip from "../../../../assets/logos/skip.png"; -import stakemeLogo from "../../../../assets/logos/stakeme-val.svg"; -import subdao from "../../../../assets/logos/subdao.png"; -import tfm from "../../../../assets/logos/tfm-logo.png"; -import theGraph from "../../../../assets/logos/theGraph.png"; -import toripunks from "../../../../assets/logos/toniPunks.png"; -import uniswap from "../../../../assets/logos/uniswap.png"; -import yieldmos from "../../../../assets/logos/yieldmos.png"; - +import BookMarkIcon from "@/assets/icons/bookmark.svg"; +import dao from "@/assets/icons/dao.svg"; +import socialFeed from "@/assets/icons/feed.svg"; +import freelance from "@/assets/icons/freelanceservice.svg"; +import governance from "@/assets/icons/governance.svg"; +import checklogo from "@/assets/icons/greenCheck.svg"; +import launchpad from "@/assets/icons/launchpad.svg"; +import leap from "@/assets/icons/leap-cosmos-logo.svg"; +import marketplace from "@/assets/icons/marketplace.svg"; +import messages from "@/assets/icons/messages.svg"; +import multisig from "@/assets/icons/multisig.svg"; +import osmosisSVG from "@/assets/icons/networks/osmosis.svg"; +import teritoriSVG from "@/assets/icons/networks/teritori.svg"; +import pathwar from "@/assets/icons/pathwar.svg"; +import otherAppsIcon from "@/assets/icons/random-goods-icon.svg"; +import riot from "@/assets/icons/rioters-game.svg"; +import staking from "@/assets/icons/staking.svg"; +import tnsService from "@/assets/icons/tns-service.svg"; +import wallet from "@/assets/icons/wallet.svg"; +import axelarLogo from "@/assets/logos/Axelar-logo.svg"; +import mapOfZones from "@/assets/logos/MoZ-icon.svg"; +import astroportLogo from "@/assets/logos/astroport.svg"; +import calcfinance from "@/assets/logos/calc-finance.jpg"; +import coinHallLogo from "@/assets/logos/coinhall.svg"; +import mintscanLogo from "@/assets/logos/cosmostation-val.png"; +import daodao from "@/assets/logos/daodao.png"; +import kjnodes from "@/assets/logos/kjnodes-logo.svg"; +import kujirapod from "@/assets/logos/kujira-network.svg"; +import nodesguruLogo from "@/assets/logos/nodeguru-val.svg"; +import pingpubLogo from "@/assets/logos/pingpub-val.svg"; +import pulsarLogo from "@/assets/logos/pulsar-logo.svg"; +import radyium from "@/assets/logos/raydium.png"; +import restake from "@/assets/logos/restake.png"; +import skip from "@/assets/logos/skip.png"; +import stakemeLogo from "@/assets/logos/stakeme-val.svg"; +import subdao from "@/assets/logos/subdao.png"; +import tfm from "@/assets/logos/tfm-logo.png"; +import theGraph from "@/assets/logos/theGraph.png"; +import toripunks from "@/assets/logos/toniPunks.png"; +import uniswap from "@/assets/logos/uniswap.png"; +import yieldmos from "@/assets/logos/yieldmos.png"; import { isElectron } from "@/utils/isElectron"; import { dAppGroup } from "@/utils/types/dapp-store"; @@ -83,16 +82,31 @@ export function getAvailableApps(): dAppGroup { selectedByDefault: true, alwaysOn: true, }, - wallet: { - id: "wallet", - title: "My Wallet", - description: "Wallet", - icon: wallet, - route: "WalletManager", - groupKey: "teritori-core-apps", - selectedByDefault: true, - alwaysOn: true, - }, + ...(Platform.OS !== "web" + ? { + toriwallet: { + id: "toriwallet", + title: "Teritori OS Wallet", + description: "Wallet", + icon: wallet, + route: "NativeWallet", + groupKey: "teritori-core-apps", + selectedByDefault: true, + alwaysOn: false, + }, + } + : { + wallet: { + id: "wallet", + title: "My Wallet", + description: "Wallet", + icon: wallet, + route: "WalletManager", + groupKey: "teritori-core-apps", + selectedByDefault: true, + alwaysOn: true, + }, + }), governance: { id: "governance", title: "Governance", @@ -145,16 +159,20 @@ export function getAvailableApps(): dAppGroup { icon: checklogo, active: true, options: { - osmosis: { - id: "osmosis", - title: "Osmosis Dex", - description: "Advanced automated market maker (AMM)", - icon: osmosisSVG, - route: "Swap", - groupKey: "top-apps", - selectedByDefault: true, - alwaysOn: false, - }, + ...(Platform.OS !== "web" + ? { + osmosis: { + id: "osmosis", + title: "Osmosis Dex", + description: "Advanced automated market maker (AMM)", + icon: osmosisSVG, + route: "Swap", + groupKey: "top-apps", + selectedByDefault: true, + alwaysOn: false, + }, + } + : {}), "social-feed": { id: "social-feed", title: "Social Feed", diff --git a/packages/screens/Mini/About/AboutScreen.tsx b/packages/screens/Mini/About/AboutScreen.tsx index 89e3582529..bea997a289 100644 --- a/packages/screens/Mini/About/AboutScreen.tsx +++ b/packages/screens/Mini/About/AboutScreen.tsx @@ -50,7 +50,7 @@ export default function AboutScreen({ navigation }: AboutScreenProps) { const onClose = () => navigation.canGoBack() ? navigation.goBack() - : navigation.replace("MiniTabs"); + : navigation.replace("MiniTabs", { screen: "MiniChats" }); return ( diff --git a/packages/screens/Mini/Chat/MiniChatScreen.tsx b/packages/screens/Mini/Chat/MiniChatScreen.tsx index fb1adfd803..9d79aa8b71 100644 --- a/packages/screens/Mini/Chat/MiniChatScreen.tsx +++ b/packages/screens/Mini/Chat/MiniChatScreen.tsx @@ -19,7 +19,7 @@ import { BrandText } from "@/components/BrandText"; import { SVG } from "@/components/SVG"; import { ScreenContainer } from "@/components/ScreenContainer"; import { CustomPressable } from "@/components/buttons/CustomPressable"; -import { MiniTabScreenFC } from "@/components/navigation/MiniModeNavigator"; +import { MiniTabScreenFC } from "@/components/navigation/getMiniModeScreens"; import { SpacerColumn } from "@/components/spacer"; import { RoundedTabs } from "@/components/tabs/RoundedTabs"; import { ToastInfo } from "@/components/toasts/ToastInfo"; diff --git a/packages/screens/Mini/ConnectLedger/ConnectLedgerScreen.tsx b/packages/screens/Mini/ConnectLedger/ConnectLedgerScreen.tsx index 8e70e716eb..049b1ed52a 100644 --- a/packages/screens/Mini/ConnectLedger/ConnectLedgerScreen.tsx +++ b/packages/screens/Mini/ConnectLedger/ConnectLedgerScreen.tsx @@ -34,7 +34,8 @@ export const ConnectLedgerScreen: ScreenFC<"ConnectLedger"> = ({ setActiveStep(step); }; - const onComplete = () => navigation.navigate("MiniTabs"); + const onComplete = () => + navigation.navigate("MiniTabs", { screen: "MiniChats" }); const activeScreenPosition = +activeStep.split("_")[1]; const screenPercentage = diff --git a/packages/screens/Mini/Conversation/ChatHeader.tsx b/packages/screens/Mini/Conversation/ChatHeader.tsx index 83854044b7..c56b8a030d 100644 --- a/packages/screens/Mini/Conversation/ChatHeader.tsx +++ b/packages/screens/Mini/Conversation/ChatHeader.tsx @@ -29,7 +29,7 @@ export const ChatHeader = ({ navigation, conversation }: HeaderProps) => { const navigateBack = () => navigation.canGoBack() ? navigation.goBack() - : navigation.replace("MiniTabs"); + : navigation.replace("MiniTabs", { screen: "MiniChats" }); const handlePhoneCellPress = () => { alert("Phone cell"); diff --git a/packages/screens/Mini/DAppStore/DAppStoreScreen.tsx b/packages/screens/Mini/DAppStore/DAppStoreScreen.tsx index 56140ae5eb..7984940e4b 100644 --- a/packages/screens/Mini/DAppStore/DAppStoreScreen.tsx +++ b/packages/screens/Mini/DAppStore/DAppStoreScreen.tsx @@ -3,15 +3,19 @@ import { FlatList, useWindowDimensions, View } from "react-native"; import { DAppStoreMenuItem } from "./component/DAppStoreMenuItems"; import { DAppsList } from "./component/DAppsList"; +import chatSVG from "../../../../assets/icons/chat-gray.svg"; +import feedSVG from "../../../../assets/icons/feed-gray.svg"; import penSVG from "../../../../assets/icons/pen-solid.svg"; +import walletSVG from "../../../../assets/icons/wallet-grey.svg"; import { BlurScreenContainer } from "../layout/BlurScreenContainer"; import { BrandText } from "@/components/BrandText"; +import { SVG } from "@/components/SVG"; import { CustomPressable } from "@/components/buttons/CustomPressable"; import { Separator } from "@/components/separators/Separator"; import { ScreenFC } from "@/utils/navigation"; import { blueDefault } from "@/utils/style/colors"; -import { fontSemibold15 } from "@/utils/style/fonts"; +import { fontMedium14, fontSemibold15 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; export const DAppStoreScreen: ScreenFC<"MiniDAppStore"> = ({ navigation }) => { @@ -64,6 +68,50 @@ export const DAppStoreScreen: ScreenFC<"MiniDAppStore"> = ({ navigation }) => { )} + {!enableEditingDApps && ( + + + navigation.navigate("MiniTabs", { + screen: "MiniChats", + }) + } + style={{ alignItems: "center", gap: layout.spacing_x1 }} + > + + Chat + + + navigation.navigate("MiniTabs", { + screen: "MiniFeeds", + }) + } + style={{ alignItems: "center", gap: layout.spacing_x1 }} + > + + Feeds + + + navigation.navigate("MiniTabs", { + screen: "MiniWallets", + }) + } + style={{ alignItems: "center", gap: layout.spacing_x1 }} + > + + Wallets + + + )} ); }; diff --git a/packages/screens/Mini/DAppStore/component/DAppsList.tsx b/packages/screens/Mini/DAppStore/component/DAppsList.tsx index f1cb8b5b2d..faef60fab6 100644 --- a/packages/screens/Mini/DAppStore/component/DAppsList.tsx +++ b/packages/screens/Mini/DAppStore/component/DAppsList.tsx @@ -7,6 +7,7 @@ import { DAppStoreMenuItem } from "./DAppStoreMenuItems"; import { BrandText } from "@/components/BrandText"; import { Separator } from "@/components/separators/Separator"; +import { useAppNavigation } from "@/hooks/navigation/useAppNavigation"; import { selectAvailableApps, selectCheckedApps, @@ -15,6 +16,7 @@ import { } from "@/store/slices/dapps-store"; import { useAppDispatch } from "@/store/store"; import { getValuesFromId, SEPARATOR } from "@/utils/dapp-store"; +import { RouteName } from "@/utils/navigation"; import { layout } from "@/utils/style/layout"; import { dAppType } from "@/utils/types/dapp-store"; @@ -24,7 +26,7 @@ type Props = { export const DAppsList = ({ isEditing }: Props) => { const dispatch = useAppDispatch(); - + const navigation = useAppNavigation(); const { width: windowsWidth } = useWindowDimensions(); const availableApps = useSelector(selectAvailableApps); const selectedApps = useSelector(selectCheckedApps); @@ -95,12 +97,9 @@ export const DAppsList = ({ isEditing }: Props) => { } }, [topApps, staking, externalApps, selectedApps, getOptions]); - const alwaysOnApps = useMemo(() => { - return [ - ...Object.values(coreDApps.options).filter((x) => x.alwaysOn), - ...Object.values(topApps.options).filter((x) => x.alwaysOn), - ]; - }, [coreDApps, topApps]); + const alwaysOnApps = Object.values(coreDApps.options) + .concat(Object.values(topApps.options)) + .filter((x: dAppType) => x.alwaysOn); const handleClick = (groupKey: string, id: string) => { const draggableId = `${groupKey}${SEPARATOR}${id}`; @@ -127,7 +126,11 @@ export const DAppsList = ({ isEditing }: Props) => { icon={item.icon} title={item.title} isAdded - onPress={() => alert(item.title)} + onPress={() => { + if (!["External", "ComingSoon"].includes(item.route)) { + navigation.replace(item.route as RouteName); + } + }} /> ); }} @@ -135,7 +138,9 @@ export const DAppsList = ({ isEditing }: Props) => { /> item.route !== "External", + )} onItemReorder={({ fromIndex, toIndex }) => { const newData = selectedApps.slice(); newData.splice(toIndex, 0, newData.splice(fromIndex, 1)[0]); @@ -149,7 +154,11 @@ export const DAppsList = ({ isEditing }: Props) => { title={item?.title || ""} subTitle={item?.description} isEditing={isEditing} - onPress={() => alert(item?.title)} + onPress={() => { + if (!["External", "ComingSoon"].includes(item.route)) { + navigation.replace(item.route as RouteName); + } + }} isAdded onActionPress={() => item && handleClick(item.groupKey, item.id) @@ -164,7 +173,9 @@ export const DAppsList = ({ isEditing }: Props) => { {isEditing && ( item.route !== "External", + )} renderItem={({ item, index }) => { return ( navigation.navigate("MiniTabs")} + onPress={() => + navigation.navigate("MiniTabs", { screen: "MiniWallets" }) + } style={{ flex: 1 }} /> { const navigation = useAppNavigation(); const onMenuItemPress = () => { - navigation.replace(navigateTo, { back: "MiniSettings" }); + if (navigation.replace) { + navigation.replace(navigateTo, { back: "MiniSettings" }); + } }; return ( <> diff --git a/packages/screens/Wallet/Screens/NativeWallet.tsx b/packages/screens/Wallet/Screens/NativeWallet.tsx index 5765ea12f9..dfb3101472 100644 --- a/packages/screens/Wallet/Screens/NativeWallet.tsx +++ b/packages/screens/Wallet/Screens/NativeWallet.tsx @@ -69,7 +69,7 @@ const NativeWallet: ScreenFC<"NativeWallet"> = () => { marginVertical: layout.spacing_x2, }} onPress={(_, navigation) => { - navigation.navigate("MiniTabs"); + navigation.navigate("MiniTabs", { screen: "MiniChats" }); }} /> )} diff --git a/packages/screens/Wallet/Screens/SucessScreen.tsx b/packages/screens/Wallet/Screens/SucessScreen.tsx index dc8c681bdf..d5e6cc5a78 100644 --- a/packages/screens/Wallet/Screens/SucessScreen.tsx +++ b/packages/screens/Wallet/Screens/SucessScreen.tsx @@ -9,7 +9,9 @@ export const SuccessScreen: ScreenFC<"SuccessScreen"> = ({ navigation }) => { return ( navigation.navigate("MiniTabs")} + onComplete={() => + navigation.navigate("MiniTabs", { screen: "MiniChats" }) + } description="Click on the Start button to launch Teritori." /> diff --git a/packages/scripts/validateNetworks.ts b/packages/scripts/validateNetworks.ts index 5c760fc9d6..13d81ed592 100644 --- a/packages/scripts/validateNetworks.ts +++ b/packages/scripts/validateNetworks.ts @@ -1,9 +1,4 @@ -import { - allNetworks, - getNativeCurrency, - NetworkFeature, - NetworkKind, -} from "../networks"; +import { allNetworks, getNativeCurrency, NetworkKind } from "../networks"; const ids: { [key: string]: boolean } = {}; const idPrefixes: { [key: string]: boolean } = {}; diff --git a/packages/utils/navigation.ts b/packages/utils/navigation.ts index b8449fe405..c48e805fb7 100644 --- a/packages/utils/navigation.ts +++ b/packages/utils/navigation.ts @@ -10,6 +10,10 @@ import { uppTabItems } from "./upp"; export type RouteName = keyof RootStackParamList; +type MiniTabsScreen = { + screen?: "MiniChats" | "MiniWallets" | "MiniFeeds"; +}; + export type RootStackParamList = { Home?: { network?: string }; MyCollection: undefined; @@ -97,7 +101,7 @@ export type RootStackParamList = { SuccessScreen: undefined; //Mini Screens - MiniTabs: undefined; + MiniTabs: MiniTabsScreen; Conversation: { conversationId: string }; MiniChats: { back?: RouteName }; MiniWallets: undefined;