Working init app
Change-Id: I545c6c2f7182adf28d4ced41ac38613746d2b3d8
This commit is contained in:
parent
13ab39d1fd
commit
6f2586ccad
15 changed files with 133 additions and 62 deletions
|
@ -1,8 +1,9 @@
|
|||
// @ts-nocheck
|
||||
import React, { FC, useEffect } from 'react';
|
||||
import { Route, Switch, useLocation } from 'wouter';
|
||||
import React, { FC } from 'react';
|
||||
import { Route, Switch } from 'wouter';
|
||||
|
||||
import { useAuth } from '@prokyon/auth/hook/useAuth';
|
||||
import Section from '@prokyon/components/Section';
|
||||
import { Skeleton } from '@prokyon/components/Skeleton';
|
||||
import { MenuItem } from '@prokyon/components/Skeleton/types';
|
||||
|
||||
|
@ -15,39 +16,40 @@ const topMenu: MenuItem[][] = [
|
|||
{ label: 'Routa', href: buildRoute('root') },
|
||||
],
|
||||
[
|
||||
// authenticated
|
||||
],
|
||||
];
|
||||
|
||||
const userMenu: MenuItem[][] = [
|
||||
[
|
||||
// public
|
||||
// public
|
||||
],
|
||||
[
|
||||
// authenticated
|
||||
// authenticated
|
||||
],
|
||||
];
|
||||
|
||||
const publicSites: string[] = [];
|
||||
|
||||
export const App: FC = () => {
|
||||
const { authenticated } = useAuth();
|
||||
|
||||
const [location] = useLocation();
|
||||
|
||||
const isPublicView = !!publicSites.find((url) => location.startsWith(url));
|
||||
const isWelcomePage = window.location.pathname === '/';
|
||||
|
||||
if (authenticated === null || authenticated === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Skeleton
|
||||
<Skeleton
|
||||
items={{
|
||||
logo: <>$(AppName)</>,
|
||||
top: authenticated ? topMenu[1] : isWelcomePage ? [] : topMenu[0],
|
||||
user: authenticated ? userMenu[1] : isPublicView ? [] : userMenu[0],
|
||||
}}>
|
||||
logo: <>Many</>,
|
||||
top: authenticated ? topMenu[1] : topMenu[0],
|
||||
user: authenticated ? userMenu[1] : userMenu[0],
|
||||
}}
|
||||
components={{
|
||||
footer: (
|
||||
<div className="text-center footer">
|
||||
<Section>
|
||||
Tento web používá pouze technické cookie. Monitorování návštěvnosti je zcela anonymní a je prováděno na straně
|
||||
provozovatele webu.
|
||||
</Section>
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
>
|
||||
{authenticated ? (
|
||||
<Switch>
|
||||
<Route>404!</Route>
|
||||
|
@ -61,3 +63,4 @@ export const App: FC = () => {
|
|||
</Skeleton>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -7,12 +7,6 @@ export const WelcomePage = () => {
|
|||
return (
|
||||
<div className="welcome">
|
||||
Seedling app generator.
|
||||
<div className="text-center footer">
|
||||
<Section>
|
||||
Tento web používá pouze technické cookie. Monitorování návštěvnosti je zcela anonymní a je prováděno na straně
|
||||
provozovatele webu.
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
3
source/shared/.gitignore
vendored
3
source/shared/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
build/
|
||||
build/
|
||||
node_modules/
|
1
source/shared/Jenkinsfile
vendored
1
source/shared/Jenkinsfile
vendored
|
@ -4,5 +4,4 @@ import FrontendBuild
|
|||
FrontendBuild({
|
||||
name = '$(appName)'
|
||||
port = '$(appPort):80'
|
||||
runSonar = true
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue