Installed Apps page revamp (#2751)

* First round of changes

* Some missing styling

* Last round of core changes

* Color tweaks

* Improving code readability

* Reverting unneeded changes

* Reverting yarn.lock

* Removing yarn.lock

* Empty state updated

* Fixing webhook test

* Cleaning up code

* Fixing test and simplifying code a bit

* Merging API Keys into developer section

* Unifying Empty Screen with monorepo version

* Cleaning up

* Installed apps logic consistency + cleaning up

* Type fixes

* Apply suggestions from code review

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

* Improvements, still WIP

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

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

* Apply suggestions from code review

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

* App active install status

* Apple Calendar setup, Daily.co preinstalled

* Final pass

* Minor tweaks

* Conflicts with migration ignored

* Fixing merge

* Fixing merge yet again

* Adopting main changes

* Removing unneeded data-testid

* Fixing reported bugs

* Simplifying webhook query

* Moving teams settings tab to second

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: zomars <[email protected]>
Co-authored-by: alannnc <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-06-01 14:24:41 -03:00
1 parent 6179b0cc56
commit 33a45a8af5
40 files changed
+605 -894

No files matched your search

@@ -1,16 +1,15 @@
import classNames from "classnames";
import Image from "next/image";
import { PlusIcon } from "@heroicons/react/solid";
import { useState } from "react";
import Button from "@calcom/ui/Button";
import { Dialog, DialogContent } from "@calcom/ui/Dialog";
import { QueryCell } from "@lib/QueryCell";
import { useLocale } from "@lib/hooks/useLocale";
import { trpc } from "@lib/trpc";
import { List, ListItem, ListItemText, ListItemTitle } from "@components/List";
import { List } from "@components/List";
import { ShellSubHeading } from "@components/Shell";
import SkeletonLoader from "@components/apps/SkeletonLoader";
import WebhookDialogForm from "@components/webhook/WebhookDialogForm";
import WebhookListItem, { TWebhook } from "@components/webhook/WebhookListItem";
@@ -21,47 +20,35 @@ export type WebhookListContainerType = {
};
export default function WebhookListContainer(props: WebhookListContainerType) {
const { t } = useLocale();
const query = props.eventTypeId
? trpc.useQuery(["viewer.webhook.list", { eventTypeId: props.eventTypeId }], {
suspense: true,
})
: trpc.useQuery(["viewer.webhook.list"], {
suspense: true,
});
const query = trpc.useQuery(["viewer.webhook.list", { eventTypeId: props.eventTypeId }], {
suspense: true,
});
const [newWebhookModal, setNewWebhookModal] = useState(false);
const [editModalOpen, setEditModalOpen] = useState(false);
const [editing, setEditing] = useState<TWebhook | null>(null);
return (
<QueryCell
query={query}
customLoader={<SkeletonLoader />}
success={({ data }) => (
<>
<ShellSubHeading className="mt-10" title={props.title} subtitle={props.subtitle} />
<List>
<ListItem className={classNames("flex-col")}>
<div
className={classNames("flex w-full flex-1 items-center space-x-2 p-3 rtl:space-x-reverse")}>
<Image width={40} height={40} src="/apps/webhooks.svg" alt="Webhooks" />
<div className="flex-grow truncate pl-2">
<ListItemTitle component="h3">Webhooks</ListItemTitle>
<ListItemText component="p">{t("automation")}</ListItemText>
</div>
<div>
<Button
color="secondary"
onClick={() => setNewWebhookModal(true)}
data-testid="new_webhook">
{t("new_webhook")}
</Button>
</div>
</div>
</ListItem>
</List>
<div className="border-b border-gray-200 py-8 pl-2 pr-1">
<ShellSubHeading
className="mt-2"
title={props.title}
subtitle={props.subtitle}
actions={
<Button
color="secondary"
size="icon"
StartIcon={PlusIcon}
onClick={() => setNewWebhookModal(true)}
data-testid="new_webhook"
/>
}
/>
{data.length ? (
<List>
<List className="mt-6">
{data.map((item) => (
<WebhookListItem
key={item.id}
@@ -97,7 +84,7 @@ export default function WebhookListContainer(props: WebhookListContainerType) {
)}
</DialogContent>
</Dialog>
</>
</div>
)}
/>
);
@@ -23,14 +23,14 @@ export default function WebhookListItem(props: { webhook: TWebhook; onEditWebhoo
});
return (
<ListItem className="-mt-px flex w-full p-4">
<ListItem className={classNames("flex w-full p-4", props.webhook.active ? "bg-white" : "bg-gray-100")}>
<div className="flex w-full justify-between">
<div className="flex max-w-full flex-col truncate">
<div className="flex space-y-1">
<span
className={classNames(
"truncate text-sm",
props.webhook.active ? "text-neutral-700" : "text-neutral-200"
props.webhook.active ? "text-neutral-700" : "text-neutral-400"
)}>
{props.webhook.subscriberUrl}
</span>
@@ -41,8 +41,8 @@ export default function WebhookListItem(props: { webhook: TWebhook; onEditWebhoo
<span
key={ind}
className={classNames(
"w-max rounded-sm px-1 text-xs ",
props.webhook.active ? "bg-blue-100 text-blue-700" : "bg-blue-50 text-blue-200"
"w-max rounded-sm px-1 text-xs",
props.webhook.active ? "text-grey-200 bg-gray-200" : "bg-grey-50 text-neutral-400"
)}>
{t(`${eventTrigger.toLowerCase()}`)}
</span>