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

View File

@@ -0,0 +1,11 @@
import PropTypes from 'prop-types';
function createRouteMatchShape(props) {
return PropTypes.shape({
params: PropTypes.shape({
...props
}).isRequired
});
}
export default createRouteMatchShape;

View File

@@ -0,0 +1,11 @@
import PropTypes from 'prop-types';
const locationShape = PropTypes.shape({
pathname: PropTypes.string.isRequired,
search: PropTypes.string.isRequired,
state: PropTypes.object,
action: PropTypes.string,
key: PropTypes.string
});
export default locationShape;

View File

@@ -0,0 +1,34 @@
import PropTypes from 'prop-types';
const settingShape = {
value: PropTypes.oneOf([PropTypes.bool, PropTypes.number, PropTypes.string]),
warnings: PropTypes.arrayOf(PropTypes.string).isRequired,
errors: PropTypes.arrayOf(PropTypes.string).isRequired
};
export const arraySettingShape = {
...settingShape,
value: PropTypes.array.isRequired
};
export const boolSettingShape = {
...settingShape,
value: PropTypes.bool.isRequired
};
export const numberSettingShape = {
...settingShape,
value: PropTypes.number.isRequired
};
export const stringSettingShape = {
...settingShape,
value: PropTypes.string
};
export const tagSettingShape = {
...settingShape,
value: PropTypes.arrayOf(PropTypes.number).isRequired
};
export default settingShape;

View File

@@ -0,0 +1,5 @@
export const LEFT = 'left';
export const CENTER = 'center';
export const RIGHT = 'right';
export const all = [LEFT, CENTER, RIGHT];

View File

@@ -0,0 +1,50 @@
import * as filterTypes from './filterTypes';
export const ARRAY = 'array';
export const DATE = 'date';
export const EXACT = 'exact';
export const NUMBER = 'number';
export const STRING = 'string';
export const all = [
ARRAY,
DATE,
EXACT,
NUMBER,
STRING
];
export const possibleFilterTypes = {
[ARRAY]: [
{ key: filterTypes.CONTAINS, value: 'contains' },
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' }
],
[DATE]: [
{ key: filterTypes.LESS_THAN, value: 'is before' },
{ key: filterTypes.GREATER_THAN, value: 'is after' },
{ key: filterTypes.IN_LAST, value: 'in the last' },
{ key: filterTypes.IN_NEXT, value: 'in the next' }
],
[EXACT]: [
{ key: filterTypes.EQUAL, value: 'is' },
{ key: filterTypes.NOT_EQUAL, value: 'is not' }
],
[NUMBER]: [
{ key: filterTypes.EQUAL, value: 'equal' },
{ key: filterTypes.GREATER_THAN, value: 'greater than' },
{ key: filterTypes.GREATER_THAN_OR_EQUAL, value: 'greater than or equal' },
{ key: filterTypes.LESS_THAN, value: 'less than' },
{ key: filterTypes.LESS_THAN_OR_EQUAL, value: 'less than or equal' },
{ key: filterTypes.NOT_EQUAL, value: 'not equal' }
],
[STRING]: [
{ key: filterTypes.CONTAINS, value: 'contains' },
{ key: filterTypes.NOT_CONTAINS, value: 'does not contain' },
{ key: filterTypes.EQUAL, value: 'equal' },
{ key: filterTypes.NOT_EQUAL, value: 'not equal' }
]
};

View File

@@ -0,0 +1,10 @@
export const BOOL = 'bool';
export const BYTES = 'bytes';
export const DATE = 'date';
export const DEFAULT = 'default';
export const INDEXER = 'indexer';
export const PROTOCOL = 'protocol';
export const QUALITY = 'quality';
export const QUALITY_PROFILE = 'qualityProfile';
export const SERIES_STATUS = 'seriesStatus';
export const TAG = 'tag';

View File

@@ -0,0 +1,45 @@
import * as filterTypes from './filterTypes';
const filterTypePredicates = {
[filterTypes.CONTAINS]: function(itemValue, filterValue) {
if (Array.isArray(itemValue)) {
return itemValue.some((v) => v === filterValue);
}
return itemValue.toLowerCase().contains(filterValue.toLowerCase());
},
[filterTypes.EQUAL]: function(itemValue, filterValue) {
return itemValue === filterValue;
},
[filterTypes.GREATER_THAN]: function(itemValue, filterValue) {
return itemValue > filterValue;
},
[filterTypes.GREATER_THAN_OR_EQUAL]: function(itemValue, filterValue) {
return itemValue >= filterValue;
},
[filterTypes.LESS_THAN]: function(itemValue, filterValue) {
return itemValue < filterValue;
},
[filterTypes.LESS_THAN_OR_EQUAL]: function(itemValue, filterValue) {
return itemValue <= filterValue;
},
[filterTypes.NOT_CONTAINS]: function(itemValue, filterValue) {
if (Array.isArray(itemValue)) {
return !itemValue.some((v) => v === filterValue);
}
return !itemValue.toLowerCase().contains(filterValue.toLowerCase());
},
[filterTypes.NOT_EQUAL]: function(itemValue, filterValue) {
return itemValue !== filterValue;
}
};
export default filterTypePredicates;

View File

@@ -0,0 +1,21 @@
export const CONTAINS = 'contains';
export const EQUAL = 'equal';
export const GREATER_THAN = 'greaterThan';
export const GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
export const IN_LAST = 'inLast';
export const IN_NEXT = 'inNext';
export const LESS_THAN = 'lessThan';
export const LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
export const NOT_CONTAINS = 'notContains';
export const NOT_EQUAL = 'notEqual';
export const all = [
CONTAINS,
EQUAL,
GREATER_THAN,
GREATER_THAN_OR_EQUAL,
LESS_THAN,
LESS_THAN_OR_EQUAL,
NOT_CONTAINS,
NOT_EQUAL
];

View File

@@ -0,0 +1,205 @@
//
// Regular
import {
faBookmark as farBookmark,
faCalendar as farCalendar,
faCircle as farCircle,
faClock as farClock,
faClone as farClone,
faDotCircle as farDotCircle,
faFile as farFile,
faFileArchive as farFileArchive,
faFileVideo as farFileVideo,
faFolder as farFolder,
faObjectGroup as farObjectGroup,
faHdd as farHdd,
faKeyboard as farKeyboard,
faObjectUngroup as farObjectUngroup
} from '@fortawesome/free-regular-svg-icons';
//
// Solid
import {
faArrowCircleLeft as fasArrowCircleLeft,
faArrowCircleRight as fasArrowCircleRight,
faBackward as fasBackward,
faBars as fasBars,
faBolt as fasBolt,
faBookmark as fasBookmark,
faBookReader as fasBookReader,
faBug as fasBug,
faBroadcastTower as fasBroadcastTower,
faCalendarAlt as fasCalendarAlt,
faCaretDown as fasCaretDown,
faCheck as fasCheck,
faChevronCircleDown as fasChevronCircleDown,
faChevronCircleRight as fasChevronCircleRight,
faChevronCircleUp as fasChevronCircleUp,
faCheckCircle as fasCheckCircle,
faCircle as fasCircle,
faCloudDownloadAlt as fasCloudDownloadAlt,
faCloud as fasCloud,
faCog as fasCog,
faCogs as fasCogs,
faCopy as fasCopy,
faDesktop as fasDesktop,
faDownload as fasDownload,
faEllipsisH as fasEllipsisH,
faExclamationCircle as fasExclamationCircle,
faExclamationTriangle as fasExclamationTriangle,
faExternalLinkAlt as fasExternalLinkAlt,
faEye as fasEye,
faFastBackward as fasFastBackward,
faFastForward as fasFastForward,
faFileInvoice as farFileInvoice,
faFilm as fasFilm,
faFilter as fasFilter,
faFolderOpen as fasFolderOpen,
faForward as fasForward,
faHeart as fasHeart,
faHistory as fasHistory,
faHome as fasHome,
faInfoCircle as fasInfoCircle,
faLaptop as fasLaptop,
faLevelUpAlt as fasLevelUpAlt,
faMedkit as fasMedkit,
faMinus as fasMinus,
faPause as fasPause,
faPlay as fasPlay,
faPlus as fasPlus,
faPowerOff as fasPowerOff,
faQuestion as fasQuestion,
faQuestionCircle as fasQuestionCircle,
faRedoAlt as fasRedoAlt,
faRetweet as fasRetweet,
faRss as fasRss,
faRocket as fasRocket,
faSave as fasSave,
faSearch as fasSearch,
faSignOutAlt as fasSignOutAlt,
faSitemap as fasSitemap,
faSpinner as fasSpinner,
faSort as fasSort,
faSortDown as fasSortDown,
faSortUp as fasSortUp,
faStop as fasStop,
faSync as fasSync,
faTags as fasTags,
faTable as fasTable,
faTh as fasTh,
faThList as fasThList,
faTrashAlt as fasTrashAlt,
faTimes as fasTimes,
faTimesCircle as fasTimesCircle,
faUser as fasUser,
faUserPlus as fasUserPlus,
faVial as fasVial,
faWrench as fasWrench
} from '@fortawesome/free-solid-svg-icons';
//
// Icons
export const ACTIONS = fasBolt;
export const ACTIVITY = farClock;
export const ADD = fasPlus;
export const ALTERNATE_TITLES = farClone;
export const ADVANCED_SETTINGS = fasCog;
export const ARROW_LEFT = fasArrowCircleLeft;
export const ARROW_RIGHT = fasArrowCircleRight;
export const BACKUP = farFileArchive;
export const BUG = fasBug;
export const CALENDAR = fasCalendarAlt;
export const CALENDAR_O = farCalendar;
export const CARET_DOWN = fasCaretDown;
export const CHECK = fasCheck;
export const CHECK_INDETERMINATE = fasMinus;
export const CHECK_CIRCLE = fasCheckCircle;
export const CIRCLE = fasCircle;
export const CIRCLE_OUTLINE = farCircle;
export const CLEAR = fasTrashAlt;
export const CLIPBOARD = fasCopy;
export const CLOSE = fasTimes;
export const CLONE = farClone;
export const COLLAPSE = fasChevronCircleUp;
export const COMPUTER = fasDesktop;
export const DANGER = fasExclamationCircle;
export const DELETE = fasTrashAlt;
export const DOWNLOAD = fasDownload;
export const DOWNLOADED = fasDownload;
export const DOWNLOADING = fasCloudDownloadAlt;
export const DRIVE = farHdd;
export const EDIT = fasWrench;
export const MOVIE_FILE = farFileVideo;
export const EXPAND = fasChevronCircleDown;
export const EXPAND_INDETERMINATE = fasChevronCircleRight;
export const EXTERNAL_LINK = fasExternalLinkAlt;
export const FATAL = fasTimesCircle;
export const FILE = farFile;
export const FILTER = fasFilter;
export const FOLDER = farFolder;
export const FOLDER_OPEN = fasFolderOpen;
export const GROUP = farObjectGroup;
export const HEALTH = fasMedkit;
export const HEART = fasHeart;
export const HISTORY = fasHistory;
export const HOUSEKEEPING = fasHome;
export const INFO = fasInfoCircle;
export const INTERACTIVE = fasUser;
export const KEYBOARD = farKeyboard;
export const LOGOUT = fasSignOutAlt;
export const MEDIA_INFO = farFileInvoice;
export const MISSING = fasExclamationTriangle;
export const MONITORED = fasBookmark;
export const NETWORK = fasBroadcastTower;
export const NAVBAR_COLLAPSE = fasBars;
export const NOT_AIRED = farClock;
export const ORGANIZE = fasSitemap;
export const OVERFLOW = fasEllipsisH;
export const OVERVIEW = fasThList;
export const PAGE_FIRST = fasFastBackward;
export const PAGE_PREVIOUS = fasBackward;
export const PAGE_NEXT = fasForward;
export const PAGE_LAST = fasFastForward;
export const PARENT = fasLevelUpAlt;
export const PAUSED = fasPause;
export const PENDING = farClock;
export const PROFILE = fasUser;
export const POSTER = fasTh;
export const QUEUED = fasCloud;
export const QUICK = fasRocket;
export const REFRESH = fasSync;
export const REMOVE = fasTimes;
export const RESTART = fasRedoAlt;
export const RESTORE = fasHistory;
export const REORDER = fasBars;
export const RSS = fasRss;
export const SAVE = fasSave;
export const SCHEDULED = farClock;
export const SCORE = fasUserPlus;
export const SEARCH = fasSearch;
export const SERIES_CONTINUING = fasPlay;
export const SERIES_ENDED = fasStop;
export const SETTINGS = fasCogs;
export const SHUTDOWN = fasPowerOff;
export const SORT = fasSort;
export const SORT_ASCENDING = fasSortUp;
export const SORT_DESCENDING = fasSortDown;
export const SPINNER = fasSpinner;
export const STUDIO = fasFilm;
export const SUBTRACT = fasMinus;
export const SYSTEM = fasLaptop;
export const TABLE = fasTable;
export const TAGS = fasTags;
export const TBA = fasQuestionCircle;
export const TEST = fasVial;
export const UNGROUP = farObjectUngroup;
export const UNKNOWN = fasQuestion;
export const UNMONITORED = farBookmark;
export const UPDATE = fasRetweet;
export const UNSAVED_SETTING = farDotCircle;
export const VIEW = fasEye;
export const WARNING = fasExclamationTriangle;
export const WIKI = fasBookReader;

View File

@@ -0,0 +1,29 @@
import * as align from './align';
import * as inputTypes from './inputTypes';
import * as filterBuilderTypes from './filterBuilderTypes';
import * as filterBuilderValueTypes from './filterBuilderValueTypes';
import filterTypePredicates from './filterTypePredicates';
import * as filterTypes from './filterTypes';
import * as icons from './icons';
import * as kinds from './kinds';
import * as messageTypes from './messageTypes';
import * as sizes from './sizes';
import * as scrollDirections from './scrollDirections';
import * as sortDirections from './sortDirections';
import * as tooltipPositions from './tooltipPositions';
export {
align,
inputTypes,
filterBuilderTypes,
filterBuilderValueTypes,
filterTypePredicates,
filterTypes,
icons,
kinds,
messageTypes,
sizes,
scrollDirections,
sortDirections,
tooltipPositions
};

View File

@@ -0,0 +1,33 @@
export const AUTO_COMPLETE = 'autoComplete';
export const CAPTCHA = 'captcha';
export const CHECK = 'check';
export const DEVICE = 'device';
export const MOVIE_MONITORED_SELECT = 'movieMonitoredSelect';
export const NUMBER = 'number';
export const OAUTH = 'oauth';
export const PASSWORD = 'password';
export const PATH = 'path';
export const QUALITY_PROFILE_SELECT = 'qualityProfileSelect';
export const ROOT_FOLDER_SELECT = 'rootFolderSelect';
export const SELECT = 'select';
export const TAG = 'tag';
export const TEXT = 'text';
export const TEXT_TAG = 'textTag';
export const all = [
AUTO_COMPLETE,
CAPTCHA,
CHECK,
DEVICE,
MOVIE_MONITORED_SELECT,
NUMBER,
OAUTH,
PASSWORD,
PATH,
QUALITY_PROFILE_SELECT,
ROOT_FOLDER_SELECT,
SELECT,
TAG,
TEXT,
TEXT_TAG
];

View File

@@ -0,0 +1,23 @@
export const DANGER = 'danger';
export const DEFAULT = 'default';
export const DISABLED = 'disabled';
export const INFO = 'info';
export const INVERSE = 'inverse';
export const PINK = 'pink';
export const PRIMARY = 'primary';
export const PURPLE = 'purple';
export const SUCCESS = 'success';
export const WARNING = 'warning';
export const all = [
DANGER,
DEFAULT,
DISABLED,
INFO,
INVERSE,
PINK,
PRIMARY,
PURPLE,
SUCCESS,
WARNING
];

View File

@@ -0,0 +1,11 @@
export const ERROR = 'error';
export const INFO = 'info';
export const SUCCESS = 'success';
export const WARNING = 'warning';
export const all = [
ERROR,
INFO,
SUCCESS,
WARNING
];

View File

@@ -0,0 +1,5 @@
export const NONE = 'none';
export const HORIZONTAL = 'horizontal';
export const VERTICAL = 'vertical';
export const all = [NONE, HORIZONTAL, VERTICAL];

View File

@@ -0,0 +1,7 @@
export const EXTRA_SMALL = 'extraSmall';
export const SMALL = 'small';
export const MEDIUM = 'medium';
export const LARGE = 'large';
export const EXTRA_LARGE = 'extraLarge';
export const all = [EXTRA_SMALL, SMALL, MEDIUM, LARGE, EXTRA_LARGE];

View File

@@ -0,0 +1,4 @@
export const ASCENDING = 'ascending';
export const DESCENDING = 'descending';
export const all = [ASCENDING, DESCENDING];

View File

@@ -0,0 +1,11 @@
export const TOP = 'top';
export const RIGHT = 'right';
export const BOTTOM = 'bottom';
export const LEFT = 'left';
export const all = [
TOP,
RIGHT,
BOTTOM,
LEFT
];

View File

@@ -0,0 +1,3 @@
export const QUALITY_PROFILE_ITEM = 'qualityProfileItem';
export const DELAY_PROFILE = 'delayProfile';
export const TABLE_COLUMN = 'tableColumn';

View File

@@ -0,0 +1,149 @@
// https://github.com/react-bootstrap/react-element-children
import React from 'react';
/**
* Iterates through children that are typically specified as `props.children`,
* but only maps over children that are "valid components".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func.
* @param {*} context Context for func.
* @return {object} Object containing the ordered map of results.
*/
export function map(children, func, context) {
let index = 0;
return React.Children.map(children, (child) => {
if (!React.isValidElement(child)) {
return child;
}
return func.call(context, child, index++);
});
}
/**
* Iterates through children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func.
* @param {*} context Context for context.
*/
export function forEach(children, func, context) {
let index = 0;
React.Children.forEach(children, (child) => {
if (!React.isValidElement(child)) {
return;
}
func.call(context, child, index++);
});
}
/**
* Count the number of "valid components" in the Children container.
*
* @param {?*} children Children tree container.
* @returns {number}
*/
export function count(children) {
let result = 0;
React.Children.forEach(children, (child) => {
if (!React.isValidElement(child)) {
return;
}
++result;
});
return result;
}
/**
* Finds children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func.
* @param {*} context Context for func.
* @returns {array} of children that meet the func return statement
*/
export function filter(children, func, context) {
const result = [];
forEach(children, (child, index) => {
if (func.call(context, child, index)) {
result.push(child);
}
});
return result;
}
export function find(children, func, context) {
let result = null;
forEach(children, (child, index) => {
if (result) {
return;
}
if (func.call(context, child, index)) {
result = child;
}
});
return result;
}
export function every(children, func, context) {
let result = true;
forEach(children, (child, index) => {
if (!result) {
return;
}
if (!func.call(context, child, index)) {
result = false;
}
});
return result;
}
export function some(children, func, context) {
let result = false;
forEach(children, (child, index) => {
if (result) {
return;
}
if (func.call(context, child, index)) {
result = true;
}
});
return result;
}
export function toArray(children) {
const result = [];
forEach(children, (child) => {
result.push(child);
});
return result;
}

View File

@@ -0,0 +1,3 @@
export default function getDisplayName(Component) {
return Component.displayName || Component.name || 'Component';
}