From 645e0ae3f3a4cd7c76d840649f0d927a3f9b00e1 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 15:00:21 +0800 Subject: [PATCH 1/6] proposal redirect to subsquare --- site/src/App/index.jsx | 22 +++++++-------- site/src/pages/Header/ProposalsMenu.jsx | 28 ++++++++++++++++++- .../src/pages/Proposals/ProposalsRedirect.jsx | 18 ++++++++++++ 3 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 site/src/pages/Proposals/ProposalsRedirect.jsx diff --git a/site/src/App/index.jsx b/site/src/App/index.jsx index 3a5a61b5f..3663235c7 100644 --- a/site/src/App/index.jsx +++ b/site/src/App/index.jsx @@ -8,8 +8,9 @@ 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 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"; @@ -68,15 +69,8 @@ export default function App() { - {isCentrifuge ? ( - - ) : ( - - )} + + {/* */} @@ -159,7 +153,11 @@ export default function App() { {!isCentrifuge && ( - + )} + + Proposals + + + + + ); +} + function ProposalsMenu() { const proposalsCount = useSelector(totalProposalsCountSelector); @@ -26,7 +48,11 @@ function CentrifugeProposalsMenu() { } export default function ProposalsMenuWrapper() { - if (isPolkadot || isKusama) { + if (isPolkadot) { + return ; + } + + if (isKusama) { return ; } 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; From 24c6b8ac2e876417bce903e07fdd7b76828b4803 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 15:05:20 +0800 Subject: [PATCH 2/6] tips redirect to subsquare --- site/src/App/index.jsx | 7 ++++++- site/src/pages/Header/TipsMenu.jsx | 31 +++++++++++++++++++++++++++- site/src/pages/Tips/TipsRedirect.jsx | 18 ++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 site/src/pages/Tips/TipsRedirect.jsx diff --git a/site/src/App/index.jsx b/site/src/App/index.jsx index 3663235c7..ac1b46286 100644 --- a/site/src/App/index.jsx +++ b/site/src/App/index.jsx @@ -8,6 +8,7 @@ import ScrollToTop from "../components/ScrollToTop"; import Header from "../pages/Header"; import Footer from "../pages/Footer"; import Tips from "../pages/Tips"; +import TipsRedirect from "../pages/Tips/TipsRedirect"; // import Proposals from "../pages/Proposals"; import ProposalsRedirect from "../pages/Proposals/ProposalsRedirect"; // import CentrifugeProposals from "../pages/CentrifugeProposals"; @@ -66,7 +67,11 @@ export default function App() { - + {isPolkadot ? ( + + ) : ( + + )} diff --git a/site/src/pages/Header/TipsMenu.jsx b/site/src/pages/Header/TipsMenu.jsx index 18969b52c..99673bb92 100644 --- a/site/src/pages/Header/TipsMenu.jsx +++ b/site/src/pages/Header/TipsMenu.jsx @@ -1,8 +1,31 @@ import React from "react"; import { Label, Menu } from "semantic-ui-react"; import { useSelector } from "react-redux"; +import IconMask from "../../components/Icon/Mask"; +import { chainSelector } from "../../store/reducers/chainSlice"; +import ExternalLink from "../../components/ExternalLink"; +import { isPolkadot } from "../../utils/chains"; import { totalTipCountSelector } from "../../store/reducers/overviewSlice"; +function TipsMenuExternalLink() { + const tipsCount = useSelector(totalTipCountSelector); + const chain = useSelector(chainSelector); + + return ( + + + Tips + + + + + ); +} + function TipsMenu() { const tipsCount = useSelector(totalTipCountSelector); @@ -13,4 +36,10 @@ function TipsMenu() { ); } -export default TipsMenu; +export default function TipsMenuWrapper() { + if (isPolkadot) { + return ; + } + + return ; +} 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; From 8c416cb5810d6aa979cafbbb72eed5b8847b9458 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 15:14:58 +0800 Subject: [PATCH 3/6] tips redirect to subsquare --- site/src/App/index.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/site/src/App/index.jsx b/site/src/App/index.jsx index ac1b46286..048f6ffc3 100644 --- a/site/src/App/index.jsx +++ b/site/src/App/index.jsx @@ -67,11 +67,8 @@ export default function App() { - {isPolkadot ? ( - - ) : ( - - )} + + From bbede80873296d03ce13a33d5f444cc86abf8b96 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 15:17:38 +0800 Subject: [PATCH 4/6] remove useless code --- site/src/pages/Header/ProposalsMenu.jsx | 36 +------------------------ site/src/pages/Header/TipsMenu.jsx | 21 +-------------- 2 files changed, 2 insertions(+), 55 deletions(-) diff --git a/site/src/pages/Header/ProposalsMenu.jsx b/site/src/pages/Header/ProposalsMenu.jsx index aa4fdaee5..513836d6f 100644 --- a/site/src/pages/Header/ProposalsMenu.jsx +++ b/site/src/pages/Header/ProposalsMenu.jsx @@ -4,11 +4,9 @@ import { useSelector } from "react-redux"; import IconMask from "../../components/Icon/Mask"; import { chainSelector } from "../../store/reducers/chainSlice"; import ExternalLink from "../../components/ExternalLink"; -import { totalProposalCountSelector } from "../../store/reducers/overviewSlice"; -import { isKusama, isPolkadot } from "../../utils/chains"; import { totalProposalsCountSelector } from "../../store/reducers/overviewSummarySlice"; -function ProposalsMenuExternalLink() { +export default function ProposalsMenuWrapper() { const proposalsCount = useSelector(totalProposalsCountSelector); const chain = useSelector(chainSelector); @@ -26,35 +24,3 @@ function ProposalsMenuExternalLink() { ); } - -function ProposalsMenu() { - const proposalsCount = useSelector(totalProposalsCountSelector); - - return ( - - Proposals - - ); -} - -function CentrifugeProposalsMenu() { - const proposalsCount = useSelector(totalProposalCountSelector); - - return ( - - Proposals - - ); -} - -export default function ProposalsMenuWrapper() { - if (isPolkadot) { - return ; - } - - if (isKusama) { - return ; - } - - return ; -} diff --git a/site/src/pages/Header/TipsMenu.jsx b/site/src/pages/Header/TipsMenu.jsx index 99673bb92..eff6e5e77 100644 --- a/site/src/pages/Header/TipsMenu.jsx +++ b/site/src/pages/Header/TipsMenu.jsx @@ -4,10 +4,9 @@ import { useSelector } from "react-redux"; import IconMask from "../../components/Icon/Mask"; import { chainSelector } from "../../store/reducers/chainSlice"; import ExternalLink from "../../components/ExternalLink"; -import { isPolkadot } from "../../utils/chains"; import { totalTipCountSelector } from "../../store/reducers/overviewSlice"; -function TipsMenuExternalLink() { +export default function TipsMenuWrapper() { const tipsCount = useSelector(totalTipCountSelector); const chain = useSelector(chainSelector); @@ -25,21 +24,3 @@ function TipsMenuExternalLink() { ); } - -function TipsMenu() { - const tipsCount = useSelector(totalTipCountSelector); - - return ( - - Tips - - ); -} - -export default function TipsMenuWrapper() { - if (isPolkadot) { - return ; - } - - return ; -} From a86bcedd99a70fc26d674917e124a110920dea15 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 15:45:29 +0800 Subject: [PATCH 5/6] tips total count --- site/src/pages/Header/TipsMenu.jsx | 4 ++-- site/src/store/reducers/overviewSummarySlice.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/site/src/pages/Header/TipsMenu.jsx b/site/src/pages/Header/TipsMenu.jsx index eff6e5e77..583ad1c0d 100644 --- a/site/src/pages/Header/TipsMenu.jsx +++ b/site/src/pages/Header/TipsMenu.jsx @@ -4,10 +4,10 @@ import { useSelector } from "react-redux"; import IconMask from "../../components/Icon/Mask"; import { chainSelector } from "../../store/reducers/chainSlice"; import ExternalLink from "../../components/ExternalLink"; -import { totalTipCountSelector } from "../../store/reducers/overviewSlice"; +import { totalTipsCountSelector } from "../../store/reducers/overviewSummarySlice"; export default function TipsMenuWrapper() { - const tipsCount = useSelector(totalTipCountSelector); + const tipsCount = useSelector(totalTipsCountSelector); const chain = useSelector(chainSelector); return ( diff --git a/site/src/store/reducers/overviewSummarySlice.js b/site/src/store/reducers/overviewSummarySlice.js index 6a204a2c2..26d33f5ab 100644 --- a/site/src/store/reducers/overviewSummarySlice.js +++ b/site/src/store/reducers/overviewSummarySlice.js @@ -49,6 +49,9 @@ export const totalBountyCountSelector = (state) => state.overviewSummary?.data?.bounties?.all || 0; export const totalProposalsCountSelector = (state) => state.overviewSummary?.data?.treasuryProposals?.all || 0; +// TODO: Update selector name to match the actual data structure +export const totalTipsCountSelector = (state) => + state.overviewSummary?.data?.tips?.total || 0; export const overviewSummaryLoadingSelector = (state) => state.overviewSummary.loading; export const overviewSummaryErrorSelector = (state) => From 9e27055baf5c61b9ad49f7c035d39a9b895d2a68 Mon Sep 17 00:00:00 2001 From: leocs2417 Date: Mon, 29 Dec 2025 16:23:44 +0800 Subject: [PATCH 6/6] tips count function --- site/src/store/reducers/overviewSummarySlice.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/site/src/store/reducers/overviewSummarySlice.js b/site/src/store/reducers/overviewSummarySlice.js index 26d33f5ab..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,9 +59,8 @@ export const totalBountyCountSelector = (state) => state.overviewSummary?.data?.bounties?.all || 0; export const totalProposalsCountSelector = (state) => state.overviewSummary?.data?.treasuryProposals?.all || 0; -// TODO: Update selector name to match the actual data structure export const totalTipsCountSelector = (state) => - state.overviewSummary?.data?.tips?.total || 0; + state.overviewSummary?.data?.tips?.all || 0; export const overviewSummaryLoadingSelector = (state) => state.overviewSummary.loading; export const overviewSummaryErrorSelector = (state) =>