Skip to content

Commit

Permalink
[Gitar] Updating TSX files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitar committed Aug 15, 2024
1 parent 183a9fc commit 0bbad6b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from 'component/providers/AccessProvider/permissions';
import { useContext } from 'react';
import AccessContext from 'contexts/AccessContext';
import { useUiFlag } from 'hooks/useUiFlag';

const WarningContainer = styled(Box)(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -109,7 +108,6 @@ type ApplicationIssues =

const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
const { hasAccess } = useContext(AccessContext);
const improveCreateFlagFlow = useUiFlag('improveCreateFlagFlow');
const length = features.length;

if (length === 0) {
Expand All @@ -130,25 +128,12 @@ const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
<ConditionallyRender
condition={hasAccess(CREATE_FEATURE)}
show={
<ConditionallyRender
condition={improveCreateFlagFlow}
show={
<StyledLink
key={feature}
to={`/projects/default?create=true&name=${feature}`}
>
Create feature flag
</StyledLink>
}
elseShow={
<StyledLink
key={feature}
to={`/projects/default/create-toggle?name=${feature}`}
>
Create feature flag
</StyledLink>
}
/>
<StyledLink
key={feature}
to={`/projects/default?create=true&name=${feature}`}
>
Create feature flag
</StyledLink>
}
/>
</IssueRowContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import Add from '@mui/icons-material/Add';
import FileDownload from '@mui/icons-material/FileDownload';
import { styled } from '@mui/material';
import ResponsiveButton from 'component/common/ResponsiveButton/ResponsiveButton';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useSearchParams } from 'react-router-dom';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import { getCreateTogglePath } from 'utils/routePathHelpers';
import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
import type { FeatureSchema } from 'openapi';
Expand Down Expand Up @@ -48,44 +47,25 @@ const FlagCreationButton: FC = () => {
const showCreateDialog = Boolean(searchParams.get('create'));
const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog);
const { loading } = useUiConfig();
const navigate = useNavigate();
const improveCreateFlagFlow = useUiFlag('improveCreateFlagFlow');

return (
<ConditionallyRender
condition={improveCreateFlagFlow}
show={
<>
<StyledResponsiveButton
onClick={() => setOpenCreateDialog(true)}
maxWidth='960px'
Icon={Add}
projectId={projectId}
disabled={loading}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
<CreateFeatureDialog
open={openCreateDialog}
onClose={() => setOpenCreateDialog(false)}
/>
</>
}
elseShow={
<StyledResponsiveButton
onClick={() => navigate(getCreateTogglePath(projectId))}
maxWidth='960px'
Icon={Add}
projectId={projectId}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
}
/>
<>
<StyledResponsiveButton
onClick={() => setOpenCreateDialog(true)}
maxWidth='960px'
Icon={Add}
projectId={projectId}
disabled={loading}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
<CreateFeatureDialog
open={openCreateDialog}
onClose={() => setOpenCreateDialog(false)}
/>
</>
);
};

Expand Down

0 comments on commit 0bbad6b

Please sign in to comment.