1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00

New: Project Aphrodite

This commit is contained in:
Qstick
2018-11-23 02:04:42 -05:00
parent 65efa15551
commit 8430cb40ab
1080 changed files with 73015 additions and 0 deletions
@@ -0,0 +1,5 @@
.cell {
composes: cell from './TableRowCell.css';
width: 180px;
}
@@ -0,0 +1,60 @@
import PropTypes from 'prop-types';
import React from 'react';
import formatDateTime from 'Utilities/Date/formatDateTime';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import TableRowCell from './TableRowCell';
import styles from './RelativeDateCell.css';
function RelativeDateCell(props) {
const {
className,
date,
includeSeconds,
showRelativeDates,
shortDateFormat,
longDateFormat,
timeFormat,
component: Component,
dispatch,
...otherProps
} = props;
if (!date) {
return (
<Component
className={className}
{...otherProps}
/>
);
}
return (
<Component
className={className}
title={formatDateTime(date, longDateFormat, timeFormat, { includeSeconds, includeRelativeDay: !showRelativeDates })}
{...otherProps}
>
{getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds, timeForToday: true })}
</Component>
);
}
RelativeDateCell.propTypes = {
className: PropTypes.string.isRequired,
date: PropTypes.string,
includeSeconds: PropTypes.bool.isRequired,
showRelativeDates: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired,
longDateFormat: PropTypes.string.isRequired,
timeFormat: PropTypes.string.isRequired,
component: PropTypes.func,
dispatch: PropTypes.func
};
RelativeDateCell.defaultProps = {
className: styles.cell,
includeSeconds: false,
component: TableRowCell
};
export default RelativeDateCell;
@@ -0,0 +1,21 @@
import _ from 'lodash';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import RelativeDateCell from './RelativeDateCell';
function createMapStateToProps() {
return createSelector(
createUISettingsSelector(),
(uiSettings) => {
return _.pick(uiSettings, [
'showRelativeDates',
'shortDateFormat',
'longDateFormat',
'timeFormat'
]);
}
);
}
export default connect(createMapStateToProps, null)(RelativeDateCell);
@@ -0,0 +1,11 @@
.cell {
padding: 8px;
border-top: 1px solid #eee;
line-height: 1.52857143;
}
@media only screen and (max-width: $breakpointSmall) {
.cell {
white-space: nowrap;
}
}
@@ -0,0 +1,37 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import styles from './TableRowCell.css';
class TableRowCell extends Component {
//
// Render
render() {
const {
className,
children,
...otherProps
} = this.props;
return (
<td
className={className}
{...otherProps}
>
{children}
</td>
);
}
}
TableRowCell.propTypes = {
className: PropTypes.string.isRequired,
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
};
TableRowCell.defaultProps = {
className: styles.cell
};
export default TableRowCell;
@@ -0,0 +1,4 @@
.cell {
composes: cell from './TableRowCell.css';
composes: link from 'Components/Link/Link.css';
}
@@ -0,0 +1,25 @@
import PropTypes from 'prop-types';
import React from 'react';
import Link from 'Components/Link/Link';
import TableRowCell from './TableRowCell';
import styles from './TableRowCellButton.css';
function TableRowCellButton({ className, ...otherProps }) {
return (
<Link
className={className}
component={TableRowCell}
{...otherProps}
/>
);
}
TableRowCellButton.propTypes = {
className: PropTypes.string.isRequired
};
TableRowCellButton.defaultProps = {
className: styles.cell
};
export default TableRowCellButton;
@@ -0,0 +1,11 @@
.selectCell {
composes: cell from 'Components/Table/Cells/TableRowCell.css';
width: 30px;
}
.input {
composes: input from 'Components/Form/CheckInput.css';
margin: 0;
}
@@ -0,0 +1,80 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import CheckInput from 'Components/Form/CheckInput';
import TableRowCell from './TableRowCell';
import styles from './TableSelectCell.css';
class TableSelectCell extends Component {
//
// Lifecycle
componentDidMount() {
const {
id,
isSelected,
onSelectedChange
} = this.props;
onSelectedChange({ id, value: isSelected });
}
componentWillUnmount() {
const {
id,
onSelectedChange
} = this.props;
onSelectedChange({ id, value: null });
}
//
// Listeners
onChange = ({ value, shiftKey }, a, b, c, d) => {
const {
id,
onSelectedChange
} = this.props;
onSelectedChange({ id, value, shiftKey });
}
//
// Render
render() {
const {
className,
id,
isSelected,
...otherProps
} = this.props;
return (
<TableRowCell className={className}>
<CheckInput
className={styles.input}
name={id.toString()}
value={isSelected}
{...otherProps}
onChange={this.onChange}
/>
</TableRowCell>
);
}
}
TableSelectCell.propTypes = {
className: PropTypes.string.isRequired,
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
isSelected: PropTypes.bool.isRequired,
onSelectedChange: PropTypes.func.isRequired
};
TableSelectCell.defaultProps = {
className: styles.selectCell,
isSelected: false
};
export default TableSelectCell;
@@ -0,0 +1,14 @@
.cell {
@add-mixin truncate;
composes: cell from 'Components/Table/Cells/TableRowCell.css';
flex-grow: 0;
flex-shrink: 1;
white-space: nowrap;
}
@media only screen and (max-width: $breakpointSmall) {
.cell {
white-space: nowrap;
}
}
@@ -0,0 +1,29 @@
import PropTypes from 'prop-types';
import React from 'react';
import styles from './VirtualTableRowCell.css';
function VirtualTableRowCell(props) {
const {
className,
children
} = props;
return (
<div
className={className}
>
{children}
</div>
);
}
VirtualTableRowCell.propTypes = {
className: PropTypes.string.isRequired,
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
};
VirtualTableRowCell.defaultProps = {
className: styles.cell
};
export default VirtualTableRowCell;
@@ -0,0 +1,11 @@
.cell {
composes: cell from 'Components/Table/Cells/VirtualTableRowCell.css';
flex: 0 0 36px;
}
.input {
composes: input from 'Components/Form/CheckInput.css';
margin: 0;
}
@@ -0,0 +1,82 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import CheckInput from 'Components/Form/CheckInput';
import VirtualTableRowCell from './VirtualTableRowCell';
import styles from './VirtualTableSelectCell.css';
export function virtualTableSelectCellRenderer(cellProps) {
const {
cellKey,
rowData,
columnData,
...otherProps
} = cellProps;
return (
<VirtualTableSelectCell
key={cellKey}
id={rowData.name}
isSelected={rowData.isSelected}
{...columnData}
{...otherProps}
/>
);
}
class VirtualTableSelectCell extends Component {
//
// Listeners
onChange = ({ value, shiftKey }) => {
const {
id,
onSelectedChange
} = this.props;
onSelectedChange({ id, value, shiftKey });
}
//
// Render
render() {
const {
inputClassName,
id,
isSelected,
isDisabled,
...otherProps
} = this.props;
return (
<VirtualTableRowCell
className={styles.cell}
{...otherProps}
>
<CheckInput
className={inputClassName}
name={id.toString()}
value={isSelected}
isDisabled={isDisabled}
onChange={this.onChange}
/>
</VirtualTableRowCell>
);
}
}
VirtualTableSelectCell.propTypes = {
inputClassName: PropTypes.string.isRequired,
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
isSelected: PropTypes.bool.isRequired,
isDisabled: PropTypes.bool.isRequired,
onSelectedChange: PropTypes.func.isRequired
};
VirtualTableSelectCell.defaultProps = {
inputClassName: styles.input,
isSelected: false
};
export default VirtualTableSelectCell;