+
+ );
+};
diff --git a/packages/frontend/src/app.tsx b/packages/frontend/src/app.tsx
index 2f81e20..70cd708 100644
--- a/packages/frontend/src/app.tsx
+++ b/packages/frontend/src/app.tsx
@@ -1,16 +1,14 @@
+import { ErrorBoundaryComponent, FeatureFlagsProvider, NavigationBar } from 'elite-components';
import { getConfiguration } from 'elite-configuration';
-import { AppPath, Configuration } from 'elite-types';
+import { AppPath, Configuration, getDisplayNameForRoute, getLinkForRoute } from 'elite-types';
import * as React from 'react';
import { hot } from 'react-hot-loader';
import { Redirect, Route, Switch } from 'react-router';
import { Router } from 'react-router-dom';
import history from './util/history';
import { APP_ROUTES } from './util/routes';
-import { ErrorBoundaryComponent, FeatureFlagsProvider } from 'elite-components';
-import { Divider } from '@material-ui/core';
-import { LinkDirectory } from './util/linkDirectory';
-// Global bootstrap: install subsystems and load configuration
+// Global bootstrap: load configuration
const configuration: Configuration = getConfiguration();
export const AppComponent = () => (
@@ -18,14 +16,25 @@ export const AppComponent = () => (
- {APP_ROUTES.map((routeProps, index) => (
-
+ {APP_ROUTES.map((route, index) => (
+ (
+ <>
+ history.push(getLinkForRoute(r))}
+ />
+ {route.render(props)}
+ >
+ )}
+ />
))}
{/* Error 404 Fallback */}
-
+ } />
-
-
diff --git a/packages/frontend/src/index.html b/packages/frontend/src/index.html
index 04e0890..cdb0bc3 100644
--- a/packages/frontend/src/index.html
+++ b/packages/frontend/src/index.html
@@ -49,7 +49,7 @@
Elite-SE | Sexy
-
+
diff --git a/packages/frontend/src/util/linkDirectory.tsx b/packages/frontend/src/util/linkDirectory.tsx
deleted file mode 100644
index 4972ee9..0000000
--- a/packages/frontend/src/util/linkDirectory.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import * as React from 'react';
-import { Link } from 'react-router-dom';
-import { APP_ROUTES, getDisplayNameForRoute, getLinkForRoute } from './routes';
-
-export const LinkDirectory = () => (
-
- {APP_ROUTES.map((route, index) => (
-
- {getDisplayNameForRoute(route)}
-
- ))}
-
-);
diff --git a/packages/frontend/src/util/routes.tsx b/packages/frontend/src/util/routes.ts
similarity index 58%
rename from packages/frontend/src/util/routes.tsx
rename to packages/frontend/src/util/routes.ts
index 666485b..f5f5947 100644
--- a/packages/frontend/src/util/routes.tsx
+++ b/packages/frontend/src/util/routes.ts
@@ -1,20 +1,9 @@
-import * as React from 'react';
import { HOME_ROUTE } from 'elite-home';
import { LINK_ROUTE } from 'elite-link';
-import { AppPath, AppRoute, LinkType } from 'elite-types';
+import { AppPath, AppRoute, LinkType, getLinkForRoute, getDisplayNameForRoute } from 'elite-types';
export const APP_ROUTES: AppRoute[] = [HOME_ROUTE, LINK_ROUTE];
-/**
- * Retrieves the url which other pages can use to link to a certain
- * app path
- *
- * @param route
- */
-export function getLinkForRoute(route: AppRoute): LinkType {
- return route.link || route.path;
-}
-
/**
* Retrieves the url which other pages can use to link to a certain
* app path
@@ -28,16 +17,6 @@ export function getLinkForPath(path: AppPath): LinkType {
return getLinkForRoute(route);
}
-/**
- * Retrieves the human readable link title/displayed name for
- * a given route
- *
- * @param route
- */
-export function getDisplayNameForRoute(route: AppRoute): string {
- return route.displayName || getLinkForRoute(route);
-}
-
/**
* Retrieves the human readable link title/displayed name for
* a given path
diff --git a/packages/home/src/home.page.tsx b/packages/home/src/home.page.tsx
index aac8236..4877add 100644
--- a/packages/home/src/home.page.tsx
+++ b/packages/home/src/home.page.tsx
@@ -1,7 +1,8 @@
import { FeatureFlag } from 'elite-components';
+import { AppPath, AppRoute } from 'elite-types';
import * as React from 'react';
import { RouteComponentProps } from 'react-router';
-import { AppPath, AppRoute } from 'elite-types';
+import HomeIcon from '@material-ui/icons/Home';
export interface HomePageProps extends RouteComponentProps {}
@@ -11,14 +12,14 @@ export interface HomePageProps extends RouteComponentProps {}
export const HOME_ROUTE: AppRoute = {
path: AppPath.HOME,
displayName: 'Home',
+ icon: ,
render: props => ,
};
-export const HomePage = (props: HomePageProps) => (
- <>
-
Main Page
+export const HomePage = (props: HomePageProps) => {
+ return (
Elite Sexyz is currently under construction. See discord main channel for more information
- >
-);
+ );
+};
diff --git a/packages/link/src/link.page.tsx b/packages/link/src/link.page.tsx
index d7bfdde..727cf15 100644
--- a/packages/link/src/link.page.tsx
+++ b/packages/link/src/link.page.tsx
@@ -1,8 +1,9 @@
import { List } from '@material-ui/core';
-import * as React from 'react';
-import { RouteComponentProps } from 'react-router';
import { LinkListItem } from 'elite-components';
import { AppPath, AppRoute } from 'elite-types';
+import * as React from 'react';
+import { RouteComponentProps } from 'react-router';
+import LinkIcon from '@material-ui/icons/Link';
export interface LinkPageProps extends RouteComponentProps {}
@@ -12,19 +13,13 @@ export interface LinkPageProps extends RouteComponentProps {}
export const LINK_ROUTE: AppRoute = {
path: AppPath.LINK,
displayName: 'Useful Links',
- render: props => (
- <>
-
- >
- ),
+ icon: ,
+ render: props => ,
};
export const LinkPage = (props: LinkPageProps) => (
- <>
-
Useful Links List
-
-
-
-
- >
+
+
+
+
);
diff --git a/packages/types/src/routes/appRoute.type.ts b/packages/types/src/routes/appRoute.type.ts
index 2fd581d..80dba3e 100644
--- a/packages/types/src/routes/appRoute.type.ts
+++ b/packages/types/src/routes/appRoute.type.ts
@@ -1,21 +1,31 @@
import { LinkType } from './link.type';
import { AppPath } from './appPath.type';
-import { RouteProps } from 'react-router';
+import { RouteProps, RouteComponentProps } from 'react-router';
/**
* Each Approute can have a specific link (i.e., path with filled parameter placeholders),
* a display Name, i.e., text of the link and a nonoptional (!) path
*/
export interface AppRoute extends RouteProps {
- // Use this if the link target differs from the path specification,
- // i.e., if the path url contains paramter specifications etc
+ /**
+ * Use this if the link target differs from the path specification,
+ * i.e., if the path url contains paramter specifications etc
+ */
readonly link?: LinkType;
- // link text (Human readable!)
+ /** link text (Human readable!) */
readonly displayName?: string;
- // AppRoutes must have a path - deoptionalize this property
+ /** optional icon displayed next to the link name */
+ readonly icon?: JSX.Element;
+
+ /** AppRoutes must have a path - deoptionalize this property */
readonly path: AppPath;
- render(props: any): any;
+ /** render is required for AppRoutes */
+ readonly render: (props: RouteComponentProps) => React.ReactNode;
+
+ /** prevent usage of component/children props, i.e., AppRoutes must use render! */
+ readonly component?: never;
+ readonly children?: never;
}
diff --git a/packages/types/src/routes/appRoute.util.ts b/packages/types/src/routes/appRoute.util.ts
new file mode 100644
index 0000000..085f05d
--- /dev/null
+++ b/packages/types/src/routes/appRoute.util.ts
@@ -0,0 +1,22 @@
+import { AppRoute } from './appRoute.type';
+import { LinkType } from './link.type';
+
+/**
+ * Retrieves the url which other pages can use to link to a certain
+ * app path
+ *
+ * @param route
+ */
+export function getLinkForRoute(route: AppRoute): LinkType {
+ return route.link || route.path;
+}
+
+/**
+ * Retrieves the human readable link title/displayed name for
+ * a given route
+ *
+ * @param route
+ */
+export function getDisplayNameForRoute(route: AppRoute): string {
+ return route.displayName || getLinkForRoute(route);
+}
diff --git a/packages/types/src/routes/index.ts b/packages/types/src/routes/index.ts
index 91d063f..fe01775 100644
--- a/packages/types/src/routes/index.ts
+++ b/packages/types/src/routes/index.ts
@@ -1,3 +1,4 @@
export * from './appPath.type';
export * from './appRoute.type';
+export * from './appRoute.util';
export * from './link.type';