mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
Merge pull request #832 from blockscout/stats-conditional
no stats endpoint -- no stats page
This commit is contained in:
@@ -154,7 +154,12 @@ export default function useNavItems(): ReturnType {
|
||||
icon: appsIcon,
|
||||
isActive: pathname.startsWith('/app'),
|
||||
} : null,
|
||||
{ text: 'Charts & stats', nextRoute: { pathname: '/stats' as const }, icon: statsIcon, isActive: pathname === '/stats' },
|
||||
appConfig.statsApi.endpoint ? {
|
||||
text: 'Charts & stats',
|
||||
nextRoute: { pathname: '/stats' as const },
|
||||
icon: statsIcon,
|
||||
isActive: pathname === '/stats',
|
||||
} : null,
|
||||
{
|
||||
text: 'API',
|
||||
icon: apiDocsIcon,
|
||||
|
||||
+12
-2
@@ -1,8 +1,10 @@
|
||||
import type { NextPage } from 'next';
|
||||
import type { NextPage, GetServerSideProps } from 'next';
|
||||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
|
||||
import appConfig from 'configs/app/config';
|
||||
import type { Props } from 'lib/next/getServerSideProps';
|
||||
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps';
|
||||
|
||||
import Stats from '../ui/pages/Stats';
|
||||
|
||||
@@ -17,4 +19,12 @@ const StatsPage: NextPage = () => {
|
||||
|
||||
export default StatsPage;
|
||||
|
||||
export { getServerSideProps } from 'lib/next/getServerSideProps';
|
||||
export const getServerSideProps: GetServerSideProps<Props> = async(args) => {
|
||||
if (!appConfig.statsApi.endpoint) {
|
||||
return {
|
||||
notFound: true,
|
||||
};
|
||||
}
|
||||
|
||||
return getServerSidePropsBase(args);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user