From 6b173de318e3a430b09f2fe55aa78b9d410f91b4 Mon Sep 17 00:00:00 2001 From: clegirar Date: Fri, 22 Sep 2023 09:14:09 +0200 Subject: [PATCH] fix: review and lint stuff Signed-off-by: clegirar --- Makefile | 2 +- packages/components/navigation/Navigator.tsx | 2 +- .../socialFeed/SocialActions/ShareButton.tsx | 5 ++- packages/networks/index.ts | 2 - .../apps/toripunks/query/useHistoryData.ts | 40 +++++++++++++++++++ .../apps/toripunks/query/userHistoryMock.ts | 19 +++++++++ ...tGameScreen.web.tsx => RiotGameScreen.tsx} | 0 packages/store/slices/marketplaceFilters.ts | 1 - packages/store/store.ts | 2 +- packages/utils/gno.ts | 1 - packages/utils/text.tsx | 4 -- 11 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 packages/screens/DAppStore/apps/toripunks/query/useHistoryData.ts create mode 100644 packages/screens/DAppStore/apps/toripunks/query/userHistoryMock.ts rename packages/screens/RiotGame/{RiotGameScreen.web.tsx => RiotGameScreen.tsx} (100%) diff --git a/Makefile b/Makefile index aea4c8cbde..4c43408848 100644 --- a/Makefile +++ b/Makefile @@ -246,4 +246,4 @@ networks.json: node_modules validate-networks .PHONY: unused-exports unused-exports: node_modules ## TODO unexclude all paths except packages/api;packages/contracts-clients;packages/evm-contracts-clients - npx ts-unused-exports ./tsconfig.json --excludePathsFromReport="packages/api;packages/contracts-clients;packages/evm-contracts-clients;packages/components/socialFeed/RichText/inline-toolbar;.*\.web|.electron|.d.ts" --ignoreTestFiles + npx ts-unused-exports ./tsconfig.json --excludePathsFromReport="packages/api;packages/contracts-clients;packages/evm-contracts-clients;packages/components/socialFeed/RichText/inline-toolbar;./App.tsx;.*\.web|.electron|.d.ts" --ignoreTestFiles diff --git a/packages/components/navigation/Navigator.tsx b/packages/components/navigation/Navigator.tsx index 6fb38f64fe..449d30e4a3 100644 --- a/packages/components/navigation/Navigator.tsx +++ b/packages/components/navigation/Navigator.tsx @@ -29,7 +29,7 @@ import { RiotGameInventoryScreen } from "../../screens/RiotGame/RiotGameInventor import { RiotGameLeaderboardScreen } from "../../screens/RiotGame/RiotGameLeaderboardScreen"; import { RiotGameMarketplaceScreen } from "../../screens/RiotGame/RiotGameMarketplaceScreen"; import { RiotGameMemoriesScreen } from "../../screens/RiotGame/RiotGameMemoriesScreen"; -import { RiotGameScreen } from "../../screens/RiotGame/RiotGameScreen.web"; +import { RiotGameScreen } from "../../screens/RiotGame/RiotGameScreen"; import { RiotersFooterScreen } from "../../screens/RiotersFooter/RiotersFooterScreen"; import { SettingsScreen } from "../../screens/Settings/SettingsScreen"; import { StakeScreen } from "../../screens/Stake"; diff --git a/packages/components/socialFeed/SocialActions/ShareButton.tsx b/packages/components/socialFeed/SocialActions/ShareButton.tsx index d1a96f5c8d..a9f303e978 100644 --- a/packages/components/socialFeed/SocialActions/ShareButton.tsx +++ b/packages/components/socialFeed/SocialActions/ShareButton.tsx @@ -7,11 +7,12 @@ import { layout } from "../../../utils/style/layout"; import { IconBox } from "../../IconBox"; import { SocialButton } from "../../buttons/SocialButton"; import ModalBase from "../../modals/ModalBase"; -interface FeedPostShareModalProps { + +interface ShareButtonProps { postId: string; } -export const ShareButton = ({ postId }: FeedPostShareModalProps) => { +export const ShareButton = ({ postId }: ShareButtonProps) => { const [isModalVisible, setIsModalVisible] = useState(false); const SOCIAL_BUTTONS = [ diff --git a/packages/networks/index.ts b/packages/networks/index.ts index 642dbf6853..d764f78c59 100644 --- a/packages/networks/index.ts +++ b/packages/networks/index.ts @@ -6,7 +6,6 @@ import { Decimal } from "@cosmjs/math"; import { Registry } from "@cosmjs/proto-signing"; import { SigningStargateClient, - StargateClient, GasPrice, defaultRegistryTypes, } from "@cosmjs/stargate"; @@ -28,7 +27,6 @@ import { teritoriNetwork } from "./teritori"; import { teritoriTestnetNetwork } from "./teritori-testnet"; import { CosmosNetworkInfo, - CurrencyInfo, EthereumNetworkInfo, GnoNetworkInfo, NativeCurrencyInfo, diff --git a/packages/screens/DAppStore/apps/toripunks/query/useHistoryData.ts b/packages/screens/DAppStore/apps/toripunks/query/useHistoryData.ts new file mode 100644 index 0000000000..6b42f4d65a --- /dev/null +++ b/packages/screens/DAppStore/apps/toripunks/query/useHistoryData.ts @@ -0,0 +1,40 @@ +import { useQuery } from "@tanstack/react-query"; + +import { historyData } from "./userHistoryMock"; +import { Wallet } from "../../../../../context/WalletsProvider"; + +export const useMyHistoryData = ({ + selectedWallet, +}: { + selectedWallet?: Wallet; +}) => { + const addr = selectedWallet?.address || ""; + const date = "2023-04-14"; //new Date().toISOString().slice(0, 10); + const { data, refetch } = useQuery( + ["history", addr], + async () => { + if (addr) { + const response = await fetch( + `https://api.roulette.aaa-metahuahua.com/tickets?addr=${addr}&date=${date}` + ); + return response.json(); + } + return []; + }, + { + initialData: [ + { + date: "00/0000", + tickets: { + bought: 0, + won: 0, + }, + toriWon: 0, + }, + ], + refetchOnMount: false, + enabled: false, + } + ); + return { data, refetch }; +}; diff --git a/packages/screens/DAppStore/apps/toripunks/query/userHistoryMock.ts b/packages/screens/DAppStore/apps/toripunks/query/userHistoryMock.ts new file mode 100644 index 0000000000..f585d52705 --- /dev/null +++ b/packages/screens/DAppStore/apps/toripunks/query/userHistoryMock.ts @@ -0,0 +1,19 @@ +interface HistoryItem { + round: string; + tickets: { + bought: number; + won: number; + }; + toriWon: number; +} + +export const historyData: HistoryItem[] = [ + { + round: "loading", + tickets: { + bought: 0, + won: 0, + }, + toriWon: 0, + }, +]; diff --git a/packages/screens/RiotGame/RiotGameScreen.web.tsx b/packages/screens/RiotGame/RiotGameScreen.tsx similarity index 100% rename from packages/screens/RiotGame/RiotGameScreen.web.tsx rename to packages/screens/RiotGame/RiotGameScreen.tsx diff --git a/packages/store/slices/marketplaceFilters.ts b/packages/store/slices/marketplaceFilters.ts index 7bf30de294..b18ba4368a 100644 --- a/packages/store/slices/marketplaceFilters.ts +++ b/packages/store/slices/marketplaceFilters.ts @@ -1,7 +1,6 @@ import { createEntityAdapter, createSlice, - EntityId, PayloadAction, } from "@reduxjs/toolkit"; diff --git a/packages/store/store.ts b/packages/store/store.ts index 37b2faef63..dd516dee59 100644 --- a/packages/store/store.ts +++ b/packages/store/store.ts @@ -1,7 +1,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import { combineReducers, configureStore } from "@reduxjs/toolkit"; import { useDispatch } from "react-redux"; -import { persistStore, persistReducer } from "redux-persist"; +import { persistReducer } from "redux-persist"; import { dAppsReducer, dAppsReducerPersisted } from "./slices/dapps-store"; import { diff --git a/packages/utils/gno.ts b/packages/utils/gno.ts index e7b58bb217..8923fc9247 100644 --- a/packages/utils/gno.ts +++ b/packages/utils/gno.ts @@ -1,6 +1,5 @@ import { GnoJSONRPCProvider } from "@gnolang/gno-js-client"; -import { Status } from "../contracts-clients/dao-proposal-single/DaoProposalSingle.types"; import { mustGetGnoNetwork } from "../networks"; interface AdenaDoContractMessage { diff --git a/packages/utils/text.tsx b/packages/utils/text.tsx index 6a84330dda..5b14fac3f8 100644 --- a/packages/utils/text.tsx +++ b/packages/utils/text.tsx @@ -1,7 +1,3 @@ -import React, { ComponentType } from "react"; - -import { DEFAULT_USERNAME } from "./social-feed"; - export const capitalize = (s: string) => (s && s[0].toUpperCase() + s.slice(1)) || "";