]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/pages/Event.js
show some past episodes on concluded events
[alttp.git] / resources / js / pages / Event.js
index 1a97cdc0700c808877eafa555cd6f6cb0b1a4804..c7f0ce55d228939ba93d5997cc019e38f517fbd4 100644 (file)
@@ -15,6 +15,7 @@ import Loading from '../components/common/Loading';
 import EpisodeList from '../components/episodes/List';
 import Detail from '../components/events/Detail';
 import Dialog from '../components/techniques/Dialog';
+import { hasConcluded } from '../helpers/Event';
 import {
        mayEditContent,
 } from '../helpers/permissions';
@@ -47,13 +48,19 @@ const Event = () => {
                        setEpisodes([]);
                        return;
                }
+               const params = {
+                       event: [event.id],
+               };
+               if (hasConcluded(event)) {
+                       params.limit = 25;
+                       params.reverse = '1';
+               } else {
+                       params.after = moment().subtract(3, 'hours').toISOString();
+                       params.before = moment().add(14, 'days').toISOString();
+               }
                axios.get(`/api/episodes`, {
                        signal: controller.signal,
-                       params: {
-                               after: moment().subtract(3, 'hours').toISOString(),
-                               before: moment().add(14, 'days').toISOString(),
-                               event: [event.id],
-                       },
+                       params,
                }).then(response => {
                        setEpisodes(response.data || []);
                }).catch(e => {
@@ -141,7 +148,12 @@ const Event = () => {
                <Container>
                        <Detail actions={actions} event={event} />
                        {episodes.length ? <>
-                               <h2 className="mt-4">{i18n.t('events.upcomingEpisodes')}</h2>
+                               <h2 className="mt-4">
+                                       {i18n.t(hasConcluded(event)
+                                               ? 'events.pastEpisodes'
+                                               : 'events.upcomingEpisodes'
+                                       )}
+                               </h2>
                                <EpisodeList episodes={episodes} />
                        </> : null}
                </Container>