* Abstract app category navigation * Send key schema to frontend Co-authored-by: Omar López <zomars@users.noreply.github.com> * Render keys for apps on admin * Add enabled col for apps * Save app keys to DB * Add checks for admin role * Abstract setup components * Add AdminAppsList to setup wizard * Migrate to v10 tRPC * Default hide keys * Display enabled apps * Merge branch 'main' into admin-apps-ui * Toggle calendars * WIP * Add params and include AppCategoryNavigation * Refactor getEnabledApps * Add warning for disabling apps * Fallback to cal video when a video app is disabled * WIP send disabled email * Send email to all users of event types with payment app * Disable Stripe when app is disabled * Disable apps in event types * Send email to users on disabled apps * Send email based on what app was disabled * WIP type fix * Disable navigation to apps list if already setup * UI import fixes * Waits for session data before redirecting * Updates admin seeded password To comply with admin password requirements * Update yarn.lock * Flex fixes * Adds admin middleware * Clean up * WIP * WIP * NTS * Add dirName to app metadata * Upsert app if not in db * Upsert app if not in db * Add dirName to app metadata * Add keys to app packages w/ keys * Merge with main * Toggle show keys & on enable * Fix empty keys * Fix lark calendar metadata * Fix some type errors * Fix Lark metadata & check for category when upserting * More type fixes * Fix types & add keys to google cal * WIP * WIP * WIP * More type fixes * Fix type errors * Fix type errors * More type fixes * More type fixes * More type fixes * Feedback * Fixes default value * Feedback * Migrate credential invalid col default value "false" * Upsert app on saving keys * Clean up * Validate app keys on frontend * Add nonempty to app keys schemas * Add web3 * Listlocale filter on categories / category * Grab app metadata via category or categories * Show empty screen if no apps are enabled * Fix type checks * Fix type checks * Fix type checks * Fix type checks * Fix type checks * Fix type checks * Replace .nonempty() w/ .min(1) * Fix type error * Address feedback * Added migration to keep current apps enabled * Update apps.tsx * Fix bug * Add keys schema to Plausible app * Add appKeysSchema to zod.ts template * Update AdminAppsList.tsx Co-authored-by: Omar López <zomars@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import { useAutoAnimate } from "@formkit/auto-animate/react";
|
|
import Link from "next/link";
|
|
|
|
import { RouterOutputs } from "@calcom/trpc/react";
|
|
import { Switch } from "@calcom/ui";
|
|
|
|
import { SetAppDataGeneric } from "../EventTypeAppContext";
|
|
import { eventTypeAppCardZod } from "../eventTypeAppCardZod";
|
|
import OmniInstallAppButton from "./OmniInstallAppButton";
|
|
|
|
export default function AppCard({
|
|
app,
|
|
description,
|
|
switchOnClick,
|
|
switchChecked,
|
|
children,
|
|
setAppData,
|
|
}: {
|
|
app: RouterOutputs["viewer"]["apps"][number];
|
|
description?: React.ReactNode;
|
|
switchChecked?: boolean;
|
|
switchOnClick?: (e: boolean) => void;
|
|
children?: React.ReactNode;
|
|
setAppData: SetAppDataGeneric<typeof eventTypeAppCardZod>;
|
|
}) {
|
|
const [animationRef] = useAutoAnimate<HTMLDivElement>();
|
|
|
|
return (
|
|
<div className={`mb-4 mt-2 rounded-md border border-gray-200 ${!app.enabled && "grayscale"}`}>
|
|
<div className="p-4 text-sm sm:p-8">
|
|
<div className="flex w-full flex-col gap-2 sm:flex-row sm:gap-0">
|
|
{/* Don't know why but w-[42px] isn't working, started happening when I started using next/dynamic */}
|
|
<Link href={"/apps/" + app.slug}>
|
|
<a className="mr-3 h-auto w-10 rounded-sm">
|
|
<img className="w-full" src={app?.logo} alt={app?.name} />
|
|
</a>
|
|
</Link>
|
|
<div className="flex flex-col">
|
|
<span className="text-base font-semibold leading-4 text-black">{app?.name}</span>
|
|
<p className="pt-2 text-sm font-normal leading-4 text-gray-600">
|
|
{description || app?.description}
|
|
</p>
|
|
</div>
|
|
{app?.isInstalled ? (
|
|
<div className="ml-auto flex items-center">
|
|
<Switch
|
|
disabled={!app.enabled}
|
|
onCheckedChange={(enabled) => {
|
|
if (switchOnClick) {
|
|
switchOnClick(enabled);
|
|
}
|
|
setAppData("enabled", enabled);
|
|
}}
|
|
checked={switchChecked}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<OmniInstallAppButton className="ml-auto flex items-center" appId={app.slug} />
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div ref={animationRef}>
|
|
{app?.isInstalled && switchChecked && <hr />}
|
|
{app?.isInstalled && switchChecked ? <div className="p-4 text-sm sm:px-8">{children}</div> : null}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|