diff --git a/daostar-website/package.json b/daostar-website/package.json index 5e1e9991..84980ba0 100644 --- a/daostar-website/package.json +++ b/daostar-website/package.json @@ -33,7 +33,7 @@ "axios-hooks": "^4.0.0", "babel-jest": "^29.4.1", "caip": "^1.1.0", - "connectkit": "^1.1.2", + "connectkit": "^1.5.3", "ethers": "^5.7.2", "graphql": "^15.0.0", "jest": "^29.4.1", @@ -49,13 +49,13 @@ "typescript": "^5.2.2", "typewriter-effect": "^2.19.0", "validator": "^13.7.0", - "wagmi": "^0.12.19", + "wagmi": "^1.4.5", "web-vitals": "^2.1.4", "web3": "^1.8.1" }, "scripts": { - "start": "PORT=8000 REACT_APP_API_URL=http://localhost:8080/https://api.daostar.org react-scripts start", - "build": "REACT_APP_API_URL=https://api.daostar.org react-scripts build", + "start": "react-scripts start", + "build": "react-scripts build", "predeploy": "REACT_APP_API_URL=https://api.daostar.org npm run build", "deploy": "REACT_APP_API_URL=https://api.daostar.org gh-pages -d build", "test": "react-scripts test", diff --git a/daostar-website/public/index.html b/daostar-website/public/index.html index c75b2f6a..139ff31a 100644 --- a/daostar-website/public/index.html +++ b/daostar-website/public/index.html @@ -45,10 +45,15 @@ --> diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index cdf8b9d6..1fd6912c 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -4,207 +4,236 @@ import Register from "./components/Register/Register"; import TopNavigation from "./components/TopNavigation/TopNavigation"; import RegistrationPage from "./components/RegistrationPage/RegistrationPage"; import ExplorePage from "./components/ExplorePage/ExplorePage"; -import { WagmiConfig, createClient } from "wagmi"; -import { ConnectKitProvider, getDefaultClient } from "connectkit"; +import { WagmiConfig, createConfig } from "wagmi"; +import { ConnectKitProvider, getDefaultConfig } from "connectkit"; import { useQuery } from "@apollo/client"; import registrationIdsToFilter from "./components/FilterRegistrations/Filter_Registrations_By_Id"; +import { ApolloClient, InMemoryCache } from "@apollo/client"; +import { createHttpLink } from "apollo-link-http"; import queries from "./components/ExplorePage/queries/registrations"; - import "./App.css"; import "./bp4-theme.css"; import Eye from "./components/Homepage/Eye/Eye"; +const mainnetOldClient = new ApolloClient({ + link: createHttpLink({ + uri: "https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0", + }), + cache: new InMemoryCache(), +}); + const alchemyId = process.env.ALCHEMY_ID; +const walletConnectId = process.env.WALLETCONNECT_ID; -const client = createClient( - getDefaultClient({ - appName: "DAOstar", - alchemyId, - }) +const client = createConfig( + getDefaultConfig({ + appName: "DAOstar", + alchemyId, + walletConnectId, + }) ); function App() { - const { - loading, - error, - data: mainnetData, - } = useQuery(queries.REGISTRATIONS, { - context: { apiName: "mainnet" }, - variables: { id: "mainnet" }, - }); - const mainnetv0Res = useQuery(queries.REGISTRATIONS, { - context: { apiName: "mainnetOld" }, - variables: { id: "mainnetOld" }, - }); - const goerliRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "goerli" }, - variables: { id: "goerli" }, - }); - const optimismGoerliRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "optimismGoerli" }, - variables: { id: "optimism-goerli" }, - }); - const arbitrumGoerliRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "arbitrumGoerli" }, - variables: { id: "arbitrum-goerli" }, - }); - const chapelRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "chapel" }, - variables: { id: "chapel" }, - }); - - const optimismRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "optimism" }, - variables: { id: "optimism" }, - }); - const { - loading: mainnetv0Loading, - error: mainnetv0Error, - data: mainnetv0Data, - } = mainnetv0Res; - const { - loading: optimismLoading, - error: optimismError, - data: optimismData, - } = optimismRes; - - const { - loading: optimismGoerliLoading, - error: optimismGoerliError, - data: optimismGoerliData, - } = optimismGoerliRes; - const { - loading: arbitrumGoerliLoading, - error: arbitrumGoerliError, - data: arbitrumGoerliData, - } = arbitrumGoerliRes; - const { - loading: chapelLoading, - error: chapelError, - data: chapelData, - } = chapelRes; - const { - loading: goerliLoading, - error: goerliError, - data: goerliData, - } = goerliRes; - const gnosisRes = useQuery(queries.REGISTRATIONS, { - context: { apiName: "gnosis" }, - variables: { id: "gnosis" }, - }); - const { - loading: gnosisLoading, - error: gnosisError, - data: gnosisData, - } = gnosisRes; - console.log({ mainnetData, goerliData, gnosisData, optimismGoerliData, arbitrumGoerliData, chapelData, mainnetv0Data }); - - if (error || goerliError || optimismGoerliError || arbitrumGoerliError || chapelError || optimismError || mainnetv0Error ) { - console.error("Mainnet Error "+ error); - console.error("Mainnet v0 Error "+ mainnetv0Error); - console.error("Goerli Error "+ goerliError); - console.error("Optimism Goerli Error "+ optimismGoerliError); - console.error("Arbitrum Goerli Error" + arbitrumGoerliError); - console.error("Chapel Error" + chapelError); - console.error("Optimism Error" + optimismError) - }; - if (loading || mainnetv0Loading || goerliLoading || gnosisLoading || optimismGoerliLoading || arbitrumGoerliLoading || chapelLoading || optimismLoading) return "loading..."; - const mainnetRegistrations = - mainnetData?.registrationNetwork?.registrations || []; - const mainnetv0Registrations = - mainnetv0Data?.registrationNetwork?.registrations || []; - const goerliRegistrations = - goerliData?.registrationNetwork?.registrations || []; - const optimismGoerliRegistrations = - optimismGoerliData?.registrationNetwork?.registrations || []; - const optimismRegistrations = - optimismData?.registrationNetwork?.registrations || []; - const gnosisRegistrations = - gnosisData?.registrationNetwork?.registrations || []; - const arbitrumGoerliRegistrations = - arbitrumGoerliData?.registrationNetwork?.registrations || []; - const chapelRegistrations = - chapelData?.registrationNetwork?.registrations || []; - const allRegistrationInstances = mainnetRegistrations.concat( - mainnetv0Registrations, - goerliRegistrations, - gnosisRegistrations, - optimismGoerliRegistrations, - arbitrumGoerliRegistrations, - chapelRegistrations, - optimismRegistrations - ); - - const registrationInstances = allRegistrationInstances.filter((instance) => - !registrationIdsToFilter.includes(instance.id) - ) - - - - return ( - - -
- - {/* */} - - - } /> - } /> - } - /> - - } - /> - - } - /> - { - window.location.href = - "https://github.com/metagov/daostar/discussions/41"; - return null; - }} - /> - -
-
-
- ); + const { + loading, + error, + data: mainnetData, + } = useQuery(queries.REGISTRATIONS, { + context: { apiName: "mainnet" }, + variables: { id: "mainnet" }, + }); + + const { + loading: mainnetv0Loading, + error: mainnetv0Error, + data: mainnetv0Data, + } = useQuery(queries.REGISTRATIONSOLD, { + client: mainnetOldClient, + context: { apiName: "mainnet" }, + variables: { id: "mainnet" }, + }); + + const goerliRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "goerli" }, + variables: { id: "goerli" }, + }); + const optimismGoerliRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "optimismGoerli" }, + variables: { id: "optimism-goerli" }, + }); + const arbitrumGoerliRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "arbitrumGoerli" }, + variables: { id: "arbitrum-goerli" }, + }); + const chapelRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "chapel" }, + variables: { id: "chapel" }, + }); + + const optimismRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "optimism" }, + variables: { id: "optimism" }, + }); + + const { + loading: goerliLoading, + error: goerliError, + data: goerliData, + } = goerliRes; + + const gnosisRes = useQuery(queries.REGISTRATIONS, { + context: { apiName: "gnosis" }, + variables: { id: "gnosis" }, + }); + const { + loading: optimismLoading, + error: optimismError, + data: optimismData, + } = optimismRes; + + const { + loading: optimismGoerliLoading, + error: optimismGoerliError, + data: optimismGoerliData, + } = optimismGoerliRes; + const { + loading: arbitrumGoerliLoading, + error: arbitrumGoerliError, + data: arbitrumGoerliData, + } = arbitrumGoerliRes; + const { + loading: chapelLoading, + error: chapelError, + data: chapelData, + } = chapelRes; + + const { + loading: gnosisLoading, + error: gnosisError, + data: gnosisData, + } = gnosisRes; + + console.log({ + mainnetData, + mainnetv0Data, + goerliData, + gnosisData, + optimismGoerliData, + arbitrumGoerliData, + chapelData, + }); + + if ( + error || + goerliError || + optimismGoerliError || + arbitrumGoerliError || + chapelError || + optimismError || + mainnetv0Error + ) { + console.error("Mainnet Error " + error); + console.error("Mainnet v0 Error " + mainnetv0Error); + console.error("Goerli Error " + goerliError); + console.error("Optimism Goerli Error " + optimismGoerliError); + console.error("Arbitrum Goerli Error" + arbitrumGoerliError); + console.error("Chapel Error" + chapelError); + console.error("Optimism Error" + optimismError); + } + if ( + loading || + goerliLoading || + gnosisLoading || + optimismGoerliLoading || + arbitrumGoerliLoading || + chapelLoading || + optimismLoading || + mainnetv0Loading + ) + return "loading..."; + const mainnetRegistrations = + mainnetData?.registrationNetwork?.registrations || []; + const mainnetv0Registrations = + mainnetv0Data?.registrationNetwork?.registrations || []; + const goerliRegistrations = + goerliData?.registrationNetwork?.registrations || []; + const optimismGoerliRegistrations = + optimismGoerliData?.registrationNetwork?.registrations || []; + const optimismRegistrations = + optimismData?.registrationNetwork?.registrations || []; + const gnosisRegistrations = + gnosisData?.registrationNetwork?.registrations || []; + const arbitrumGoerliRegistrations = + arbitrumGoerliData?.registrationNetwork?.registrations || []; + const chapelRegistrations = + chapelData?.registrationNetwork?.registrations || []; + const allRegistrationInstances = mainnetRegistrations.concat( + mainnetv0Registrations, + goerliRegistrations, + gnosisRegistrations, + optimismGoerliRegistrations, + arbitrumGoerliRegistrations, + chapelRegistrations, + optimismRegistrations + ); + + const registrationInstances = allRegistrationInstances.filter( + (instance) => !registrationIdsToFilter.includes(instance.id) + ); + + return ( + + +
+ + {/* */} + + + } /> + } /> + } /> + + } + /> + + } + /> + { + window.location.href = + "https://github.com/metagov/daostar/discussions/41"; + return null; + }} + /> + +
+
+
+ ); } if (window.location.path === "creative-universe") { - window.location = "https://github.com/metagov/daostar/discussions/41"; + window.location = "https://github.com/metagov/daostar/discussions/41"; } -export default App; +export default App; \ No newline at end of file diff --git a/daostar-website/src/components/ExplorePage/ExplorePage.js b/daostar-website/src/components/ExplorePage/ExplorePage.js index 3407c59e..f2509f2e 100644 --- a/daostar-website/src/components/ExplorePage/ExplorePage.js +++ b/daostar-website/src/components/ExplorePage/ExplorePage.js @@ -17,7 +17,6 @@ const ExplorePage = ({registrationInstances}) => { const [filterVal, setFilterVal] = useState('') const onChangeFilter = (e) => setFilterVal(e.target.value) - const daoCards = registrationInstances .filter((reg) => filterRegistrations(reg, filterVal)) .map((registration, i) => { diff --git a/daostar-website/src/components/ExplorePage/queries/registrations.js b/daostar-website/src/components/ExplorePage/queries/registrations.js index 28c52176..f06f71f8 100644 --- a/daostar-website/src/components/ExplorePage/queries/registrations.js +++ b/daostar-website/src/components/ExplorePage/queries/registrations.js @@ -25,6 +25,33 @@ const REGISTRATIONS = gql` } } ` +// DO NOT UPDATE THIS QUERY, this query is specifically for v0 Subgraph Indexer +// We don't want to keep having to update the schema of old indexers as we add new fields +const REGISTRATIONSOLD = gql` + query Registrations($id: String) @api(contextKey: "apiName") { + registrationNetwork(id: $id) { + id + registrations { + id + daoAddress + daoURI + daoName + daoDescription + proposalsURI + membersURI + issuersURI + governanceURI + activityLogURI + managerAddress + contractsRegistryURI + registrationAddress + registrationNetwork { + id + } + } + } + } +` const REGISTRATION = gql` query Registration($id: String) @api(contextKey: "apiName") { @@ -49,4 +76,4 @@ const REGISTRATION = gql` } ` -export default { REGISTRATIONS, REGISTRATION } +export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD } diff --git a/daostar-website/src/components/Homepage/Eye/Box.js b/daostar-website/src/components/Homepage/Eye/Box.js index 8b62cc81..1ab52cf9 100644 --- a/daostar-website/src/components/Homepage/Eye/Box.js +++ b/daostar-website/src/components/Homepage/Eye/Box.js @@ -9,10 +9,12 @@ export default function Box({ text, ...props }) { const [hovered, setHovered] = useState(false) useFrame(({ mouse, viewport }) => { + if (viewport.width && viewport.height) { + const x = (mouse.x * viewport.width) / 2.5 const y = (mouse.y * viewport.height) / 2.5 ref.current.lookAt(x, y, 1) - ref.current.material.color.lerp(hovered ? lime : black, 0.05) + ref.current.material.color.lerp(hovered ? lime : black, 0.05) } }) return ( diff --git a/daostar-website/src/errorHandler.js b/daostar-website/src/errorHandler.js new file mode 100644 index 00000000..a8eda249 --- /dev/null +++ b/daostar-website/src/errorHandler.js @@ -0,0 +1,9 @@ +export function setupErrorHandling() { + window.onerror = function (message, source, lineno, colno, error) { + // Handle the error, log it, or send it to a reporting service. + console.error(message, source, lineno, colno, error); + // Return false to prevent the default browser error handling. + return false; + }; + } + \ No newline at end of file diff --git a/daostar-website/src/index.js b/daostar-website/src/index.js index 0fd19279..0bbb96ec 100644 --- a/daostar-website/src/index.js +++ b/daostar-website/src/index.js @@ -15,15 +15,18 @@ import { import { createHttpLink } from "apollo-link-http"; import { MultiAPILink } from "@habx/apollo-multi-endpoint-link"; import "./index.css"; +import { setupErrorHandling } from "./errorHandler.js"; const root = ReactDOM.createRoot(document.getElementById("root")); +setupErrorHandling(); FocusStyleManager.onlyShowFocusOnTabs(); function getLibrary(provider) { return new Web3Provider(provider); } + const client = new ApolloClient({ link: ApolloLink.from([ new MultiAPILink({ @@ -35,10 +38,9 @@ const client = new ApolloClient({ arbitrumGoerli: `https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-arbitrum-goerli`, chapel:`https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-bnb-bruno`, optimism: `https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-optimism`, - mainnetOld: `https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0` }, - // defaultEndpoint: 'https://api.thegraph.com/subgraphs/name/ipatka/daostar', + //defaultEndpoint: 'https://api.thegraph.com/subgraphs/name/ipatka/daostar', httpSuffix: "", createHttpLink: createHttpLink, }), @@ -46,6 +48,7 @@ const client = new ApolloClient({ cache: new InMemoryCache({}), }); + root.render(