diff --git a/package.json b/package.json index 91f02735eb..39104f4101 100644 --- a/package.json +++ b/package.json @@ -55,11 +55,11 @@ "dotenv-cli": "^7.2.1", "eslint": "^8.50.0", "eslint-plugin-import": "^2.28.1", + "eslint-plugin-react": "^7.37.2", + "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unicorn": "^48.0.1", "eslint-plugin-unused-imports": "^3.0.0", - "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-react": "^7.37.2", "is-ci-cli": "^2.2.0", "jest": "^29.2.1", "jest-environment-jsdom": "^29.7.0", diff --git a/packages/mobile/app/(tabs)/assets.tsx b/packages/mobile/app/(tabs)/assets.tsx index 21bcd7c07f..3293357831 100644 --- a/packages/mobile/app/(tabs)/assets.tsx +++ b/packages/mobile/app/(tabs)/assets.tsx @@ -2,7 +2,7 @@ import { Dec } from "@osmosis-labs/unit"; import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"; import { FlashList } from "@shopify/flash-list"; import { debounce } from "debounce"; -import { useRouter } from "expo-router"; +import { Link } from "expo-router"; import { useMemo, useState } from "react"; import { ActivityIndicator, @@ -96,7 +96,7 @@ export default function TabTwoScreen() { ); const selectedDisplayOption = useMemo(() => { return displayOptions.find((item) => item.key === displayOption); - }, [items, displayOption]); + }, [displayOption]); return ( {isLoading ? ( - + + + ) : ( )} - {isFetchingNextPage && } + {isFetchingNextPage && ( + + + + )} ); @@ -180,112 +186,116 @@ const AssetItem = ({ }: { asset: RouterOutputs["local"]["assets"]["getMarketAssets"]["items"][number]; }) => { - const router = useRouter(); const { displayOption } = useDisplayOptionStore(); return ( - - router.push({ - pathname: "/asset/[id]", - params: { - id: asset.coinMinimalDenom.replace(/\//g, "-"), - coinDenom: asset.coinDenom, - coinImageUrl: asset.coinImageUrl, - }, - }) - } - style={styles.assetItem} + - - {asset.coinImageUrl?.endsWith(".svg") ? ( - - ) : ( - - )} - - {asset.coinDenom} + + + {asset.coinImageUrl?.endsWith(".svg") ? ( + + ) : ( + + )} + + {asset.coinDenom} + - - - {displayOption.startsWith("price") && ( - <> - - {asset.currentPrice ? ( - <> - {asset.currentPrice.symbol} - - - ) : ( - "" - )} - - {displayOption === "price-24h" && ( - - {asset.priceChange24h?.toString()} + + {displayOption.startsWith("price") && ( + <> + + {asset.currentPrice ? ( + <> + {asset.currentPrice.symbol} + + + ) : ( + "" + )} - )} + {displayOption === "price-24h" && ( + + {asset.priceChange24h?.toString()} + + )} - {displayOption === "price-7d" && ( - - {asset.priceChange7d?.toString()} - - )} + {displayOption === "price-7d" && ( + + {asset.priceChange7d?.toString()} + + )} - {displayOption === "price-1h" && ( - - {asset.priceChange1h?.toString()} - - )} - - )} + {displayOption === "price-1h" && ( + + {asset.priceChange1h?.toString()} + + )} + + )} - {displayOption === "volume" && ( - {asset.volume24h?.toString() ?? "-"} - )} + {displayOption === "volume" && ( + + {asset.volume24h?.toString() ?? "-"} + + )} - {displayOption === "market-cap" && ( - {asset.marketCap?.toString() ?? "-"} - )} + {displayOption === "market-cap" && ( + + {asset.marketCap?.toString() ?? "-"} + + )} - {displayOption === "favorite" && Favorite} - - + {displayOption === "favorite" && Favorite} + + + ); }; @@ -293,7 +303,6 @@ const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#0F172A", - padding: 16, }, header: { fontSize: 24, @@ -331,6 +340,7 @@ const styles = StyleSheet.create({ justifyContent: "space-between", alignItems: "center", marginBottom: 16, + paddingHorizontal: 24, }, subheader: { fontSize: 16, @@ -352,6 +362,7 @@ const styles = StyleSheet.create({ justifyContent: "space-between", alignItems: "center", paddingVertical: 12, + paddingHorizontal: 24, }, assetLeft: { flexDirection: "row", @@ -401,7 +412,6 @@ const styles = StyleSheet.create({ contentContainer: { backgroundColor: Colors.osmoverse[900], flex: 1, - paddingHorizontal: 24, paddingTop: 32, borderTopEndRadius: 32, borderTopStartRadius: 32, diff --git a/packages/mobile/app/asset/[id].tsx b/packages/mobile/app/asset/[coinMinimalDenom].tsx similarity index 71% rename from packages/mobile/app/asset/[id].tsx rename to packages/mobile/app/asset/[coinMinimalDenom].tsx index 67734896ba..3d35c4e426 100644 --- a/packages/mobile/app/asset/[id].tsx +++ b/packages/mobile/app/asset/[coinMinimalDenom].tsx @@ -6,25 +6,23 @@ import { Image, ScrollView, StyleSheet, - TouchableOpacity, View, } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; -import { AssetChart, AssetChartHeader } from "~/components/asset-chart"; -import { AssetDetails } from "~/components/asset-details"; -import { ChevronLeftIcon } from "~/components/icons/chevron-left"; +import { AssetChart, AssetChartHeader } from "~/components/asset/asset-chart"; +import { AssetDetails } from "~/components/asset/asset-details"; +import { RouteHeader } from "~/components/route-header"; import { Button } from "~/components/ui/button"; import { Text } from "~/components/ui/text"; -import { Colors } from "~/constants/theme-colors"; import { getChangeColor } from "~/utils/price"; import { api } from "~/utils/trpc"; const TRADE_BUTTON_HEIGHT = 100; const AssetRoute = () => { - const { id, coinDenom, coinImageUrl } = useLocalSearchParams<{ - id: string; + const { coinMinimalDenom, coinDenom, coinImageUrl } = useLocalSearchParams<{ + coinMinimalDenom: string; coinDenom: string; coinImageUrl: string; }>(); @@ -32,19 +30,13 @@ const AssetRoute = () => { return ( - - - - router.back()} - > - - + + + { /> {coinDenom} - - - + + +