diff --git a/site/src/App/index.jsx b/site/src/App/index.jsx index 3a5a61b5f..048f6ffc3 100644 --- a/site/src/App/index.jsx +++ b/site/src/App/index.jsx @@ -8,8 +8,10 @@ import ScrollToTop from "../components/ScrollToTop"; import Header from "../pages/Header"; import Footer from "../pages/Footer"; import Tips from "../pages/Tips"; -import Proposals from "../pages/Proposals"; -import CentrifugeProposals from "../pages/CentrifugeProposals"; +import TipsRedirect from "../pages/Tips/TipsRedirect"; +// import Proposals from "../pages/Proposals"; +import ProposalsRedirect from "../pages/Proposals/ProposalsRedirect"; +// import CentrifugeProposals from "../pages/CentrifugeProposals"; import Bounties from "../pages/Bounties"; import ChildBounties from "../pages/ChildBounties"; import Burnt from "../pages/Burnt"; @@ -65,18 +67,12 @@ export default function App() { - + + - {isCentrifuge ? ( - - ) : ( - - )} + + {/* */} @@ -159,7 +155,11 @@ export default function App() { {!isCentrifuge && ( - + )} - Proposals - - ); -} - -function CentrifugeProposalsMenu() { - const proposalsCount = useSelector(totalProposalCountSelector); - - return ( - - Proposals + + Proposals + + + ); } - -export default function ProposalsMenuWrapper() { - if (isPolkadot || isKusama) { - return ; - } - - return ; -} diff --git a/site/src/pages/Header/TipsMenu.jsx b/site/src/pages/Header/TipsMenu.jsx index 18969b52c..583ad1c0d 100644 --- a/site/src/pages/Header/TipsMenu.jsx +++ b/site/src/pages/Header/TipsMenu.jsx @@ -1,16 +1,26 @@ import React from "react"; import { Label, Menu } from "semantic-ui-react"; import { useSelector } from "react-redux"; -import { totalTipCountSelector } from "../../store/reducers/overviewSlice"; +import IconMask from "../../components/Icon/Mask"; +import { chainSelector } from "../../store/reducers/chainSlice"; +import ExternalLink from "../../components/ExternalLink"; +import { totalTipsCountSelector } from "../../store/reducers/overviewSummarySlice"; -function TipsMenu() { - const tipsCount = useSelector(totalTipCountSelector); +export default function TipsMenuWrapper() { + const tipsCount = useSelector(totalTipsCountSelector); + const chain = useSelector(chainSelector); return ( - Tips + + Tips + + + ); } - -export default TipsMenu; diff --git a/site/src/pages/Proposals/ProposalsRedirect.jsx b/site/src/pages/Proposals/ProposalsRedirect.jsx new file mode 100644 index 000000000..79e6a298a --- /dev/null +++ b/site/src/pages/Proposals/ProposalsRedirect.jsx @@ -0,0 +1,18 @@ +import { useEffect } from "react"; +import { currentChain } from "../../utils/chains"; + +const ProposalsRedirect = () => { + useEffect(() => { + if (!currentChain) { + return; + } + + window.location.replace( + `https://${currentChain}.subsquare.io/treasury/proposals`, + ); + }, []); + + return null; +}; + +export default ProposalsRedirect; diff --git a/site/src/pages/Tips/TipsRedirect.jsx b/site/src/pages/Tips/TipsRedirect.jsx new file mode 100644 index 000000000..be15751b8 --- /dev/null +++ b/site/src/pages/Tips/TipsRedirect.jsx @@ -0,0 +1,18 @@ +import { useEffect } from "react"; +import { currentChain } from "../../utils/chains"; + +const TipsRedirect = () => { + useEffect(() => { + if (!currentChain) { + return; + } + + window.location.replace( + `https://${currentChain}.subsquare.io/treasury/tips`, + ); + }, []); + + return null; +}; + +export default TipsRedirect; diff --git a/site/src/store/reducers/overviewSummarySlice.js b/site/src/store/reducers/overviewSummarySlice.js index 6a204a2c2..8db8f2738 100644 --- a/site/src/store/reducers/overviewSummarySlice.js +++ b/site/src/store/reducers/overviewSummarySlice.js @@ -37,8 +37,18 @@ export const fetchOverviewSummary = () => async (dispatch) => { try { dispatch(setLoading(true)); - const { result } = await subsquareApi.fetch("/overview/summary"); - dispatch(setOverviewSummary(result)); + + const [overviewResult, tipsResult] = await Promise.all([ + subsquareApi.fetch("/overview/summary"), + subsquareApi.fetch("/treasury/tips/summary"), + ]); + + dispatch( + setOverviewSummary({ + ...overviewResult.result, + tips: tipsResult.result, + }), + ); } catch (error) { dispatch(setError(error.message)); } @@ -49,6 +59,8 @@ export const totalBountyCountSelector = (state) => state.overviewSummary?.data?.bounties?.all || 0; export const totalProposalsCountSelector = (state) => state.overviewSummary?.data?.treasuryProposals?.all || 0; +export const totalTipsCountSelector = (state) => + state.overviewSummary?.data?.tips?.all || 0; export const overviewSummaryLoadingSelector = (state) => state.overviewSummary.loading; export const overviewSummaryErrorSelector = (state) =>