-
Notifications
You must be signed in to change notification settings - Fork 11.7k
feat: add Recent No-Show Guests chart to insights page #23381
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
30cda42
feat: add Recent No-Show Guests chart to insights page
devin-ai-integration[bot] 18c2e2f
re-order charts
eunjae-lee ec24849
Merge branch 'main' into devin/recent-no-show-guests-1756284064
eunjae-lee b446102
clean up
eunjae-lee 861c4fe
feat: add optional tooltip functionality to PanelCard
devin-ai-integration[bot] 30ddbfb
style adjustment
eunjae-lee 592bf6d
Merge branch 'main' into devin/recent-no-show-guests-1756284064
eunjae-lee 35026e5
update style
eunjae-lee f79e618
Merge branch 'devin/recent-no-show-guests-1756284064' of github.com:c…
eunjae-lee 65f2230
address feedback
eunjae-lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
82 changes: 82 additions & 0 deletions
82
packages/features/insights/components/booking/RecentNoShowGuestsChart.tsx
This file contains hidden or 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,82 @@ | ||
| "use client"; | ||
|
|
||
| import { useCopy } from "@calcom/lib/hooks/useCopy"; | ||
| import { useLocale } from "@calcom/lib/hooks/useLocale"; | ||
| import { trpc } from "@calcom/trpc"; | ||
| import { Button } from "@calcom/ui/components/button"; | ||
| import { showToast } from "@calcom/ui/components/toast"; | ||
|
|
||
| import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; | ||
| import { ChartCard, ChartCardItem } from "../ChartCard"; | ||
| import { LoadingInsight } from "../LoadingInsights"; | ||
|
|
||
| export const RecentNoShowGuestsChart = () => { | ||
| const { t } = useLocale(); | ||
| const { copyToClipboard, isCopied } = useCopy(); | ||
| const insightsBookingParams = useInsightsBookingParameters(); | ||
| const timeZone = insightsBookingParams.timeZone; | ||
|
|
||
| const { data, isSuccess, isPending } = trpc.viewer.insights.recentNoShowGuests.useQuery( | ||
| insightsBookingParams, | ||
| { | ||
| staleTime: 180000, | ||
| refetchOnWindowFocus: false, | ||
| trpc: { | ||
| context: { skipBatch: true }, | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| if (isPending) return <LoadingInsight />; | ||
|
|
||
| if (!isSuccess || !data) return null; | ||
|
|
||
| const handleCopyEmail = (email: string) => { | ||
| copyToClipboard(email); | ||
| showToast(t("email_copied"), "success"); | ||
| }; | ||
|
|
||
| return ( | ||
| <ChartCard | ||
| title={t("recent_no_show_guests")} | ||
| titleTooltip={t("recent_no_show_guests_tooltip")} | ||
| className="h-full"> | ||
| <div className="sm:max-h-[30.6rem] sm:overflow-y-auto"> | ||
| {data.map((item) => ( | ||
| <ChartCardItem key={item.bookingId}> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <div className="flex gap-2"> | ||
| <div className="bg-subtle h-16 w-[2px] shrink-0 rounded-sm" /> | ||
| <div className="flex flex-col space-y-1"> | ||
| <p className="text-sm font-medium">{item.guestName}</p> | ||
| <div className="text-subtle text-sm leading-tight"> | ||
| <p>{item.eventTypeName}</p> | ||
| <p> | ||
| {Intl.DateTimeFormat(undefined, { | ||
| timeZone, | ||
| dateStyle: "medium", | ||
| timeStyle: "short", | ||
| }).format(new Date(item.startTime))} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <Button | ||
| color="minimal" | ||
| size="sm" | ||
| StartIcon={isCopied ? "clipboard-check" : "clipboard"} | ||
| onClick={() => handleCopyEmail(item.guestEmail)}> | ||
| {!isCopied ? t("email") : t("copied")} | ||
| </Button> | ||
| </div> | ||
| </ChartCardItem> | ||
| ))} | ||
| </div> | ||
| {data.length === 0 && ( | ||
| <div className="flex h-60 text-center"> | ||
| <p className="m-auto text-sm font-light">{t("insights_no_data_found_for_filter")}</p> | ||
| </div> | ||
| )} | ||
| </ChartCard> | ||
| ); | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.