1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: add edit project icon in header

This commit is contained in:
Ivar Conradi Østhus 2021-10-06 13:45:56 +02:00
parent 10fa0fd908
commit cdf54667c5
2 changed files with 15 additions and 3 deletions

View File

@ -16,7 +16,6 @@ const BreadcrumbNav = () => {
item =>
item !== 'create' &&
item !== 'edit' &&
item !== 'access' &&
item !== 'view' &&
item !== 'variants' &&
item !== 'logs' &&

View File

@ -6,7 +6,8 @@ import useUiConfig from '../../../hooks/api/getters/useUiConfig/useUiConfig';
import ApiError from '../../common/ApiError/ApiError';
import ConditionallyRender from '../../common/ConditionallyRender';
import { useStyles } from './Project.styles';
import { Tab, Tabs } from '@material-ui/core';
import { IconButton, Tab, Tabs } from '@material-ui/core';
import { Edit } from '@material-ui/icons';
import useToast from '../../../hooks/useToast';
import useQueryParams from '../../../hooks/useQueryParams';
import { useEffect } from 'react';
@ -59,6 +60,15 @@ const Project = () => {
/* eslint-disable-next-line */
}, []);
const goToTabWithName = (name: string) => {
const index = tabData.findIndex(t => t.name === name);
if(index >= 0) {
const tab = tabData[index];
history.push(tab.path);
setActiveTab(index);
}
}
const tabData = [
{
title: 'Overview',
@ -127,8 +137,11 @@ const Project = () => {
<div ref={ref}>
<div className={styles.header}>
<div className={styles.innerContainer}>
<h2 data-loading className={commonStyles.title}>
<h2 data-loading className={commonStyles.title} style={{margin: 0}}>
Project: {project?.name}{' '}
<IconButton onClick={() => goToTabWithName('settings')}>
<Edit />
</IconButton>
</h2>
<p>{project?.description}</p>
</div>