From 18012b70ad48a5613bcb08f0a13251d88a9d258f Mon Sep 17 00:00:00 2001 From: zht826 <39635371@qq.com> Date: Wed, 7 Feb 2024 22:20:42 +0800 Subject: [PATCH] feat: showMore message add event info (#2496) * feat: showMore message add event info * feat: add remaining events and all events in day --------- authored-by: mutao.zht --- src/EventEndingRow.js | 13 +++++++------ stories/props/messages.mdx | 8 ++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/EventEndingRow.js b/src/EventEndingRow.js index fd2d8a699..fc32457a7 100644 --- a/src/EventEndingRow.js +++ b/src/EventEndingRow.js @@ -7,7 +7,7 @@ import range from 'lodash/range' let isSegmentInSlot = (seg, slot) => seg.left <= slot && seg.right >= slot let eventsInSlot = (segments, slot) => - segments.filter((seg) => isSegmentInSlot(seg, slot)).length + segments.filter((seg) => isSegmentInSlot(seg, slot)).map((seg) => seg.event) class EventEndingRow extends React.Component { render() { @@ -68,16 +68,17 @@ class EventEndingRow extends React.Component { let { segments } = this.props return range(slot, slot + span).every((s) => { - let count = eventsInSlot(segments, s) + const count = eventsInSlot(segments, s).length return count === 1 }) } renderShowMore(segments, slot) { - let { localizer } = this.props - let count = eventsInSlot(segments, slot) - + let { localizer, slotMetrics } = this.props + const events = slotMetrics.getEventsForSlot(slot) + const remainingEvents = eventsInSlot(segments, slot) + const count = remainingEvents.length return count ? ( ) : ( false diff --git a/stories/props/messages.mdx b/stories/props/messages.mdx index 2bd0e8be1..d23cbd4b1 100644 --- a/stories/props/messages.mdx +++ b/stories/props/messages.mdx @@ -27,8 +27,12 @@ defualts agenda: 'Agenda', noEventsInRange: 'There are no events in this range.', - - showMore: total => `+${total} more`, + /** + * params {total} count of remaining events + * params {remainingEvents} remaining events + * params {events} all events in day + */ + showMore: (total, remainingEvents, events) => `+${total} más`, } ```