Icon.DELETE = makePreset('DeleteIcon', 'user-xmark');
Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']);
Icon.EDIT = makePreset('EditIcon', 'edit');
+Icon.FILTER = makePreset('FilterIcon', 'filter');
Icon.FINISHED = makePreset('FinishedIcon', 'square-check');
Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy');
Icon.FORBIDDEN = makePreset('ForbiddenIcon', 'square-xmark');
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';
-import { Alert, Container } from 'react-bootstrap';
+import { Alert, Button, Container } from 'react-bootstrap';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import toastr from 'toastr';
import CanonicalLinks from '../common/CanonicalLinks';
import ErrorBoundary from '../common/ErrorBoundary';
+import Icon from '../common/Icon';
import ApplyDialog from '../episodes/ApplyDialog';
import Filter from '../episodes/Filter';
import List from '../episodes/List';
const [restreamEpisode, setRestreamEpisode] = React.useState(null);
const [showApplyDialog, setShowApplyDialog] = React.useState(false);
const [showRestreamDialog, setShowRestreamDialog] = React.useState(false);
+ const [showFilter, setShowFilter] = React.useState(false);
const { t } = useTranslation();
};
}, [ahead, behind, fetchEpisodes, filter]);
+ const toggleFilter = React.useCallback(() => {
+ setShowFilter(show => !show);
+ }, []);
+
+ const filterButtonVariant = React.useMemo(() => {
+ const outline = showFilter ? '' : 'outline-';
+ const filterActive = filter && filter.event && filter.event.length;
+ return `${outline}${filterActive ? 'info' : 'secondary'}`;
+ }, [filter, showFilter]);
+
return <Container>
<Helmet>
<title>{t('schedule.heading')}</title>
<meta name="description" content={t('schedule.description')} />
</Helmet>
<CanonicalLinks base="/schedule" />
- <div className="d-flex align-items-start justify-content-between">
- <h1>{t('schedule.heading')}</h1>
- <div className="ms-3 mt-5">
+ <div className="d-flex align-items-end justify-content-between">
+ <h1 className="mb-0">{t('schedule.heading')}</h1>
+ <Button
+ onClick={toggleFilter}
+ title={t('button.filter')}
+ variant={filterButtonVariant}
+ >
+ <Icon.FILTER title="" />
+ </Button>
+ </div>
+ {showFilter ?
+ <div className="my-2">
<Filter filter={filter} setFilter={updateFilter} />
</div>
- </div>
+ : null}
<ErrorBoundary>
{episodes.length ?
<List