mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 06:32:11 +00:00
refactor: move ICON_FOR_TYPE to CONSTANTS
This commit is contained in:
parent
3bd2738001
commit
6bff7761dc
3 changed files with 18 additions and 31 deletions
|
|
@ -25,6 +25,19 @@ const TYPE_PRIORITIES = {
|
|||
adult: 1,
|
||||
other: -Infinity
|
||||
};
|
||||
const ICON_FOR_TYPE = new Map([
|
||||
['movie', 'ic_movies'],
|
||||
['series', 'ic_series'],
|
||||
['channel', 'ic_channels'],
|
||||
['tv', 'ic_tv'],
|
||||
['book', 'ic_book'],
|
||||
['game', 'ic_games'],
|
||||
['music', 'ic_music'],
|
||||
['adult', 'ic_adult'],
|
||||
['radio', 'ic_radio'],
|
||||
['podcast', 'ic_podcast'],
|
||||
['other', 'ic_movies'],
|
||||
]);
|
||||
|
||||
module.exports = {
|
||||
CHROMECAST_RECEIVER_APP_ID,
|
||||
|
|
@ -39,5 +52,6 @@ module.exports = {
|
|||
IMDB_LINK_CATEGORY,
|
||||
SHARE_LINK_CATEGORY,
|
||||
WRITERS_LINK_CATEGORY,
|
||||
TYPE_PRIORITIES
|
||||
TYPE_PRIORITIES,
|
||||
ICON_FOR_TYPE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,22 +10,9 @@ const Image = require('stremio/common/Image');
|
|||
const Multiselect = require('stremio/common/Multiselect');
|
||||
const PlayIconCircleCentered = require('stremio/common/PlayIconCircleCentered');
|
||||
const useBinaryState = require('stremio/common/useBinaryState');
|
||||
const { ICON_FOR_TYPE } = require('stremio/common/CONSTANTS');
|
||||
const styles = require('./styles');
|
||||
|
||||
const ICON_FOR_TYPE = new Map([
|
||||
['movie', 'ic_movies'],
|
||||
['series', 'ic_series'],
|
||||
['channel', 'ic_channels'],
|
||||
['tv', 'ic_tv'],
|
||||
['book', 'ic_book'],
|
||||
['game', 'ic_games'],
|
||||
['music', 'ic_music'],
|
||||
['adult', 'ic_adult'],
|
||||
['radio', 'ic_radio'],
|
||||
['podcast', 'ic_podcast'],
|
||||
['other', 'ic_movies'],
|
||||
]);
|
||||
|
||||
const MetaItem = React.memo(({ className, type, name, poster, posterShape, playIcon, progress, options, deepLinks, dataset, optionOnSelect, ...props }) => {
|
||||
const [menuOpen, onMenuOpen, onMenuClose] = useBinaryState(false);
|
||||
const href = React.useMemo(() => {
|
||||
|
|
|
|||
|
|
@ -2,23 +2,9 @@ const React = require('react');
|
|||
const PropTypes = require('prop-types');
|
||||
const classnames = require('classnames');
|
||||
const Icon = require('@stremio/stremio-icons/dom');
|
||||
const { Image, Button } = require('stremio/common');
|
||||
const { Image, Button, CONSTANTS } = require('stremio/common');
|
||||
const styles = require('./styles');
|
||||
|
||||
const ICON_FOR_TYPE = new Map([
|
||||
['movie', 'ic_movies'],
|
||||
['series', 'ic_series'],
|
||||
['channel', 'ic_channels'],
|
||||
['tv', 'ic_tv'],
|
||||
['book', 'ic_book'],
|
||||
['game', 'ic_games'],
|
||||
['music', 'ic_music'],
|
||||
['adult', 'ic_adult'],
|
||||
['radio', 'ic_radio'],
|
||||
['podcast', 'ic_podcast'],
|
||||
['other', 'ic_movies'],
|
||||
]);
|
||||
|
||||
const NextVideoPopup = ({ className, metaItem, nextVideo, onDismiss, onPlayNextVideoRequested }) => {
|
||||
const watchNowButtonRef = React.useRef(null);
|
||||
const [animationEnded, setAnimationEnded] = React.useState(false);
|
||||
|
|
@ -38,7 +24,7 @@ const NextVideoPopup = ({ className, metaItem, nextVideo, onDismiss, onPlayNextV
|
|||
return metaItem !== null && typeof metaItem.type === 'string' ?
|
||||
<Icon
|
||||
className={styles['placeholder-icon']}
|
||||
icon={ICON_FOR_TYPE.has(metaItem.type) ? ICON_FOR_TYPE.get(metaItem.type) : ICON_FOR_TYPE.get('other')}
|
||||
icon={CONSTANTS.ICON_FOR_TYPE.has(metaItem.type) ? CONSTANTS.ICON_FOR_TYPE.get(metaItem.type) : CONSTANTS.ICON_FOR_TYPE.get('other')}
|
||||
/>
|
||||
:
|
||||
null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue