web.lib.components.extensions-picker.search-results-info.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of code-quarkus Show documentation
Show all versions of code-quarkus Show documentation
Customize a Web Interface to generate Quarkus starter projects.
import React, { SetStateAction } from 'react';
import { clearFilterOrigin, FilterResult } from './extensions-utils';
import classNames from 'classnames';
import { FaCheck } from 'react-icons/fa';
import { Alert, Button } from 'react-bootstrap';
import './search-results-info.scss';
import { DEFAULT_FILTER } from '../api/quarkus-project-utils';
import { useAnalytics } from '../../core/analytics';
import { Plural } from '../../core/components';
import { PlatformIcon } from "./extensions-origin";
export function SearchResultsInfo(props: { filter: string; setFilter: React.Dispatch>, result: FilterResult }) {
const analytics = useAnalytics();
const context = { element: 'search-result-info-panel' };
function clickPlatform() {
if (props.result.origin !== 'platform') {
analytics.event('Switch origin', { origin: 'platform', ...context });
props.setFilter(`origin:platform ${clearFilterOrigin(props.filter)}`);
} else {
analytics.event('Switch origin', { origin: '', ...context });
props.setFilter(`${clearFilterOrigin(props.filter)}`);
}
}
function clickOther() {
if (props.result.origin !== 'other' ) {
analytics.event('Switch origin', { origin: 'other', ...context });
props.setFilter(`origin:other ${clearFilterOrigin(props.filter)}`);
} else {
analytics.event('Switch origin', { origin: '', ...context });
props.setFilter(`${clearFilterOrigin(props.filter)}`);
}
}
const origin = props.result?.origin;
const originOther = origin === 'other' ;
const originPlatform = origin === 'platform';
return (
<>
{props.result?.filtered && (
<>
{props.result.all.length === 0 && No extensions found }
{props.result.all.length > 0 && (
Extensions found by origin:
{originPlatform && }{props.result.platform.length} in platform
{originOther && }{props.result.other.length} in other
)}
{props.result.selected.length === 0 && props.result.other.length > 0 && (
No extensions found in platform. .
)}
{props.result.selected.length === 0 && props.result.platform.length > 0 && (
No extensions found in other origin. .
)}
>
)}
>
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy