diff --git a/CHANGELOG.md b/CHANGELOG.md index 25258db5..3b12e651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ ## Changelog +### Unreleased + +- Don't show proposals tab in user profile +- Show treasury balance upto two decimal places only +- Don't re-render header everytime we switch tab +- Show link to parent repo in case of fork repo + +### v3.1.0 - 2nd Dec 2024 + +- Add button for Member Dashboard in public view (if member) and public view in Member dashboard +- Improve the dao dashboard and some other minor improvements +- Fix overflow of voting chart in dao creation step +- Sanitize dao names before posting the transaction + +### v3.0.0 - 2nd Dec 2024 + +- Implement the new dao creation and proposal workflows + ### v2.2.2 - 3rd Sep 2024 - Fix missing apiClient in getUser and getRepository methods diff --git a/components/account/DaoTreasuryStats.js b/components/account/DaoTreasuryStats.js index 8cd942bc..3ece2022 100644 --- a/components/account/DaoTreasuryStats.js +++ b/components/account/DaoTreasuryStats.js @@ -14,8 +14,12 @@ function DaoTreasuryStats({ dao, className = "", getBalance, advanceUser }) { const balance = await getBalance(cosmosBankApiClient, dao.address); setTreasuryBalance( advanceUser === true - ? balance + " " + process.env.NEXT_PUBLIC_ADVANCE_CURRENCY_TOKEN - : balance / 1000000 + " " + process.env.NEXT_PUBLIC_CURRENCY_TOKEN + ? balance.toFixed(2) + + " " + + process.env.NEXT_PUBLIC_ADVANCE_CURRENCY_TOKEN + : (balance / 1000000).toFixed(2) + + " " + + process.env.NEXT_PUBLIC_CURRENCY_TOKEN ); } initBalance(); diff --git a/components/account/daoHeader.js b/components/account/daoHeader.js index ba47c37f..b611f882 100644 --- a/components/account/daoHeader.js +++ b/components/account/daoHeader.js @@ -117,7 +117,6 @@ function AccountDaoHeader(props) { )} - {/* Add the treasury stats component */} ); diff --git a/components/dashboard/publicTabs.js b/components/dashboard/publicTabs.js index f1d0b205..2d373357 100644 --- a/components/dashboard/publicTabs.js +++ b/components/dashboard/publicTabs.js @@ -60,32 +60,34 @@ export default function PublicTabs({ ) : null} {showPeople ? ( - - - - - People - - ) : null} + <> + + + + + People + - - - - - Proposals - + + + + + Proposals + + + ) : null} {showProposal ? ( { @@ -32,6 +33,43 @@ const OwnershipBadge = ({ type }) => { ); }; +const ForkParentInfo = ({ parentId }) => { + const [parentRepo, setParentRepo] = useState(null); + const { apiClient } = useApiClient(); + + useEffect(() => { + async function fetchParentRepo() { + try { + const parentRepo = await getRepositoryById(apiClient, parentId); + setParentRepo(parentRepo); + } catch (error) { + console.error("Error fetching parent repository:", error); + } + } + + if (parentId) { + fetchParentRepo(); + } + }, [parentId, apiClient]); + + if (!parentRepo) return null; + + return ( +
+ + Forked from + + {shrinkAddress(parentRepo.owner.id)} + / + {parentRepo.name} + +
+ ); +}; + const RepositoryHeader = ({ repository, daoData, selectedAddress }) => { const [forkTargetShown, setForkTargetShown] = useState(false); const [branchCount, setBranchCount] = useState(0); @@ -86,45 +124,51 @@ const RepositoryHeader = ({ repository, daoData, selectedAddress }) => {
-
-

-
- {isDAORepository ? ( - - ) : ( - - )} +
+
+

+
+ {isDAORepository ? ( + + ) : ( + + )} + + {shrinkAddress(repository.owner.id)} + +
+ / - {shrinkAddress(repository.owner.id)} + {repository.name} -

- / - - {repository.name} - -

-
+ +
-
- - {isDAORepository && daoData && ( - - )} - {repository.fork && ( -
- -
+ {repository.fork && repository.parent && ( + )} + +
+ + {isDAORepository && daoData && ( + + )} + {repository.fork && ( +
+ +
+ )} +
diff --git a/components/repository/supportOwner.js b/components/repository/supportOwner.js index e6f600a5..3aa70c68 100644 --- a/components/repository/supportOwner.js +++ b/components/repository/supportOwner.js @@ -53,10 +53,15 @@ function SupportOwner({ repository, ownerAddress, isMobile, ...props }) { useEffect(() => { async function initBalance() { const balance = await props.getBalance(cosmosBankApiClient, ownerAddress); + // In the initBalance function inside useEffect setOwnerBalance( props.advanceUser === true - ? balance + " " + process.env.NEXT_PUBLIC_ADVANCE_CURRENCY_TOKEN - : balance / 1000000 + " " + process.env.NEXT_PUBLIC_CURRENCY_TOKEN + ? balance.toFixed(2) + + " " + + process.env.NEXT_PUBLIC_ADVANCE_CURRENCY_TOKEN + : (balance / 1000000).toFixed(2) + + " " + + process.env.NEXT_PUBLIC_CURRENCY_TOKEN ); } initBalance(); diff --git a/pages/[userId]/index.js b/pages/[userId]/index.js index 8f0cf56c..6dc7fbad 100644 --- a/pages/[userId]/index.js +++ b/pages/[userId]/index.js @@ -1,6 +1,6 @@ import Head from "next/head"; import Header from "../../components/header"; -import { useEffect, useState, useCallback } from "react"; +import { useEffect, useState, useCallback, useMemo } from "react"; import { connect } from "react-redux"; import { useRouter } from "next/router"; import Footer from "../../components/footer"; @@ -129,7 +129,6 @@ function AccountView({ const hrefBase = `/${router.query.userId}`; const checkMembership = async (daoData) => { - console.log(selectedAddress, daoData.group_id); if (!selectedAddress || !daoData.group_id) return; try { const members = await getGroupMembers( @@ -189,14 +188,14 @@ function AccountView({ setIsLoading(false); } }, - [router, apiClient, setErrorStatusCode] + [apiClient, setErrorStatusCode, router.query.userId, selectedAddress] ); useEffect(() => { getId(); }, [getId]); - const renderContent = () => { + const content = useMemo(() => { const { tab, id } = router.query; switch (tab) { case "repositories": @@ -228,7 +227,14 @@ function AccountView({ /> ); } - }; + }, [ + router.query.tab, + router.query.id, + user, + dao, + allRepos, + router.query.userId, + ]); const title = user.id ? user.username || user.creator : dao.name; @@ -249,13 +255,11 @@ function AccountView({ ) : ( <> {dao.address ? ( - <> - - + ) : ( )} @@ -270,7 +274,7 @@ function AccountView({ } />
- {renderContent()} + {content} )}