/* * SonarQube * Copyright (C) 2009-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; import { Link } from 'react-router'; import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import ProjectCardQualityGate from './ProjectCardQualityGate'; import ProjectCardLeakMeasures from './ProjectCardLeakMeasures'; import ProjectCardOrganizationContainer from './ProjectCardOrganizationContainer'; import Favorite from '../../../components/controls/Favorite'; import TagsList from '../../../components/tags/TagsList'; import PrivateBadge from '../../../components/common/PrivateBadge'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Project } from '../types'; interface Props { organization?: { key: string }; project: Project; } export default function ProjectCardLeak({ organization, project }: Props) { const { measures } = project; const isPrivate = project.visibility === 'private'; const hasTags = project.tags.length > 0; return (
{project.isFavorite != null && ( )}

{!organization && ( )} {project.name}

{project.analysisDate && }
{isPrivate && ( )} {hasTags && }
{project.analysisDate && project.leakPeriodDate && (
{fromNow => ( {translateWithParameters('projects.leak_period_x', fromNow)} )} {formattedDate => ( {translateWithParameters('projects.last_analysis_on_x', formattedDate)} )}
)}
{project.analysisDate && project.leakPeriodDate ? (
) : (
{project.analysisDate ? translate('projects.no_leak_period') : translate('projects.not_analyzed')}
)}
); }