3 * Copyright (C) 2009-2022 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 import * as React from 'react';
21 import PrivacyBadgeContainer from '../../../../../components/common/PrivacyBadgeContainer';
22 import { translate } from '../../../../../helpers/l10n';
23 import { ComponentQualifier } from '../../../../../types/component';
24 import { Component, Measure } from '../../../../../types/types';
25 import DrawerLink from './DrawerLink';
26 import MetaKey from './meta/MetaKey';
27 import MetaLinks from './meta/MetaLinks';
28 import MetaQualityGate from './meta/MetaQualityGate';
29 import MetaQualityProfiles from './meta/MetaQualityProfiles';
30 import MetaSize from './meta/MetaSize';
31 import MetaTags from './meta/MetaTags';
32 import { ProjectInformationPages } from './ProjectInformationPages';
34 export interface ProjectInformationRendererProps {
35 canConfigureNotifications: boolean;
36 canUseBadges: boolean;
39 onComponentChange: (changes: {}) => void;
40 onPageChange: (page: ProjectInformationPages) => void;
43 export function ProjectInformationRenderer(props: ProjectInformationRendererProps) {
44 const { canConfigureNotifications, canUseBadges, component, measures = [] } = props;
46 const isApp = component.qualifier === ComponentQualifier.Application;
51 <h2 className="big-padded bordered-bottom">
52 {translate(isApp ? 'application' : 'project', 'info.title')}
56 <div className="overflow-y-auto">
57 <div className="big-padded bordered-bottom">
58 <div className="display-flex-center">
59 <h3 className="spacer-right">{translate('project.info.description')}</h3>
60 {component.visibility && (
61 <PrivacyBadgeContainer
62 qualifier={component.qualifier}
63 visibility={component.visibility}
68 {component.description && (
69 <p className="it__project-description">{component.description}</p>
72 <MetaTags component={component} onComponentChange={props.onComponentChange} />
75 <div className="big-padded bordered-bottom it__project-loc-value">
76 <MetaSize component={component} measures={measures} />
80 (component.qualityGate ||
81 (component.qualityProfiles && component.qualityProfiles.length > 0)) && (
83 <div className="big-padded bordered-bottom">
84 {component.qualityGate && <MetaQualityGate qualityGate={component.qualityGate} />}
86 {component.qualityProfiles && component.qualityProfiles.length > 0 && (
88 headerClassName={component.qualityGate ? 'big-spacer-top' : undefined}
89 profiles={component.qualityProfiles}
96 {!isApp && <MetaLinks component={component} />}
98 <div className="big-padded bordered-bottom">
99 <MetaKey componentKey={component.key} qualifier={component.qualifier} />
104 label={translate('overview.badges.get_badge', component.qualifier)}
105 onPageChange={props.onPageChange}
106 to={ProjectInformationPages.badges}
109 {canConfigureNotifications && (
111 label={translate('project.info.to_notifications')}
112 onPageChange={props.onPageChange}
113 to={ProjectInformationPages.notifications}
121 export default React.memo(ProjectInformationRenderer);