1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-19 21:46:50 -04:00
Files
Radarr/frontend/src/Components/Form/Select/RootFolderSelectInputOption.tsx
T

66 lines
1.7 KiB
TypeScript

import classNames from 'classnames';
import React from 'react';
import formatBytes from 'Utilities/Number/formatBytes';
import translate from 'Utilities/String/translate';
import EnhancedSelectInputOption, {
EnhancedSelectInputOptionProps,
} from './EnhancedSelectInputOption';
import styles from './RootFolderSelectInputOption.css';
interface RootFolderSelectInputOptionProps
extends EnhancedSelectInputOptionProps {
id: string;
value: string;
freeSpace?: number;
isMissing?: boolean;
movieFolder?: string;
isMobile: boolean;
isWindows?: boolean;
}
function RootFolderSelectInputOption({
id,
value,
freeSpace,
isMissing,
movieFolder,
isMobile,
isWindows,
...otherProps
}: RootFolderSelectInputOptionProps) {
const slashCharacter = isWindows ? '\\' : '/';
return (
<EnhancedSelectInputOption id={id} isMobile={isMobile} {...otherProps}>
<div
className={classNames(styles.optionText, isMobile && styles.isMobile)}
>
<div className={styles.value}>
{value}
{movieFolder && id !== 'addNew' ? (
<div className={styles.movieFolder}>
{slashCharacter}
{movieFolder}
</div>
) : null}
</div>
{freeSpace == null ? null : (
<div className={styles.freeSpace}>
{translate('RootFolderSelectFreeSpace', {
freeSpace: formatBytes(freeSpace),
})}
</div>
)}
{isMissing ? (
<div className={styles.isMissing}>{translate('Missing')}</div>
) : null}
</div>
</EnhancedSelectInputOption>
);
}
export default RootFolderSelectInputOption;