diff --git a/.eslintrc b/.eslintrc index c73227bfec..95523ba685 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,8 @@ { "endOfLine": "auto" } - ] + ], + "import/named": "error" }, "settings": { "import/resolver": { diff --git a/package.json b/package.json index a4b12afd78..2569a640f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "givethdapp", - "version": "2.0.6", + "version": "2.0.7", "private": true, "scripts": { "build": "next build", @@ -19,6 +19,7 @@ "@ethersproject/units": "^5.5.0", "@giveth/ui-design-system": "^1.8.3", "@gnosis.pm/safe-apps-web3-react": "^1.3.0", + "@reduxjs/toolkit": "^1.8.1", "@sentry/nextjs": "^6.19.3", "@toruslabs/torus-embed": "^1.20.2", "@uniswap/v3-sdk": "^3.6.2-optimism-regenesis", @@ -29,13 +30,13 @@ "axios": "^0.25.0", "bignumber.js": "^9.0.1", "deepmerge": "^4.2.2", - "ethers": "^5.5.3", + "ethers": "^5.6.5", "framer-motion": "^6.2.8", "graphql": "^16.0.1", "human-standard-token-abi": "^2.0.0", "lodash.debounce": "^4.0.8", "lodash.isequal": "^4.5.0", - "next": "^12.1.4", + "next": "^12.1.6", "nprogress": "^0.2.0", "quill": "^1.3.7", "quill-emoji": "^0.2.0", @@ -51,9 +52,11 @@ "react-lottie": "^1.2.3", "react-places-autocomplete": "^7.3.0", "react-quill": "^2.0.0-beta.4", + "react-redux": "^8.0.1", "react-select": "^5.2.1", "react-share": "^4.4.0", "sharp": "^0.30.3", + "siwe": "^1.1.6", "styled-components": "^5.3.0", "unsplash-js": "^7.0.15" }, diff --git a/pages/_app.tsx b/pages/_app.tsx index 7067746597..c320ea4f35 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -7,18 +7,18 @@ import { ExternalProvider, Web3Provider } from '@ethersproject/providers'; import NProgress from 'nprogress'; import { useRouter } from 'next/router'; -import { NftsProvider } from '@/context/positions.context'; -import { TokenDistroProvider } from '@/context/tokenDistro.context'; -import { SubgraphProvider } from '@/context/subgraph.context'; -import { PriceProvider } from '@/context/price.context'; +import { Provider } from 'react-redux'; import { GeneralProvider } from '@/context/general.context'; import { useApollo } from '@/apollo/apolloClient'; -import { UserProvider } from '@/context/UserProvider'; -import { ModalProvider } from '@/context/ModalProvider'; import { HeaderWrapper } from '@/components/Header/HeaderWrapper'; import { FooterWrapper } from '@/components/Footer/FooterWrapper'; import '../styles/globals.css'; +import { store } from '@/features/store'; +import SubgraphController from '@/components/controller/subgraph.ctrl'; +import UserController from '@/components/controller/user.ctrl'; +import ModalController from '@/components/controller/modal.ctrl'; +import PriceController from '@/components/controller/price.ctrl'; import type { AppProps } from 'next/app'; function getLibrary(provider: ExternalProvider) { @@ -57,27 +57,21 @@ function MyApp({ Component, pageProps }: AppProps) { content='width=device-width, initial-scale=1.0' /> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + ); diff --git a/pages/about.tsx b/pages/about.tsx index 8adeef14ad..f6c48e158b 100644 --- a/pages/about.tsx +++ b/pages/about.tsx @@ -1,11 +1,13 @@ import Head from 'next/head'; import AboutIndex from '@/components/views/about/AboutIndex'; +import { aboutMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; const AboutRoute = () => { return ( <> - About Us | Giveth + diff --git a/pages/account.tsx b/pages/account.tsx index 9f4ce6e9e5..1592d88e5a 100644 --- a/pages/account.tsx +++ b/pages/account.tsx @@ -3,23 +3,21 @@ import { H5 } from '@giveth/ui-design-system'; import Head from 'next/head'; import { FC } from 'react'; import UserPublicProfileView from '@/components/views/userPublicProfile/UserPublicProfile.view'; -import useUser from '@/context/UserProvider'; +import { useAppSelector } from '@/features/hooks'; const NoUserContainer = styled.div` padding: 200px; `; const UserRoute: FC = () => { - const { - state: { user }, - } = useUser(); + const user = useAppSelector(state => state.user.userData); return ( <> Giveth | {user?.name} {user ? ( - + ) : (
Not logged in or user not found
diff --git a/pages/claim.tsx b/pages/claim.tsx index 8bc30b27db..5a78a15056 100644 --- a/pages/claim.tsx +++ b/pages/claim.tsx @@ -4,7 +4,6 @@ import { useEffect } from 'react'; import ClaimView from '@/components/views/claim/Claim.view'; import { ClaimProvider } from '@/context/claim.context'; import { ETheme, useGeneral } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; export default function GIVdropRoute() { const { setShowHeader, setTheme } = useGeneral(); @@ -22,7 +21,6 @@ export default function GIVdropRoute() { <> GIVdrop - diff --git a/pages/donate/[slug].tsx b/pages/donate/[slug].tsx index 6f66e10e35..4c344267e5 100644 --- a/pages/donate/[slug].tsx +++ b/pages/donate/[slug].tsx @@ -6,7 +6,7 @@ import { captureException } from '@sentry/nextjs'; import { IProjectBySlug } from '@/apollo/types/types'; import { FETCH_PROJECT_BY_SLUG } from '@/apollo/gql/gqlProjects'; import { client } from '@/apollo/apolloClient'; -import { ProjectMeta } from '@/lib/meta'; +import { ProjectMeta } from '@/components/Metatag'; const DonateIndex = dynamic( () => import('@/components/views/donate/DonateIndex'), diff --git a/pages/givbacks.tsx b/pages/givbacks.tsx index fd5ff0ebc8..185495e490 100644 --- a/pages/givbacks.tsx +++ b/pages/givbacks.tsx @@ -3,7 +3,8 @@ import { useEffect } from 'react'; import GIVbackView from '@/components/views/Back.view'; import { useGeneral, ETheme } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; +import { givbacksMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; export default function GIVbacksRoute() { const { setTheme } = useGeneral(); @@ -17,8 +18,7 @@ export default function GIVbacksRoute() { return ( <> - GIVbacks - + diff --git a/pages/giveconomy.tsx b/pages/giveconomy.tsx index 1d4ffa7843..2ec37d4966 100644 --- a/pages/giveconomy.tsx +++ b/pages/giveconomy.tsx @@ -3,7 +3,8 @@ import { useEffect } from 'react'; import HomeView from '@/components/views/Home.view'; import { ETheme, useGeneral } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; +import { giveconomyMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; export default function GIVeconomyRoute() { const { setTheme } = useGeneral(); @@ -18,8 +19,7 @@ export default function GIVeconomyRoute() { return ( <> - GIVeconomy - + diff --git a/pages/givfarm.tsx b/pages/givfarm.tsx index ac631431fa..ff2f1eb5e3 100644 --- a/pages/givfarm.tsx +++ b/pages/givfarm.tsx @@ -3,7 +3,8 @@ import { useEffect } from 'react'; import GIVfarmView from '@/components/views/Farm.view'; import { useGeneral, ETheme } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; +import { givfarmMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; export default function GIVfarmRoute() { const { setTheme } = useGeneral(); @@ -17,8 +18,7 @@ export default function GIVfarmRoute() { return ( <> - GIVfarm - + diff --git a/pages/givgarden.tsx b/pages/givgarden.tsx index 2b18a6c978..889c1bb38b 100644 --- a/pages/givgarden.tsx +++ b/pages/givgarden.tsx @@ -3,7 +3,8 @@ import { useEffect } from 'react'; import GIVgardenView from '@/components/views/Garden.view'; import { useGeneral, ETheme } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; +import { givgardenMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; export default function GIVgardenRoute() { const { setTheme } = useGeneral(); @@ -17,8 +18,7 @@ export default function GIVgardenRoute() { return ( <> - GIVgarden - + diff --git a/pages/givstream.tsx b/pages/givstream.tsx index c32c4d9dcc..4fa22e438e 100644 --- a/pages/givstream.tsx +++ b/pages/givstream.tsx @@ -3,7 +3,8 @@ import { useEffect } from 'react'; import GIVstreamView from '@/components/views/Stream.view'; import { useGeneral, ETheme } from '@/context/general.context'; -import { GiveconomyMeta } from '@/lib/meta'; +import { givstreamMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; export default function GIVstreamRoute() { const { setTheme } = useGeneral(); @@ -17,8 +18,7 @@ export default function GIVstreamRoute() { return ( <> - GIVstream - + diff --git a/pages/index.tsx b/pages/index.tsx index cc320c9ae0..5a370d39c1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -6,8 +6,9 @@ import { client } from '@/apollo/apolloClient'; import { FETCH_HOME_PROJECTS } from '@/apollo/gql/gqlProjects'; import { EDirection, gqlEnums } from '@/apollo/types/gqlEnums'; import { IProject } from '@/apollo/types/types'; -import useUser from '@/context/UserProvider'; -import { HomeMeta } from '@/lib/meta'; +import { useAppSelector } from '@/features/hooks'; +import { homeMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; const projectsToFetch = 12; @@ -35,10 +36,7 @@ const fetchProjects = async (userId: string | undefined = undefined) => { }; const HomeRoute = (props: IHomeRoute) => { - const { - state: { user }, - } = useUser(); - + const user = useAppSelector(state => state.user.userData); const [projects, setProjects] = useState(props.projects); const [totalCount, setTotalCount] = useState(props.totalCount); @@ -52,8 +50,7 @@ const HomeRoute = (props: IHomeRoute) => { return ( <> - Home | Giveth - + diff --git a/pages/projects.tsx b/pages/projects.tsx index 0e4737cade..6c7cb89bcd 100644 --- a/pages/projects.tsx +++ b/pages/projects.tsx @@ -4,7 +4,8 @@ import { FETCH_ALL_PROJECTS } from '@/apollo/gql/gqlProjects'; import { OPTIONS_HOME_PROJECTS } from '@/apollo/gql/gqlOptions'; import ProjectsIndex from '@/components/views/projects/ProjectsIndex'; import { ICategory, IProject } from '@/apollo/types/types'; -import { ProjectsMeta } from '@/lib/meta'; +import { projectsMetatags } from '@/content/metatags'; +import { GeneralMetatags } from '@/components/Metatag'; interface IProjectsRoute { projects: IProject[]; @@ -17,8 +18,7 @@ const ProjectsRoute = (props: IProjectsRoute) => { return ( <> - Projects | Giveth - + { + // const xDaiValues = useSelector( + // (state: RootState) => state.subgraph.xDaiValues, + // ); + const { account } = useWeb3React(); + const dispatch = useAppDispatch(); + + // const { data, isLoading, error, refetch } = useGetSubgraphValuesQuery({ + // chain: chainId, + // userAddress: account, + // }); + const notify = () => gToast('Testeeee', { type: ToastType.SUCCESS, @@ -12,12 +26,35 @@ const TestRoute = () => { dismissLabel: 'OK :D', position: 'bottom-center', }); + + // console.log('xDaiValues', xDaiValues); + // useEffect(() => { + // if (!library) return; + // library.on('block', (evt: any) => { + // console.log('evt', evt); + // // dispatch(updateXDaiValues()); + // }); + // return () => { + // library.removeAllListeners('block'); + // }; + // }, [library]); + // console.log('****data', data); + return ( <> Terms of use | Giveth +