diff --git a/src/bootstrap/app.js b/src/bootstrap/app.js index 4beacf4..f594f66 100644 --- a/src/bootstrap/app.js +++ b/src/bootstrap/app.js @@ -35,16 +35,6 @@ const FooterWrapper = styled.div` margin-top: auto !important; ` -export const AlertMessage = styled.div` - display: flex; - width: 100vw; - background-color: #a83232; - color: #ffffff; - justify-content: center; - text-align: center; - padding: 6px 0; -` - const App = () => { const [isMenuClosed, setIsMenuClosed] = useState(true) @@ -79,14 +69,6 @@ const App = () => { - {/* temporary alert message until subgraph issues are fixed */} - - TheGraph is currently facing intermittent issues that are - affecting the search functionality on this frontend, making it - difficult to locate certain entries. To ensure you don't - submit duplicates, please manually check if an entry has - already been submitted. - { // there are a few ethers queries coming from here. // they might have to be changed to subgraph queries // TODO read and figure it out - const { itemID, props, registry } = item + const { itemID, metadata: itemMetadata, registry } = item const { id: tcrAddress } = registry const { gtcrView, @@ -111,14 +111,14 @@ const OptionItem = ({ item }) => { <> ) : ( - props + itemMetadata?.props .filter(col => col.isIdentifier) .map((column, j) => ( @@ -142,12 +142,14 @@ const OptionItem = ({ item }) => { OptionItem.propTypes = { item: PropTypes.shape({ itemID: PropTypes.string, - props: PropTypes.arrayOf( - PropTypes.shape({ - type: PropTypes.oneOf(Object.values(ItemTypes)), - value: PropTypes.string.isRequired - }) - ), + metadata: PropTypes.shape({ + props: PropTypes.arrayOf( + PropTypes.shape({ + type: PropTypes.oneOf(Object.values(ItemTypes)), + value: PropTypes.string.isRequired + }) + ) + }), registry: PropTypes.shape({ id: PropTypes.string }) @@ -182,7 +184,7 @@ const LightSearchBar = () => { }, [itemSearchQuery]) const options = data.map(d => { - const itemLabels = d.props.filter(prop => + const itemLabels = d.item?.metadata?.props.filter(prop => searchableFields.includes(prop.type) ) @@ -191,11 +193,11 @@ const LightSearchBar = () => { label = itemLabels.find(prop => prop.type === ItemTypes.TEXT)?.value || itemLabels[0].value - else label = d.itemID + else label = d.item.itemID return ( - - + + ) }) diff --git a/src/components/request-timelines.js b/src/components/request-timelines.js index 493eda3..8acb0cf 100644 --- a/src/components/request-timelines.js +++ b/src/components/request-timelines.js @@ -87,11 +87,11 @@ const Timeline = ({ request, item, metaEvidence }) => { name: 'Evidence', timestamp: e.timestamp, transactionHash: e.txHash, - title: e.title, - description: e.description, + title: e.metadata?.title, + description: e.metadata?.description, URI: e.URI, - fileURI: e.fileURI, - fileTypeExtension: e.fileTypeExtension, + fileURI: e.metadata?.fileURI, + fileTypeExtension: e.metadata?.fileTypeExtension, party: e.party })) @@ -117,13 +117,13 @@ const Timeline = ({ request, item, metaEvidence }) => { useEffect(() => { const evidenceManualFetch = async () => { const unindexedEvidenceURIs = logs - .filter(e => e.name === 'Evidence') + .filter(e => e.metadata?.name === 'Evidence') .filter( e => - e.title === null && - e.description === null && - e.fileURI === null && - e.fileTypeExtension === null + e.metadata?.title === null && + e.metadata?.description === null && + e.metadata?.fileURI === null && + e.metadata?.fileTypeExtension === null ) .map(e => e.URI) diff --git a/src/config/tcr-addresses.ts b/src/config/tcr-addresses.ts index 0f757ea..0b48d71 100644 --- a/src/config/tcr-addresses.ts +++ b/src/config/tcr-addresses.ts @@ -128,7 +128,9 @@ export const txBatcherAddresses = { } as const export const subgraphUrl = { - '1': 'https://api.thegraph.com/subgraphs/name/kleros/curate', + '1': + 'https://api.studio.thegraph.com/query/61738/legacy-curate-mainnet/version/latest', '5': 'https://api.thegraph.com/subgraphs/name/kleros/curate-goerli', - '100': 'https://api.thegraph.com/subgraphs/name/kleros/legacy-curate-xdai' + '100': + 'https://api.studio.thegraph.com/query/61738/legacy-curate-gnosis/version/latest' } as const diff --git a/src/hooks/factory.js b/src/hooks/factory.js index 189d8eb..ec7dc1e 100644 --- a/src/hooks/factory.js +++ b/src/hooks/factory.js @@ -25,6 +25,7 @@ const useFactory = () => { const { data } = await ( await fetch(GTCR_SUBGRAPH_URL, { method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(query) }) ).json() @@ -55,6 +56,7 @@ const useFactory = () => { const { data } = await ( await fetch(GTCR_SUBGRAPH_URL, { method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(query) }) ).json() diff --git a/src/hooks/light-tcr-view.js b/src/hooks/light-tcr-view.js index f885bb0..eeecb32 100644 --- a/src/hooks/light-tcr-view.js +++ b/src/hooks/light-tcr-view.js @@ -23,6 +23,7 @@ export const fetchMetaEvidence = async (tcr, networkId) => { const response = await fetch(subgraphUrl[networkId], { method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(query) }) diff --git a/src/hooks/tcr-view.js b/src/hooks/tcr-view.js index db6d3d9..f80bd54 100644 --- a/src/hooks/tcr-view.js +++ b/src/hooks/tcr-view.js @@ -24,11 +24,13 @@ export const fetchMetaEvidence = async (tcr, networkId) => { } connectedTCR } - }` + }`, + variables: {} } const response = await fetch(subgraphUrl[networkId], { method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(query) }) diff --git a/src/pages/light-item-details/badges/index.js b/src/pages/light-item-details/badges/index.js index 1c7836c..35d1293 100644 --- a/src/pages/light-item-details/badges/index.js +++ b/src/pages/light-item-details/badges/index.js @@ -73,8 +73,8 @@ const mapToLegacy = items => items .map(item => ({ ...item, - decodedData: item.props.map(({ value }) => value), - mergedData: item.props + decodedData: item.metadata?.props.map(({ value }) => value), + mergedData: item.metadata?.props })) .map( ({ @@ -321,18 +321,20 @@ const Badges = ({ connectedTCRAddr, item, tcrAddress }) => { query: ` { litems (where:{ - registry: "${badgeAddr.toLowerCase()}" - keywords: "${keywords}" + registry: "${badgeAddr.toLowerCase()}", + metadata_: {keywords: "${keywords}"} }) { itemID status data - props { - value - type - label - description - isIdentifier + metadata{ + props { + value + type + label + description + isIdentifier + } } requests(first: 1, orderBy: submissionTime, orderDirection: desc) { disputed @@ -359,6 +361,7 @@ const Badges = ({ connectedTCRAddr, item, tcrAddress }) => { const { data } = await ( await fetch(GTCR_SUBGRAPH_URL, { method: 'POST', + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(query) }) ).json() diff --git a/src/pages/light-items/index.js b/src/pages/light-items/index.js index a8190ba..e2f7533 100644 --- a/src/pages/light-items/index.js +++ b/src/pages/light-items/index.js @@ -257,8 +257,8 @@ const Items = () => { let { litems: items } = data items = items.map(item => ({ ...item, - decodedData: item.props.map(({ value }) => value), - mergedData: item.props + decodedData: item.metadata?.props.map(({ value }) => value), + mergedData: item.metadata?.props })) // HACK: // the graph could have failed to include the props. @@ -276,7 +276,12 @@ const Items = () => { value: item.values[column.label] })) const decodedData = mergedData.map(d => d.value) - const newItem = { ...i, mergedData, decodedData, props: mergedData } + const newItem = { + ...i, + mergedData, + decodedData, + metadata: { props: mergedData } + } return newItem } else return i }) diff --git a/src/pages/light-items/tour-steps.js b/src/pages/light-items/tour-steps.js index 2714487..2a12835 100644 --- a/src/pages/light-items/tour-steps.js +++ b/src/pages/light-items/tour-steps.js @@ -21,7 +21,7 @@ const itemsTourSteps = metadata => { {metadata && `In the case of ${tcrTitle}, each item is ${getArticleFor( itemName - )} ${itemName.toLowerCase()}`} + )} ${itemName?.toLowerCase()}`} . ) diff --git a/src/utils/graphql/classic-item-details.js b/src/utils/graphql/classic-item-details.js index c10ff82..1ae4143 100644 --- a/src/utils/graphql/classic-item-details.js +++ b/src/utils/graphql/classic-item-details.js @@ -26,14 +26,17 @@ const CLASSIC_ITEM_DETAILS_QUERY = gql` id evidences(orderBy: number, orderDirection: desc) { party - title - description URI - fileURI number timestamp txHash - fileTypeExtension + metadata { + name + title + description + fileURI + fileTypeExtension + } } } rounds(orderBy: creationTime, orderDirection: desc) { diff --git a/src/utils/graphql/item-details.js b/src/utils/graphql/item-details.js index db84fd6..8fd63bc 100644 --- a/src/utils/graphql/item-details.js +++ b/src/utils/graphql/item-details.js @@ -26,14 +26,17 @@ const LIGHT_ITEM_DETAILS_QUERY = gql` id evidences(orderBy: number, orderDirection: desc) { party - title - description URI - fileURI number timestamp txHash - fileTypeExtension + metadata { + name + title + description + fileURI + fileTypeExtension + } } } rounds(orderBy: creationTime, orderDirection: desc) { diff --git a/src/utils/graphql/item-search.js b/src/utils/graphql/item-search.js index 20c896b..0555260 100644 --- a/src/utils/graphql/item-search.js +++ b/src/utils/graphql/item-search.js @@ -3,34 +3,38 @@ import { gql } from '@apollo/client' const ITEM_SEARCH_QUERY = gql` query itemSearchQuery($text: String!) { itemSearch(text: $text, first: $first) { - id - itemID - data - props { - type - value - isIdentifier - } - registry { + item { id - } - requests(first: 1, orderBy: submissionTime, orderDirection: desc) { - disputed - disputeID - submissionTime - resolved - requester - challenger - resolutionTime - deposit - rounds(first: 1, orderBy: creationTime, orderDirection: desc) { - appealPeriodStart - appealPeriodEnd - ruling - hasPaidRequester - hasPaidChallenger - amountPaidRequester - amountPaidChallenger + itemID + data + metadata { + props { + type + value + isIdentifier + } + } + registry { + id + } + requests(first: 1, orderBy: submissionTime, orderDirection: desc) { + disputed + disputeID + submissionTime + resolved + requester + challenger + resolutionTime + deposit + rounds(first: 1, orderBy: creationTime, orderDirection: desc) { + appealPeriodStart + appealPeriodEnd + ruling + hasPaidRequester + hasPaidChallenger + amountPaidRequester + amountPaidChallenger + } } } } diff --git a/src/utils/graphql/light-items.js b/src/utils/graphql/light-items.js index 4de1dd4..2f3f561 100644 --- a/src/utils/graphql/light-items.js +++ b/src/utils/graphql/light-items.js @@ -26,12 +26,14 @@ const LIGHT_ITEMS_QUERY = gql` itemID status data - props { - value - type - label - description - isIdentifier + metadata { + props { + value + type + label + description + isIdentifier + } } requests(first: 1, orderBy: submissionTime, orderDirection: desc) { disputed