Revamp Google Cal warning for Meet, Amie, and Vimcal (#7308)

* Create requires Google Cal component

* Create installed GCal message

* Move requires GCal component to App

* Clean up

* Abstract prerequisite component

* Add requires message on app card

* Refactor to dependency

* Clean up

* Change typeform dep & remove app card dep component

* Clean up

* Change dependency to dependencies

* Pass disableInstall to default install button for AppCard

* Refactor app page to dependencies

* Type fix

* More type fixes

* Update apps/web/components/apps/App.tsx

* Apply suggestions from code review

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-03-09 10:07:23 +01:00
1 parent c32aadf297
commit 58b439ca65
18 files changed
+240 -121

No files matched your search

+23 -1
View File
@@ -3,7 +3,7 @@ import type { Prisma } from "@prisma/client";
import z from "zod";
import { appKeysSchemas } from "@calcom/app-store/apps.keys-schemas.generated";
import { getLocalAppMetadata } from "@calcom/app-store/utils";
import { getLocalAppMetadata, getAppFromSlug } from "@calcom/app-store/utils";
import { sendDisabledAppEmail } from "@calcom/emails";
import { deriveAppDictKeyFromType } from "@calcom/lib/deriveAppDictKeyFromType";
import { getTranslation } from "@calcom/lib/server/i18n";
@@ -320,4 +320,26 @@ export const appsRouter = router({
return !!updated;
}),
queryForDependencies: authedProcedure.input(z.string().array().optional()).query(async ({ ctx, input }) => {
if (!input) return;
const dependencyData: { name: string; slug: string; installed: boolean }[] = [];
await Promise.all(
input.map(async (dependency) => {
const appInstalled = await ctx.prisma.credential.findFirst({
where: {
appId: dependency,
userId: ctx.user.id,
},
});
const app = await getAppFromSlug(dependency);
dependencyData.push({ name: app?.name || dependency, slug: dependency, installed: !!appInstalled });
})
);
return dependencyData;
}),
});