-
Notifications
You must be signed in to change notification settings - Fork 10.2k
docs: Create add-new-booking-charts.mdx #22865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new documentation guide has been added that provides detailed instructions for adding a booking chart to the Cal.com insights page, covering frontend and backend integration steps, including UI component creation, data fetching, service implementation, and database querying. Additionally, the documentation navigation configuration was updated to include a new "Insights" group under the "Guides" section, linking to the newly added guide. No changes were made to exported or public code entities. Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
docs/mint.json (1)
109-117
: Missing comma before new object breaks JSONThe
"Embeds"
object (Line 109-112) is not terminated with a comma, so the{
that begins the new"Insights"
object (Line 113) makes the file invalid JSON.- "pages": ["developing/guides/embeds/embed-events"] + "pages": ["developing/guides/embeds/embed-events"],
🧹 Nitpick comments (2)
docs/developing/guides/insights/add-new-booking-charts.mdx (2)
154-165
: Timezone accuracy ofDATE("createdAt")
Casting to
DATE
silently converts timestamps to the DB server’s timezone. If Cal.com runs in multiple regions you may show users the wrong day buckets.date_trunc('day', … at time zone 'UTC')
(or their explicit tz) avoids this ambiguity.
31-42
: Remember to add translation key
ChartCard
receivest("my_new_chart_title")
, but the guide doesn’t remind devs to add this key to theen.json
(and other locale files). A quick bullet in the checklist will prevent missing-string fall-backs in the UI.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/developing/guides/insights/add-new-booking-charts.mdx
(1 hunks)docs/mint.json
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.
Applied to files:
docs/developing/guides/insights/add-new-booking-charts.mdx
📚 Learning: in the insights routing funnel component (packages/features/insights/components/routingfunnel.tsx), ...
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/RoutingFunnel.tsx:15-17
Timestamp: 2025-07-15T12:58:40.539Z
Learning: In the insights routing funnel component (packages/features/insights/components/RoutingFunnel.tsx), the useColumnFilters exclusions are intentionally different from the general useInsightsParameters exclusions. RoutingFunnel specifically excludes only ["createdAt"] while useInsightsParameters excludes ["bookingUserId", "formId", "createdAt", "eventTypeId"]. This difference is by design.
Applied to files:
docs/developing/guides/insights/add-new-booking-charts.mdx
📚 Learning: in the insightsbookingservice (packages/lib/server/service/insightsbooking.ts), the constructor stor...
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.
Applied to files:
docs/developing/guides/insights/add-new-booking-charts.mdx
🪛 Biome (2.1.2)
docs/mint.json
[error] 113-113: expected ,
but instead found {
Remove {
(parse)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
docs/developing/guides/insights/add-new-booking-charts.mdx (1)
146-159
: Unsafe string interpolation in$queryRaw
exampleThe guide shows
${baseConditions}
pasted directly into the SQL. In production code this pattern bypasses Prisma’s SQL-tag parameterisation and can open the door to SQL-injection or broken queries ifbaseConditions
is an empty string.Please amend the snippet to use
Prisma.sql
(or the Prismasql`` tag) and explicit
where` fragments, e.g.:const data = await this.prisma.$queryRaw< { date: Date; bookingsCount: number }[] >(Prisma.sql` SELECT DATE("createdAt") AS date, COUNT(*)::int AS "bookingsCount" FROM "BookingTimeStatusDenormalized" WHERE ${baseConditions} GROUP BY DATE("createdAt") ORDER BY date ASC `);This keeps interpolation type-safe and guards against injections.
E2E results are ready! |
What does this PR do?
Visual Demo (For contributors especially)
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist