Skip to content
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

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eunjae-lee
Copy link
Contributor

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

What does this PR do?

  • Fixes CAL-5012
  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

Copy link

linear bot commented Jan 14, 2025

Copy link

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 16, 2025 3:06pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2025 3:06pm

Copy link

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
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
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
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.

@@ -582,7 +630,7 @@ export function RoutingFormResponsesTableContent() {
<DataTableFilters.ColumnVisibilityButton table={table} />
</>
}>
<RoutingKPICards />
<RoutingKPICards given={{ isAll, teamId, userId }} />
Copy link
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
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
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
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
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
Copy link

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.

Copy link
Contributor

E2E results are ready!

Copy link
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

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

image
As discussed in DMs: Lets add the selected filters back to ensure we dont have any regression

@github-actions github-actions bot marked this pull request as draft January 15, 2025 10:36
@eunjae-lee eunjae-lee changed the title fix: clean up filter logic in /insights/routing fix: implement filter components in /insights/routing Jan 16, 2025
@eunjae-lee eunjae-lee changed the title fix: implement filter components in /insights/routing fix: re-implement filter components in /insights/routing Jan 16, 2025
@eunjae-lee
Copy link
Contributor Author

new implementation!

Screenshot.2025-01-16.at.15.20.12.mp4

@eunjae-lee eunjae-lee force-pushed the eunjae/cal-5013-improve-team-filter-component branch from a51a903 to 30d0dee Compare January 16, 2025 15:06
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.

4 participants