Skip to content

Commit

Permalink
Merge pull request #119 from metagov/rashmi/patch-1
Browse files Browse the repository at this point in the history
fix edit form
  • Loading branch information
Rashmi-278 authored Aug 21, 2023
2 parents 326ba42 + ddaecdd commit b3c9b87
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ const RegistrationReceived = ({
"summonRegistration",
[...regData]
);
if (daoContractNetwork === 'optimism-goerli') {
daoContractNetwork = 'optimismGoerli'
}

if(daoContractNetwork === 'optimism-goerli'){
daoContractNetwork = 'optimismGoerli';
}


return (
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,124 +1,124 @@
import { Button, Divider} from '@blueprintjs/core';
import React, { Fragment } from 'react';
import { Link } from 'react-router-dom';
import EtherscanLink from './EtherscanLink/EtherscanLink';
import URILink from './URILink/URILink';
import { Button, Divider } from "@blueprintjs/core";
import React, { Fragment } from "react";
import { Link } from "react-router-dom";
import EtherscanLink from "./EtherscanLink/EtherscanLink";
import URILink from "./URILink/URILink";

const IPFS_GATEWAY = `https://ipfs.io/ipfs`
const IPFS_GATEWAY = `https://ipfs.io/ipfs`;

const getHttpDaoURI = (daoURI) => {
if (daoURI.includes(`ipfs://`)) {
const uri_hash = daoURI.substring(7);
return `${IPFS_GATEWAY}/${uri_hash}`
}
return daoURI;
if (daoURI.includes(`ipfs://`)) {
const uri_hash = daoURI.substring(7);
return `${IPFS_GATEWAY}/${uri_hash}`;
}
return daoURI;
};

const DisplayRegistration = ({
id,
network,
onClickEdit,
contractAddress,
managerAddress,
daoURI,
description,
name,
standalone,
membersURI,
activityLogURI,
issuersURI,
proposalsURI,
governanceURI
id,
network,
onClickEdit,
contractAddress,
managerAddress,
daoURI,
description,
name,
standalone,
membersURI,
activityLogURI,
issuersURI,
proposalsURI,
governanceURI,
}) => {
const httpDaoURI = getHttpDaoURI(daoURI);
if (network === "optimism-goerli") {
network = "optimismGoerli";
}

const httpDaoURI = getHttpDaoURI(daoURI);
if (network === 'optimism-goerli') {
network = 'optimismGoerli'
}

return (
<Fragment>
{standalone === true ? (
<h3>{name}</h3>
) : (
<Link to={`/registration/${network}:${id}`} className='underline'>
<h3>{name}</h3>
</Link>
)}
{standalone === true && (
<Button
className='edit-reg-btn'
icon='edit'
text='Edit'
onClick={onClickEdit}
/>
)}
<Divider />
<div className='card-metadata'>
<p className='bp4-text-small wizard-no-margin'>
<span className='bp4-text-muted'>Contract address: </span>
<EtherscanLink address={contractAddress} />
</p>
<p className='bp4-text-small wizard-no-margin'>
<span className='bp4-text-muted'>DAO URI: </span>
<span className='card-metadata-value'>
<a
href={httpDaoURI}
target="_blank"
className='no-underline' rel="noreferrer"
>
{httpDaoURI}
</a>
</span>
</p>
<p className='bp4-text-small wizard-no-margin'>
<span className='bp4-text-muted'>Manager address: </span>
{managerAddress ? (
<EtherscanLink address={managerAddress} />
) : (
<span className='card-metadata-value'>None provided</span>
)}
</p>
<p className='bp4-text-small wizard-no-margin'>
<span className='bp4-text-muted'>Network: </span>
<span className='card-metadata-value'>{network}</span>
</p>
</div>
<Divider />
<div className='card-metadata'>
<h6>Description</h6>
<p className='bp4-text-large'>
{description ? description : 'None provided'}
</p>
<div className='card-metadata-row'>
<div className='card-metadata-item'>
<h6>Members</h6>
<p className='bp4-text-large'>
<URILink uri={membersURI} />
</p>
</div>
<div className='card-metadata-item'>
<h6>Proposals</h6>
<p className='bp4-text-large'>
<URILink uri={proposalsURI} />
</p>
</div>
<div className='card-metadata-item'>
<h6>Governance</h6>
<p className='bp4-text-large'>
<URILink uri={governanceURI} />
</p>
</div>
<div className='card-metadata-item'>
<h6>Issuers</h6>
<p className='bp4-text-large'>
<URILink uri={issuersURI} />
</p>
</div>
</div>
</div>
</Fragment>
)
}
return (
<Fragment>
{standalone === true ? (
<h3>{name}</h3>
) : (
<Link to={`/registration/${network}:${id}`} className="underline">
<h3>{name}</h3>
</Link>
)}
{standalone === true && (
<Button
className="edit-reg-btn"
icon="edit"
text="Edit"
onClick={onClickEdit}
/>
)}
<Divider />
<div className="card-metadata">
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Contract address: </span>
<EtherscanLink address={contractAddress} />
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">DAO URI: </span>
<span className="card-metadata-value">
<a
href={httpDaoURI}
target="_blank"
className="no-underline"
rel="noreferrer"
>
{httpDaoURI}
</a>
</span>
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Manager address: </span>
{managerAddress ? (
<EtherscanLink address={managerAddress} />
) : (
<span className="card-metadata-value">None provided</span>
)}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Network: </span>
<span className="card-metadata-value">{network}</span>
</p>
</div>
<Divider />
<div className="card-metadata">
<h6>Description</h6>
<p className="bp4-text-large">
{description ? description : "None provided"}
</p>
<div className="card-metadata-row">
<div className="card-metadata-item">
<h6>Members</h6>
<p className="bp4-text-large">
<URILink uri={membersURI} />
</p>
</div>
<div className="card-metadata-item">
<h6>Proposals</h6>
<p className="bp4-text-large">
<URILink uri={proposalsURI} />
</p>
</div>
<div className="card-metadata-item">
<h6>Governance</h6>
<p className="bp4-text-large">
<URILink uri={governanceURI} />
</p>
</div>
<div className="card-metadata-item">
<h6>Issuers</h6>
<p className="bp4-text-large">
<URILink uri={issuersURI} />
</p>
</div>
</div>
</div>
</Fragment>
);
};

export default DisplayRegistration;
export default DisplayRegistration;
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const RegistrationCard = ({
{cardScreen === 'UPDATED' && (
<RegistrationReceived
isUpdate
daoContractNetwork={registrationNetwork.id}
{...updatedData}
/>
)}
Expand Down

0 comments on commit b3c9b87

Please sign in to comment.