From 306dc5e4fb41ccf0302f2e34d30b3c4c7f22a3d4 Mon Sep 17 00:00:00 2001 From: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Date: Mon, 5 May 2025 17:30:55 +0200 Subject: [PATCH] fix: add back round robin data to insights/router-position (#21116) * add back all data to router-position * fix type error --------- Co-authored-by: CarinaWolli Co-authored-by: Peer Richelsen --- .../insights/insights-virtual-queues-view.tsx | 7 +- apps/web/public/static/locales/en/common.json | 5 +- .../components/_components/ResultSection.tsx | 16 +++- .../_components/TeamMembersMatchResult.tsx | 87 +------------------ .../components/_components/TestForm.tsx | 36 +++++--- 5 files changed, 47 insertions(+), 104 deletions(-) diff --git a/apps/web/modules/insights/insights-virtual-queues-view.tsx b/apps/web/modules/insights/insights-virtual-queues-view.tsx index d1ffd94951..0d06d78c1e 100644 --- a/apps/web/modules/insights/insights-virtual-queues-view.tsx +++ b/apps/web/modules/insights/insights-virtual-queues-view.tsx @@ -40,12 +40,7 @@ export default function InsightsVirtualQueuesPage() { />
{selectedForm ? ( - + ) : ( <> )} diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 42289751b8..a7b187fef7 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -3172,12 +3172,15 @@ "skip_trial": "Skip trial period", "team_trials_skipped_successfully": "Team trials skipped successfully", "sms_workflow_consent": "By entering your phone number you consent to receive SMS messages for this event. SMS rates may apply.", - "routing_preview_more_info_found_insights": "More info can be found in Routing Insights", + "routing_preview_more_info_found_insights": "More info can be found in <0>Routing Insights", "results": "Results", "view_form": "View Form", "sms_opt_out_message": "Text STOP to opt-out of SMS messages", "routing_form_next_in_queue": "{{count}} next in queue", "routing_form_select_members_to_email": "Send email responses to", "routing_incomplete_booking_tab": "Incomplete Bookings", + "matching": "Matching", + "event_redirect": "Event Redirect", + "reset_form": "Reset Form", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/app-store/routing-forms/components/_components/ResultSection.tsx b/packages/app-store/routing-forms/components/_components/ResultSection.tsx index 7b9ed9c401..3d16160484 100644 --- a/packages/app-store/routing-forms/components/_components/ResultSection.tsx +++ b/packages/app-store/routing-forms/components/_components/ResultSection.tsx @@ -1,8 +1,10 @@ "use client"; import { motion } from "framer-motion"; +import Link from "next/link"; import type { ReactNode } from "react"; +import ServerTrans from "@calcom/lib/components/ServerTrans"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Badge } from "@calcom/ui/components/badge"; import type { IconName } from "@calcom/ui/components/icon"; @@ -263,7 +265,19 @@ export const ResultsView = ({
- {t("routing_preview_more_info_found_insights")} + + Routing Insights + , + ]} + />
}> diff --git a/packages/app-store/routing-forms/components/_components/TeamMembersMatchResult.tsx b/packages/app-store/routing-forms/components/_components/TeamMembersMatchResult.tsx index 6a6a31654b..ccc3c9ebc0 100644 --- a/packages/app-store/routing-forms/components/_components/TeamMembersMatchResult.tsx +++ b/packages/app-store/routing-forms/components/_components/TeamMembersMatchResult.tsx @@ -1,6 +1,4 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; -import classNames from "@calcom/ui/classNames"; -import { Alert } from "@calcom/ui/components/alert"; export type MembersMatchResultType = { isUsingAttributeWeights: boolean; @@ -20,53 +18,15 @@ export type MembersMatchResultType = { export const TeamMembersMatchResult = ({ membersMatchResult, - chosenRouteName, - showAllData, }: { membersMatchResult: MembersMatchResultType; - chosenRouteName: string; - showAllData: boolean; }) => { const { t } = useLocale(); if (!membersMatchResult) return null; - const hasMainWarnings = (membersMatchResult.mainWarnings?.length ?? 0) > 0; - const hasFallbackWarnings = (membersMatchResult.fallbackWarnings?.length ?? 0) > 0; - - const renderFallbackLogicStatus = () => { - if (!membersMatchResult.checkedFallback) { - return t("fallback_not_needed"); - } else if ( - isNoLogicFound(membersMatchResult.teamMembersMatchingAttributeLogic) || - membersMatchResult.teamMembersMatchingAttributeLogic.length > 0 - ) { - return t("yes"); - } else { - return t("no"); - } - }; - - const renderMainLogicStatus = () => { - return !membersMatchResult.checkedFallback ? t("yes") : t("no"); - }; - const renderQueue = () => { if (isNoLogicFound(membersMatchResult.teamMembersMatchingAttributeLogic)) { - if (!showAllData) return
{t("no_active_queues")}
; - if (membersMatchResult.checkedFallback) { - return ( - - {t( - "all_assigned_members_of_the_team_event_type_consider_adding_some_attribute_rules_to_fallback" - )} - - ); - } - return ( - - {t("all_assigned_members_of_the_team_event_type_consider_adding_some_attribute_rules")} - - ); + return
{t("no_active_queues")}
; } const matchingMembers = membersMatchResult.teamMembersMatchingAttributeLogic; @@ -124,61 +84,16 @@ export const TeamMembersMatchResult = ({ return (
- {showAllData ? ( - <> -
- {t("chosen_route")}: {chosenRouteName} -
-
- {t("attribute_logic_matched")}: {renderMainLogicStatus()} - {hasMainWarnings && ( - - )} -
-
- {t("attribute_logic_fallback_matched")}:{" "} - {renderFallbackLogicStatus()} - {hasFallbackWarnings && ( - - )} -
- - ) : ( - <> - )}
{membersMatchResult.contactOwnerEmail ? (
{t("contact_owner")}:{" "} {membersMatchResult.contactOwnerEmail}
- ) : showAllData ? ( -
- {t("contact_owner")}: Not found -
) : ( <> )}
- {showAllData ? ( - <> - {membersMatchResult.isUsingAttributeWeights - ? t("matching_members_queue_using_attribute_weights") - : t("matching_members_queue_using_event_assignee_weights")} - - ) : ( - <> - )} {renderQueue()}
diff --git a/packages/app-store/routing-forms/components/_components/TestForm.tsx b/packages/app-store/routing-forms/components/_components/TestForm.tsx index 98dd897c85..6b37faa4b9 100644 --- a/packages/app-store/routing-forms/components/_components/TestForm.tsx +++ b/packages/app-store/routing-forms/components/_components/TestForm.tsx @@ -23,6 +23,7 @@ import type { RoutingForm, FormResponse, NonRouterRoute } from "../../types/type import FormInputFields from "../FormInputFields"; import { ResultsView as Results } from "./ResultSection"; import type { MembersMatchResultType } from "./TeamMembersMatchResult"; +import { TeamMembersMatchResult } from "./TeamMembersMatchResult"; export type UptoDateForm = Brand< NonNullable, @@ -76,17 +77,17 @@ const FormView = ({ export const TestForm = ({ form, supportsTeamMembersMatchingLogic, - showAllData = true, renderFooter, isDialog = false, onClose: onCloseProp, + showRRData = false, }: { form: UptoDateForm | RoutingForm; supportsTeamMembersMatchingLogic: boolean; - showAllData?: boolean; renderFooter?: (onClose: () => void, onSubmit: () => void, isValid: boolean) => React.ReactNode; isDialog?: boolean; onClose?: () => void; + showRRData?: boolean; }) => { const { t } = useLocale(); const [response, setResponse] = useState({}); @@ -201,7 +202,7 @@ export const TestForm = ({ <> {isDialog ? ( - ) : ( + ) : !showRRData ? (

{t("preview")}

@@ -228,6 +229,8 @@ export const TestForm = ({
+ ) : ( + <> )} {isDialog ? ( - ) : ( + ) : !showRRData ? (

{t("results")}

@@ -279,13 +282,26 @@ export const TestForm = ({
+ ) : ( + <> )} - + + {showRRData ? ( + <> + + + + ) : ( + + )} + {isDialog && (