import styled from '@emotion/styled';
import Feature from 'sentry/components/acl/feature';
import FeatureDisabled from 'sentry/components/acl/featureDisabled';
import Button from 'sentry/components/button';
import Highlight from 'sentry/components/highlight';
import {Hovercard} from 'sentry/components/hovercard';
import IdBadge from 'sentry/components/idBadge';
import PageFilterRow from 'sentry/components/organizations/pageFilterRow';
import BookmarkStar from 'sentry/components/projects/bookmarkStar';
import {IconOpen, IconSettings} from 'sentry/icons';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
import {Organization, Project} from 'sentry/types';
import {analytics} from 'sentry/utils/analytics';
type Props = {
inputValue: string;
isChecked: boolean;
multi: boolean;
organization: Organization;
project: Project;
onMultiSelect?: (project: Project, event: React.MouseEvent) => void;
};
function ProjectSelectorItem({
project,
organization,
onMultiSelect,
multi = false,
inputValue = '',
isChecked = false,
}: Props) {
const handleClick = (event: React.MouseEvent) => {
event.stopPropagation();
onMultiSelect?.(project, event);
};
const handleBookmarkToggle = (isBookmarked: boolean) => {
analytics('projectselector.bookmark_toggle', {
org_id: parseInt(organization.id, 10),
bookmarked: isBookmarked,
});
};
const renderDisabledCheckbox = ({
children,
features,
}: {
children: React.ReactNode;
features: string[];
}) => {
return (
}
>
{children}
);
};
return (
(
{checkbox}
)}
>
{project.slug}}
avatarProps={{consistentWidth: true}}
disableLink
/>
}
/>
}
/>
);
}
export default ProjectSelectorItem;
const BadgeWrapper = styled('div')`
display: flex;
flex: 1;
white-space: nowrap;
overflow: hidden;
`;
const ActionButton = styled(Button)`
color: ${p => p.theme.subText};
padding: ${space(1)} ${space(0.25)} ${space(1)} ${space(1)};
opacity: 0.33;
:hover {
color: ${p => p.theme.textColor};
}
`;
const ActionBookmark = styled(BookmarkStar)`
${p => !p.project.isBookmarked && 'opacity: 0.33'};
`;
const ProjectFilterRow = styled(PageFilterRow)`
:hover ${ActionButton}, :hover ${ActionBookmark} {
opacity: 1;
}
`;