+
+type CssRules = 'tag' | 'editIcon' | 'editButton';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+ tag: {
+ marginRight: theme.spacing.unit / 2,
+ marginBottom: theme.spacing.unit / 2,
+ },
+ editIcon: {
+ paddingRight: theme.spacing.unit / 2,
+ fontSize: '1.125rem',
+ },
+ editButton: {
+ boxShadow: 'none',
+ padding: '2px 10px 2px 5px',
+ fontSize: '0.75rem'
+ },
+});
+
+interface ProjectDetailsComponentDataProps {
+ project: ProjectResource;
+}
+
+interface ProjectDetailsComponentActionProps {
+ onClick: (prj: ProjectUpdateFormDialogData) => () => void;
+}
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+ onClick: (prj: ProjectUpdateFormDialogData) =>
+ () => dispatch<any>(openProjectUpdateDialog(prj)),
+});
+
+type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDetailsComponentActionProps & WithStyles<CssRules>;
+
+const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
+ withStyles(styles)(
+ ({ classes, project, onClick }: ProjectDetailsComponentProps) => <div>
+ {project.groupClass !== GroupClass.FILTER ?
+ <Button onClick={onClick({
+ uuid: project.uuid,
+ name: project.name,
+ description: project.description,
+ properties: project.properties,
+ })}
+ className={classes.editButton} variant='contained'
+ data-cy='details-panel-edit-btn' color='primary' size='small'>
+ <RenameIcon className={classes.editIcon} /> Edit
+ </Button>
+ : ''
+ }
+ <DetailsAttribute label='Type' value={project.groupClass === GroupClass.FILTER ? 'Filter group' : resourceLabel(ResourceKind.PROJECT)} />
+ <DetailsAttribute label='Owner' linkToUuid={project.ownerUuid}
+ uuidEnhancer={(uuid: string) => <ResourceWithName uuid={uuid} />} />
+ <DetailsAttribute label='Last modified' value={formatDate(project.modifiedAt)} />
+ <DetailsAttribute label='Created at' value={formatDate(project.createdAt)} />
+ <DetailsAttribute label='UUID' linkToUuid={project.uuid} value={project.uuid} />
+ <DetailsAttribute label='Description'>
+ {project.description ?
+ <RichTextEditorLink
+ title={`Description of ${project.name}`}
+ content={project.description}
+ label='Show full description' />
+ : '---'
+ }
+ </DetailsAttribute>
+ <DetailsAttribute label='Properties' />
+ {
+ Object.keys(project.properties).map(k =>
+ Array.isArray(project.properties[k])
+ ? project.properties[k].map((v: string) =>
+ getPropertyChip(k, v, undefined, classes.tag))
+ : getPropertyChip(k, project.properties[k], undefined, classes.tag)
+ )
+ }
+ </div>
+ ));