X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Fepisodes%2FItem.js;h=4fb466669dfdc2591b90fab9778f263cff4a4ab4;hb=e10222af705e3475fcea6e0b17d1c9984a62db26;hp=9acb95d29859b0bb6242312edccb333c8918061b;hpb=442732627373739adf18518b6bbfbc305356f53f;p=alttp.git diff --git a/resources/js/components/episodes/Item.js b/resources/js/components/episodes/Item.js index 9acb95d..4fb4666 100644 --- a/resources/js/components/episodes/Item.js +++ b/resources/js/components/episodes/Item.js @@ -1,32 +1,23 @@ -import moment from 'moment'; import PropTypes from 'prop-types'; import React from 'react'; import { Button } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; +import { Link } from 'react-router-dom'; import Channels from './Channels'; import Crew from './Crew'; import MultiLink from './MultiLink'; import Players from './Players'; import Icon from '../common/Icon'; +import { hasPassed, hasSGRestream, isActive } from '../../helpers/Episode'; import { canApplyForEpisode, canRestreamEpisode } from '../../helpers/permissions'; import { withUser } from '../../helpers/UserContext'; -const isActive = episode => { - if (!episode.start) return false; - const now = moment(); - const start = moment(episode.start).subtract(10, 'minutes'); - const end = moment(episode.start).add(episode.estimate, 'seconds'); - return start.isBefore(now) && end.isAfter(now); -}; - const Item = ({ episode, onAddRestream, onApply, onEditRestream, user }) => { const { t } = useTranslation(); const classNames = [ 'episodes-item', - 'd-flex', - 'align-items-stretch', 'my-3', 'p-2', 'border', @@ -49,60 +40,82 @@ const Item = ({ episode, onAddRestream, onApply, onEditRestream, user }) => { const hasPlayers = episode.players && episode.players.length; return