import React, { RefObject } from 'react'; import { TagIcon, Squares2X2Icon, PencilSquareIcon, TrashIcon, ShareIcon, CameraIcon, } from '@heroicons/react/24/outline'; import BannerBadge from '../Shared/BannerBadge'; import { Project } from '../../entities/Project'; import { Area } from '../../entities/Area'; import { useNavigate } from 'react-router-dom'; import { TFunction } from 'i18next'; import { getCreatorFromBannerUrl, isPresetBanner, } from '../../utils/bannersService'; import { getAssetPath } from '../../config/paths'; interface ProjectBannerProps { project: Project; areas: Area[]; t: TFunction; getStatusIcon: (status: string) => React.ReactNode; onDeleteClick: () => void; editButtonRef: RefObject; onEditBannerClick?: () => void; } const ProjectBanner: React.FC = ({ project, areas, t, getStatusIcon, onDeleteClick, editButtonRef, onEditBannerClick, }) => { const navigate = useNavigate(); const creatorName = project.image_url && isPresetBanner(project.image_url) ? getCreatorFromBannerUrl(project.image_url) : null; return (
{project.image_url ? ( {project.name} ) : (
)} {creatorName && (
Photo by {creatorName}
)}

{project.name}

{project.description && (

{project.description}

)}
{project.status && ( {getStatusIcon(project.status)} {t(`projectStatus.${project.status}`)} )} {project.tags && project.tags.length > 0 && ( {project.tags.map((tag, index) => ( {index < (project.tags?.length || 0) - 1 && ( ,{' '} )} ))} )} {(project.area || (project as any).Area) && ( )} {project.is_shared && ( {t('projects.shared', 'Shared')} )}
{onEditBannerClick && ( )}
); }; export default ProjectBanner;