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

+8 -10
View File
@@ -1,11 +1,11 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import type { Credential } from "@prisma/client";
import { useRouter } from "next/router";
import { UIEvent, useEffect, useRef, useState } from "react";
import { classNames } from "@calcom/lib";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { App } from "@calcom/types/App";
import type { AppFrontendPayload as App } from "@calcom/types/App";
import type { CredentialFrontendPayload as Credential } from "@calcom/types/Credential";
import { Icon } from "@calcom/ui";
import EmptyScreen from "../EmptyScreen";
@@ -37,7 +37,11 @@ export function useShouldShowArrows() {
return { ref, calculateScroll, leftVisible: showArrowScroll.left, rightVisible: showArrowScroll.right };
}
type AllAppsPropsType = { apps: (App & { credentials: Credential[] | undefined })[]; searchText?: string };
type AllAppsPropsType = {
apps: (App & { credentials?: Credential[] })[];
searchText?: string;
categories: string[];
};
interface CategoryTabProps {
selectedCategory: string | null;
@@ -125,18 +129,12 @@ function CategoryTab({ selectedCategory, categories, searchText }: CategoryTabPr
);
}
export default function AllApps({ apps, searchText }: AllAppsPropsType) {
export default function AllApps({ apps, searchText, categories }: AllAppsPropsType) {
const router = useRouter();
const { t } = useLocale();
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
const [appsContainerRef, enableAnimation] = useAutoAnimate<HTMLDivElement>();
const categories = apps
.map((app) => app.category)
.filter((cat, pos, self) => {
return self.indexOf(cat) === pos;
});
if (searchText) {
enableAnimation && enableAnimation(false);
}
+2 -4
View File
@@ -1,11 +1,11 @@
import type { Credential } from "@prisma/client";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
import { InstallAppButton } from "@calcom/app-store/components";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { App } from "@calcom/types/App";
import { AppFrontendPayload as App } from "@calcom/types/App";
import type { CredentialFrontendPayload as Credential } from "@calcom/types/Credential";
import { Button, Icon } from "../../..";
import { showToast } from "../notifications";
@@ -123,8 +123,6 @@ export default function AppCard({ app, credentials, searchText }: AppCardProps)
},
};
}
props.color;
// ^?
return (
<Button
StartIcon={Icon.FiPlus}
@@ -1,5 +1,5 @@
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { App } from "@calcom/types/App";
import { AppFrontendPayload as App } from "@calcom/types/App";
import AppCard from "./AppCard";
import Slider from "./Slider";