Skip to content

Commit

Permalink
fix: limit number of results links in event summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
brownben committed Jan 5, 2025
1 parent 8ae6ff7 commit 35e93f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions frontend/components/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ const props = defineProps({
})
const emit = defineEmits(['event-changed'])
const resultsLinks = computed(() =>
Object.keys(props.event.results_links).filter(
(link) => props.event.results_links[link],
),
)
const resultsLinks = computed(() => {
const resultsLinks = props.event.results_links
const links = Object.keys(resultsLinks).filter((link) => resultsLinks[link])
if (props.small) return links.slice(-3)
return links
})
const uploadLink = `/upload/file?event_id=${encodeURIComponent(
props.event.id,
)}&upload_key=${encodeURIComponent(props.event.upload_key ?? '')}`
Expand Down
5 changes: 3 additions & 2 deletions frontend/pages/leagues/[name]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ if (league.value) {
>
Latest Results
</h2>
<Event :event="latestEvents[0]" class="pb-6 pt-4" />
<Event :event="latestEvents[0]" class="pb-6 pt-4" small />
</div>
<div v-if="nextEvent">
<h2
class="font-bold uppercase text-gray-500 sm:pb-2 dark:text-gray-300"
>
Next Event
</h2>
<Event :event="nextEvent" class="pb-6 pt-4" />
<Event :event="nextEvent" class="pb-6 pt-4" small />
</div>
<div v-else>
<p
Expand All @@ -132,6 +132,7 @@ if (league.value) {
v-if="latestEvents.length > 1"
:event="latestEvents[1]"
class="pb-6 pt-4"
small
/>
</div>
</section>
Expand Down

0 comments on commit 35e93f1

Please sign in to comment.