* refactor: make DataTableProvider framework-agnostic by requiring tableIdentifier
- Remove Next.js usePathname dependency from DataTableProvider
- Make tableIdentifier a required prop instead of optional
- Update all usages to provide explicit tableIdentifier values
- This makes DataTableProvider usable in non-Next.js contexts
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* refactor: use usePathname at usage sites instead of hardcoding tableIdentifier
- Add validation in DataTableProvider for empty/nullish tableIdentifier
- Use usePathname() in Next.js apps to pass pathname as tableIdentifier
- Use descriptive identifiers for non-Next.js package components
- This keeps DataTableProvider framework-agnostic while allowing Next.js apps to use pathname
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* use pathname instead of hard-coded identifiers
* change type of tableIdentifier
* simplify
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-10-23 15:32:16 +02:00
Eunjae LeeGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* feat: implement default filter segments for data tables
- Add defaultSegmentId column to UserFilterSegmentPreference table
- Support mixed segment ID types (number for user segments, string for default segments)
- Add DefaultFilterSegment and CombinedFilterSegment types
- Update useSegments hook to handle default segments with date range recalculation
- Modify FilterSegmentSelect to group and display default segments separately
- Add default segments to bookings view (My Bookings, Upcoming Bookings)
- Prevent editing/deleting of default segments in SaveFilterSegmentButton
- Update DataTableProvider to support defaultSegments prop
- Update parsers and repository to handle mixed segment ID types
Implements frontend-only default segments as specified in the requirements.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* chore: update ESLint dependencies to resolve configuration issues
- Update eslint-config-next and @typescript-eslint packages to latest versions
- Fix dependency compatibility issues that were blocking pre-commit hooks
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* revert eslint change
* some changes
* refactor: implement discriminated union for segment types
- Update SegmentIdentifier to use discriminated union with 'custom' vs 'default' types
- Refactor setSegmentId to accept object parameters: { id: string; type: 'default' } | { id: number; type: 'custom' }
- Update type definitions with DefaultFilterSegment, CustomFilterSegment, and CombinedFilterSegment
- Modify useSegments hook to handle new segment type structure
- Update FilterSegmentSelect component to work with discriminated unions
- Refactor database preference handling to store segment type alongside ID
- Add proper type safety throughout the data flow
- Remove description property from DefaultFilterSegment type
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: update unit test to expect discriminated union format for preferredSegmentId
The test was expecting preferredSegmentId to be a number, but after the discriminated union refactor it now returns { id: number, type: 'custom' } for custom segments. Updated the assertion to use toEqual() for deep object comparison.
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: correct SegmentIdentifier type to exclude undefined
- Remove null from SegmentIdentifier type definition since null/undefined indicate absence of identifier
- Update DataTableProvider and useSegments to handle SegmentIdentifier | null properly
- Fix type safety while maintaining discriminated union functionality
- Ensure setAndPersistSegmentId accepts null values for clearing segments
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* remove unused segment
* a little update
* feat: add default- prefix to default segment IDs for clearer type identification
- Update 'my_bookings' to 'default-my_bookings'
- Update 'upcoming-bookings' to 'default-upcoming-bookings'
- Makes it easier to verify segment type by looking at the ID string
- Maintains all existing discriminated union functionality
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* refactor: rename segment types from default/custom to system/user for better semantics
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: update unit test to expect 'user' type instead of 'custom' in discriminated union
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* fix: complete type renaming from default/custom to system/user across all component files
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* refactor: update segment ID prefix from default- to system- to match type naming
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
* remove unused segment
* some fixes
* revert schema change
* rename defaultSegmentId to systemSegmentId
* renaming
* fix save button
* remove as any
* clean up prisma migrations
* type fixes
* many fixes
* remove icon property
* fix infinite rendering
* fix race condition
* re-visiting useSegments implementation WIP
* extract useElementByClassName
* add e2e tests
* fix a bug that the created segment was not selected automatically
* add useSegments to /insights and fix e2e test
* fix type error
* fix type error
* apply feedback
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* feat: add 'View Responses' menu item to Routing Form dropdown
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: use nuqs createSerializer for URL generation
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* refactor: move serializer to data-table lib and use proper type constants
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: type errors in serializers and FormActions
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: use parseAsArrayOf with parseAsJson for proper nuqs serialization
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: update to use dataTableQueryParamsSerializer with proper nuqs pattern
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* refactor: extract parsers from DataTableProvider to be reused in serializers
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: remove deprecated activeFiltersSerializer and use empty array instead of null
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: only show View Responses menu when form id and teamId exist
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* remove teamId condition
* refactor: improve viewResponses URL generation with cleaner conditional
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* Update packages/features/data-table/lib/parsers.ts
* refactor: make constants in parsers.ts non-exported
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: add explicit type annotations to constants in parsers.ts
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: add explicit type annotations and export DEFAULT_PAGE_SIZE in parsers.ts
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
* fix: add explicit type assertions to DEFAULT_ACTIVE_FILTERS and DEFAULT_SORTING
Co-Authored-By: eunjae@cal.com <eunjae@cal.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: eunjae@cal.com <eunjae@cal.com>
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
Co-authored-by: Benny Joo <sldisek783@gmail.com>
* fix: relocate filter segment buttons on org member list
* implement toolbarContainerRef
* adjust location
* reorganize the hierarchy of DataTableProvider
* rename toolbar container to cta container
* move clear button to toolbar right