-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from metagov/rashmi/patch-1
fix edit form
- Loading branch information
Showing
3 changed files
with
121 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230 changes: 115 additions & 115 deletions
230
daostar-website/src/components/RegistrationCard/DisplayRegistration/DisplayRegistration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters