Fix app categories (#6016)

* Fix app metas

* Optimize categories on app store

* Remove commented code

* Remove console log

* Update apps/web/pages/apps/index.tsx

Co-authored-by: Omar López <[email protected]>

* Add categories to missing app metadata

* Fix type error

* Type fix

* Type fixes

* More type fixes

* Clean up

* Fix build error

* No leaky please

* Remove comment

Co-authored-by: Omar López <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-12-20 15:15:06 -07:00
1 parent 2d9064e92f
commit 540bf3a1cb
48 files changed
+99 -63

No files matched your search

+13 -9
View File
@@ -1,7 +1,6 @@
import type { Credential } from "@prisma/client";
import prisma from "@calcom/prisma";
import { App } from "@calcom/types/App";
import prisma, { safeAppSelect, safeCredentialSelect } from "@calcom/prisma";
import { AppFrontendPayload as App } from "@calcom/types/App";
import { CredentialFrontendPayload as Credential } from "@calcom/types/Credential";
export async function getAppWithMetadata(app: { dirName: string }) {
let appMetadata: App | null = null;
@@ -30,7 +29,7 @@ export async function getAppRegistry() {
where: { enabled: true },
select: { dirName: true, slug: true, categories: true, enabled: true },
});
const apps = [] as Omit<App, "key">[];
const apps = [] as App[];
for await (const dbapp of dbApps) {
const app = await getAppWithMetadata(dbapp);
if (!app) continue;
@@ -56,9 +55,15 @@ export async function getAppRegistry() {
export async function getAppRegistryWithCredentials(userId: number) {
const dbApps = await prisma.app.findMany({
where: { enabled: true },
include: { credentials: { where: { userId } } },
select: {
...safeAppSelect,
credentials: {
where: { userId },
select: safeCredentialSelect,
},
},
});
const apps = [] as (Omit<App, "key"> & {
const apps = [] as (App & {
credentials: Credential[];
})[];
for await (const dbapp of dbApps) {
@@ -77,8 +82,7 @@ export async function getAppRegistryWithCredentials(userId: number) {
...remainingAppProps,
categories: dbapp.categories,
credentials: dbapp.credentials,
installed:
true /* All apps from DB are considered installed by default. @TODO: Add and filter our by `enabled` property */,
installed: true,
});
}
return apps;
@@ -10,6 +10,7 @@ export const metadata = {
title: "Apple Calendar",
imageSrc: "/api/app-store/applecalendar/icon.svg",
variant: "calendar",
categories: ["calendar"],
category: "calendar",
logo: "/api/app-store/applecalendar/icon.svg",
publisher: "Cal.com",
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "around",
appData: {
location: {
@@ -11,6 +11,7 @@ export const metadata = {
imageSrc: "/api/app-store/caldavcalendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
logo: "/api/app-store/caldavcalendar/icon.svg",
publisher: "Cal.com",
rating: 5,
@@ -11,6 +11,7 @@ export const metadata = {
imageSrc: "/api/app-store/caldavcalendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
logo: "/api/app-store/caldavcalendar/icon.svg",
publisher: "Cal.com",
rating: 5,
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "caldavcalendar",
...config,
} as AppMeta;
@@ -10,6 +10,7 @@ export const metadata = {
imageSrc: "/api/app-store/dailyvideo/icon.svg",
variant: "conferencing",
url: "https://daily.co",
categories: ["calendar"],
trending: true,
logo: "/api/app-store/dailyvideo/icon.svg",
publisher: "Cal.com",
@@ -11,6 +11,7 @@ export const metadata = {
imageSrc: "/api/app-store/exchange2013calendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
label: "Exchange Calendar",
logo: "/api/app-store/exchange2013calendar/icon.svg",
publisher: "Cal.com",
@@ -11,6 +11,7 @@ export const metadata = {
imageSrc: "/api/app-store/exchange2016calendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
label: "Exchange Calendar",
logo: "/api/app-store/exchange2016calendar/icon.svg",
publisher: "Cal.com",
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "ga4",
...config,
} as AppMeta;
+1 -1
View File
@@ -6,7 +6,7 @@ export const metadata = {
name: "Giphy",
description: _package.description,
installed: true,
category: "other",
categories: ["other"],
// If using static next public folder, can then be referenced from the base URL (/).
imageSrc: "/api/app-store/giphy/icon.svg",
logo: "/api/app-store/giphy/icon.svg",
@@ -12,6 +12,7 @@ export const metadata = {
imageSrc: "/api/app-store/googlecalendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
logo: "/api/app-store/googlecalendar/icon.svg",
publisher: "Cal.com",
rating: 5,
@@ -9,6 +9,7 @@ export const metadata = {
installed: !!(process.env.GOOGLE_API_CREDENTIALS && validJson(process.env.GOOGLE_API_CREDENTIALS)),
slug: "google-meet",
category: "video",
categories: ["video"],
type: "google_video",
title: "Google Meet",
imageSrc: "/api/app-store/googlevideo/logo.webp",
+1 -1
View File
@@ -15,7 +15,7 @@ export const metadata = {
verified: true,
rating: 4.3, // TODO: placeholder for now, pull this from TrustPilot or G2
reviews: 69, // TODO: placeholder for now, pull this from TrustPilot or G2
category: "other",
categories: ["other"],
label: "HubSpot CRM",
slug: "hubspot",
title: "HubSpot CRM",
@@ -10,6 +10,7 @@ export const metadata = {
type: "huddle01_video",
imageSrc: "/api/app-store/huddle01video/icon.svg",
variant: "conferencing",
categories: ["video", "web3"],
logo: "/api/app-store/huddle01video/icon.svg",
publisher: "huddle01.com",
url: "https://huddle01.com",
+1 -1
View File
@@ -9,13 +9,13 @@ export const metadata = {
type: "jitsi_video",
imageSrc: "/api/app-store/jitsivideo/icon.svg",
variant: "conferencing",
categories: ["video"],
logo: "/api/app-store/jitsivideo/icon.svg",
publisher: "Cal.com",
url: "https://jitsi.org/",
verified: true,
rating: 0, // TODO: placeholder for now, pull this from TrustPilot or G2
reviews: 0, // TODO: placeholder for now, pull this from TrustPilot or G2
category: "video",
slug: "jitsi",
title: "Jitsi Meet",
trending: true,
+1 -1
View File
@@ -10,7 +10,7 @@ export const metadata = {
title: "Lark Calendar",
imageSrc: "/api/app-store/larkcalendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
logo: "/api/app-store/larkcalendar/icon.svg",
publisher: "Lark",
rating: 5,
@@ -10,6 +10,7 @@ export const metadata = {
imageSrc: "/api/app-store/office365calendar/icon.svg",
variant: "calendar",
category: "calendar",
categories: ["calendar"],
logo: "/api/app-store/office365calendar/icon.svg",
publisher: "Cal.com",
rating: 5,
@@ -11,6 +11,7 @@
"rating": 4.3,
"reviews": 69,
"category": "video",
"categories": ["video"],
"slug": "msteams",
"title": "MS Teams (Requires work/school account)",
"trending": true,
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
// FIXME: Currently for an app to be shown as installed, it must have this variable set. Either hardcoded or if it depends on some env variable, that should be checked here
installed: true,
rating: 0,
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "pipedream",
...config,
} as AppMeta;
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "rainbow",
...config,
} as AppMeta;
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
// FIXME: Currently for an app to be shown as installed, it must have this variable set. Either hardcoded or if it depends on some env variable, that should be checked here
installed: true,
rating: 0,
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "salesforce",
...config,
} as AppMeta;
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "sendgrid",
...config,
} as AppMeta;
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "signal",
...config,
} as AppMeta;
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "sirius_video",
...config,
} as AppMeta;
@@ -12,6 +12,7 @@ export const metadata = {
),
slug: "stripe",
category: "payment",
categories: ["payment"],
logo: "/api/app-store/stripepayment/icon.svg",
rating: 4.6,
trending: true,
@@ -9,6 +9,7 @@ export const metadata = {
title: "Tandem Video",
imageSrc: "/api/app-store/tandemvideo/icon.svg",
variant: "conferencing",
categories: ["video"],
slug: "tandem",
category: "video",
logo: "/api/app-store/tandemvideo/icon.svg",
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "telegram",
...config,
} as AppMeta;
+4 -1
View File
@@ -76,7 +76,10 @@ export function getLocationGroupedOptions(integrations: ReturnType<typeof getApp
const apps: Record<string, { label: string; value: string; disabled?: boolean; icon?: string }[]> = {};
integrations.forEach((app) => {
if (app.locationOption) {
const category = app.category;
// All apps that are labeled as a locationOption are video apps. Extract the secondary category if available
let category =
app.categories.length >= 2 ? app.categories.find((category) => category !== "video") : app.category;
if (!category) category = "video";
const option = { ...app.locationOption, icon: app.imageSrc };
if (apps[category]) {
apps[category] = [...apps[category], option];
+1
View File
@@ -7,6 +7,7 @@ export const metadata = {
description: _package.description,
installed: true,
category: "other",
categories: ["other"],
// If using static next public folder, can then be referenced from the base URL (/).
imageSrc: "/api/app-store/vital/icon.svg",
logo: "/api/app-store/vital/icon.svg",
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
dirName: "whatsapp",
...config,
} as AppMeta;
-1
View File
@@ -3,7 +3,6 @@ import type { AppMeta } from "@calcom/types/App";
import config from "./config.json";
export const metadata = {
category: "other",
// FIXME: Currently for an app to be shown as installed, it must have this variable set. Either hardcoded or if it depends on some env variable, that should be checked here
installed: true,
rating: 0,
@@ -7,6 +7,7 @@ export const metadata = {
description: _package.description,
installed: true,
category: "other",
categories: ["other"],
// If using static next public folder, can then be referenced from the base URL (/).
imageSrc: "/api/app-store/wipemycalother/icon-dark.svg",
logo: "/api/app-store/wipemycalother/icon-dark.svg",
+1
View File
@@ -7,6 +7,7 @@ export const metadata = {
description: _package.description,
installed: true,
category: "automation",
categories: ["automation"],
imageSrc: "/api/app-store/zapier/icon.svg",
logo: "/api/app-store/zapier/icon.svg",
publisher: "Cal.com",
@@ -7,6 +7,7 @@ export const metadata = {
name: "Zoom Video",
description: _package.description,
type: "zoom_video",
categories: ["video"],
imageSrc: "/api/app-store/zoomvideo/icon.svg",
variant: "conferencing",
logo: "/api/app-store/zoomvideo/icon.svg",