Skip to content

Commit

Permalink
[3591] Add EditProject subtitle extension point
Browse files Browse the repository at this point in the history
Bug: eclipse-sirius#3591
Signed-off-by: William Piers <[email protected]>
  • Loading branch information
wpiers authored and sbegaudeau committed Jun 20, 2024
1 parent 822adbe commit 67747ca
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ This dialog presents diagram elements in a tree and allows to select them and up
+
image:doc/screenshots/diagramFilterView.png[Diagram Filter View, 70%]
- https://github.com/eclipse-sirius/sirius-web/issues/3523[#3523] [gantt] Support rounding dates when changing dates from gantt
- https://github.com/eclipse-sirius/sirius-web/issues/3591[#3591] [sirius-web] Add EditProject subtitle extension point

=== Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export {
navigationBarRightContributionExtensionPoint,
} from './navigationBar/NavigationBarExtensionPoints';
export { routerExtensionPoint } from './router/RouterExtensionPoints';
export { type EditProjectNavbarSubtitleProps } from './views/edit-project/EditProjectNavbar/EditProjectNavbar.types';
export { editProjectNavbarSubtitleExtensionPoint } from './views/edit-project/EditProjectNavbar/EditProjectNavbarExtensionPoints';
export { type CreateProjectAreaCardProps } from './views/project-browser/create-projects-area/CreateProjectArea.types';
export { createProjectAreaCardExtensionPoint } from './views/project-browser/create-projects-area/CreateProjectAreaExtensionPoints';
export { projectActionButtonMenuItemExtensionPoint } from './views/project-browser/list-projects-area/ProjectActionButtonExtensionPoints';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Obeo - initial API and implementation
*******************************************************************************/
import { gql, useSubscription } from '@apollo/client';
import { ServerContext, ServerContextValue, Toast } from '@eclipse-sirius/sirius-components-core';
import { ServerContext, ServerContextValue, Toast, useComponent } from '@eclipse-sirius/sirius-components-core';
import IconButton from '@material-ui/core/IconButton';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
Expand All @@ -32,6 +32,7 @@ import { RenameProjectModal } from '../../../modals/rename-project/RenameProject
import { NavigationBar } from '../../../navigationBar/NavigationBar';
import { EditProjectNavbarProps, GQLProjectEventSubscription } from './EditProjectNavbar.types';

import { editProjectNavbarSubtitleExtensionPoint } from './EditProjectNavbarExtensionPoints';
import {
EditProjectNavbarContext,
EditProjectNavbarEvent,
Expand Down Expand Up @@ -63,10 +64,15 @@ const projectEventSubscription = gql`
const useEditProjectViewNavbarStyles = makeStyles((theme) => ({
center: {
display: 'flex',
flexDirection: 'row',
flexDirection: 'column',
alignItems: 'center',
},
title: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
},
titleLabel: {
marginRight: theme.spacing(2),
overflow: 'hidden',
textOverflow: 'ellipsis',
Expand Down Expand Up @@ -163,24 +169,30 @@ export const EditProjectNavbar = ({ project }: EditProjectNavbarProps) => {
modal = <DeleteProjectModal project={project} onSuccess={onProjectDeleted} onCancel={onCloseModal} />;
}
}

const { Component: ProjectSubtitle } = useComponent(editProjectNavbarSubtitleExtensionPoint);
return (
<>
<NavigationBar>
<div className={classes.center}>
<Typography variant="h6" noWrap className={classes.title} data-testid={`navbar-${projectName}`}>
{projectName}
</Typography>
<IconButton
className={classes.onDarkBackground}
edge="start"
aria-label="more"
aria-controls="more-menu"
aria-haspopup="true"
onClick={onMoreClick}
color="inherit"
data-testid="more">
<MoreVertIcon />
</IconButton>
<div className={classes.title}>
<Typography variant="h6" noWrap className={classes.titleLabel} data-testid={`navbar-${projectName}`}>
{projectName}
</Typography>
<IconButton
className={classes.onDarkBackground}
edge="start"
size="small" // Per #3591 it should remain "small" to keep vertical space for a potential subtitle
aria-label="more"
aria-controls="more-menu"
aria-haspopup="true"
onClick={onMoreClick}
color="inherit"
data-testid="more">
<MoreVertIcon />
</IconButton>
</div>
<ProjectSubtitle />
</div>
</NavigationBar>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface EditProjectNavbarProps {
project: Project;
}

export interface EditProjectNavbarSubtitleProps {}

export interface GQLProjectEventSubscription {
projectEvent: GQLProjectEventPayload;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2021, 2024 Obeo.
* 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 { ComponentExtensionPoint } from '@eclipse-sirius/sirius-components-core';
import { EditProjectNavbarSubtitleProps } from './EditProjectNavbar.types';

export const editProjectNavbarSubtitleExtensionPoint: ComponentExtensionPoint<EditProjectNavbarSubtitleProps> = {
identifier: 'editProjectNavbar#subtitle',
FallbackComponent: () => null,
};

0 comments on commit 67747ca

Please sign in to comment.