Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed May 24, 2024
1 parent 498e96c commit 5441cb1
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 3 deletions.
18 changes: 18 additions & 0 deletions daostar-website/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,24 @@ function App() {
data: EASOptimismData,
} = EASOptimismRes;
console.log(EASOptimismData)


const ENSQueryRes = useQuery(queries.ENS_QUERY, {
context: { apiName: "ensTextRecords" },
variables: {
"where": {
"value_not": null,
"key_starts_with_nocase": "com.github",
"key_ends_with_nocase": "com.github"
}
},
});
const {
loading: ENSQueryResLoading,
error: ENSQueryResError,
data: ENSQueryResData,
} = ENSQueryRes;
console.log(ENSQueryResData)
if (
error ||
goerliError ||
Expand Down
70 changes: 70 additions & 0 deletions daostar-website/src/components/ENSCard/AttestationCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.attestation-card {
position: relative;
width: 100%;
min-height: 100px;
}

.attestation-card h3 {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}

.card-metadata {
padding: 12px 24px;
word-wrap: break-word;
overflow-wrap: break-word;
}

.card-metadata p {
line-height: 1.5;
}

.card-metadata h6 {
font-weight: 400;
color: #9c9c9c;
margin: 0;

}

.card-metadata-value {
max-width: 65%;
text-overflow: ellipsis;
word-wrap: break-word;
overflow-wrap: break-word;
white-space: nowrap;
display: inline-block;
vertical-align: bottom;
}

.card-metadata-item svg {
position: relative;
top: -4px;
left: 4px;
}

.card-metadata-row {
margin: 18px 24px 0 0;
display: flex;
justify-content: space-between;
}

a.card-link {
border-bottom: 0;
}

.card-link .bp4-card {
border: 1px solid var(--card-border);
}

.card-link .bp4-card:hover {
background-color: #3b3b3b;
color: inherit;
border: 1px solid var(--card-border-hover);
}

.edit-reg-btn {
position: absolute;
top: 20px;
right: 24px;
}
124 changes: 124 additions & 0 deletions daostar-website/src/components/ENSCard/AttestationCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import React, { useState, Fragment } from 'react';
import { Button, Card, Divider, FormGroup, Spinner } from '@blueprintjs/core';
import EtherscanLink from "../RegistrationCard/DisplayRegistration/EtherscanLink/EtherscanLink";
import './AttestationCard.css'
import { Link } from 'react-router-dom';

const DisplayAttestation = ({
id,
key,
value,

}) => {
const decodedData = JSON.parse(decodedDataJson);

const renderEtherscanLink = (address) => (
<EtherscanLink address={address} />
);

const formatTime = (timestamp) => {
return new Date(timestamp * 1000).toLocaleString();
};

//Extract DAO Name
const daoName = decodedData.find(item => item.name === "daoName")?.value.value || "Unknown DAO";
const daoURI = decodedData.find(item => item.name === "daoURI")?.value.value || "https://daostar.org/registration";

let decodedDataArray = Array.isArray(decodedData) ? decodedData : [decodedData];
function ensureArray(data) {
if (!data) return []; // Return an empty array if data is falsy (e.g., undefined or null)
return Array.isArray(data) ? data : [data];
}

decodedDataArray = ensureArray(decodedData);

return (
<Card
className='wizard-card attestation-card'
>
<Fragment>
<h3>{daoName}</h3>

{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">Attestation ID: </span>
{id}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Recipient Address: </span>
{renderEtherscanLink(recipient)}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Attester Address: </span>
{renderEtherscanLink(attester)}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Time: </span>
<span className="card-metadata-value">{formatTime(time)}</span>
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Expiration Time: </span>
<span className="card-metadata-value">{expirationTime ? formatTime(expirationTime) : 'None'}</span>
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Revocable: </span>
<span className="card-metadata-value">{revocable ? 'Yes' : 'No'}</span>
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Revoked: </span>
<span className="card-metadata-value">{revoked ? 'Yes' : 'No'}</span>
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Schema ID: </span>
{schemaId}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">IPFS Hash: </span>
{ipfsHash}
</p>

<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">Offchain: </span>
<span className="card-metadata-value">{isOffchain ? 'Yes' : 'No'}</span>
</p>
<Divider style={{ marginTop: '5px', marginBottom: '5px'}}/>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">DAO URI: </span>
<Link target='_blank' to={daoURI}>{daoURI}</Link>
</p>
</div>
<Divider />
<div className="card-metadata">
<h6>Decoded Data:</h6>
{decodedDataArray.map((item, index) => {
let value;
if (item.name === 'networkID') {
// Convert hex to decimal for networkID
value = parseInt(item.value?.value?.hex ?? item.value?.value, 16).toString();
} else {
// For other items, use the original logic to determine the value
value = item.value?.value?.hex ?? item.value?.value ?? 'N/A';
}
return (
<p key={index} className="bp4-text-large" style={{ marginBottom: '10px' }}>
<strong>{item.name}:</strong> {value}
</p>
);
})}
</div>

</Fragment>
</Card>
);
};

export default DisplayAttestation;
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,22 @@ const ATTESTATIONS_BY_SCHEMA = gql`
}
`;

export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA }



const ENS_QUERY = gql `
query TextChangeds($where: TextChanged_filter) @api(contextKey: "apiName"){
textChangeds(where: $where) {
id
key
value
resolver {
addr {
id
}
address
}
}
}
`;
export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA, ENS_QUERY }
4 changes: 2 additions & 2 deletions daostar-website/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const client = new ApolloClient({
ethereum: "https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0",
arbitrum: "https://api.thegraph.com/subgraphs/name/crazyyuan/daostar-arbitrum",
easOptimismSepolia:"https://optimism-sepolia.easscan.org/graphql",
easOptimism:"https://optimism.easscan.org/graphql"

easOptimism:"https://optimism.easscan.org/graphql",
ensTextRecords: "https://api.thegraph.com/subgraphs/name/ensdomains/ens"
},
//defaultEndpoint: 'https://api.thegraph.com/subgraphs/name/ipatka/daostar',
httpSuffix: "",
Expand Down

0 comments on commit 5441cb1

Please sign in to comment.