Skip to content

Commit 6c069a4

Browse files
feat: skip onboarding and fix UI for redirect apps (calcom#23115)
* skip onboarding and fix UI for redirect apps * fix --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: unknown <adhabal2002@gmail.com>
1 parent 42cbc46 commit 6c069a4

4 files changed

Lines changed: 69 additions & 2 deletions

File tree

apps/web/components/apps/AppPage.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useRouter } from "next/navigation";
33
import type { IframeHTMLAttributes } from "react";
44
import React, { useEffect, useState } from "react";
55

6+
import { isRedirectApp } from "@calcom/app-store/_utils/redirectApps";
67
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
78
import { AppDependencyComponent, InstallAppButton } from "@calcom/app-store/components";
89
import { doesAppSupportTeamInstall, isConferencing } from "@calcom/app-store/utils";
@@ -112,6 +113,11 @@ export const AppPage = ({
112113
});
113114

114115
const handleAppInstall = () => {
116+
if (isRedirectApp(slug)) {
117+
setIsLoading(true);
118+
mutation.mutate({ type, variant, slug });
119+
return;
120+
}
115121
setIsLoading(true);
116122
if (isConferencing(categories) && !concurrentMeetings) {
117123
mutation.mutate({
@@ -185,6 +191,19 @@ export const AppPage = ({
185191
}, []);
186192

187193
const installOrDisconnectAppButton = () => {
194+
if (isRedirectApp(slug)) {
195+
return (
196+
<Button
197+
onClick={() => handleAppInstall()}
198+
className="mt-2"
199+
StartIcon="external-link"
200+
loading={isLoading}
201+
disabled={isLoading}>
202+
{t("visit")}
203+
</Button>
204+
);
205+
}
206+
188207
if (appDbQuery.isPending) {
189208
return <SkeletonButton className="h-10 w-24" />;
190209
}

apps/web/public/static/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,6 +3573,7 @@
35733573
"webhook_metadata": "Metadata",
35743574
"stats": "Stats",
35753575
"booking_status": "Booking status",
3576+
"visit": "Visit",
35763577
"location_custom_label_input_label": "Custom label on booking page",
35773578
"meeting_link": "Meeting link",
35783579
"my_bookings": "My Bookings",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const REDIRECT_APPS = [
2+
"amie",
3+
"autocheckin",
4+
"bolna",
5+
"chatbase",
6+
"clic",
7+
"deel",
8+
"elevenlabs",
9+
"granola",
10+
"greetmate-ai",
11+
"lindy",
12+
"linear",
13+
"millis-ai",
14+
"monobot",
15+
"retell-ai",
16+
"synthflow",
17+
"telli",
18+
"vimcal",
19+
"wordpress",
20+
];
21+
22+
export const isRedirectApp = (slug: string): boolean => {
23+
return REDIRECT_APPS.includes(slug);
24+
};

packages/features/apps/components/AppCard.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useRouter } from "next/navigation";
44
import { useEffect, useState } from "react";
55

6+
import { isRedirectApp } from "@calcom/app-store/_utils/redirectApps";
67
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
78
import { InstallAppButton } from "@calcom/app-store/components";
89
import { doesAppSupportTeamInstall, isConferencing } from "@calcom/app-store/utils";
@@ -56,6 +57,10 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
5657
}, [app.name, searchText]);
5758

5859
const handleAppInstall = () => {
60+
if (isRedirectApp(app.slug)) {
61+
mutation.mutate({ type: app.type, variant: app.variant, slug: app.slug });
62+
return;
63+
}
5964
if (isConferencing(app.categories) && !app.concurrentMeetings) {
6065
mutation.mutate({
6166
type: app.type,
@@ -148,7 +153,9 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
148153
loading: mutation.isPending,
149154
};
150155
}
151-
return <InstallAppButtonChild paid={app.paid} {...props} />;
156+
return (
157+
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
158+
);
152159
}}
153160
/>
154161
)
@@ -170,7 +177,9 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
170177
loading: mutation.isPending,
171178
};
172179
}
173-
return <InstallAppButtonChild paid={app.paid} {...props} />;
180+
return (
181+
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
182+
);
174183
}}
175184
/>
176185
)}
@@ -192,11 +201,25 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
192201

193202
const InstallAppButtonChild = ({
194203
paid,
204+
isRedirect = false,
195205
...props
196206
}: {
197207
paid: App["paid"];
208+
isRedirect?: boolean;
198209
} & ButtonProps) => {
199210
const { t } = useLocale();
211+
if (isRedirect) {
212+
return (
213+
<Button
214+
color="secondary"
215+
className="[@media(max-width:260px)]:w-full [@media(max-width:260px)]:justify-center"
216+
StartIcon="external-link"
217+
{...props}
218+
size="base">
219+
{t("visit")}
220+
</Button>
221+
);
222+
}
200223
// Paid apps don't support team installs at the moment
201224
// Also, cal.ai(the only paid app at the moment) doesn't support team install either
202225
if (paid) {

0 commit comments

Comments
 (0)