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

feat: added insights badge to event-types #17762

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1942,6 +1942,7 @@
"under_maintenance": "Down for maintenance",
"under_maintenance_description": "The {{appName}} team are performing scheduled maintenance. If you have any questions, please contact support.",
"event_type_seats": "{{numberOfSeats}} seats",
"event_type_insights": "{{numberOfBookings}} bookings",
"booking_questions_title": "Booking questions",
"booking_questions_description": "Customize the questions asked on the booking page",
"add_a_booking_question": "Add a question",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma } from "@prisma/client";
import Link from "next/link";
import { useMemo } from "react";
import type { z } from "zod";

Expand Down Expand Up @@ -70,6 +71,7 @@ export const EventTypeDescription = ({
</Badge>
</li>
)}

{eventType.schedulingType && eventType.schedulingType !== SchedulingType.MANAGED && (
<li>
<Badge variant="gray" startIcon="users">
Expand Down Expand Up @@ -128,6 +130,13 @@ export const EventTypeDescription = ({
</Badge>
</li>
) : null}
<li>
<Link href={`/insights?isAll=false&filter=event-type&eventTypeId=${eventType.id}`}>
Copy link
Member Author

Choose a reason for hiding this comment

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

@eunjae-lee @sean-brydon this is currently not working consistently because the URL-param are borked. that PR needs to go live first

<Badge variant="gray" startIcon="chart-bar">
<p>{t("event_type_insights", { numberOfBookings: 42 })} </p>
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: query needed for total bookings

</Badge>
</Link>
</li>
</ul>
</div>
</>
Expand Down
19 changes: 19 additions & 0 deletions packages/features/eventtypes/components/EventTypeLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ function EventTypeSingleLayout({
)}
</>
)}
<Tooltip content={t("insights")} side="bottom" sideOffset={4}>
<Button
color="secondary"
target="_blank"
variant="icon"
href={`/insights?isAll=false&filter=event-type&eventTypeId=${eventType.id}`}
rel="noreferrer"
StartIcon="chart-bar"
/>
</Tooltip>
{!isChildrenManagedEventType && allowDelete && (
<Button
color="destructive"
Expand Down Expand Up @@ -231,6 +241,15 @@ function EventTypeSingleLayout({
{t("copy_link")}
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuItem className="focus:ring-muted">
<DropdownItem
type="a"
StartIcon="chart-bar"
href={`/insights?isAll=false&filter=event-type&eventTypeId=${eventType.id}`}>
{t("insights")}
</DropdownItem>
</DropdownMenuItem>

{allowDelete && (
<DropdownMenuItem className="focus:ring-muted">
<DropdownItem
Expand Down
Loading