feat: implement filter segment (#20066)

* feat: add filter segment

* add tests

* add ui

* provide tableIdentifier from context

* fix components

* update save button

* try to fix router

* add proper implementation

* update icon

* remove segmentId if invalid

* fix tests

* fix type errors

* fix type errors

* fix unit test

* clean up

* minor fixes

* clean up types

* avoid barrel imports

* fix imports

* minor improvements

* fix type error

* fix radio import

* fix little issues

* menu permission

* update icon snapshot

* fix: remember last used filter segment (#20261)

* fix: remember last used filter segment

* extract segments logic as a separate file

* remove unnecessary query

* apply feedback

* deep comparison
This commit is contained in:
Eunjae Lee authored and GitHub committed 2025-03-31 08:53:48 +00:00
1 parent c95118715a
commit f15d347804
45 files changed
+2348 -79

No files matched your search

@@ -0,0 +1,4 @@
import { createNextApiHandler } from "@calcom/trpc/server/createNextApiHandler";
import { filterSegmentsRouter } from "@calcom/trpc/server/routers/viewer/filterSegments/_router";
export default createNextApiHandler(filterSegmentsRouter);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 239 KiB

+12
View File
@@ -80,6 +80,9 @@
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" ></path>
<circle cx="12" cy="8" r="2" ></circle>
</symbol>
<symbol class="lucide lucide-bookmark" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="bookmark">
<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" ></path>
</symbol>
<symbol class="lucide lucide-building" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="building">
<rect width="16" height="20" x="4" y="2" rx="2" ry="2" ></rect>
<path d="M9 22v-4h6v4" ></path>
@@ -418,6 +421,11 @@
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" ></path>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" ></path>
</symbol>
<symbol class="lucide lucide-list-filter" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="list-filter">
<path d="M3 6h18" ></path>
<path d="M7 12h10" ></path>
<path d="M10 18h4" ></path>
</symbol>
<symbol class="lucide lucide-loader" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="loader">
<path d="M12 2v4" ></path>
<path d="m16.2 7.8 2.9-2.9" ></path>
@@ -605,6 +613,10 @@
<rect width="18" height="18" x="3" y="3" rx="2" ></rect>
<path d="m9 12 2 2 4-4" ></path>
</symbol>
<symbol class="lucide lucide-square-pen" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="square-pen">
<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" ></path>
<path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" ></path>
</symbol>
<symbol class="lucide lucide-star" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="star">
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" ></polygon>
</symbol>

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 51 KiB

@@ -3038,6 +3038,29 @@
"tip_username_plus": "Tip: You can a '+' between usernames: cal.com/anna+brian to make a dynamic group meeting",
"user_has_no_team_yet": "You don't have a team yet",
"no_team_members": "You don't have team members yet",
"segment": "Segment",
"rename": "Rename",
"rename_segment": "Rename Segment",
"delete_segment": "Delete Segment",
"duplicate_segment": "Duplicate Segment",
"delete_segment_confirmation": "Are you sure you want to delete this segment? This action cannot be undone.",
"filter_segment_updated": "Filter segment updated",
"error_updating_filter_segment": "Error updating filter segment",
"filter_segment_duplicated": "Filter segment duplicated",
"error_duplicating_filter_segment": "Error duplicating filter segment",
"filter_segment_deleted": "Filter segment deleted",
"error_deleting_filter_segment": "Error deleting filter segment",
"save_segment": "Save Segment",
"segment_not_found": "Segment not found",
"filter_segment_saved": "Filter segment saved",
"no_segments": "No segments",
"error_saving_filter_segment": "Error saving filter segment",
"override_segment": "Save overrides to \"{{name}}\"",
"create_new_segment": "Create new segment",
"save_for_team": "Save for team",
"select_team": "Select team",
"please_select_team": "Please select a team",
"personal": "Personal",
"hide_team_profile_link": "Hide Team Profile Link",
"hide_team_profile_link_description": "Hide the team profile link on booking pages",
"display": "Display",