Skip to content

feat(event-meta): add description field to EventMeta#390

Open
Shrotriya-lalit wants to merge 3 commits into
Openpanel-dev:mainfrom
Shrotriya-lalit:feat/event-meta-description
Open

feat(event-meta): add description field to EventMeta#390
Shrotriya-lalit wants to merge 3 commits into
Openpanel-dev:mainfrom
Shrotriya-lalit:feat/event-meta-description

Conversation

@Shrotriya-lalit

@Shrotriya-lalit Shrotriya-lalit commented Jun 7, 2026

Copy link
Copy Markdown

There is no way to document what an event means inside OpenPanel. Teams end up maintaining a separate wiki or spreadsheet to explain their event taxonomy — this adds that context directly to the platform.

Changes

  • schema.prisma: add optional description String? field to EventMeta model
  • migration.sql: ALTER TABLE event_meta ADD COLUMN IF NOT EXISTS "description" TEXT
  • packages/trpc/src/routers/event.ts: accept and persist description in updateEventMeta
  • apps/start/src/modals/edit-event.tsx: textarea in the Edit Event modal to set/edit the description
  • apps/start/src/modals/Modal/Container.tsx: fix modal X button — wrap in DialogClose (Radix native) instead of calling popModal() directly, which could race with Radix's internal open-state tracking

How it looks

Open any event in the Events page → click the icon → Edit Event modal now has a Description field below the Conversion checkbox.

Future scope

The description field is a foundation for a full Lexicon view (event catalog with descriptions, display names, volume — similar to Mixpanel Lexicon). That can be built as a follow-up.

Summary by CodeRabbit

  • New Features

    • Event descriptions: add and edit a description for events to provide richer context.
  • Improvements

    • Modal close behavior refined for more consistent and reliable closing across dialogs.

Shrotriya-lalit and others added 2 commits June 7, 2026 10:36
Adds an optional description/note field to event definitions so teams
can document what each event means directly in the OpenPanel UI — a
lightweight alternative to a separate wiki.

Changes:
- Prisma schema: `description String?` on EventMeta model
- Migration: ALTER TABLE event_meta ADD COLUMN description TEXT
- tRPC router: accept and persist description in updateEventMeta
- Edit-event modal: textarea to set/edit the description

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The close button was a plain Button calling popModal(), which could race
with Radix's internal open-state tracking. Wrapping it in DialogClose
(asChild) lets Radix own the close event — same mechanism as clicking
outside the dialog.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e9c2253-0b4f-42c8-b597-5befcd2c51a8

📥 Commits

Reviewing files that changed from the base of the PR and between 9137ac5 and 68d3a28.

📒 Files selected for processing (1)
  • apps/start/src/modals/edit-event.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/start/src/modals/edit-event.tsx

📝 Walkthrough

Walkthrough

Adds an optional event description through Prisma + migration, extends the tRPC updateEventMeta mutation to accept and persist description, updates the EditEvent modal to edit and send description, and refactors the modal close button to use Radix DialogClose calling only onClose?.().

Changes

Event description editing feature

Layer / File(s) Summary
Database schema and migration
packages/db/prisma/schema.prisma, packages/db/prisma/migrations/20260607120000_add_event_meta_description/migration.sql
EventMeta model adds optional description field; migration adds TEXT description column to event_meta table if missing.
Backend updateEventMeta mutation
packages/trpc/src/routers/event.ts
updateEventMeta input schema now accepts optional description: string; db.eventMeta.upsert persists description on create and update.
Frontend edit event modal
apps/start/src/modals/edit-event.tsx
Modal imports Textarea, adds description state initialized from event.meta.description, renders a description Textarea, and includes description.trim() in the update mutation payload.

Modal close button refactor

Layer / File(s) Summary
Modal container close button
apps/start/src/modals/Modal/Container.tsx
Adds DialogClose import; ModalHeader close button wrapped with DialogClose and invokes onClose?.() only, removing previous popModal fallback.

Sequence Diagram

sequenceDiagram
  participant Frontend as EditEvent Modal
  participant API as tRPC updateEventMeta
  participant DB as Postgres (event_meta)
  Frontend->>API: mutate updateEventMeta({ meta: {...}, description: description.trim() })
  API->>DB: db.eventMeta.upsert(create/update with description)
  DB-->>API: upsert result
  API-->>Frontend: mutation response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A little field hops into the stack,
From schema roots up through the app,
A textarea nibble, a trimmed-off line,
Modal closes tidy — all working fine! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(event-meta): add description field to EventMeta' directly and clearly summarizes the main change—adding a description field to the EventMeta model, which is the core of this changeset across schema, migrations, API, and UI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/start/src/modals/edit-event.tsx`:
- Line 220: The payload currently drops empty descriptions by using
description.trim() || undefined; update the payload in edit-event.tsx so the
description field sends an explicit empty string when the trimmed input is empty
(or simply send description.trim() without coalescing to undefined) to allow
clearing an existing description; change the object property that uses
description (the description: ... entry) to pass the trimmed value even when
it's empty so updates can clear stored descriptions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5da985c3-4d89-4706-ba99-c5cb93b8a650

📥 Commits

Reviewing files that changed from the base of the PR and between b94d256 and 9137ac5.

📒 Files selected for processing (5)
  • apps/start/src/modals/Modal/Container.tsx
  • apps/start/src/modals/edit-event.tsx
  • packages/db/prisma/migrations/20260607120000_add_event_meta_description/migration.sql
  • packages/db/prisma/schema.prisma
  • packages/trpc/src/routers/event.ts

Comment thread apps/start/src/modals/edit-event.tsx Outdated
Sending `trim() || undefined` silently dropped empty input, preventing
users from clearing an existing description. Now sends the trimmed value
directly so an empty string is passed and the server can clear the field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant