Skip to content

Conversation

@skateman
Copy link

@skateman skateman commented Oct 3, 2025

I guess it's obvious what this does, if you have many calendar events a day, you might want to limit the list to the next 3-4. The default behavior is to not limit, which happens if it is set to 0.

Without a limit:
image

With a limit:
image

Summary by CodeRabbit

  • New Features

    • Added an Event limit configuration to cap the number of displayed events (0 = unlimited). Available as a numeric field in the editor.
  • Localization

    • Added translations for the Event limit setting in English, German, and Spanish.
  • Documentation

    • Updated README to include the new Event limit option and its default.

@coderabbitai
Copy link

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adds an optional numeric event_limit configuration (default 0) across config, defaults, editor UI, validation, localization, README; and updates calendar event filtering to apply an optional post-filter slice based on event_limit.

Changes

Cohort / File(s) Summary
Documentation
README.md
Documents new event_limit option in YAML and configuration lists with default 0.
Config Defaults
src/const.ts
Adds event_limit: 0 to DEFAULT_CONFIG.
Editor UI
src/elements/editor.ts
Adds numeric input field event_limit (mode: box, step: 1, default 0) to editor schema.
Filtering Logic
src/functions/calendar.ts
filterEvents now assigns filteredEvents then returns it directly or sliced to event_limit when >0.
Validation/Types
src/structs/config.ts
Extends cardConfigStruct to accept optional numeric event_limit.
Localization
src/localization/lang/en.json, src/localization/lang/de.json, src/localization/lang/es.json
Adds config.label.event_limit translations ("Event limit", "Terminlimit", "Límite de eventos").

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant E as Editor UI
  participant CFG as Config Store
  participant C as Card Renderer
  participant CAL as calendar.filterEvents

  U->>E: set event_limit (0 or N)
  E->>CFG: save config { event_limit, ... }
  C->>CAL: filterEvents(events, CFG)
  rect rgb(240,248,255)
    note right of CAL: apply existing filters (all-day, past, sorting)
    CAL->>CAL: filteredEvents = events.filter(...)
  end
  alt event_limit == 0
    CAL-->>C: return filteredEvents
  else event_limit > 0
    CAL-->>C: return filteredEvents.slice(0, event_limit)
  end
  C-->>U: render events
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble configs with whiskered delight,
A cap for events—zero keeps the night bright.
Editor fields bloom, translations in tune,
Filters trim lists like a crescent moon.
Thump goes my foot—limit set, done soon. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately captures the main change of introducing a configurable limit on the number of displayed events, matching the PR’s content and objectives.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d91702 and c4f94ba.

📒 Files selected for processing (8)
  • README.md (2 hunks)
  • src/const.ts (1 hunks)
  • src/elements/editor.ts (1 hunks)
  • src/functions/calendar.ts (2 hunks)
  • src/localization/lang/de.json (1 hunks)
  • src/localization/lang/en.json (1 hunks)
  • src/localization/lang/es.json (1 hunks)
  • src/structs/config.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/const.ts
  • src/localization/lang/de.json
  • src/localization/lang/es.json
  • src/functions/calendar.ts
  • src/localization/lang/en.json
  • src/structs/config.ts
  • src/elements/editor.ts
  • README.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skateman
Copy link
Author

skateman commented Oct 3, 2025

@coderabbitai generate docstrings

@coderabbitai
Copy link

coderabbitai bot commented Oct 3, 2025

✅ Actions performed

Docstrings generation started.

coderabbitai bot added a commit that referenced this pull request Oct 3, 2025
Docstrings generation was requested by @skateman.

* #48 (comment)

The following files were modified:

* `src/functions/calendar.ts`
@coderabbitai
Copy link

coderabbitai bot commented Oct 3, 2025

Note

Generated docstrings for this pull request at #49

@skateman
Copy link
Author

skateman commented Oct 3, 2025

Most likely the docstrings are not needed in the context of the PR.

@JonasDoebertin
Copy link
Owner

I like it. Thanks!

You're right with the docstrings. I'll need to tweak the Coderabbit config.

@skateman
Copy link
Author

skateman commented Nov 2, 2025

@JonasDoebertin what else do you need from me to get this in and released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants