Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

---

## ⚠️ Deprecated Repository

**This repository is no longer maintained and has been deprecated in favor of [explorer (rebased)](https://github.com/iotaledger/iota/tree/develop/apps/explorer).**

Please refer to the new repository for the latest updates, bug fixes, and features.

## About

This repository is where the IOTA Foundation hosts the open-source code for the [Tangle Explorer website](https://explorer.iota.org/).
Expand Down
12 changes: 12 additions & 0 deletions client/src/app/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
@include desktop-down {
margin-top: calc(2 * #{$navbar-height-mobile});
}

.disclaimer-banner {
padding: 20px;
border-radius: 0;
border: 1px solid $iota2-teal-500;
background-color: rgba($iota2-teal-500, 0.2);

p {
color: var(--body-color);
font-size: 16px;
}
}
}

.maintenance {
Expand Down
35 changes: 29 additions & 6 deletions client/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { scrollToTop } from "~helpers/pageUtils";
import { useWasmLoader } from "~helpers/hooks/useWasmLoader";
import { useInitServicesLoader } from "~helpers/hooks/useInitServicesLoader";
import { INetwork } from "~models/config/INetwork";
import { MAINNET } from "~models/config/networkType";
import { MAINNET, SHIMMER } from "~models/config/networkType";
import { IOTA_UI, IOTA2_UI, SHIMMER_UI } from "~models/config/uiTheme";
import { NOVA, STARDUST } from "~models/config/protocolVersion";
import { NetworkService } from "~services/networkService";
Expand Down Expand Up @@ -56,7 +56,9 @@ const App: React.FC<RouteComponentProps<AppRouteProps>> = ({

const identityResolverEnabled = protocolVersion !== STARDUST && (networkConfig?.identityResolverEnabled ?? true);
const currentNetworkName = networkConfig?.network;
const isShimmer = isShimmerUiTheme(networkConfig?.uiTheme);
const isShimmerTheme = isShimmerUiTheme(networkConfig?.uiTheme);
const isShimmer = networkConfig && networkConfig.network === SHIMMER;
const isStardust = networkConfig && networkConfig.protocolVersion === STARDUST;
const nodeService = ServiceFactory.get<NodeInfoServiceStardust>("node-info-stardust");
const nodeInfo = networkConfig?.network ? nodeService.get(networkConfig?.network) : null;
const withNetworkContext = networkContextWrapper(currentNetworkName, nodeInfo, networkConfig?.uiTheme);
Expand Down Expand Up @@ -90,14 +92,14 @@ const App: React.FC<RouteComponentProps<AppRouteProps>> = ({
);
}

const routes = buildAppRoutes(networkConfig?.protocolVersion ?? "", withNetworkContext);
const routes = buildAppRoutes(networkConfig?.protocolVersion ?? "", networkConfig?.network ?? "", withNetworkContext);
const pages = getPages(networkConfig, networks);

const metaLabel = buildMetaLabel(currentNetworkName);
const faviconHelmet = getFaviconHelmet(isShimmer);
const faviconHelmet = getFaviconHelmet(isShimmerTheme);

return (
<div className={classNames("app", { shimmer: isShimmer })}>
<div className={classNames("app", { shimmer: isShimmerTheme })}>
<Helmet>
<meta name="apple-mobile-web-app-title" content={metaLabel} />
<meta name="application-name" content={metaLabel} />
Expand All @@ -122,6 +124,27 @@ const App: React.FC<RouteComponentProps<AppRouteProps>> = ({
<div className="maintenance-inner">The network provided does not exist, please check the url.</div>
</div>
)}
{isStardust && !isShimmer && (
<div className="card disclaimer-banner">
<div
className="card--value card--value__no-margin description col row middle"
style={{ whiteSpace: "nowrap" }}
>
<p>
<span>This network is superseded by </span>
<a href="https://explorer.iota.org" target="_blank" rel="noopener noreferrer">
Mainnet (rebased)
</a>
.
</p>
{/** TODO: Add exact Milestone https://github.com/iotaledger/explorer/issues/1497
<p>
<span>It can only be used to browse historic data before milestone XYZ</span>
</p>
**/}
</div>
</div>
)}
{networkConfig && routes}
</React.Fragment>
) : (
Expand All @@ -130,7 +153,7 @@ const App: React.FC<RouteComponentProps<AppRouteProps>> = ({
</div>
)}
</div>
{isShimmer ? (
{isShimmerTheme ? (
<ShimmerFooter dynamic={getFooterItems(currentNetworkName ?? "", networks, identityResolverEnabled)} />
) : (
<Footer dynamic={getFooterItems(currentNetworkName ?? "", networks, identityResolverEnabled)} />
Expand Down
16 changes: 4 additions & 12 deletions client/src/app/AppUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ export const networkContextWrapper = (currentNetwork: string | undefined, nodeIn
export const getPages = (currentNetwork: INetwork | undefined, networks: INetwork[]): NavigationRoute[] => {
const hasNetworks = networks.length > 0 && currentNetwork !== undefined;

const { network, protocolVersion, hasStatisticsSupport } = currentNetwork ?? { network: "", hasStatisticsSupport: false };
const { network, protocolVersion } = currentNetwork ?? { network: "", hasStatisticsSupport: false };

const isStardust = hasNetworks && currentNetwork.protocolVersion === STARDUST;
const isNova = hasNetworks && currentNetwork.protocolVersion === NOVA;
const isStardustOrNova = isStardust || isNova;
const isShimmer = hasNetworks && currentNetwork.network === SHIMMER;

const routes: NavigationRoute[] = [
{
Expand All @@ -58,12 +57,7 @@ export const getPages = (currentNetwork: INetwork | undefined, networks: INetwor
{
label: "Visualizer",
url: `/${network}/visualizer/`,
disabled: !hasNetworks || !isStardustOrNova,
},
{
label: "Statistics",
url: `/${network}/statistics/`,
disabled: !hasNetworks || !hasStatisticsSupport || !isStardustOrNova,
disabled: !hasNetworks || !isShimmer,
},
{
label: "Validators",
Expand Down Expand Up @@ -124,9 +118,7 @@ export const getFooterItems = (currentNetwork: string, networks: INetwork[], ide
if (networks.length > 0) {
let footerArray = networks.filter((network) => network.isEnabled).map((n) => ({ label: n.label, url: n.network.toString() }));

footerArray = footerArray
.concat({ label: "Streams v0", url: `${currentNetwork}/streams/0/` })
.concat({ label: "Visualizer", url: `${currentNetwork}/visualizer/` });
footerArray = footerArray.concat({ label: "Streams v0", url: `${currentNetwork}/streams/0/` });

if (identityResolverEnabled) {
footerArray.push({ label: "Identity Resolver", url: `${currentNetwork}/identity-resolver/` });
Expand Down
33 changes: 12 additions & 21 deletions client/src/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import ChrysalisLanding from "./routes/chrysalis/Landing";
import ChrysalisMessage from "./routes/chrysalis/Message";
import { MessageProps as ChrysalisMessageProps } from "./routes/chrysalis/MessageProps";
import ChrysalisSearch from "./routes/chrysalis/Search";
import ChrysalisVisualizer from "./routes/chrysalis/Visualizer";
import IdentityResolver from "./routes/IdentityResolver";
import { IdentityResolverProps } from "./routes/IdentityResolverProps";
import { LandingRouteProps } from "./routes/LandingRouteProps";
Expand All @@ -23,7 +22,6 @@ import LegacyTag from "./routes/legacy/Tag";
import { TagRouteProps as LegacyTagRouteProps } from "./routes/legacy/TagRouteProps";
import LegacyTransaction from "./routes/legacy/Transaction";
import { TransactionRouteProps as LegacyTransactionRouteProps } from "./routes/legacy/TransactionRouteProps";
import LegacyVisualizer from "./routes/legacy/Visualizer";
import { SearchRouteProps } from "./routes/SearchRouteProps";
import StardustAddressPage from "./routes/stardust/AddressPage";
import NovaAddressPage from "./routes/nova/AddressPage";
Expand All @@ -44,16 +42,13 @@ import NovaSearch from "./routes/nova/Search";
import NovaEpochPage from "./routes/nova/EpochPage";
import NovaSlotPage from "./routes/nova/SlotPage";
import StardustSearch from "./routes/stardust/Search";
import StardustStatisticsPage from "./routes/stardust/statistics/StatisticsPage";
import NovaStatisticsPage from "./routes/nova/statistics/StatisticsPage";
import StardustTransactionPage from "./routes/stardust/TransactionPage";
import { Visualizer as StardustVisualizer } from "./routes/stardust/Visualizer";
import Visualizer from "./routes/nova/Visualizer";
import StreamsV0 from "./routes/StreamsV0";
import { StreamsV0RouteProps } from "./routes/StreamsV0RouteProps";
import { VisualizerRouteProps } from "./routes/VisualizerRouteProps";
import ValidatorsPage from "./routes/nova/ValidatorsPage";
import { CHRYSALIS, LEGACY, NOVA, STARDUST } from "~models/config/protocolVersion";
import { SHIMMER } from "~/models/config/networkType";

/**
* Generator for keys in routes. Gives an incremented value on every next().
Expand All @@ -67,7 +62,11 @@ function* keyGenerator(count: number): IterableIterator<number> {
}
}

const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedComponent: React.ReactNode) => JSX.Element | null) => {
const buildAppRoutes = (
protocolVersion: string,
networkName: string,
withNetworkContext: (wrappedComponent: React.ReactNode) => JSX.Element | null,
) => {
const keys = keyGenerator(0);

const commonRoutes = [
Expand All @@ -92,18 +91,15 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom
commonRoutes.push(IdentiyResolverRoute);
}

const isShimmer = networkName === SHIMMER;

const legacyRoutes = [
<Route
exact
path="/:network"
key={keys.next().value}
component={(props: RouteComponentProps<LandingRouteProps>) => <LegacyLanding {...props} />}
/>,
<Route
path="/:network/visualizer/"
key={keys.next().value}
component={(props: RouteComponentProps<VisualizerRouteProps>) => <LegacyVisualizer {...props} />}
/>,
<Route
path="/:network/search/:query?"
key={keys.next().value}
Expand Down Expand Up @@ -143,11 +139,6 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom
key={keys.next().value}
component={(props: RouteComponentProps<SearchRouteProps>) => <ChrysalisSearch {...props} />}
/>,
<Route
path="/:network/visualizer/"
key={keys.next().value}
component={(props: RouteComponentProps<VisualizerRouteProps>) => <ChrysalisVisualizer {...props} />}
/>,
<Route
path="/:network/message/:messageId"
key={keys.next().value}
Expand All @@ -167,7 +158,6 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom

const stardustRoutes = [
<Route exact path="/:network" key={keys.next().value} component={StardustLanding} />,
<Route path="/:network/visualizer/" key={keys.next().value} component={StardustVisualizer} />,
<Route path="/:network/search/:query?" key={keys.next().value} component={StardustSearch} />,
<Route path="/:network/addr/:address" key={keys.next().value} component={StardustAddressPage} />,
<Route path="/:network/nft/:nftId" key={keys.next().value} component={NftRedirectRouteStardust} />,
Expand All @@ -176,13 +166,15 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom
<Route path="/:network/output/:outputId" key={keys.next().value} component={StardustOutputPage} />,
<Route path="/:network/outputs" key={keys.next().value} component={StardustOutputList} />,
<Route path="/:network/foundry/:foundryId" key={keys.next().value} component={StardustFoundry} />,
<Route path="/:network/statistics" key={keys.next().value} component={StardustStatisticsPage} />,
];

if (isShimmer) {
stardustRoutes.push(<Route path="/:network/visualizer/" key={keys.next().value} component={StardustVisualizer} />);
}

const novaRoutes = [
<Route exact path="/:network" key={keys.next().value} component={NovaLanding} />,
<Route path="/:network/addr/:address" key={keys.next().value} component={NovaAddressPage} />,
<Route path="/:network/visualizer/" key={keys.next().value} component={Visualizer} />,
<Route path="/:network/block/:blockId" key={keys.next().value} component={NovaBlockPage} />,
<Route path="/:network/output/:outputId" key={keys.next().value} component={NovaOutputPage} />,
<Route path="/:network/search/:query?" key={keys.next().value} component={NovaSearch} />,
Expand All @@ -191,7 +183,6 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom
<Route path="/:network/transaction/:transactionId" key={keys.next().value} component={NovaTransactionPage} />,
<Route path="/:network/foundry/:foundryId" key={keys.next().value} component={NovaFoundryPage} />,
<Route path="/:network/nft/:nftId" key={keys.next().value} component={NftRedirectRouteNova} />,
<Route path="/:network/statistics" key={keys.next().value} component={NovaStatisticsPage} />,
<Route path="/:network/validators" key={keys.next().value} component={ValidatorsPage} />,
<Route path="/:network/outputs" key={keys.next().value} component={NovaOutputsPage} />,
];
Expand Down
Loading