--- /dev/null
+/*
+ * 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 { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router';
+import { translate } from '../../../helpers/l10n';
+import { Query } from '../query';
+import '../../../components/common/EmptySearch.css';
+
+export default function EmptyFavoriteSearch({ query }: { query: Query }) {
+ return (
+ <div className="empty-search">
+ <h3>{translate('no_results_search.favorites')}</h3>
+ <p className="big-spacer-top">
+ <FormattedMessage
+ defaultMessage={translate('no_results_search.favorites.2')}
+ id="no_results_search.favorites.2"
+ values={{
+ url: <Link to={{ pathname: '/projects', query }}>{translate('all')}</Link>
+ }}
+ />
+ </p>
+ </div>
+ );
+}
import ProjectCard from './ProjectCard';
import NoFavoriteProjects from './NoFavoriteProjects';
import EmptyInstance from './EmptyInstance';
+import EmptyFavoriteSearch from './EmptyFavoriteSearch';
import EmptySearch from '../../../components/common/EmptySearch';
import { Project } from '../types';
+import { Query } from '../query';
interface Props {
cardType?: string;
isFiltered: boolean;
organization?: { key: string };
projects: Project[];
+ query: Query;
}
export default class ProjectsList extends React.PureComponent<Props> {
renderNoProjects() {
- if (this.props.isFavorite && !this.props.isFiltered) {
- return <NoFavoriteProjects />;
- } else if (!this.props.isFiltered) {
- return <EmptyInstance />;
- } else {
- return <EmptySearch />;
+ const { isFavorite, isFiltered, query } = this.props;
+ if (isFiltered) {
+ return isFavorite ? <EmptyFavoriteSearch query={query} /> : <EmptySearch />;
}
+ return isFavorite ? <NoFavoriteProjects /> : <EmptyInstance />;
}
render() {
no_results=No results
no_results_for_x=No results for "{0}"
no_results_search=We couldn't find any results matching selected criteria.
+no_results_search.favorites=We couldn't find any results matching selected criteria in your favorites.
no_results_search.2=Try to change filters to get some results.
+no_results_search.favorites.2=Would you like to search among {url} projects?
page_extension_failed=Page extension failed.
set_as_default=Set as Default
unset_as_default=Unset as Default