feature: BTC namespace will be shown on results table.

This commit is contained in:
Raja Ilayaperumal
2022-09-22 20:27:42 +05:30
parent 272a987c92
commit 198546621f
5 changed files with 74 additions and 21 deletions

View File

@@ -230,7 +230,7 @@ export default function BuilderComponent(props) {
putFileToGaia("pollIndex.json", JSON.stringify(currentPollIndexObj), {}).then(response => {
if (pollObject?.ipfsLocation) {
const gaiaAddress = getUserData()?.gaiaHubConfig?.address;
Router.replace("/p/" + pollObject?.id + "/" + gaiaAddress);
Router.replace("/" + pollObject?.id + "/" + gaiaAddress);
} else if (pollId === "new") {
Router.replace("/builder/" + pollObject.id + "/draft");
setPollId(pollObject.id);
@@ -397,14 +397,6 @@ export default function BuilderComponent(props) {
</Link>
<Form style={{ margin: "20px 0 100px 0" }}>
{/* Error Message */}
{errorMessage &&
<div style={{ margin: "10px 0" }}>
<span style={{ fontSize: "14px" }}>{errorMessage}</span>
</div>
}
<Form.Group className="mb-3">
<Form.Label className='ballot_labels'>Title</Form.Label>
<Form.Control type="text" name="title" value={pollObject.title} onChange={handleChange}
@@ -418,7 +410,27 @@ export default function BuilderComponent(props) {
{/* Voting system */}
<Form.Group className="mb-3">
<Form.Label className='ballot_labels'>Voting system</Form.Label>
<Form.Label className='ballot_labels'>
Voting system {" "}
<Link href="https://docs.ballot.gg">
<a style={{ fontSize: "14px" }} className="ballot_links" target={"_blank"}>
Learn more
<svg style={{ marginLeft: "6px" }}
width="8"
height="8"
viewBox="0 0 12 12"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3.5044 0.743397C3.5044 0.33283 3.83723 -6.71395e-08 4.2478 0L11.2566 6.60206e-07C11.6672 6.60206e-07 12 0.33283 12 0.743397L12 7.7522C12 8.16277 11.6672 8.4956 11.2566 8.4956C10.846 8.4956 10.5132 8.16277 10.5132 7.7522V2.53811L1.26906 11.7823C0.978742 12.0726 0.50805 12.0726 0.217736 11.7823C-0.0725787 11.4919 -0.0725784 11.0213 0.217736 10.7309L9.46189 1.48679L4.2478 1.48679C3.83723 1.48679 3.5044 1.15396 3.5044 0.743397Z"
fill="initial"
/>
</svg>
</a>
</Link>
</Form.Label>
<div>
<Form.Select id="voting-strategy-template" name="votingSystem"
value={pollObject?.votingSystem ? pollObject.votingSystem : ""}
@@ -572,6 +584,13 @@ export default function BuilderComponent(props) {
onClick={() => { publishPoll() }} disabled={isProcessing || pollObject?.status != "draft"}>
Publish
</Button>
{/* Error Message */}
{errorMessage &&
<div style={{ marginTop: "10px" }}>
<span style={{ fontSize: "14px" }}>{errorMessage}</span>
</div>
}
</div>
<div style={{ margin: "28px 0px 100px 0px", padding: "0px 20px" }}>

View File

@@ -31,6 +31,13 @@ export default function HeaderComponent(props) {
}
};
const convertToHrefLink = (text) => {
const urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(urlRegex, function (url) {
return '<a href="' + url + '" target="_blank">' + url + '</a>';
});
}
// Design
return (
<>
@@ -193,8 +200,8 @@ export default function HeaderComponent(props) {
{/* Description */}
<div style={{ marginBottom: "24px", whiteSpace: "pre-wrap" }}>
<p style={{ lineHeight: "1.7" }}>
{pollObject?.description}
<p style={{ lineHeight: "1.7" }}
dangerouslySetInnerHTML={{ __html: pollObject?.description ? convertToHrefLink(pollObject?.description) : "" }}>
</p>
</div>
</>

View File

@@ -56,7 +56,7 @@ export default function DashboardAllPollsComponent() {
}
return (
<Link href={pollIndexObject?.status == "draft" ? `/builder/${pollIndexObject.id}/draft` : `/p/${pollIndexObject.id}/${gaiaAddress}`}>
<Link href={pollIndexObject?.status == "draft" ? `/builder/${pollIndexObject.id}/draft` : `/${pollIndexObject.id}/${gaiaAddress}`}>
<div>
{/* Title */}
<div className="d-flex align-items-center" style={{ marginBottom: "10px", columnGap: "10px", width: "100%" }}>

View File

@@ -279,7 +279,7 @@ export default function PollComponent(props) {
<Table striped bordered>
<thead>
<tr>
<th>Address</th>
<th>User name</th>
<th>Option</th>
<th>No. of votes</th>
<th>Voting power</th>
@@ -293,7 +293,7 @@ export default function PollComponent(props) {
<td>{resultsByPosition[position]?.address &&
<a className="ballot_link" target="_blank" rel="noreferrer" href={formStacksExplorerUrl(resultsByPosition[position]?.address)}>
<span>
{resultsByPosition[position]?.address} { }
{resultsByPosition[position]?.username ? resultsByPosition[position]?.username : resultsByPosition[position]?.address} { }
<svg
width="10"
height="10"