routes.ts
1 import { ROUTE_LINKS } from 'routeLinks'; 2 3 import StarIcon from './images/icons/star.svg'; 4 import ClockIcon from './images/icons/clock.svg'; 5 import { 6 ROUTE_TYPE, 7 DAPP_CATEGORY, 8 DAPP_CATEGORY_ICONS, 9 } from 'utils/constants'; 10 import DAppManagementContainer from 'containers/modules/DAppManagementContainer'; 11 import VoteModule from 'containers/modules/VoteModule'; 12 import { FunctionComponent, ReactNode, ComponentType } from 'react'; 13 import HowToVoteModule from 'containers/modules/HowToVoteModule'; 14 import DiscoverDappModule from 'containers/modules/DiscoverDappModule'; 15 import Landing from 'components/views/pages/Landing'; 16 import WithdrawModule from 'containers/modules/WithdrawModule'; 17 import CategoryModule from 'containers/modules/CategoryModule'; 18 19 export interface AppRoute { 20 name: string; 21 path: string; 22 component: ComponentType<any>; 23 isProtected: boolean; 24 isNavRequired: boolean; 25 routeNavLinkIcon?: FunctionComponent<ReactNode>; // Should be provided if Nav is required 26 routeType?: ROUTE_TYPE; 27 modalComponent?: FunctionComponent<any>; 28 } 29 30 const routes: AppRoute[] = [ 31 { 32 name: 'Home', 33 path: ROUTE_LINKS.Home, 34 component: Landing, 35 isProtected: false, // This allows general access control 36 isNavRequired: false, // This allows mapping into a navigation bar 37 }, 38 39 { 40 name: 'Create DApp', 41 path: ROUTE_LINKS.CreateDApp, 42 component: Landing, 43 isProtected: false, // This allows general access control 44 isNavRequired: false, // This allows mapping into a navigation bar 45 modalComponent: DAppManagementContainer, 46 }, 47 48 { 49 name: 'Discover DApp', 50 path: ROUTE_LINKS.Discover(':dappname'), 51 component: Landing, 52 isProtected: false, // This allows general access control 53 isNavRequired: false, // This allows mapping into a navigation bar 54 modalComponent: DiscoverDappModule, 55 }, 56 57 { 58 name: 'Update DApp', 59 path: ROUTE_LINKS.UpdateDApp(':dappname'), 60 component: Landing, 61 isProtected: true, // This allows general access control 62 isNavRequired: false, // This allows mapping into a navigation bar 63 modalComponent: DAppManagementContainer, 64 }, 65 66 { 67 name: 'Withdraw', 68 path: ROUTE_LINKS.Withdraw(':dappname'), 69 component: Landing, 70 isProtected: true, // This allows general access control 71 isNavRequired: false, // This allows mapping into a navigation bar 72 modalComponent: WithdrawModule, 73 }, 74 75 { 76 name: 'Vote on DApp', 77 path: ROUTE_LINKS.Vote(':dappname', ':voteType'), 78 component: Landing, 79 isProtected: false, // This allows general access control 80 isNavRequired: false, // This allows mapping into a navigation bar 81 modalComponent: VoteModule, 82 }, 83 84 { 85 name: 'How to vote', 86 path: ROUTE_LINKS.HowToVote, 87 component: Landing, 88 isProtected: false, // This allows general access control 89 isNavRequired: false, // This allows mapping into a navigation bar 90 modalComponent: HowToVoteModule, 91 }, 92 93 // Categories 94 { 95 name: 'All ÐApps', 96 path: ROUTE_LINKS.categories.All, 97 component: Landing, 98 isProtected: false, // This allows general access control 99 isNavRequired: true, // This allows mapping into a navigation bar 100 modalComponent: CategoryModule, 101 }, 102 { 103 name: 'Exchanges', 104 path: ROUTE_LINKS.categories.EXCHANGES, 105 component: Landing, 106 isProtected: false, // This allows general access control 107 isNavRequired: true, // This allows mapping into a navigation bar 108 routeType: ROUTE_TYPE.CATEGORY, 109 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.EXCHANGES].minimal, 110 modalComponent: CategoryModule, 111 }, 112 { 113 name: 'Marketplaces', 114 path: ROUTE_LINKS.categories.MARKETPLACES, 115 component: Landing, 116 isProtected: false, // This allows general access control 117 isNavRequired: true, // This allows mapping into a navigation bar 118 routeType: ROUTE_TYPE.CATEGORY, 119 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.MARKETPLACES].minimal, 120 modalComponent: CategoryModule, 121 }, 122 { 123 name: 'Collectibles', 124 path: ROUTE_LINKS.categories.COLLECTIBLES, 125 component: Landing, 126 isProtected: false, // This allows general access control 127 isNavRequired: true, // This allows mapping into a navigation bar 128 routeType: ROUTE_TYPE.CATEGORY, 129 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.COLLECTIBLES].minimal, 130 modalComponent: CategoryModule, 131 }, 132 { 133 name: 'Games', 134 path: ROUTE_LINKS.categories.GAMES, 135 component: Landing, 136 isProtected: false, // This allows general access control 137 isNavRequired: false, // This allows mapping into a navigation bar 138 routeType: ROUTE_TYPE.CATEGORY, 139 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.GAMES].minimal, 140 modalComponent: CategoryModule, 141 }, 142 { 143 name: 'Social Networks', 144 path: ROUTE_LINKS.categories.SOCIAL_NETWORKS, 145 component: Landing, 146 isProtected: false, // This allows general access control 147 isNavRequired: true, // This allows mapping into a navigation bar 148 routeType: ROUTE_TYPE.CATEGORY, 149 routeNavLinkIcon: 150 DAPP_CATEGORY_ICONS[DAPP_CATEGORY.SOCIAL_NETWORKS].minimal, 151 modalComponent: CategoryModule, 152 }, 153 { 154 name: 'Utilities', 155 path: ROUTE_LINKS.categories.UTILITIES, 156 component: Landing, 157 isProtected: false, // This allows general access control 158 isNavRequired: true, // This allows mapping into a navigation bar 159 routeType: ROUTE_TYPE.CATEGORY, 160 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.UTILITIES].minimal, 161 modalComponent: CategoryModule, 162 }, 163 { 164 name: 'Other', 165 path: ROUTE_LINKS.categories.OTHER, 166 component: Landing, 167 isProtected: false, // This allows general access control 168 isNavRequired: true, // This allows mapping into a navigation bar 169 routeType: ROUTE_TYPE.CATEGORY, 170 routeNavLinkIcon: DAPP_CATEGORY_ICONS[DAPP_CATEGORY.OTHER].minimal, 171 modalComponent: CategoryModule, 172 }, 173 // List 174 { 175 name: 'Highest rated', 176 path: ROUTE_LINKS.lists.highestRated, 177 component: Landing, 178 isProtected: false, // This allows general access control 179 isNavRequired: true, // This allows mapping into a navigation bar 180 routeType: ROUTE_TYPE.LIST, 181 routeNavLinkIcon: StarIcon, 182 }, 183 { 184 name: 'Recently added', 185 path: ROUTE_LINKS.lists.recentlyAdded, 186 component: Landing, 187 isProtected: false, // This allows general access control 188 isNavRequired: true, // This allows mapping into a navigation bar 189 routeType: ROUTE_TYPE.LIST, 190 routeNavLinkIcon: ClockIcon, 191 }, 192 ]; 193 194 export default routes;