index.ts 2.7 KB
Newer Older
P
Peter Pan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * Copyright 2020 Baidu Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

17 18 19 20 21 22 23
import React, {FunctionComponent, LazyExoticComponent} from 'react';

export enum Pages {
    Scalar = 'scalar',
    Histogram = 'histogram',
    Image = 'image',
    Audio = 'audio',
P
Peter Pan 已提交
24
    Text = 'text',
25 26
    Graph = 'graph',
    HighDimensional = 'high-dimensional',
P
Peter Pan 已提交
27 28
    PRCurve = 'pr-curve',
    ROCCurve = 'roc-curve'
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
}

export interface Route {
    id: Pages | string;
    default?: boolean;
    visible?: boolean;
    path?: string;
    component?: LazyExoticComponent<FunctionComponent>;
    children?: Pick<Route, 'id' | 'path' | 'component'>[];
}

const routes: Route[] = [
    {
        id: 'index',
        default: true,
        visible: false,
        path: '/index',
        component: React.lazy(() => import('~/pages/index'))
    },
    {
        id: Pages.Scalar,
        path: '/scalar',
        component: React.lazy(() => import('~/pages/scalar'))
    },
    {
        id: Pages.Histogram,
        path: '/histogram',
        component: React.lazy(() => import('~/pages/histogram'))
    },
    {
        id: 'sample',
        children: [
            {
                id: Pages.Image,
                path: '/sample/image',
                component: React.lazy(() => import('~/pages/sample/image'))
            },
            {
                id: Pages.Audio,
                path: '/sample/audio',
                component: React.lazy(() => import('~/pages/sample/audio'))
P
Peter Pan 已提交
70 71 72 73 74
            },
            {
                id: Pages.Text,
                path: '/sample/text',
                component: React.lazy(() => import('~/pages/sample/text'))
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
            }
        ]
    },
    {
        id: Pages.Graph,
        path: '/graph',
        component: React.lazy(() => import('~/pages/graph'))
    },
    {
        id: Pages.HighDimensional,
        path: '/high-dimensional',
        component: React.lazy(() => import('~/pages/high-dimensional'))
    },
    {
        id: Pages.PRCurve,
        path: '/pr-curve',
P
Peter Pan 已提交
91 92 93 94 95 96
        component: React.lazy(() => import('~/pages/curves/pr'))
    },
    {
        id: Pages.ROCCurve,
        path: '/roc-curve',
        component: React.lazy(() => import('~/pages/curves/roc'))
97 98 99 100
    }
];

export default routes;