Redirect old docs pages and wiki to new doc pages

This commit is contained in:
fabioberger
2019-08-26 13:57:05 +02:00
parent 1dac6b6157
commit fd9b51c7db
6 changed files with 106 additions and 95 deletions

View File

@@ -3,7 +3,7 @@ import * as React from 'react';
import { Container } from 'ts/components/ui/container';
import { DropDown } from 'ts/components/ui/drop_down';
import { Text } from 'ts/components/ui/text';
import { ALink, Deco, Key, WebsitePaths } from 'ts/types';
import { ALink, Deco, Key, WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { colors } from 'ts/utils/colors';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
@@ -33,11 +33,11 @@ const gettingStartedKeyToLinkInfo2: ALink[] = [
const popularDocsToLinkInfos: ALink[] = [
{
title: Key.ZeroExJs,
to: WebsitePaths.ZeroExJs,
to: WebsiteLegacyPaths.ZeroExJs,
},
{
title: Key.Connect,
to: WebsitePaths.Connect,
to: WebsiteLegacyPaths.Connect,
},
{
title: Key.SmartContract,

View File

@@ -8,7 +8,7 @@ import * as React from 'react';
import { colors } from 'ts/style/colors';
import { Dispatcher } from 'ts/redux/dispatcher';
import { ALink, Deco, Key, Language, WebsitePaths } from 'ts/types';
import { ALink, Deco, Key, Language, WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
@@ -51,7 +51,7 @@ export class Footer extends React.Component<FooterProps, FooterState> {
},
{
title: '0x.js',
to: WebsitePaths.ZeroExJs,
to: WebsiteLegacyPaths.ZeroExJs,
},
{
title: this.props.translate.get(Key.SmartContracts, Deco.Cap),
@@ -59,7 +59,7 @@ export class Footer extends React.Component<FooterProps, FooterState> {
},
{
title: this.props.translate.get(Key.Connect, Deco.Cap),
to: WebsitePaths.Connect,
to: WebsiteLegacyPaths.Connect,
},
{
title: this.props.translate.get(Key.Whitepaper, Deco.Cap),

View File

@@ -5,7 +5,6 @@ import { Provider } from 'react-redux';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom';
import { MetaTags } from 'ts/components/meta_tags';
import { NotFound } from 'ts/containers/not_found';
import { Wiki } from 'ts/containers/wiki';
import { createLazyComponent } from 'ts/lazy_component';
import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage';
import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage';
@@ -44,6 +43,7 @@ trackedTokenStorage.clearIfRequired();
import 'less/all.less';
import 'sass/modal_video.scss';
import { constants } from 'ts/utils/constants';
// We pass modulePromise returning lambda instead of module promise,
// cause we only want to import the module when the user navigates to the page.
@@ -135,73 +135,75 @@ render(
Note(ez): We remove/replace all old routes with next routes
once we're ready to put a ring on it. for now let's keep em there for reference
*/}
<Redirect from="/otc" to={`${WebsitePaths.Portal}`} />
<Route path={WebsitePaths.Portal} component={LazyPortal} />
<Route path={WebsitePaths.Wiki} component={Wiki as any} />
<Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} />
<Route
path={`${WebsitePaths.ContractWrappers}/:version?`}
component={LazyContractWrappersDocumentation}
<Redirect from={`${WebsiteLegacyPaths.ZeroExJs}/:version?`} to={constants.URL_NPMJS_ZEROEXJS} />
<Redirect
from={`${WebsiteLegacyPaths.ContractWrappers}/:version?`}
to={`${WebsitePaths.Docs}/tools/contract-wrappers/:version?`}
/>
<Route path={`${WebsitePaths.Migrations}/:version?`} component={LazyMigrationsDocumentation} />
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
<Route
path={`${WebsitePaths.SolCompiler}/:version?`}
component={LazySolCompilerDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.Migrations}/:version?`}
to={`${WebsitePaths.Docs}/tools/migrations/:version?`}
/>
<Route
path={`${WebsitePaths.SolCoverage}/:version?`}
component={LazySolCoverageDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.Connect}/:version?`}
to={`${WebsitePaths.Docs}/tools/connect/:version?`}
/>
<Route path={`${WebsitePaths.SolTrace}/:version?`} component={LazySolTraceDocumentation} />
<Route
path={`${WebsitePaths.SolProfiler}/:version?`}
component={LazySolProfilerDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.SolCompiler}/:version?`}
to={`${WebsitePaths.Docs}/tools/sol-compiler/:version?`}
/>
<Route
path={`${WebsitePaths.JSONSchemas}/:version?`}
component={LazyJSONSchemasDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.SolCoverage}/:version?`}
to={`${WebsitePaths.Docs}/tools/sol-coverage/:version?`}
/>
<Route
path={`${WebsitePaths.Subproviders}/:version?`}
component={LazySubprovidersDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.SolTrace}/:version?`}
to={`${WebsitePaths.Docs}/tools/sol-trace/:version?`}
/>
<Route path={`${WebsitePaths.OrderUtils}/:version?`} component={LazyOrderUtilsDocumentation} />
<Route
path={`${WebsitePaths.Web3Wrapper}/:version?`}
component={LazyWeb3WrapperDocumentation}
<Redirect
from={`${WebsiteLegacyPaths.SolProfiler}/:version?`}
to={`${WebsitePaths.Docs}/tools/sol-profiler/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.JSONSchemas}/:version?`}
to={`${WebsitePaths.Docs}/tools/json-schemas/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.Subproviders}/:version?`}
to={`${WebsitePaths.Docs}/tools/subproviders/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.OrderUtils}/:version?`}
to={`${WebsitePaths.Docs}/tools/order-utils/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`}
to={`${WebsitePaths.Docs}/tools/web3-wrapper/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.EthereumTypes}/:version?`}
to={`${WebsitePaths.Docs}/tools/ethereum-types/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.AssetBuyer}/:version?`}
to={`${WebsitePaths.Docs}/tools/asset-buyer/:version?`}
/>
<Redirect
from={`${WebsiteLegacyPaths.AssetSwapperDocs}/:version?`}
to={`${WebsitePaths.Docs}/tools/asset-swapper/:version?`}
/>
<Route
path={`${WebsitePaths.SmartContracts}/:version?`}
component={LazySmartContractsDocumentation}
/>
<Route
path={`${WebsitePaths.EthereumTypes}/:version?`}
component={LazyEthereumTypesDocumentation}
/>
<Route path={`${WebsitePaths.AssetBuyer}/:version?`} component={LazyAssetBuyerDocumentation} />
<Route
path={`${WebsitePaths.AssetSwapperDocs}/:version?`}
component={LazyAssetSwapperDocumentation}
/>
<Route exact={true} path={WebsitePaths.Docs} component={DocsHome as any} />
<Route exact={true} path={WebsitePaths.DocsGuides} component={DocsGuides as any} />
<Route exact={true} path={WebsitePaths.DocsTools} component={DocsTools as any} />
<Route path={`${WebsitePaths.Docs}/:type/:page?/:version?`} component={DocsPage as any} />
{/* Legacy endpoints */}
<Route
path={`${WebsiteLegacyPaths.ZeroExJs}/:version?`}
component={LazyZeroExJSDocumentation}
/>
<Route
path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`}
component={LazyWeb3WrapperDocumentation}
/>
<Route
path={`${WebsiteLegacyPaths.Deployer}/:version?`}
component={LazySolCompilerDocumentation}
/>
<Redirect from={WebsitePaths.Wiki} to={WebsitePaths.DocsGuides} />
<Redirect from={WebsiteLegacyPaths.Jobs} to={WebsitePaths.AboutJobs} />
<Redirect from={WebsitePaths.Careers} to={WebsitePaths.AboutJobs} />
<Route component={NotFound as any} />

View File

@@ -8,7 +8,17 @@ import { NestedSidebarMenu } from 'ts/components/nested_sidebar_menu';
import { Button } from 'ts/components/ui/button';
import { DevelopersPage } from 'ts/pages/documentation/developers_page';
import { Dispatcher } from 'ts/redux/dispatcher';
import { ALink, Categories, Deco, Key, Package, ScreenWidths, TutorialInfo, WebsitePaths } from 'ts/types';
import {
ALink,
Categories,
Deco,
Key,
Package,
ScreenWidths,
TutorialInfo,
WebsiteLegacyPaths,
WebsitePaths,
} from 'ts/types';
import { colors } from 'ts/utils/colors';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
@@ -63,7 +73,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'A library for interacting with the 0x protocol. It is a high level package which combines a number of smaller specific-purpose packages such as [order-utils](https://0x.org/docs/order-utils) and [contract-wrappers](https://0x.org/docs/contract-wrappers).',
link: {
title: '0x.js',
to: WebsitePaths.ZeroExJs,
to: WebsiteLegacyPaths.ZeroExJs,
},
},
{
@@ -97,7 +107,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'An http & websocket client for interacting with relayers that have implemented the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)',
link: {
title: '@0x/connect',
to: WebsitePaths.Connect,
to: WebsiteLegacyPaths.Connect,
},
},
{
@@ -105,7 +115,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'Typescript/Javascript wrappers of the 0x protocol Ethereum smart contracts. Use this library to call methods on the 0x smart contracts, subscribe to contract events and to fetch information stored in contracts.',
link: {
title: '@0x/contract-wrappers',
to: WebsitePaths.ContractWrappers,
to: WebsiteLegacyPaths.ContractWrappers,
},
},
{
@@ -113,7 +123,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
"A package to deploy the 0x protocol's system of smart contracts to the testnet of your choice",
link: {
title: '@0x/migrations',
to: WebsitePaths.Migrations,
to: WebsiteLegacyPaths.Migrations,
},
},
{
@@ -121,7 +131,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'A collection of 0x-related JSON-schemas (incl. SRA request/response schemas, 0x order message format schema, etc...)',
link: {
title: '@0x/json-schemas',
to: WebsitePaths.JSONSchemas,
to: WebsiteLegacyPaths.JSONSchemas,
},
},
{
@@ -129,7 +139,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'A set of utils for working with 0x orders. It includes utilities for creating, signing, validating 0x orders, encoding/decoding assetData and much more.',
link: {
title: '@0x/order-utils',
to: WebsitePaths.OrderUtils,
to: WebsiteLegacyPaths.OrderUtils,
},
},
{
@@ -163,14 +173,14 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'Convenience package for buying assets represented on the Ethereum blockchain using 0x. In its simplest form, the package helps in the usage of the [0x forwarder contract](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md), which allows users to execute [Wrapped Ether](https://weth.io/) based 0x orders without having to set allowances, wrap Ether or own ZRX, meaning they can buy tokens with Ether alone. Given some liquidity (0x signed orders), it helps estimate the Ether cost of buying a certain asset (giving a range) and then buying that asset.',
link: {
title: '@0x/asset-buyer [Deprecated]',
to: WebsitePaths.AssetBuyer,
to: WebsiteLegacyPaths.AssetBuyer,
},
},
{
description: 'Convenience package for discovering and performing swaps for any ERC Assets',
link: {
title: '@0x/asset-swapper',
to: WebsitePaths.AssetSwapperDocs,
to: WebsiteLegacyPaths.AssetSwapperDocs,
},
},
],
@@ -231,7 +241,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
'A collection of subproviders to use with [web3-provider-engine](https://www.npmjs.com/package/web3-provider-engine) (e.g subproviders for interfacing with Ledger hardware wallet, Mnemonic wallet, private key wallet, etc...)',
link: {
title: '@0x/subproviders',
to: WebsitePaths.Subproviders,
to: WebsiteLegacyPaths.Subproviders,
},
},
],

View File

@@ -423,38 +423,9 @@ export enum Docs {
}
export enum WebsiteLegacyPaths {
ZeroExJs = '/docs/0xjs',
Web3Wrapper = '/docs/web3_wrapper',
Deployer = '/docs/deployer',
Jobs = '/jobs',
}
export enum WebsitePaths {
Portal = '/portal',
Wiki = '/wiki',
Docs = '/docs',
DocsApiExplorer = '/docs/api-explorer',
DocsCoreConcepts = '/docs/core-concepts',
DocsGuides = '/docs/guides',
DocsTools = '/docs/tools',
ZeroExJs = '/docs/0x.js',
Home = '/',
About = '/about',
AboutMission = '/about/mission',
AboutTeam = '/about/team',
AboutPress = '/about/press',
AboutJobs = '/about/jobs',
Community = '/community',
LaunchKit = '/launch-kit',
Instant = '/instant',
Ecosystem = '/eap',
MarketMaker = '/market-maker',
Governance = '/governance',
Why = '/why',
PrivacyPolicy = '/privacy',
TermsOfService = '/terms',
Whitepaper = '/pdfs/0x_white_paper.pdf',
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
Web3Wrapper = '/docs/web3-wrapper',
ContractWrappers = '/docs/contract-wrappers',
@@ -469,6 +440,33 @@ export enum WebsitePaths {
AssetBuyer = '/docs/asset-buyer',
AssetSwapperDocs = '/docs/asset-swapper',
Migrations = '/docs/migrations',
}
export enum WebsitePaths {
Portal = '/portal',
Wiki = '/wiki',
Docs = '/docs',
DocsApiExplorer = '/docs/api-explorer',
DocsCoreConcepts = '/docs/core-concepts',
DocsGuides = '/docs/guides',
DocsTools = '/docs/tools',
Home = '/',
About = '/about',
AboutMission = '/about/mission',
AboutTeam = '/about/team',
AboutPress = '/about/press',
AboutJobs = '/about/jobs',
Community = '/community',
LaunchKit = '/launch-kit',
Instant = '/instant',
Ecosystem = '/eap',
MarketMaker = '/market-maker',
Governance = '/governance',
SmartContracts = '/docs/contracts',
Why = '/why',
PrivacyPolicy = '/privacy',
TermsOfService = '/terms',
Whitepaper = '/pdfs/0x_white_paper.pdf',
Careers = '/careers',
Credits = '/credits',
Vote = '/vote',

View File

@@ -95,6 +95,7 @@ export const constants = {
URL_METAMASK_HOMEPAGE: 'https://metamask.io/',
URL_METAMASK_OPERA_STORE: 'https://addons.opera.com/en/extensions/details/metamask/',
URL_MIST_DOWNLOAD: 'https://github.com/ethereum/mist/releases',
URL_NPMJS_ZEROEXJS: 'https://www.npmjs.com/package/0x.js',
URL_PARITY_CHROME_STORE:
'https://chrome.google.com/webstore/detail/parity-ethereum-integrati/himekenlppkgeaoeddcliojfddemadig',
URL_REDDIT: 'https://reddit.com/r/0xproject',