// Copyright (C) 2017-2023 Smart code 203358507
const React = require('react');
const { useTranslation } = require('react-i18next');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const { default: Icon } = require('@stremio/stremio-icons/react');
const { default: Image } = require('stremio/components/Image');
const styles = require('./styles');
const AddonDetails = ({ className, id, name, version, logo, description, types, transportUrl, official }) => {
const { t } = useTranslation();
const renderLogoFallback = React.useCallback(() => (
), []);
return (
{typeof name === 'string' && name.length > 0 ? name : id}
{
typeof version === 'string' && version.length > 0 ?
{t('ADDON_VERSION_SHORT', {version})}
:
null
}
{
typeof description === 'string' && description.length > 0 ?
{description}
:
null
}
{
typeof transportUrl === 'string' && transportUrl.length > 0 ?
{`${t('URL')}:`}
{transportUrl}
:
null
}
{
Array.isArray(types) && types.length > 0 ?
{`${t('ADDON_SUPPORTED_TYPES')}:`}
{
types.length === 1 ?
types[0]
:
types.slice(0, -1).join(', ') + ' & ' + types[types.length - 1]
}
:
null
}
{
!official ?
:
null
}
);
};
AddonDetails.propTypes = {
className: PropTypes.string,
id: PropTypes.string,
name: PropTypes.string,
version: PropTypes.string,
logo: PropTypes.string,
description: PropTypes.string,
types: PropTypes.arrayOf(PropTypes.string),
transportUrl: PropTypes.string,
official: PropTypes.bool,
};
module.exports = AddonDetails;