Skip to content

Commit

Permalink
#1 Customize the front end
Browse files Browse the repository at this point in the history
Bug: #1
Signed-off-by: Laurent Fasani <[email protected]>
  • Loading branch information
lfasani committed Nov 26, 2024
1 parent 1e6100b commit 85729ed
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/deeplab-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Sirius Web</title>
<title>Pepper</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file modified frontend/deeplab-web/public/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/deeplab-web/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "Sirius Web",
"name": "Sirius Web Frontend",
"short_name": "Pepper",
"name": "Pepper Frontend",
"icons": [
{
"src": "favicon.ico",
Expand Down
41 changes: 41 additions & 0 deletions frontend/deeplab-web/src/core/Help.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2024 CEA LIST.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
import IconButton from '@mui/material/IconButton';
import Link from '@mui/material/Link';
import { emphasize } from '@mui/material/styles';
import { makeStyles } from 'tss-react/mui';
import HelpIcon from '@mui/icons-material/Help';

const useHelpStyle = makeStyles()((theme) => ({
onDarkBackground: {
'&:hover': {
backgroundColor: emphasize(theme.palette.secondary.main, 0.08),
},
},
}));

export const Help = () => {
const { classes } = useHelpStyle();
return (
<Link
href="https://github.com/ObeoNetwork/pepper"
rel="noopener noreferrer"
target="_blank"
color="inherit"
data-testid="help-link">
<IconButton className={classes.onDarkBackground} color="inherit">
<HelpIcon />
</IconButton>
</Link>
);
};
17 changes: 17 additions & 0 deletions frontend/deeplab-web/src/core/PepperIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright (c) 2024 CEA LIST.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
import pepperImage from '../icons/pepper-icon.png';

export const PepperIcon = () => {
return <img src={pepperImage} alt="Back to the homepage" height="25px" width="25px" />;
};
39 changes: 39 additions & 0 deletions frontend/deeplab-web/src/footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2024 CEA LIST.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
import Link from '@mui/material/Link';
import { makeStyles } from 'tss-react/mui';
import Typography from '@mui/material/Typography';

const useFooterStyles = makeStyles()((theme) => ({
footer: {
display: 'flex',
justifyContent: 'center',
margin: theme.spacing(2),
'& > *': {
marginLeft: theme.spacing(0.5),
marginRight: theme.spacing(0.5),
},
},
}));

export const Footer = () => {
const { classes } = useFooterStyles();
return (
<footer className={classes.footer}>
<Typography variant="caption">&copy; {new Date().getFullYear()} CEA LIST. Powered by&nbsp;</Typography>
<Link variant="caption" href="https://github.com/ObeoNetwork/pepper" rel="noopener noreferrer" target="_blank">
ObeoNetwork/Pepper
</Link>
</footer>
);
};
Binary file added frontend/deeplab-web/src/icons/pepper-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions frontend/deeplab-web/src/icons/pepper-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 26 additions & 2 deletions frontend/deeplab-web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {
DiagramRepresentationConfiguration,
NodeTypeRegistry,
SiriusWebApplication,
navigationBarIconExtensionPoint,
footerExtensionPoint,
navigationBarMenuIconExtensionPoint,
} from '@eclipse-sirius/sirius-web-application';
import { createRoot } from 'react-dom/client';
import { httpOrigin, wsOrigin } from './core/URL';
Expand All @@ -29,24 +32,45 @@ import './fonts.css';
import './portals.css';
import './reset.css';
import './variables.css';
import { Footer } from './footer/Footer';
import { Help } from './core/Help';
import { PepperIcon } from './core/PepperIcon';

if (process.env.NODE_ENV !== 'production') {
loadDevMessages();
loadErrorMessages();
}

const registry = new ExtensionRegistry();
const extensionRegistry: ExtensionRegistry = new ExtensionRegistry();

const nodeTypeRegistry: NodeTypeRegistry = {
nodeLayoutHandlers: [new EllipseNodeLayoutHandler()],
nodeConverters: [new EllipseNodeConverter()],
nodeTypeContributions: [<NodeTypeContribution component={EllipseNode} type={'ellipseNode'} />],
};

// Help component contribution
extensionRegistry.addComponent(navigationBarMenuIconExtensionPoint, {
identifier: 'pepper-help',
Component: () => <Help />,
});

// Footer contribution
extensionRegistry.addComponent(footerExtensionPoint, {
identifier: 'pepper-footer',
Component: Footer,
});

// Main icon contribution
extensionRegistry.addComponent(navigationBarIconExtensionPoint, {
identifier: 'pepper_navigationbar#icon',
Component: PepperIcon,
});

const container = document.getElementById('root');
const root = createRoot(container!);
root.render(
<SiriusWebApplication httpOrigin={httpOrigin} wsOrigin={wsOrigin} extensionRegistry={registry}>
<SiriusWebApplication httpOrigin={httpOrigin} wsOrigin={wsOrigin} extensionRegistry={extensionRegistry}>
<DiagramRepresentationConfiguration nodeTypeRegistry={nodeTypeRegistry} />
</SiriusWebApplication>
);

0 comments on commit 85729ed

Please sign in to comment.