diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 8a971a7a..fa94069c 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -82,12 +82,12 @@ jobs: - name: Install dependencies uses: ./.github/actions/install-dependencies - name: Download test screenshots artifact - uses: actions/download-artifact@master + uses: actions/download-artifact@v3 with: name: test-screenshots path: test/screenshots - name: Download test report artifact - uses: actions/download-artifact@master + uses: actions/download-artifact@v3 with: name: test-blob-reports path: test/blob-reports diff --git a/src/components/WarningBar.tsx b/src/components/WarningBar.tsx new file mode 100644 index 00000000..59931f0a --- /dev/null +++ b/src/components/WarningBar.tsx @@ -0,0 +1,31 @@ +/** @jsxImportSource @emotion/react */ +import { css } from "@emotion/react"; +import { Outlet } from "react-router-dom"; +import { Link } from "./Link"; + +const barStyle = css` + background-color: rgb(237, 108, 2); + color: white; + text-align: center; + font-size: 16px; + padding: 10px; + + a { + color: white; + text-decoration: underline; + } +`; + +export const WarningBar = () => { + return ( + <> +
+ On January 31, Calamar and its data sources will go into self-hosted only mode.
+ This is following the deprecation of Firesquid archives and its resulting effect on Giant Squid.
+ We apologize for any inconvenience.
+ Read more +
+ + + ); +}; diff --git a/src/router.tsx b/src/router.tsx index d3f79af0..c6fab93c 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -23,6 +23,7 @@ import { simplifyExtrinsicId } from "./services/extrinsicsService"; import { simplifyEventId } from "./services/eventsService"; import { getNetwork } from "./services/networksService"; import { normalizeCallName, normalizeConstantName, normalizeErrorName, normalizeEventName, normalizePalletName, normalizeStorageName } from "./services/runtimeMetadataService"; +import { WarningBar } from "./components/WarningBar"; const networkLoader = ({ params }: LoaderFunctionArgs) => { const { network: networkName } = params as { network: string }; @@ -37,255 +38,260 @@ const networkLoader = ({ params }: LoaderFunctionArgs) => { export const routes: RouteObject[] = [ { - element: , + element: , children: [ { - index: true, - element: , - }, - { - element: , + element: , children: [ { - path: "search/:tab?", - element: , - errorElement: , + index: true, + element: , }, { - id: "network", - path: ":network", - loader: networkLoader, - errorElement: , + element: , children: [ { - path: ":tab?", - element: , + path: "search/:tab?", + element: , + errorElement: , }, { - path: "block/:id/:tab?", - element: , - loader: (args) => { - const { params } = args; - const { id } = params as { id: string }; + id: "network", + path: ":network", + loader: networkLoader, + errorElement: , + children: [ + { + path: ":tab?", + element: , + }, + { + path: "block/:id/:tab?", + element: , + loader: (args) => { + const { params } = args; + const { id } = params as { id: string }; - const simplifiedId = simplifyBlockId(id); + const simplifiedId = simplifyBlockId(id); - if (id !== simplifiedId) { - const { network } = networkLoader(args); - return redirect(`/${network.name}/block/${simplifiedId}`); - } + if (id !== simplifiedId) { + const { network } = networkLoader(args); + return redirect(`/${network.name}/block/${simplifiedId}`); + } - return null; - } - }, - { - path: "extrinsic/:id/:tab?", - element: , - loader: (args) => { - const { params } = args; - const { id } = params as { id: string }; + return null; + } + }, + { + path: "extrinsic/:id/:tab?", + element: , + loader: (args) => { + const { params } = args; + const { id } = params as { id: string }; - const simplifiedId = simplifyExtrinsicId(id); + const simplifiedId = simplifyExtrinsicId(id); - if (id !== simplifiedId) { - const { network } = networkLoader(args); - return redirect(`/${network.name}/extrinsic/${simplifiedId}`); - } + if (id !== simplifiedId) { + const { network } = networkLoader(args); + return redirect(`/${network.name}/extrinsic/${simplifiedId}`); + } - return null; - } - }, - { - path: "call/:id/:tab?", - element: , - loader: (args) => { - const { params } = args; - const { id } = params as { id: string }; + return null; + } + }, + { + path: "call/:id/:tab?", + element: , + loader: (args) => { + const { params } = args; + const { id } = params as { id: string }; - const simplifiedId = simplifyCallId(id); + const simplifiedId = simplifyCallId(id); - if (id !== simplifiedId) { - const { network } = networkLoader(args); - return redirect(`/${network.name}/call/${simplifiedId}`); - } + if (id !== simplifiedId) { + const { network } = networkLoader(args); + return redirect(`/${network.name}/call/${simplifiedId}`); + } - return null; - } - }, - { - path: "event/:id", - element: , - loader: (args) => { - const { params } = args; - const { id } = params as { id: string }; + return null; + } + }, + { + path: "event/:id", + element: , + loader: (args) => { + const { params } = args; + const { id } = params as { id: string }; - const simplifiedId = simplifyEventId(id); + const simplifiedId = simplifyEventId(id); - if (id !== simplifiedId) { - const { network } = networkLoader(args); - return redirect(`/${network.name}/event/${simplifiedId}`); - } + if (id !== simplifiedId) { + const { network } = networkLoader(args); + return redirect(`/${network.name}/event/${simplifiedId}`); + } - return null; - } - }, - { - path: "account/:address/:tab?", - element: , - loader: (args) => { - const { params } = args; - const { address } = params as { address: string }; + return null; + } + }, + { + path: "account/:address/:tab?", + element: , + loader: (args) => { + const { params } = args; + const { address } = params as { address: string }; - const { network } = networkLoader(args); + const { network } = networkLoader(args); - const encodedAddress = encodeAddress(address, network.prefix); - if (address !== encodedAddress) { - return redirect(`/${network.name}/account/${encodedAddress}`); - } + const encodedAddress = encodeAddress(address, network.prefix); + if (address !== encodedAddress) { + return redirect(`/${network.name}/account/${encodedAddress}`); + } - return null; - } - }, - { - path: "latest-extrinsics", - element: , - }, - { - path: "runtime", - children: [ + return null; + } + }, { - index: true, - element: , + path: "latest-extrinsics", + element: , }, { - path: ":specVersion", + path: "runtime", children: [ { index: true, - element: , + element: , }, { - id: "runtime-pallet", - path: ":palletName", - loader: async (args) => { - const { params } = args; - const { specVersion, palletName } = params as { specVersion: string, palletName: string }; - - const { network } = networkLoader(args); - - console.log("pallet loader", specVersion, palletName); - - return { - palletName: await normalizePalletName(network, palletName, specVersion) - }; - }, + path: ":specVersion", children: [ { - path: ":tab?", - element: , - }, - { - id: "runtime-call", - path: "calls/:callName", - loader: async (args) => { - const { params } = args; - const { specVersion, palletName, callName } = params as { specVersion: string, palletName: string, callName: string }; - - const { network } = networkLoader(args); - - const callFullName = `${palletName}.${callName}`; - const normalizedCallFullName = await normalizeCallName(network, callFullName, specVersion); - - return { - callName: normalizedCallFullName.split(".")[1] as string - }; - }, - element: - }, - { - id: "runtime-event", - path: "events/:eventName", - loader: async (args) => { - const { params } = args; - const { specVersion, palletName, eventName } = params as { specVersion: string, palletName: string, eventName: string }; - - const { network } = networkLoader(args); - - const eventFullName = `${palletName}.${eventName}`; - const normalizedEventFullName = await normalizeEventName(network, eventFullName, specVersion); - - return { - eventName: normalizedEventFullName.split(".")[1] as string - }; - }, - element: - }, - { - id: "runtime-constant", - path: "constants/:constantName", - loader: async (args) => { - const { params } = args; - const { specVersion, palletName, constantName } = params as { specVersion: string, palletName: string, constantName: string }; - - const { network } = networkLoader(args); - - const constantFullName = `${palletName}.${constantName}`; - const normalizedConstantFullName = await normalizeConstantName(network, constantFullName, specVersion); - - return { - constantName: normalizedConstantFullName.split(".")[1] as string - }; - }, - element: + index: true, + element: , }, { - id: "runtime-storage", - path: "storages/:storageName", + id: "runtime-pallet", + path: ":palletName", loader: async (args) => { const { params } = args; - const { specVersion, palletName, storageName } = params as { specVersion: string, palletName: string, storageName: string }; + const { specVersion, palletName } = params as { specVersion: string, palletName: string }; const { network } = networkLoader(args); - const storageFullName = `${palletName}.${storageName}`; - const normalizedStorageFullName = await normalizeStorageName(network, storageFullName, specVersion); + console.log("pallet loader", specVersion, palletName); return { - storageName: normalizedStorageFullName.split(".")[1] as string + palletName: await normalizePalletName(network, palletName, specVersion) }; }, - element: + children: [ + { + path: ":tab?", + element: , + }, + { + id: "runtime-call", + path: "calls/:callName", + loader: async (args) => { + const { params } = args; + const { specVersion, palletName, callName } = params as { specVersion: string, palletName: string, callName: string }; + + const { network } = networkLoader(args); + + const callFullName = `${palletName}.${callName}`; + const normalizedCallFullName = await normalizeCallName(network, callFullName, specVersion); + + return { + callName: normalizedCallFullName.split(".")[1] as string + }; + }, + element: + }, + { + id: "runtime-event", + path: "events/:eventName", + loader: async (args) => { + const { params } = args; + const { specVersion, palletName, eventName } = params as { specVersion: string, palletName: string, eventName: string }; + + const { network } = networkLoader(args); + + const eventFullName = `${palletName}.${eventName}`; + const normalizedEventFullName = await normalizeEventName(network, eventFullName, specVersion); + + return { + eventName: normalizedEventFullName.split(".")[1] as string + }; + }, + element: + }, + { + id: "runtime-constant", + path: "constants/:constantName", + loader: async (args) => { + const { params } = args; + const { specVersion, palletName, constantName } = params as { specVersion: string, palletName: string, constantName: string }; + + const { network } = networkLoader(args); + + const constantFullName = `${palletName}.${constantName}`; + const normalizedConstantFullName = await normalizeConstantName(network, constantFullName, specVersion); + + return { + constantName: normalizedConstantFullName.split(".")[1] as string + }; + }, + element: + }, + { + id: "runtime-storage", + path: "storages/:storageName", + loader: async (args) => { + const { params } = args; + const { specVersion, palletName, storageName } = params as { specVersion: string, palletName: string, storageName: string }; + + const { network } = networkLoader(args); + + const storageFullName = `${palletName}.${storageName}`; + const normalizedStorageFullName = await normalizeStorageName(network, storageFullName, specVersion); + + return { + storageName: normalizedStorageFullName.split(".")[1] as string + }; + }, + element: + }, + { + id: "runtime-error", + path: "errors/:errorName", + loader: async (args) => { + const { params } = args; + const { specVersion, palletName, errorName } = params as { specVersion: string, palletName: string, errorName: string }; + + const { network } = networkLoader(args); + + const errorFullName = `${palletName}.${errorName}`; + const normalizedErrorFullName = await normalizeErrorName(network, errorFullName, specVersion); + + return { + errorName: normalizedErrorFullName.split(".")[1] as string + }; + }, + element: + } + ] }, - { - id: "runtime-error", - path: "errors/:errorName", - loader: async (args) => { - const { params } = args; - const { specVersion, palletName, errorName } = params as { specVersion: string, palletName: string, errorName: string }; - - const { network } = networkLoader(args); - - const errorFullName = `${palletName}.${errorName}`; - const normalizedErrorFullName = await normalizeErrorName(network, errorFullName, specVersion); - - return { - errorName: normalizedErrorFullName.split(".")[1] as string - }; - }, - element: - } ] - }, + } ] - } - ] - }, - { - path: "*", - element: , + }, + { + path: "*", + element: , + }, + ], }, - ], - }, + ] + } ] } ]