@@ -59,15 +74,9 @@ function UserUsername(props = { isEditable: false }) {
setValue={setNewUsername}
hint={newUsernameHint}
size="lg"
+ ref={input}
/>
- {/*
- Cancel
- */}
{
+ setModalOpen(true);
+ }}
className={
"modal-button py-1 border-b mr-2" +
(props.isEditable
@@ -93,9 +105,9 @@ function UserUsername(props = { isEditable: false }) {
>
{props.isEditable
? props.user.username
- ? props.user.username
+ ? "@" + props.user.username
: "No Username"
- : props.user.username}
+ : "@" + props.user.username}
);
diff --git a/helpers/getNodeInfo.js b/helpers/getNodeInfo.js
index 8140cd3e..038738d3 100644
--- a/helpers/getNodeInfo.js
+++ b/helpers/getNodeInfo.js
@@ -2,7 +2,7 @@ import axios from "../helpers/axiosFetch";
export default async function getNodeInfo() {
let networkName = "gitopia";
const baseUrl =
- process.env.NEXT_PUBLIC_API_URL + "/node_info"
+ process.env.NEXT_PUBLIC_API_URL + "/cosmos/base/tendermint/v1beta1/node_info"
await axios
.get(baseUrl)
.then((response) => {
diff --git a/helpers/keplr.js b/helpers/keplr.js
index 6af818f6..21644d0d 100644
--- a/helpers/keplr.js
+++ b/helpers/keplr.js
@@ -17,7 +17,7 @@ export default async function initKeplr() {
// If the same chain id is already registered, it will resolve and not require the user interactions.
const suggestChain = await window.keplr.experimentalSuggestChain({
// Chain-id of the Cosmos SDK chain.
- chainId: info.node_info.network,
+ chainId: info.default_node_info.network,
// The name of the chain to be displayed to the user.
chainName: info.application_version.name,
// RPC endpoint of the chain.
@@ -118,7 +118,7 @@ export default async function initKeplr() {
// Enabling before using the Keplr is recommended.
// This method will ask the user whether or not to allow access if they haven't visited this website.
// Also, it will request user to unlock the wallet if the wallet is locked.
- await window.keplr.enable(info.node_info.network);
+ await window.keplr.enable(info.default_node_info.network);
// const offlineSigner = window.getOfflineSigner(chainId);
// console.log(offlineSigner);
diff --git a/package.json b/package.json
index 1a7fd986..7ee21179 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"@cosmjs/ledger-amino": "^0.27.1",
"@cosmjs/proto-signing": "0.27.1",
"@cosmjs/stargate": "^0.27.1",
- "@gitopia/gitopia-js": "git+https://github.com/gitopia/gitopia-js#078070f1b30467234775c246adf97b14a1c5eedd",
+ "@gitopia/gitopia-js": "1.0.0",
"@gitopia/stargate": "0.27.1",
"@ledgerhq/hw-transport-webhid": "^6.20.0",
"@ledgerhq/hw-transport-webusb": "^6.20.0",
diff --git a/pages/[userId]/index.js b/pages/[userId]/index.js
index de7803b2..f686a7a4 100644
--- a/pages/[userId]/index.js
+++ b/pages/[userId]/index.js
@@ -15,6 +15,9 @@ import AccountRepositories from "../../components/account/repositories";
import AccountTransactions from "../../components/account/transactions";
import AccountPeople from "../../components/account/people";
import AccountDaoHeader from "../../components/account/daoHeader";
+import DaoProposalList from "../../components/account/daoProposalList";
+import DaoProposalCreate from "../../components/account/daoProposalCreate";
+import DaoProposalDetails from "../../components/account/daoProposalDetails";
import validAddress from "../../helpers/validAddress";
export async function getStaticProps() {
@@ -141,6 +144,19 @@ function AccountView(props) {
) : (
""
)}
+ {router.query.tab === "proposals" ? (
+ router.query.id ? (
+ router.query.id === "new" ? (
+
+ ) : (
+
+ )
+ ) : (
+
+ )
+ ) : (
+ ""
+ )}
{router.query.tab === "people" ?
: ""}
diff --git a/pages/[userId]/proposals/[proposalId].js b/pages/[userId]/proposals/[proposalId].js
deleted file mode 100644
index c99f1d94..00000000
--- a/pages/[userId]/proposals/[proposalId].js
+++ /dev/null
@@ -1,792 +0,0 @@
-import Head from "next/head";
-import Header from "../../../components/header";
-import { useEffect, useState } from "react";
-import { connect } from "react-redux";
-import getProposal from "../../../helpers/getProposal";
-import dayjs from "dayjs";
-import { useRouter } from "next/router";
-import { proposalDeposit } from "../../../store/actions/proposals";
-import { proposalVote } from "../../../store/actions/proposals";
-import { CircularProgressbar, buildStyles } from "react-circular-progressbar";
-import "react-circular-progressbar/dist/styles.css";
-import getTally from "../../../helpers/getTally";
-import Link from "next/dist/client/link";
-import getDepositor from "../../../helpers/getDepositor";
-import getVoter from "../../../helpers/getVoter";
-import ReactMarkdown from "react-markdown";
-
-function ProposalDetailsView(props) {
- const [amount, setAmount] = useState("");
- const [validateAmountError, setValidateAmountError] = useState("");
- const [depositLoading, setDepositLoading] = useState(false);
- const [voteAbstainLoading, setVoteAbstainLoading] = useState(false);
- const [voteNoLoading, setVoteNoLoading] = useState(false);
- const [voteYesLoading, setVoteYesLoading] = useState(false);
- const [voteNoWithVetoLoading, setVoteNoWithVetoLoading] = useState(false);
- const [proposal, setProposal] = useState({ content: { description: "" } });
- const [proposer, setProposer] = useState("");
- const [initialDeposit, setInitialDeposit] = useState("");
- const [tally, setTally] = useState({});
- const [depositors, setDepositors] = useState([]);
- const [voters, setVoters] = useState([]);
- const router = useRouter();
- const id = router.query.proposalId;
- const hrefBase = "/" + router.query.userId;
- const type = "@type";
- var localizedFormat = require("dayjs/plugin/localizedFormat");
- dayjs.extend(localizedFormat);
-
- const refreshProposal = async () => {
- if (id !== undefined) {
- await getProposal(id).then((res) => {
- if (res !== undefined) {
- setProposal(res.msg);
- setProposer(res.proposer);
- setInitialDeposit(res.initial_deposit);
- } else {
- router.push(router.query.userId + "/proposals");
- }
- });
- }
- };
-
- const refreshTally = async () => {
- if (id !== undefined) {
- await getTally(id).then((res) => {
- if (res === {}) {
- setTally({
- yes: 0,
- no: 0,
- abstain: 0,
- no_with_veto: 0,
- });
- }
- setTally(res.tally);
- });
- }
- };
-
- const refreshDepositors = async () => {
- if (id !== undefined) {
- await getDepositor(id).then((res) => {
- if (res !== undefined) {
- setDepositors(res.slice(1, res.length));
- }
- });
- }
- };
-
- const refreshVoters = async () => {
- if (id !== undefined) {
- await getVoter(id).then((res) => {
- setVoters(res);
- });
- }
- };
-
- useEffect(refreshProposal, [id]);
- useEffect(refreshTally, [id]);
- useEffect(refreshDepositors, [id]);
- useEffect(refreshVoters, [id]);
-
- function isNaturalNumber(n) {
- n = n.toString();
- var n1 = Math.abs(n),
- n2 = parseInt(n, 10);
- return !isNaN(n1) && n2 === n1 && n1.toString() === n;
- }
-
- const validateAmount = async (amount) => {
- setValidateAmountError(null);
- let Vamount = Number(amount);
- if (amount == "" || amount == 0) {
- setValidateAmountError("Enter Valid Amount");
- }
-
- let balance = props.loreBalance;
- if (props.advanceUser === false) {
- Vamount = Vamount * 1000000;
- }
- if (Vamount > 0 && isNaturalNumber(Vamount)) {
- if (Vamount > balance) {
- setValidateAmountError("Insufficient Balance");
- }
- } else {
- setValidateAmountError("Enter a Valid Amount");
- }
- };
-
- function getPercentage(key) {
- if (tally !== undefined) {
- let total =
- parseInt(tally.yes) +
- parseInt(tally.no) +
- parseInt(tally.abstain) +
- parseInt(tally.no_with_veto);
- if (total > 0) {
- let count;
- if (key == "yes") {
- count = parseInt(tally.yes);
- } else if (key == "no") {
- count = parseInt(tally.no);
- } else if (key == "abstain") {
- count = parseInt(tally.abstain);
- } else if (key == "no_with_veto") {
- count = parseInt(tally.no_with_veto);
- }
- let percent = count / total;
- return percent * 100;
- }
- }
- return 0;
- }
-
- return (
-