-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: virtual queues tab in insights (#18260)
Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: sean-brydon <sean@cal.com> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com>
- Loading branch information
Showing
39 changed files
with
538 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { withAppDirSsr } from "app/WithAppDirSsr"; | ||
import { _generateMetadata } from "app/_utils"; | ||
import { WithLayout } from "app/layoutHOC"; | ||
|
||
import { getServerSideProps } from "@lib/insights/getServerSideProps"; | ||
|
||
import InsightsVirtualQueuesPage from "~/insights/insights-virtual-queues-view"; | ||
|
||
export const generateMetadata = async () => | ||
await _generateMetadata( | ||
(t) => t("insights"), | ||
(t) => t("insights_subtitle") | ||
); | ||
|
||
const getData = withAppDirSsr(getServerSideProps); | ||
|
||
export default WithLayout({ getLayout: null, getData, Page: InsightsVirtualQueuesPage }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
apps/web/modules/insights/insights-virtual-queues-view.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
import { TestForm } from "@calcom/app-store/routing-forms/components/SingleForm"; | ||
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, Select } from "@calcom/ui"; | ||
|
||
import InsightsLayout from "./layout"; | ||
|
||
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 ( | ||
<InsightsLayout> | ||
<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} showAllData={false} /> : <></>} | ||
</div> | ||
</InsightsLayout> | ||
); | ||
|
||
return <></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.