Skip to content

Commit

Permalink
About menu
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt committed May 25, 2020
1 parent 925a1f3 commit 5b9ebd3
Show file tree
Hide file tree
Showing 22 changed files with 88 additions and 52 deletions.
56 changes: 56 additions & 0 deletions src/js/components/about/About.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, { useState, useEffect } from 'react';
import Typography from '@material-ui/core/Typography';
import { Tooltip } from '@material-ui/core';
import dayjs from 'dayjs';
import GitInfo from 'react-git-info/macro';
import { Configuration, getConfiguration } from 'js/api/configuration';
import FilDAriane, { fil } from 'js/components/commons/fil-d-ariane';

const EnTete = () => (
<div className="en-tete">
<Typography variant="h2" align="center" color="textPrimary" gutterBottom>
A propos d'Onyxia
</Typography>
</div>
);

const About = () => {
const [configuration, setConfiguration] = useState<Configuration>();

useEffect(() => {
getConfiguration().then((resp) => setConfiguration(resp));
}, []);

const gitInfo = GitInfo();
return (
<>
<EnTete />
<FilDAriane fil={fil.about} />
<div className="contenu accueil">
<Typography gutterBottom noWrap>
<Tooltip title={gitInfo.commit.message}>
<>
Interface :
{gitInfo.tags.length > 0 ? gitInfo.tags[0] : gitInfo.branch}(
{gitInfo.commit.date})
<br />
Serveur :
{configuration
? `${configuration.build.version} (
${dayjs(configuration.build.timestamp * 1000).format()}
)`
: ' introuvable'}
<br />
Region :{' '}
{configuration?.regions?.length > 0
? configuration.regions[0].regionId
: ' introuvable'}
</>
</Tooltip>
</Typography>
</div>
</>
);
};

export default About;
1 change: 1 addition & 0 deletions src/js/components/about/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './About';
2 changes: 2 additions & 0 deletions src/js/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Favicon from 'js/components/commons/favicon';
import MesSecretsHome from 'js/components/mes-secrets/home';
import MesSecrets from 'js/components/mes-secrets';
import Notifications from 'js/components/notifications';
import About from 'js/components/about';
import 'typeface-roboto';
import './app.scss';

Expand Down Expand Up @@ -99,6 +100,7 @@ const AppFeelGood = ({ waiting, applicationResize, idep }) => (
<main role="main">
<Switch>
<Route path="/accueil" component={Accueil} />
<Route path="/about" component={About} />
<Route exact path="/services" component={Services} />
<Route path="/services/*" component={ServiceDetails} />
<Route exact path="/trainings" component={Trainings} />
Expand Down
7 changes: 7 additions & 0 deletions src/js/components/commons/fil-d-ariane/fil-d-ariane.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export const fil = {
accueil: [
{ pathname: '/home', component: <Icon className="home-icone">home</Icon> },
],
about: [
{ pathname: '/home', component: <Icon className="home-icone">home</Icon> },
{
pathname: '/about',
component: <span>A propos</span>,
},
],
catalogues: [
{ pathname: '/home', component: <Icon className="home-icone">home</Icon> },
{
Expand Down
37 changes: 2 additions & 35 deletions src/js/components/commons/footer/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import React from 'react';
import Typography from '@material-ui/core/Typography';
import { Button, Icon, Tooltip } from '@material-ui/core';
import { Button, Icon } from '@material-ui/core';
import Divider from '@material-ui/core/Divider';
import {
RocketChatIcon,
Expand All @@ -10,18 +10,7 @@ import {
import './footer.scss';
import conf from '../../../configuration';

import GitInfo from 'react-git-info/macro';
import { getConfiguration, Configuration } from 'js/api/configuration';
import dayjs from 'dayjs';

const Footer = () => {
const [configuration, setConfiguration] = useState<Configuration>();

useEffect(() => {
getConfiguration().then((resp) => setConfiguration(resp));
}, []);

const gitInfo = GitInfo();
return (
<footer className="footer">
<Divider light />
Expand Down Expand Up @@ -54,28 +43,6 @@ const Footer = () => {
<LienSimple href={conf.FOOTER.ONYXIA.GIT}>contribuer</LienSimple>
<LienSimple href={conf.FOOTER.SWAGGER_API}>notre api</LienSimple>
</Typography>

<Typography gutterBottom noWrap>
<Tooltip title={gitInfo.commit.message}>
<>
Interface :
{gitInfo.tags.length > 0 ? gitInfo.tags[0] : gitInfo.branch}(
{gitInfo.commit.date})
<br />
Serveur :
{configuration
? `${configuration.build.version} (
${dayjs(configuration.build.timestamp * 1000).format()}
)`
: ' introuvable'}
<br />
Region :{' '}
{configuration?.regions?.length > 0
? configuration.regions[0].regionId
: ' introuvable'}
</>
</Tooltip>
</Typography>
</footer>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ const ItemLogin = ({ login }) => (
</ListItem>
);

/*const ItemLogout = ({ logout }) => (
<ListItem button onClick={logout}>
<ListItemIcon>
<Icon className="login" style={{ color: "crimson" }}>
power_settings_new_icon
</Icon>
</ListItemIcon>
<ListItemText primary="logout" />
</ListItem>
);*/

export default ({
open,
handleClose,
Expand Down Expand Up @@ -121,6 +110,15 @@ export default ({
<ListItemText primary={D.mySecretsTitle} />
</ListItem>
) : null}
<ListItem>
<ListItemText primary="Informations" />
</ListItem>
<ListItem button component={Link} to="/about">
<ListItemIcon>
<Icon>infoIcon</Icon>
</ListItemIcon>
<ListItemText primary={D.about} />
</ListItem>
</List>
</div>
</Drawer>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ export const createDictionary = (lang) => (dict) =>
* If the lang is not fr, will return en
* @param {string} lang the lang of the user
*/
export const getLang = (defaultLang) =>
(defaultLang || navigator.language || navigator.browserLanguage).split(
'-'
)[0] === 'fr'
? 'fr'
: 'en';
export const getLang = (defaultLang?: string) =>
(defaultLang || navigator.language)?.split('-')[0] === 'fr' ? 'fr' : 'en';

export default createDictionary(getLang());
8 changes: 8 additions & 0 deletions src/js/i18n/dictionary/about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const dictionary = {
about: {
fr: 'A propos',
en: 'About',
},
};

export default dictionary;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export { default as trainings } from './trainings';
export { default as guidedtour } from './visiteguidee';
export { default as messecrets } from './messecrets';
export { default as mesfichiers } from './mesfichiers';
export { default as about } from './about';
export * from './commons';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5b9ebd3

Please sign in to comment.