Skip to content

fix: re-implement filter components in /insights/routing#18655

Merged
eunjae-lee merged 8 commits intomainfrom
eunjae/cal-5013-improve-team-filter-component
Jan 24, 2025
Merged

fix: re-implement filter components in /insights/routing#18655
eunjae-lee merged 8 commits intomainfrom
eunjae/cal-5013-improve-team-filter-component

Conversation

@eunjae-lee
Copy link
Copy Markdown
Contributor

@eunjae-lee eunjae-lee commented Jan 14, 2025

What does this PR do?

  • Fixes CAL-5013
  1. Cloned TeamAndSelfList into OrgTeamsFilter and removed implementation regarding useFilterContext()
  2. Cloned ClearFilters into DataTableFilters.ClearFiltersButton and removed implementation regarding useFilterContext()
  3. Removed custom "Routing Form" and "People" filter components and use proper tanstack filter system.
  4. Removed externalFilters-related code from useDataTable(). It was a temporary way to keep "Routing Form" and "People" filter as-is.
Screenshot.2025-01-14.at.17.17.33.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

All the filters work the same on /insights/routing

@linear
Copy link
Copy Markdown

linear Bot commented Jan 14, 2025

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 24, 2025 3:36pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 24, 2025 3:36pm

@linear
Copy link
Copy Markdown

linear Bot commented Jan 14, 2025

@eunjae-lee eunjae-lee force-pushed the eunjae/cal-5013-improve-team-filter-component branch from 2dbcb73 to 96e21a0 Compare January 14, 2025 16:05
@eunjae-lee eunjae-lee changed the title fix: re-implement team filter & people filter components fix: clean up filter logic in /insights/routing Jan 14, 2025
Comment on lines 125 to 126
table: Table<TData>;
externalFilters?: ExternalFilter[];
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

externalFilters is no longer needed as I've migrated Routing Form and People filter properly.

@@ -263,43 +261,56 @@ export function RoutingFormResponsesTableContent() {
const { t } = useLocale();
const { filter } = useFilterContext();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now, we rely on useFilterContext() only for the date selectors. All the other parameters are managed below.

Comment on lines +350 to +369
columnHelper.accessor("formId", {
id: "formId",
header: t("routing_forms"),
enableColumnFilter: true,
enableSorting: false,
meta: {
filter: { type: "single_select" },
},
cell: () => null,
}),
columnHelper.accessor("bookingUserId", {
id: "bookingUserId",
header: t("people"),
enableColumnFilter: true,
enableSorting: false,
meta: {
filter: { type: "single_select" },
},
cell: () => null,
}),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these are hidden columns but they exist to feed the filterable columns to the tanstack table.

</>
}>
<RoutingKPICards />
<RoutingKPICards given={{ isAll, teamId, userId }} />
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We caxn provide isAll, teamId, userId to this component, so that it won't attempt to read them from useFilterContext().

export type OrgTeamsType = "org" | "team" | "yours";

// This is a cleaned-up version of TeamAndSelfList.
export const OrgTeamsFilter = ({
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This button is not a part of "Add Filters" button and its "ActiveFilters". It exists separately on the left-most side.

Screenshot 2025-01-14 at 17 35 25

);
}
);
export const RoutingFormFilterList = memo(() => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed showOnlyWhenSelectedInContext as it's no longer needed

showOnlyWhenSelectedInContext?: boolean;
onClear?: () => void;
}) => {
export const UserListInTeam = ({ onClear }: { onClear?: () => void }) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed showOnlyWhenSelectedInContext as it's no longer needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file has no logic change. Just a bit cleaned up for readability.

@eunjae-lee eunjae-lee marked this pull request as ready for review January 14, 2025 16:46
@dosubot dosubot Bot added insights area: insights, analytics routing-forms area: routing forms, routing, forms labels Jan 14, 2025
@graphite-app graphite-app Bot requested a review from a team January 14, 2025 16:47
@eunjae-lee eunjae-lee force-pushed the eunjae/cal-5013-improve-team-filter-component branch from 96e21a0 to 2cf0187 Compare January 14, 2025 16:48
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Jan 14, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (01/14/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (01/17/25)

1 reviewer was added to this PR based on Keith Williams's automation.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2025

E2E results are ready!

@eunjae-lee eunjae-lee force-pushed the eunjae/cal-5013-improve-team-filter-component branch from 0d4c38e to c6cbde5 Compare January 17, 2025 13:49
@eunjae-lee eunjae-lee marked this pull request as ready for review January 17, 2025 13:52
@graphite-app graphite-app Bot requested a review from a team January 17, 2025 13:52
@Udit-takkar Udit-takkar added this to the v5.0 milestone Jan 17, 2025
Copy link
Copy Markdown
Contributor

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

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

I appreciate the self-review!

@eunjae-lee eunjae-lee merged commit d5e633b into main Jan 24, 2025
@eunjae-lee eunjae-lee deleted the eunjae/cal-5013-improve-team-filter-component branch January 24, 2025 16:38
MuhammadAimanSulaiman pushed a commit to hit-pay/cal.com that referenced this pull request Feb 25, 2025
* fix: re-implement team filter & people filter components

* implement DateRangeFilter

* show selected filter values

---------

Co-authored-by: Benny Joo <sldisek783@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only insights area: insights, analytics ready-for-e2e routing-forms area: routing forms, routing, forms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants