mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
fix: revert uneccesary changes
This commit is contained in:
parent
87ebc0dd18
commit
86ffd5af5b
@ -1,6 +1,6 @@
|
|||||||
import type { IFeatureToggle } from 'interfaces/featureToggle';
|
import type { IFeatureToggle } from 'interfaces/featureToggle';
|
||||||
import { useContext, useState } from 'react';
|
import { useContext, useState } from 'react';
|
||||||
import { Button, Divider, styled } from '@mui/material';
|
import { Button, Chip, Divider, styled } from '@mui/material';
|
||||||
import useFeatureTags from 'hooks/api/getters/useFeatureTags/useFeatureTags';
|
import useFeatureTags from 'hooks/api/getters/useFeatureTags/useFeatureTags';
|
||||||
import Add from '@mui/icons-material/Add';
|
import Add from '@mui/icons-material/Add';
|
||||||
import Cancel from '@mui/icons-material/Cancel';
|
import Cancel from '@mui/icons-material/Cancel';
|
||||||
@ -13,7 +13,6 @@ import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
|||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { Tag } from 'component/common/Tag/Tag';
|
|
||||||
|
|
||||||
const StyledContainer = styled('div')(({ theme }) => ({
|
const StyledContainer = styled('div')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -27,6 +26,10 @@ const StyledTagContainer = styled('div')(({ theme }) => ({
|
|||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const StyledChip = styled(Chip)(({ theme }) => ({
|
||||||
|
fontSize: theme.fontSizes.smallBody,
|
||||||
|
}));
|
||||||
|
|
||||||
const StyledDivider = styled(Divider)(({ theme }) => ({
|
const StyledDivider = styled(Divider)(({ theme }) => ({
|
||||||
margin: theme.spacing(3),
|
margin: theme.spacing(3),
|
||||||
borderStyle: 'dashed',
|
borderStyle: 'dashed',
|
||||||
@ -79,10 +82,13 @@ export const FeatureOverviewSidePanelTags = ({
|
|||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
{header}
|
{header}
|
||||||
<StyledTagContainer>
|
<StyledTagContainer>
|
||||||
{tags.map((tag) => (
|
{tags.map((tag) => {
|
||||||
<Tag
|
const tagLabel = `${tag.type}:${tag.value}`;
|
||||||
key={`${tag.type}:${tag.value}`}
|
return (
|
||||||
tag={tag}
|
<StyledChip
|
||||||
|
key={tagLabel}
|
||||||
|
label={tagLabel}
|
||||||
|
deleteIcon={<Cancel titleAccess='Remove' />}
|
||||||
onDelete={
|
onDelete={
|
||||||
canUpdateTags
|
canUpdateTags
|
||||||
? () => {
|
? () => {
|
||||||
@ -91,9 +97,9 @@ export const FeatureOverviewSidePanelTags = ({
|
|||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
deleteIcon={<Cancel titleAccess='Remove' />}
|
|
||||||
/>
|
/>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</StyledTagContainer>
|
</StyledTagContainer>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={canUpdateTags}
|
condition={canUpdateTags}
|
||||||
@ -117,18 +123,18 @@ export const FeatureOverviewSidePanelTags = ({
|
|||||||
<ManageTagsDialog open={openTagDialog} setOpen={setOpenTagDialog} />
|
<ManageTagsDialog open={openTagDialog} setOpen={setOpenTagDialog} />
|
||||||
<Dialogue
|
<Dialogue
|
||||||
open={showDelDialog}
|
open={showDelDialog}
|
||||||
primaryButtonText='Delete'
|
primaryButtonText='Delete tag'
|
||||||
secondaryButtonText='Cancel'
|
secondaryButtonText='Cancel'
|
||||||
|
onClose={() => {
|
||||||
|
setShowDelDialog(false);
|
||||||
|
setSelectedTag(undefined);
|
||||||
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDelDialog(false);
|
setShowDelDialog(false);
|
||||||
handleDelete();
|
handleDelete();
|
||||||
setSelectedTag(undefined);
|
setSelectedTag(undefined);
|
||||||
}}
|
}}
|
||||||
onClose={() => {
|
title='Delete tag?'
|
||||||
setShowDelDialog(false);
|
|
||||||
setSelectedTag(undefined);
|
|
||||||
}}
|
|
||||||
title='Delete tag'
|
|
||||||
>
|
>
|
||||||
You are about to delete tag:{' '}
|
You are about to delete tag:{' '}
|
||||||
<strong>
|
<strong>
|
||||||
|
@ -8,7 +8,7 @@ import { ProjectCardFooter } from './ProjectCardFooter/ProjectCardFooter';
|
|||||||
import { ProjectModeBadge } from './ProjectModeBadge/ProjectModeBadge';
|
import { ProjectModeBadge } from './ProjectModeBadge/ProjectModeBadge';
|
||||||
import { ProjectIcon } from 'component/common/ProjectIcon/ProjectIcon';
|
import { ProjectIcon } from 'component/common/ProjectIcon/ProjectIcon';
|
||||||
import { FavoriteAction } from './FavoriteAction/FavoriteAction';
|
import { FavoriteAction } from './FavoriteAction/FavoriteAction';
|
||||||
import { Box, styled, Chip, type ChipProps } from '@mui/material';
|
import { Box, styled } from '@mui/material';
|
||||||
import { flexColumn } from 'themes/themeStyles';
|
import { flexColumn } from 'themes/themeStyles';
|
||||||
import { TimeAgo } from 'component/common/TimeAgo/TimeAgo';
|
import { TimeAgo } from 'component/common/TimeAgo/TimeAgo';
|
||||||
import { ProjectLastSeen } from './ProjectLastSeen/ProjectLastSeen';
|
import { ProjectLastSeen } from './ProjectLastSeen/ProjectLastSeen';
|
||||||
@ -18,7 +18,6 @@ import { ProjectMembers } from './ProjectCardFooter/ProjectMembers/ProjectMember
|
|||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
||||||
import type { ProjectSchema } from 'openapi';
|
import type { ProjectSchema } from 'openapi';
|
||||||
import type { ITag } from 'interfaces/tags';
|
|
||||||
|
|
||||||
const StyledUpdated = styled('span')(({ theme }) => ({
|
const StyledUpdated = styled('span')(({ theme }) => ({
|
||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
@ -46,30 +45,7 @@ const StyledHeader = styled('div')(({ theme }) => ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledTags = styled('div')(({ theme }) => ({
|
type ProjectCardProps = ProjectSchema & { onHover?: () => void };
|
||||||
display: 'flex',
|
|
||||||
flexWrap: 'wrap',
|
|
||||||
gap: theme.spacing(0.5),
|
|
||||||
marginTop: theme.spacing(1),
|
|
||||||
}));
|
|
||||||
|
|
||||||
interface StyledTagProps extends ChipProps {
|
|
||||||
tagColor?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const StyledTag = styled(Chip)<StyledTagProps>(({ theme, tagColor }) => ({
|
|
||||||
backgroundColor: tagColor || theme.palette.primary.main,
|
|
||||||
color: theme.palette.primary.contrastText,
|
|
||||||
'& .MuiChip-label': {
|
|
||||||
padding: theme.spacing(0.5, 1),
|
|
||||||
fontSize: theme.fontSizes.smallerBody,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
interface ProjectCardProps extends ProjectSchema {
|
|
||||||
onHover?: () => void;
|
|
||||||
tags?: ITag[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ProjectCard = ({
|
export const ProjectCard = ({
|
||||||
name,
|
name,
|
||||||
@ -84,7 +60,6 @@ export const ProjectCard = ({
|
|||||||
createdAt,
|
createdAt,
|
||||||
lastUpdatedAt,
|
lastUpdatedAt,
|
||||||
lastReportedFlagUsage,
|
lastReportedFlagUsage,
|
||||||
tags = [],
|
|
||||||
}: ProjectCardProps) => {
|
}: ProjectCardProps) => {
|
||||||
const { searchQuery } = useSearchHighlightContext();
|
const { searchQuery } = useSearchHighlightContext();
|
||||||
|
|
||||||
@ -128,21 +103,6 @@ export const ProjectCard = ({
|
|||||||
<ProjectLastSeen date={lastReportedFlagUsage} />
|
<ProjectLastSeen date={lastReportedFlagUsage} />
|
||||||
</div>
|
</div>
|
||||||
</StyledInfo>
|
</StyledInfo>
|
||||||
<ConditionallyRender
|
|
||||||
condition={tags.length > 0}
|
|
||||||
show={
|
|
||||||
<StyledTags>
|
|
||||||
{tags.map((tag: ITag) => (
|
|
||||||
<StyledTag
|
|
||||||
key={`${tag.type}-${tag.value}`}
|
|
||||||
label={tag.value}
|
|
||||||
tagColor={tag.color}
|
|
||||||
size='small'
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</StyledTags>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</StyledProjectCardBody>
|
</StyledProjectCardBody>
|
||||||
<ProjectCardFooter id={id} owners={owners}>
|
<ProjectCardFooter id={id} owners={owners}>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
Loading…
Reference in New Issue
Block a user