mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
37 lines
1001 B
TypeScript
37 lines
1001 B
TypeScript
import type { Feature } from './types';
|
|
import type { ApiDocsTabId } from 'types/views/apiDocs';
|
|
import { API_DOCS_TABS } from 'types/views/apiDocs';
|
|
|
|
import { getEnvValue, parseEnvJson } from '../utils';
|
|
|
|
const tabs = (() => {
|
|
const value = (parseEnvJson<Array<ApiDocsTabId>>(getEnvValue('NEXT_PUBLIC_API_DOCS_TABS')) || API_DOCS_TABS)
|
|
.filter((tab) => API_DOCS_TABS.includes(tab));
|
|
|
|
return value.length > 0 ? value : undefined;
|
|
})();
|
|
|
|
const title = 'API documentation';
|
|
|
|
const config: Feature<{
|
|
tabs: Array<ApiDocsTabId>;
|
|
alertMessage: string | undefined;
|
|
}> = (() => {
|
|
if (tabs) {
|
|
return Object.freeze({
|
|
title,
|
|
isEnabled: true,
|
|
tabs,
|
|
coreApiSwaggerUrl: getEnvValue('NEXT_PUBLIC_API_SPEC_URL') || `https://raw.githubusercontent.com/luxfi/explorer-api-swagger/main/swagger.yaml`,
|
|
alertMessage: getEnvValue('NEXT_PUBLIC_API_DOCS_ALERT_MESSAGE'),
|
|
});
|
|
}
|
|
|
|
return Object.freeze({
|
|
title,
|
|
isEnabled: false,
|
|
});
|
|
})();
|
|
|
|
export default config;
|