Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Geo-Web-Project/cadastre into fe…
Browse files Browse the repository at this point in the history
…at/augments
  • Loading branch information
codynhat committed Jun 19, 2024
2 parents b31f424 + 65b8045 commit caf8e73
Show file tree
Hide file tree
Showing 13 changed files with 1,089 additions and 76 deletions.
1 change: 0 additions & 1 deletion .env.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ VITE_BLOCK_EXPLORER = "https://optimistic.etherscan.io/"
VITE_WORLD_ADDRESS =
VITE_WORLD_BLOCK_NUMBER =
VITE_SPATIAL_DOMAIN = "https://geoweb.app/"
VITE_IPFS_GATEWAY = https://gateway.pinata.cloud/ipfs
VITE_GRAPH_URI=https://gateway-arbitrum.network.thegraph.com/api/6f359a9519137a5048fdc3d24f78f630/subgraphs/id/4DC8D9kNX7sw8ayCNgsWUNcHtJvQiDTwKTkWudWDowKC
VITE_SSX_HOST = https://ssx.geoweb.network
VITE_ANALYTICS_ID = geoweb.land
Expand Down
1 change: 0 additions & 1 deletion .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ VITE_WORLD_ADDRESS = 0xc22c14290ad8d1677b03e1e1d69e2620f0b1e793
VITE_WORLD_BLOCK_NUMBER = 12210025
VITE_SPATIAL_DOMAIN = "https://testnet.geoweb.app/"
VITE_GRAPH_URI=https://gateway-arbitrum.network.thegraph.com/api/6f359a9519137a5048fdc3d24f78f630/subgraphs/id/Dv2u1QabAxCxjN59putrh24pLPuBCy8PidbEc4fZBFAo
VITE_IPFS_GATEWAY = https://gateway.pinata.cloud/ipfs
VITE_SSX_HOST = https://ssx-stg.geoweb.network
VITE_ANALYTICS_ID =
VITE_REFERRAL_HOST = https://referral-stg.geoweb.network
Expand Down
35 changes: 0 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,5 @@
window.global = window;
</script>
<script type="module" src="/src/main.tsx"></script>
<script>
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic("reattach_activator");
ic("update", w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "https://widget.intercom.io/widget/qonbdvt5";
var x = d.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === "complete") {
l();
} else if (w.attachEvent) {
w.attachEvent("onload", l);
} else {
w.addEventListener("load", l, false);
}
}
})();
</script>
</body>
</html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@geo-web/sdk": "^4.4.0",
"@latticexyz/protocol-parser": "^2.0.11",
"@mapbox/mapbox-gl-geocoder": "^5.0.2",
"@helia/verified-fetch": "^1.3.14",
"@popperjs/core": "^2.11.5",
"@rainbow-me/rainbowkit": "^1.3.4",
"@reduxjs/toolkit": "^1.8.1",
Expand Down
12 changes: 6 additions & 6 deletions src/components/cadastre/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1186,12 +1186,12 @@ function Map(props: MapProps) {
isTablet && interactionState === STATE.CLAIM_SELECTING
? `calc(180px + ${DRAWER_CLAIM_HEIGHT}px)`
: isTablet
? "266px"
? "204px"
: isMobile && interactionState === STATE.CLAIM_SELECTING
? `calc(152px + ${DRAWER_CLAIM_HEIGHT}px)`
: isMobile
? "236px"
: "258px",
? "186px"
: "208px",
visibility:
(isMobile || isTablet) &&
interactionState !== STATE.VIEWING &&
Expand All @@ -1211,8 +1211,8 @@ function Map(props: MapProps) {
(isMobile || isTablet) && interactionState === STATE.CLAIM_SELECTING
? `calc(56px + ${DRAWER_CLAIM_HEIGHT}px)`
: isTablet
? "142px"
: "140px",
? "80px"
: "90px",
right: "2vw",
zIndex: 1,
width: isMobile || isTablet ? "38px" : "31px",
Expand Down Expand Up @@ -1247,7 +1247,7 @@ function Map(props: MapProps) {
bottom:
(isMobile || isTablet) && interactionState === STATE.CLAIM_SELECTING
? `${DRAWER_CLAIM_HEIGHT}px`
: "86px",
: "30px",
right: "2%",
width: "123px",
borderRadius: 12,
Expand Down
13 changes: 1 addition & 12 deletions src/components/shared/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, useEffect } from "react";
import { useMemo } from "react";
import { Outlet, Link, useLocation, useNavigate } from "react-router-dom";
import { useAccount, useNetwork } from "wagmi";
import {
Expand Down Expand Up @@ -80,17 +80,6 @@ export default function Header(props: HeaderProps) {
[]
);

useEffect(() => {
(window as any).Intercom("boot", {
api_base: "https://api-iam.intercom.io",
app_id: "qonbdvt5",
});
}, []);

useEffect(() => {
(window as any).Intercom("update");
}, [location.pathname]);

return (
<ApolloProvider client={apolloClient}>
{(!isMobile && !isTablet) || !isFullScreen ? (
Expand Down
14 changes: 11 additions & 3 deletions src/context/Allo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { Address } from "viem";
import { usePublicClient } from "wagmi";
import { optimism, optimismSepolia } from "wagmi/chains";
import { SQFSuperFluidStrategy } from "@allo-team/allo-v2-sdk/";
import { createVerifiedFetch } from "@helia/verified-fetch";
import { recipientIds } from "../lib/governance/recipientIds";
import { sqfStrategyAbi } from "../lib/abi/sqfStrategy";
import { getGatewayUrl } from "../lib/utils";
import {
RPC_URLS_HTTP,
SQF_STRATEGY_ADDRESS,
ALLO_POOL_ID,
IPFS_GATEWAYS,
} from "../lib/constants";

export type Recipient = {
Expand Down Expand Up @@ -128,14 +129,21 @@ export function AlloContextProvider({

if (pointer) {
try {
const detailsRes = await fetch(getGatewayUrl(pointer));
const verifiedFetch = await createVerifiedFetch({
gateways: IPFS_GATEWAYS,
});
const detailsRes = await verifiedFetch(pointer);

const { name, description, image, website, social } =
await detailsRes.json();

const imageRes = await verifiedFetch(image);
const imageBlob = await imageRes.blob();

recipientsDetails.push({
name,
description,
image: getGatewayUrl(image),
image: URL.createObjectURL(imageBlob),
website,
social,
});
Expand Down
11 changes: 7 additions & 4 deletions src/hooks/geo-web-content/basicProfile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useState, useEffect } from "react";
import { Contracts } from "@geo-web/sdk/dist/contract/types";
import { IPFS_GATEWAY } from "../../lib/constants";
import { IPFS_GATEWAYS } from "../../lib/constants";
import { ethers } from "ethers";
import { createVerifiedFetch } from "@helia/verified-fetch";

export type BasicProfile = { name?: string; external_url?: string };

Expand Down Expand Up @@ -76,9 +77,11 @@ function useBasicProfile(
return basicProfile;
}

const basicProfileRes = await fetch(
`${IPFS_GATEWAY}/${tokenURI.slice(7)}`
);
const verifiedFetch = await createVerifiedFetch({
gateways: IPFS_GATEWAYS,
});
const basicProfileRes = await verifiedFetch(tokenURI);

basicProfile = await basicProfileRes.json();
} catch (err) {
console.warn(err);
Expand Down
9 changes: 8 additions & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ export const PAYMENT_TOKEN_FAUCET_URL = "https://faucet.paradigm.xyz";
export const BETA_AGREEMENT_KEY = "storedBetaAgreement";
export const STORAGE_WORKER_ENDPOINT =
"https://storage-workers.geo-web.workers.dev";
export const IPFS_GATEWAY = import.meta.env.VITE_IPFS_GATEWAY;
export const IPFS_GATEWAYS = [
"https://trustless-gateway.link",
"https://gateway.pinata.cloud",
"https://storry.tv",
"https://cloudflare-ipfs.com",
"https://4everland.io",
"https://ipfs.runfission.com",
];

export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
export const SECONDS_IN_WEEK = 60 * 60 * 24 * 7;
Expand Down
5 changes: 0 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { formatEther } from "viem";
import { BigNumber } from "ethers";
import { Framework, NativeAssetSuperToken } from "@superfluid-finance/sdk-core";
import { IPFS_GATEWAY } from "./constants";

export enum TimeInterval {
DAY = "/day",
Expand Down Expand Up @@ -98,10 +97,6 @@ export function calculateAuctionValue(
return forSalePrice.sub(priceDecrease);
}

export function getGatewayUrl(uri: string) {
return uri.startsWith("ipfs://") ? `${IPFS_GATEWAY}/${uri.slice(7)}` : uri;
}

export function perSecondToPerMonth(amount: number) {
return amount * 2628000;
}
Expand Down
7 changes: 4 additions & 3 deletions src/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ export const makeStore = () => {
return await Framework.create({
chainId: NETWORK_ID,
provider: new ethers.providers.JsonRpcProvider(RPC_URLS_HTTP[NETWORK_ID]),
customSubgraphQueriesEndpoint:
customSubgraphQueriesEndpoint: `https://subgraph-endpoints.superfluid.dev/${
import.meta.env.MODE === "mainnet"
? "https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet"
: "https://subgraph-endpoints.superfluid.dev/optimism-sepolia/protocol-v1",
? "optimism-mainnet"
: "optimism-sepolia"
}/protocol-v1`,
resolverAddress: SUPERFLUID_RESOLVER_ADDRESS,
});
});
Expand Down
4 changes: 0 additions & 4 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ input[type="number"] {
max-width: 46px !important;
}

.intercom-lightweight-app-launcher.intercom-launcher {
right: 2%;
}

.grid-switch.btn:hover,
.grid-switch.btn:focus,
.grid-switch.btn:active {
Expand Down
Loading

0 comments on commit caf8e73

Please sign in to comment.