mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-18 21:55:12 -04:00
c3cf8a6ebb
(cherry picked from commit d6d90a64a39d3b9d3a95fb6b265517693a70fdd7) (cherry picked from commit 428569106499b5e3a463f1990ae2996d1ae4ab49) (cherry picked from commit d0e9504af0d88391a74e04b90638e4b2d99fb476) (cherry picked from commit ee80564dd427ca1dc14c192955efaa61f386ad44) (cherry picked from commit 76650af9fdc7ef06d13ce252986d21574903d293)
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import React, { useCallback } from 'react';
|
|
import Icon from 'Components/Icon';
|
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
import TableRowButton from 'Components/Table/TableRowButton';
|
|
import DownloadProtocol from 'DownloadClient/DownloadProtocol';
|
|
import { icons } from 'Helpers/Props';
|
|
import CapabilitiesLabel from 'Indexer/Index/Table/CapabilitiesLabel';
|
|
import PrivacyLabel from 'Indexer/Index/Table/PrivacyLabel';
|
|
import ProtocolLabel from 'Indexer/Index/Table/ProtocolLabel';
|
|
import { IndexerCapabilities, IndexerPrivacy } from 'Indexer/Indexer';
|
|
import translate from 'Utilities/String/translate';
|
|
import styles from './SelectIndexerRow.css';
|
|
|
|
interface SelectIndexerRowProps {
|
|
name: string;
|
|
protocol: DownloadProtocol;
|
|
privacy: IndexerPrivacy;
|
|
language: string;
|
|
description: string;
|
|
capabilities: IndexerCapabilities;
|
|
implementation: string;
|
|
implementationName: string;
|
|
isExistingIndexer: boolean;
|
|
onIndexerSelect(...args: unknown[]): void;
|
|
}
|
|
|
|
function SelectIndexerRow(props: SelectIndexerRowProps) {
|
|
const {
|
|
name,
|
|
protocol,
|
|
privacy,
|
|
language,
|
|
description,
|
|
capabilities,
|
|
implementation,
|
|
implementationName,
|
|
isExistingIndexer,
|
|
onIndexerSelect,
|
|
} = props;
|
|
|
|
const onPress = useCallback(() => {
|
|
onIndexerSelect({ implementation, implementationName, name });
|
|
}, [implementation, implementationName, name, onIndexerSelect]);
|
|
|
|
return (
|
|
<TableRowButton onPress={onPress}>
|
|
<TableRowCell className={styles.protocol}>
|
|
<ProtocolLabel protocol={protocol} />
|
|
</TableRowCell>
|
|
|
|
<TableRowCell>
|
|
{name}
|
|
{isExistingIndexer ? (
|
|
<Icon
|
|
className={styles.alreadyExistsIcon}
|
|
name={icons.CHECK_CIRCLE}
|
|
size={15}
|
|
title={translate('IndexerAlreadySetup')}
|
|
/>
|
|
) : null}
|
|
</TableRowCell>
|
|
|
|
<TableRowCell>{language}</TableRowCell>
|
|
|
|
<TableRowCell>{description}</TableRowCell>
|
|
|
|
<TableRowCell>
|
|
<PrivacyLabel privacy={privacy} />
|
|
</TableRowCell>
|
|
|
|
<TableRowCell>
|
|
<CapabilitiesLabel capabilities={capabilities} />
|
|
</TableRowCell>
|
|
</TableRowButton>
|
|
);
|
|
}
|
|
|
|
export default SelectIndexerRow;
|