mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-17 01:17:29 +02:00
[Gitar] Updating TSX files
This commit is contained in:
parent
c56200e030
commit
5cb6b3e827
@ -8,12 +8,9 @@ import Add from '@mui/icons-material/Add';
|
|||||||
import { Box } from '@mui/system';
|
import { Box } from '@mui/system';
|
||||||
import type { IFilterItem } from './Filters/Filters';
|
import type { IFilterItem } from './Filters/Filters';
|
||||||
import { FILTERS_MENU } from 'utils/testIds';
|
import { FILTERS_MENU } from 'utils/testIds';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
|
||||||
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
||||||
import useSplashApi from 'hooks/api/actions/useSplashApi/useSplashApi';
|
import useSplashApi from 'hooks/api/actions/useSplashApi/useSplashApi';
|
||||||
import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash';
|
import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash';
|
||||||
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
|
|
||||||
import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser';
|
|
||||||
|
|
||||||
const StyledButton = styled(Button)(({ theme }) => ({
|
const StyledButton = styled(Button)(({ theme }) => ({
|
||||||
padding: theme.spacing(0, 1.25, 0, 1.25),
|
padding: theme.spacing(0, 1.25, 0, 1.25),
|
||||||
@ -52,9 +49,6 @@ export const AddFilterButton = ({
|
|||||||
setHiddenOptions,
|
setHiddenOptions,
|
||||||
availableFilters,
|
availableFilters,
|
||||||
}: IAddFilterButtonProps) => {
|
}: IAddFilterButtonProps) => {
|
||||||
const projectId = useOptionalPathParam('projectId');
|
|
||||||
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
const { user } = useAuthUser();
|
|
||||||
const { setSplashSeen } = useSplashApi();
|
const { setSplashSeen } = useSplashApi();
|
||||||
const { splash } = useAuthSplash();
|
const { splash } = useAuthSplash();
|
||||||
|
|
||||||
@ -79,15 +73,6 @@ export const AddFilterButton = ({
|
|||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOldCustomer = (createdAt: string | undefined) => {
|
|
||||||
if (!createdAt) return false;
|
|
||||||
const cutoffDate = new Date('2024-11-08T00:00:00.000Z');
|
|
||||||
return new Date(createdAt) < cutoffDate;
|
|
||||||
};
|
|
||||||
|
|
||||||
const showArchiveTooltip =
|
|
||||||
simplifyProjectOverview && projectId && isOldCustomer(user?.createdAt);
|
|
||||||
|
|
||||||
const ArchiveTooltip = () => {
|
const ArchiveTooltip = () => {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
@ -112,7 +97,6 @@ export const AddFilterButton = ({
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{showArchiveTooltip ? (
|
|
||||||
<StyledHtmlTooltip
|
<StyledHtmlTooltip
|
||||||
placement='right'
|
placement='right'
|
||||||
arrow
|
arrow
|
||||||
@ -124,11 +108,6 @@ export const AddFilterButton = ({
|
|||||||
Add Filter
|
Add Filter
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</StyledHtmlTooltip>
|
</StyledHtmlTooltip>
|
||||||
) : (
|
|
||||||
<StyledButton onClick={handleClick} startIcon={<Add />}>
|
|
||||||
Add Filter
|
|
||||||
</StyledButton>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
id='simple-menu'
|
id='simple-menu'
|
||||||
|
@ -41,7 +41,6 @@ import {
|
|||||||
useProjectFeatureSearchActions,
|
useProjectFeatureSearchActions,
|
||||||
} from './useProjectFeatureSearch';
|
} from './useProjectFeatureSearch';
|
||||||
import { AvatarCell } from './AvatarCell';
|
import { AvatarCell } from './AvatarCell';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
|
||||||
import { styled } from '@mui/material';
|
import { styled } from '@mui/material';
|
||||||
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
import { ConnectSdkDialog } from '../../../onboarding/dialog/ConnectSdkDialog';
|
import { ConnectSdkDialog } from '../../../onboarding/dialog/ConnectSdkDialog';
|
||||||
@ -92,7 +91,6 @@ export const ProjectFeatureToggles = ({
|
|||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const { project } = useProjectOverview(projectId);
|
const { project } = useProjectOverview(projectId);
|
||||||
const [connectSdkOpen, setConnectSdkOpen] = useState(false);
|
const [connectSdkOpen, setConnectSdkOpen] = useState(false);
|
||||||
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -587,7 +585,6 @@ export const ProjectFeatureToggles = ({
|
|||||||
onChange={setTableState}
|
onChange={setTableState}
|
||||||
state={filterState}
|
state={filterState}
|
||||||
/>
|
/>
|
||||||
{simplifyProjectOverview && (
|
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
@ -600,7 +597,6 @@ export const ProjectFeatureToggles = ({
|
|||||||
<ImportSvg />
|
<ImportSvg />
|
||||||
</PermissionIconButton>
|
</PermissionIconButton>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
)}
|
|
||||||
</FilterRow>
|
</FilterRow>
|
||||||
<SearchHighlightProvider
|
<SearchHighlightProvider
|
||||||
value={tableState.query || ''}
|
value={tableState.query || ''}
|
||||||
|
@ -6,7 +6,6 @@ import {
|
|||||||
type IFilterItem,
|
type IFilterItem,
|
||||||
} from 'component/filter/Filters/Filters';
|
} from 'component/filter/Filters/Filters';
|
||||||
import { useProjectFlagCreators } from 'hooks/api/getters/useProjectFlagCreators/useProjectFlagCreators';
|
import { useProjectFlagCreators } from 'hooks/api/getters/useProjectFlagCreators/useProjectFlagCreators';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
|
||||||
|
|
||||||
interface IProjectOverviewFilters {
|
interface IProjectOverviewFilters {
|
||||||
state: FilterItemParamHolder;
|
state: FilterItemParamHolder;
|
||||||
@ -22,7 +21,6 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
|
|||||||
const { tags } = useAllTags();
|
const { tags } = useAllTags();
|
||||||
const { flagCreators } = useProjectFlagCreators(project);
|
const { flagCreators } = useProjectFlagCreators(project);
|
||||||
const [availableFilters, setAvailableFilters] = useState<IFilterItem[]>([]);
|
const [availableFilters, setAvailableFilters] = useState<IFilterItem[]>([]);
|
||||||
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const tagsOptions = (tags || []).map((tag) => ({
|
const tagsOptions = (tags || []).map((tag) => ({
|
||||||
@ -44,14 +42,10 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
|
|||||||
label: 'Stale',
|
label: 'Stale',
|
||||||
value: 'stale',
|
value: 'stale',
|
||||||
},
|
},
|
||||||
...(simplifyProjectOverview
|
|
||||||
? [
|
|
||||||
{
|
{
|
||||||
label: 'Potentially stale',
|
label: 'Potentially stale',
|
||||||
value: 'potentially-stale',
|
value: 'potentially-stale',
|
||||||
},
|
},
|
||||||
]
|
|
||||||
: []),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const availableFilters: IFilterItem[] = [
|
const availableFilters: IFilterItem[] = [
|
||||||
@ -105,8 +99,7 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
|
|||||||
singularOperators: ['IS', 'IS_NOT'],
|
singularOperators: ['IS', 'IS_NOT'],
|
||||||
pluralOperators: ['IS_ANY_OF', 'IS_NONE_OF'],
|
pluralOperators: ['IS_ANY_OF', 'IS_NONE_OF'],
|
||||||
},
|
},
|
||||||
...(simplifyProjectOverview
|
...([
|
||||||
? ([
|
|
||||||
{
|
{
|
||||||
label: 'Show only archived',
|
label: 'Show only archived',
|
||||||
icon: 'inventory',
|
icon: 'inventory',
|
||||||
@ -115,8 +108,7 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({
|
|||||||
singularOperators: ['IS'],
|
singularOperators: ['IS'],
|
||||||
pluralOperators: ['IS_ANY_OF'],
|
pluralOperators: ['IS_ANY_OF'],
|
||||||
},
|
},
|
||||||
] as IFilterItem[])
|
] as IFilterItem[]),
|
||||||
: []),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
setAvailableFilters(availableFilters);
|
setAvailableFilters(availableFilters);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { useNavigate } from 'react-router';
|
import { useNavigate } from 'react-router';
|
||||||
import useLoading from 'hooks/useLoading';
|
import useLoading from 'hooks/useLoading';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { ReactComponent as ImportSvg } from 'assets/icons/import.svg';
|
|
||||||
import { ReactComponent as ProjectStatusSvg } from 'assets/icons/projectStatus.svg';
|
import { ReactComponent as ProjectStatusSvg } from 'assets/icons/projectStatus.svg';
|
||||||
import {
|
import {
|
||||||
StyledDiv,
|
StyledDiv,
|
||||||
@ -31,8 +30,6 @@ import ProjectEnvironment from '../ProjectEnvironment/ProjectEnvironment';
|
|||||||
import { ProjectFeaturesArchive } from './ProjectFeaturesArchive/ProjectFeaturesArchive';
|
import { ProjectFeaturesArchive } from './ProjectFeaturesArchive/ProjectFeaturesArchive';
|
||||||
import ProjectFlags from './ProjectFlags';
|
import ProjectFlags from './ProjectFlags';
|
||||||
import ProjectHealth from './ProjectHealth/ProjectHealth';
|
import ProjectHealth from './ProjectHealth/ProjectHealth';
|
||||||
import PermissionIconButton from 'component/common/PermissionIconButton/PermissionIconButton';
|
|
||||||
import { UPDATE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
|
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
|
||||||
@ -43,7 +40,6 @@ import { ProjectChangeRequests } from '../../changeRequest/ProjectChangeRequests
|
|||||||
import { ProjectSettings } from './ProjectSettings/ProjectSettings';
|
import { ProjectSettings } from './ProjectSettings/ProjectSettings';
|
||||||
import { useFavoriteProjectsApi } from 'hooks/api/actions/useFavoriteProjectsApi/useFavoriteProjectsApi';
|
import { useFavoriteProjectsApi } from 'hooks/api/actions/useFavoriteProjectsApi/useFavoriteProjectsApi';
|
||||||
import { ImportModal } from './Import/ImportModal';
|
import { ImportModal } from './Import/ImportModal';
|
||||||
import { IMPORT_BUTTON } from 'utils/testIds';
|
|
||||||
import { EnterpriseBadge } from 'component/common/EnterpriseBadge/EnterpriseBadge';
|
import { EnterpriseBadge } from 'component/common/EnterpriseBadge/EnterpriseBadge';
|
||||||
import { Badge } from 'component/common/Badge/Badge';
|
import { Badge } from 'component/common/Badge/Badge';
|
||||||
import type { UiFlags } from 'interfaces/uiConfig';
|
import type { UiFlags } from 'interfaces/uiConfig';
|
||||||
@ -54,7 +50,6 @@ import { ProjectInsights } from './ProjectInsights/ProjectInsights';
|
|||||||
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
|
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
|
||||||
import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
|
||||||
import { useActionableChangeRequests } from 'hooks/api/getters/useActionableChangeRequests/useActionableChangeRequests';
|
import { useActionableChangeRequests } from 'hooks/api/getters/useActionableChangeRequests/useActionableChangeRequests';
|
||||||
import { ProjectStatusModal } from './ProjectStatus/ProjectStatusModal';
|
import { ProjectStatusModal } from './ProjectStatus/ProjectStatusModal';
|
||||||
|
|
||||||
@ -94,14 +89,9 @@ const TabText = styled('span')(({ theme }) => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const ChangeRequestsLabel = () => {
|
const ChangeRequestsLabel = () => {
|
||||||
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const { total } = useActionableChangeRequests(projectId);
|
const { total } = useActionableChangeRequests(projectId);
|
||||||
|
|
||||||
if (!simplifyProjectOverview) {
|
|
||||||
return 'Change requests';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledCounterBadge badgeContent={total ?? 0} color='primary'>
|
<StyledCounterBadge badgeContent={total ?? 0} color='primary'>
|
||||||
<TabText>Change requests</TabText>
|
<TabText>Change requests</TabText>
|
||||||
@ -155,7 +145,6 @@ export const Project = () => {
|
|||||||
const basePath = `/projects/${projectId}`;
|
const basePath = `/projects/${projectId}`;
|
||||||
const projectName = project?.name || projectId;
|
const projectName = project?.name || projectId;
|
||||||
const { favorite, unfavorite } = useFavoriteProjectsApi();
|
const { favorite, unfavorite } = useFavoriteProjectsApi();
|
||||||
const simplifyProjectOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
|
|
||||||
const [showDelDialog, setShowDelDialog] = useState(false);
|
const [showDelDialog, setShowDelDialog] = useState(false);
|
||||||
|
|
||||||
@ -166,29 +155,10 @@ export const Project = () => {
|
|||||||
|
|
||||||
const tabs: ITab[] = [
|
const tabs: ITab[] = [
|
||||||
{
|
{
|
||||||
title: simplifyProjectOverview ? 'Overview' : 'Flags',
|
title: 'Overview',
|
||||||
path: basePath,
|
path: basePath,
|
||||||
name: 'flags',
|
name: 'flags',
|
||||||
},
|
},
|
||||||
...(simplifyProjectOverview
|
|
||||||
? []
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
title: 'Insights',
|
|
||||||
path: `${basePath}/insights`,
|
|
||||||
name: 'insights',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Health',
|
|
||||||
path: `${basePath}/health`,
|
|
||||||
name: 'health',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Archived flags',
|
|
||||||
path: `${basePath}/archive`,
|
|
||||||
name: 'archive',
|
|
||||||
} as ITab,
|
|
||||||
]),
|
|
||||||
{
|
{
|
||||||
title: 'Change requests',
|
title: 'Change requests',
|
||||||
path: `${basePath}/change-requests`,
|
path: `${basePath}/change-requests`,
|
||||||
@ -207,7 +177,7 @@ export const Project = () => {
|
|||||||
name: 'logs',
|
name: 'logs',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: simplifyProjectOverview ? 'Settings' : 'Project settings',
|
title: 'Settings',
|
||||||
path: `${basePath}/settings`,
|
path: `${basePath}/settings`,
|
||||||
ossPath: `${basePath}/settings/api-access`,
|
ossPath: `${basePath}/settings/api-access`,
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
@ -301,22 +271,7 @@ export const Project = () => {
|
|||||||
</StyledProjectTitle>
|
</StyledProjectTitle>
|
||||||
</StyledDiv>
|
</StyledDiv>
|
||||||
<StyledDiv>
|
<StyledDiv>
|
||||||
<ConditionallyRender
|
<ProjectStatus />
|
||||||
condition={Boolean(!simplifyProjectOverview)}
|
|
||||||
show={
|
|
||||||
<PermissionIconButton
|
|
||||||
permission={UPDATE_FEATURE}
|
|
||||||
projectId={projectId}
|
|
||||||
onClick={() => setModalOpen(true)}
|
|
||||||
tooltipProps={{ title: 'Import' }}
|
|
||||||
data-testid={IMPORT_BUTTON}
|
|
||||||
data-loading-project
|
|
||||||
>
|
|
||||||
<ImportSvg />
|
|
||||||
</PermissionIconButton>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{simplifyProjectOverview && <ProjectStatus />}
|
|
||||||
</StyledDiv>
|
</StyledDiv>
|
||||||
</StyledTopRow>
|
</StyledTopRow>
|
||||||
</StyledInnerContainer>
|
</StyledInnerContainer>
|
||||||
|
@ -7,7 +7,6 @@ import useProjectOverview, {
|
|||||||
} from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
} from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
import { usePageTitle } from 'hooks/usePageTitle';
|
import { usePageTitle } from 'hooks/usePageTitle';
|
||||||
import { useLastViewedProject } from 'hooks/useLastViewedProject';
|
import { useLastViewedProject } from 'hooks/useLastViewedProject';
|
||||||
import { ProjectOverviewChangeRequests } from './ProjectOverviewChangeRequests';
|
|
||||||
import { OutdatedSdksBanner } from '../../banners/OutdatedSdksBanner/OutdatedSdksBanner';
|
import { OutdatedSdksBanner } from '../../banners/OutdatedSdksBanner/OutdatedSdksBanner';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
import { ConditionallyRender } from '../../common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from '../../common/ConditionallyRender/ConditionallyRender';
|
||||||
@ -51,14 +50,9 @@ const ProjectOverview: FC = () => {
|
|||||||
setLastViewed(projectId);
|
setLastViewed(projectId);
|
||||||
}, [projectId, setLastViewed]);
|
}, [projectId, setLastViewed]);
|
||||||
|
|
||||||
const hideChangeRequestOverview = useUiFlag('simplifyProjectOverview');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer key={projectId}>
|
<StyledContainer key={projectId}>
|
||||||
<StyledContentContainer>
|
<StyledContentContainer>
|
||||||
{hideChangeRequestOverview ? null : (
|
|
||||||
<ProjectOverviewChangeRequests project={projectId} />
|
|
||||||
)}
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={outdatedSdksBannerEnabled}
|
condition={outdatedSdksBannerEnabled}
|
||||||
show={<OutdatedSdksBanner project={projectId} />}
|
show={<OutdatedSdksBanner project={projectId} />}
|
||||||
|
Loading…
Reference in New Issue
Block a user