Skip to content

Commit

Permalink
Merge branch 'sunrise2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed Aug 16, 2024
2 parents 77f893f + da0f010 commit 40170bd
Show file tree
Hide file tree
Showing 9 changed files with 649 additions and 62 deletions.
15 changes: 10 additions & 5 deletions daostar-website/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import "./bp4-theme.css";
import Eye from "./components/Homepage/Eye/Eye";
import { useEffect, useState } from "react";
import axios from "axios";
import { mockExploreData } from "./components/ExplorePage/mockExploreData";
import RegistrationLeanPage from "./components/RegistrationPage/RegistrationLeanPage";

const mainnetOldClient = new ApolloClient({
link: createHttpLink({
uri: "https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0",
Expand Down Expand Up @@ -237,7 +238,7 @@ function App() {
data: gnosisData,
} = gnosisRes;

const arbitrumRes = useQuery(queries.REGISTRATIONS, {
const arbitrumRes = useQuery(queries.GET_REGISTRATIONS, {
context: { apiName: "arbitrum" },
variables: { id: "arbitrum-one" },
});
Expand All @@ -247,6 +248,8 @@ function App() {
data: arbitrumData,
} = arbitrumRes;



const EASOptimismSepoliaiRes = useQuery(queries.ATTESTATIONS_BY_SCHEMA, {
context: { apiName: "easOptimismSepolia" },
variables: {
Expand Down Expand Up @@ -337,7 +340,7 @@ function App() {
const arbitrumGoerliRegistrations =
arbitrumGoerliData?.registrationNetwork?.registrations || [];
const arbitrumRegistrations =
arbitrumData?.registrationNetwork?.registrations || [];
arbitrumData?.registrationInstances || [];
const chapelRegistrations =
chapelData?.registrationNetwork?.registrations || [];

Expand Down Expand Up @@ -369,7 +372,7 @@ function App() {
arbitrumGoerliRegistrations,
chapelRegistrations,
optimismRegistrations,
arbitrumRegistrations
// arbitrumRegistrations
);

const EASAttestations = EASOptimismAttestations.concat(EASOptimismSepoliaAttestations);
Expand All @@ -386,7 +389,7 @@ function App() {
optimismGoerliData,
arbitrumGoerliData,
chapelData,
arbitrumData
arbitrumData,
});

return (
Expand All @@ -412,6 +415,7 @@ function App() {
<Route path="/eye" element={<Eye />} />
<Route path="/register" element={<Register />} />
<Route path="/registration/:regID" element={<RegistrationPage />} />
<Route path="/registration/l2/:regID" element={<RegistrationLeanPage />} />
<Route
path="/explore"
element={
Expand All @@ -422,6 +426,7 @@ function App() {
stargazeInstances={stargazeInstances}
easAttestations={EASAttestations}
ENSTextRecords={ENSTextRecords}
sunriseInstances={arbitrumRegistrations}
/>
}
/>
Expand Down
91 changes: 35 additions & 56 deletions daostar-website/src/components/ExplorePage/ExplorePage.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useEffect, useState } from "react";
import RegistrationCard from "../RegistrationCard/RegistrationCard";
import RegistrationLeanCard from "../RegistrationCard/RegistrationLeanCard";
import AttestationCard from "../AttestationCard/AttestationCard";
import ENSCard from "../ENSCard/ENSCard";
import "./ExplorePage.css";
import { InputGroup, Button } from "@blueprintjs/core";
import { filterEASbyId } from "../FilterRegistrations/Filter_Registrations_By_Id";
import RegistrationCard from "../RegistrationCard/RegistrationCard";

// Prelimnary check filter, if a DAO has no name, it won't be displayed
export const filterRegistrations = (registration, filterVal = "") => {
Expand All @@ -13,18 +14,16 @@ export const filterRegistrations = (registration, filterVal = "") => {
return false;
}

if (!registration.daoName || registration.daoName.trim() === "") {
return false;
}
// Omit dev test address
if (!registration.daoAddress === "0xDeb9e5915Db81011C549799A9EA37EdE4d72EFBA") {
// Omit dev test address
if (registration.daoAddress === "0xDeb9e5915Db81011C549799A9EA37EdE4d72EFBA") {
return false;
}

const daoNameLower = registration.daoName.toLowerCase();
const filterWords = ["scam", "test", "fuck"];

// Check for excluded words
if (filterWords.some(filterWord => daoNameLower.includes(filterWord))) {
if (filterWords.some((filterWord) => daoNameLower.includes(filterWord))) {
return false;
}

Expand All @@ -34,18 +33,18 @@ export const filterRegistrations = (registration, filterVal = "") => {

// Network Filter for EVM Chains
export const NetworkFilterRegistrations = (registration, filterVal = "") => {
console.log(registration.registrationNetwork.id);
if (registration.registrationNetwork.id === filterVal) {
return true;
}
if (filterVal === "ethereum") {
if (
(registration.registrationNetwork.id === filterVal) |
(registration.registrationNetwork.id === "mainnet")
registration.registrationNetwork.id === filterVal ||
registration.registrationNetwork.id === "mainnet"
) {
return true;
}
}
return false;
};

const NetworkButtons = [
Expand All @@ -62,9 +61,9 @@ const NetworkButtons = [
{ text: "Osmosis", filter: "osmosis" },
{ text: "Stargaze", filter: "stargaze" },
{ text: "EAS", filter: "easAttestations" },
{ text: "ENS", filter: "ensTextRecords"}

{ text: "ENS", filter: "ensTextRecords" },
];

NetworkButtons.sort((a, b) => a.text.localeCompare(b.text));

const ExplorePage = ({
Expand All @@ -73,12 +72,16 @@ const ExplorePage = ({
osmosisInstances,
stargazeInstances,
easAttestations,
ENSTextRecords
ENSTextRecords,
sunriseInstances,
}) => {
const [filterVal, setFilterVal] = useState("");
const onChangeFilter = (e) => setFilterVal(e.target.value);
const [networkFilter, setNetworkFilter] = useState("all");

console.log("Sunrise Instances");
console.log(sunriseInstances);

// Network Filter for Juno, Stargaze and Osmosis
const filteredRegistrations = (instances) => {
return instances
Expand All @@ -88,12 +91,7 @@ const ExplorePage = ({
)
)
.map((registration, i) => (
<RegistrationCard
key={i}
{...registration}
standalone={true}
displayWithoutEdit={true}
/>
<RegistrationCard key={i} {...registration} displayWithoutEdit={true} standalone={true} />
));
};

Expand All @@ -106,10 +104,10 @@ const ExplorePage = ({
case "stargaze":
return filteredRegistrations(stargazeInstances);
case "arbitrum-one":
return registrationInstances
.filter((reg) => NetworkFilterRegistrations(reg, "arbitrum-one"))
return sunriseInstances
.filter((registration) => registration.daoAddress.toLowerCase() !== "0xdeb9e5915db81011c549799a9ea37ede4d72efba") // Remove while testing
.map((registration, i) => (
<RegistrationCard key={i} {...registration} />
<RegistrationLeanCard key={i} {...registration} />
));
case "chapel":
return registrationInstances
Expand All @@ -133,7 +131,7 @@ const ExplorePage = ({
return registrationInstances
.filter((reg) => NetworkFilterRegistrations(reg, "ethereum"))
.map((registration, i) => (
<RegistrationCard key={i} {...registration} />
<RegistrationCard key={i} {...registration} /> // Convert to lean card
));
case "optimism":
return registrationInstances
Expand All @@ -155,15 +153,14 @@ const ExplorePage = ({
));
case "easAttestations":
return easAttestations
.filter(attestation => !filterEASbyId.includes(attestation.id)) // Filter out attestation by name
.map((attestation, i) => (
<AttestationCard key={i} {...attestation} />
));
case "ensTextRecords":
return ENSTextRecords
.map((textRecord, i) => (
<ENSCard key={i} {...textRecord} />
.filter((attestation) => !filterEASbyId.includes(attestation.id)) // Filter out attestation by name
.map((attestation, i) => (
<AttestationCard key={i} {...attestation} />
));
case "ensTextRecords":
return ENSTextRecords.map((textRecord, i) => (
<ENSCard key={i} {...textRecord} />
));
default:
return (
<>
Expand Down Expand Up @@ -194,33 +191,20 @@ const ExplorePage = ({
)
)
.map((registration, i) => {
return (
<RegistrationCard
key={i}
{...registration}
standalone={true}
displayWithoutEdit={true}
/>
);
return <RegistrationCard key={i} {...registration} standalone={true}
displayWithoutEdit={true} />;
});

// Handle Stargaze DAOs
console.log(stargazeInstances);
const stargazeDaoCards = stargazeInstances
?.flatMap((network) =>
network.registrationNetwork.registrations.filter((reg) =>
filterRegistrations(reg, filterVal)
)
)
.map((registration, i) => {
return (
<RegistrationCard
key={i}
{...registration}
standalone={true}
displayWithoutEdit={true}
/>
);
return <RegistrationCard key={i} {...registration} standalone={true}
displayWithoutEdit={true} />;
});

// Handle Osmosis DAOs
Expand All @@ -231,15 +215,10 @@ const ExplorePage = ({
)
)
.map((registration, i) => {
return (
<RegistrationCard
key={i}
{...registration}
standalone={true}
displayWithoutEdit={true}
/>
);
return <RegistrationCard key={i} {...registration} standalone={true}
displayWithoutEdit={true} />;
});

return (
<div className="explore-page">
<div className="filter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,53 @@ const REGISTRATION = gql`
}
}
`
const GET_REGISTRATIONS = gql`
query RegistrationInstances @api(contextKey: "apiName") {
registrationInstances {
id
daoAddress
registrationNetwork {
chainId
id
}
registrationAddress
daoURI
}
}
`;

const GET_DAOMETA_DATA = gql`
query Daometadata($daometadataId: ID!) @api(contextKey: "apiName") {
daometadata(id: $daometadataId) {
id
daoName
daoDescription
membersURI
issuersURI
proposalsURI
governanceURI
activityLogURI
contractsRegistryURI
managerAddress
}
}
`;


const GET_REG_INSTANCE = gql`
query RegistrationInstance($registrationInstanceId: ID!) @api(contextKey: "apiName"){
registrationInstance(id: $registrationInstanceId) {
id
daoAddress
registrationNetwork {
id
chainId
}
registrationAddress
daoURI
}
}
`;

const ATTESTATIONS_BY_SCHEMA = gql`
query AttestationsBySchema($schemaId: String!) @api(contextKey: "apiName") {
Expand Down Expand Up @@ -114,4 +161,4 @@ query Domains($where: Domain_filter, $first: Int) @api(contextKey: "apiName"){
}
}
`;
export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA, ENS_QUERY }
export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA, ENS_QUERY, GET_REGISTRATIONS, GET_DAOMETA_DATA, GET_REG_INSTANCE }
Loading

0 comments on commit 40170bd

Please sign in to comment.