Files
calendar/apps/web/modules/insights/insights-virtual-queues-view.tsx
Benny JooGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
76bba1ca05 refactor: remove circular dependency between appstore and trpc (#23768)
* mv PaymentPage to web

* mv 2 more components to web

* refactor

* update imports

* mv

* revert

* fix

* fix

* update

* migrate relevant test too

* move setup components to web from appstore

* move wipemycalother

* mv

* fix typechecks

* mv more routing forms components

* fix

* fix

* fix

* fix: resolve type errors in SingleForm.tsx after migration

- Updated SingleFormComponentProps type to include enriched form properties
- Added proper typing for user, team, nonOrgUsername, nonOrgTeamslug, userOrigin, teamOrigin
- Fixes type errors that occurred after migrating SingleForm.tsx from packages/app-store/routing-forms/components/
- Resolves both SingleForm.tsx and TestForm.tsx type errors

Co-Authored-By: [email protected] <[email protected]>

* delete

* refactors

* fix

* fix

* fix

* remove usage of trpc client from OmniInstallAppButton.tsx

* fix test

* import only type

* fix test

* remove trpc package from appstore package.json

* remove remaining trpc usage

* update test

* fix type checks

* fix errors

* fix

* make it error

* nit

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-09-14 12:51:05 +00:00

54 lines
1.7 KiB
TypeScript

"use client";
import { useState } from "react";
import type { RoutingForm } from "@calcom/app-store/routing-forms/types/types";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc";
import { Label } from "@calcom/ui/components/form";
import { Select } from "@calcom/ui/components/form";
import { TestForm } from "../../components/apps/routing-forms/TestForm";
export default function InsightsVirtualQueuesPage() {
const { t } = useLocale();
const { data: routingForms, isLoading: isRoutingFormsLoading } =
trpc.viewer.insights.getUserRelevantTeamRoutingForms.useQuery();
const [selectedForm, setSelectedForm] = useState<RoutingForm | undefined>(
routingForms && routingForms.length > 0 ? routingForms[0] : undefined
);
if (routingForms && !selectedForm && routingForms.length > 0) {
setSelectedForm(routingForms[0]);
}
return (
<>
<Label>{t("routing_form")}</Label>
<Select
placeholder="Select project"
options={routingForms?.map((form) => ({ label: form.name, value: form.id })) ?? []}
isLoading={isRoutingFormsLoading}
className="w-60"
onChange={(e) => {
if (e && routingForms) {
const form = routingForms.find((form) => form.id === e.value);
setSelectedForm(form);
}
}}
value={selectedForm ? { label: selectedForm.name, value: selectedForm.id } : undefined}
/>
<div className="mt-10">
{selectedForm ? (
<TestForm form={selectedForm} supportsTeamMembersMatchingLogic={true} showRRData={true} />
) : (
<></>
)}
</div>
</>
);
return <></>;
}