Feat: v2 App Store / Installed Apps (#4220)

* First commit

* Additional changes to meet designs

* Fixing app details disconnect button
App Store category filtering fixed

* Further changes for the fix

* Progress on various fronts

* Fixing e2e tests

* second try fixing e2e tests

* Yet again trying to fix e2e tests

* Missing action for non-credential flow

* Adding missing Add button

* Final tweaks and fixes

* Missing button in empty screen

* fix border radius

* EmptyScreen for calendar

* Dynamic installed app return page with highlights + other fixes

* Removing unneeded code

* App Store V2 Improvements over feat/v2-installed-apps (#4379)

* Removing unneeded text

* Fixing app details disconnect button and number of apps (#4305)

* V2 Settings Shell - Add Teams Section & UI fixes (#4347)

* Add teams to sidebar and fix UI

* Clean up

* V2 Multi-select (Team Select) (#4324)

* --init

* design improved

* further fine tuning

* more fixes

* removed extra JSX tag

* added story

* NIT

* revert to use of CheckedTeamSelect

* Removes comments

Co-authored-by: Peer Richelsen <[email protected]>

* fix: toggle alligment (#4361)

* fix: add checked tranform for switch (#4357)

* fixed input size on mobile, fixed settings (#4360)

* fixing type errors

* Mobile fixes

* Tests fixes

Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: zomars <[email protected]>

* Feat/team owner booking (#3999)

* WIP: testing queries

* feat: add badge

* fix: get only id

* refactor: get bookings query

* WIP: display attendees added

* fix: add type

* Adds skeleton loader to workflows (#4402)

* fix event types skeleton loader

* fix margin in event types

* fix skeleton loader in bookings

* add skeleton loader for workflow list

* add skeleton loader for editing page

* fix border radius of skeleton loader

* fix mobile view workflow list

* add mobile view for skeleton list

* make multi select full with in mobile view

* mobile view for edit skeleton loader

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* V2 settings teams (Profil, Members, Appearance View) (#4350)

* add team profile

* first version for team members page

* finish up design of member list item

* fix dialog buttons

* add missing seats and upgrading information

* add v2 dialog for changing role

* finish basic version of member's schedule

* remove modalContainer

* design fixes team profile page

* show only team info to non admins

* allow all member to check availabilities

* make time available heading sticky

* add dropdown for mobile view

* create team appearance view

* finish appearance page

* use settings layout and add danger zone for member

* add fallback logo

* Add teams to sidebar and fix UI

* add team invitations

* Clean up

* code clean up

* add impersontation and disable autofocus on calendar

* improve team info

* refactor teaminvitelist code and fix leaving a team

* add team pages to settings shell

* add link to create new team

* small fixes

* clean up comments

* V2 Multi-select (Team Select) (#4324)

* --init

* design improved

* further fine tuning

* more fixes

* removed extra JSX tag

* added story

* NIT

* revert to use of CheckedTeamSelect

* Removes comments

Co-authored-by: Peer Richelsen <[email protected]>

* fix: toggle alligment (#4361)

* fix: add checked tranform for switch (#4357)

* fixed input size on mobile, fixed settings (#4360)

* fix image uploader button in safari

* code clean up

* fixing type errors

* Moved v2 team components to features

Adds deprecation notices

* Update SettingsLayout.tsx

* Migrated to features and build fixes

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: zomars <[email protected]>

* add rainbowkit form to v2 event-types (#4349)

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

* v1.9.5

* Fix/daterangepicker css (#4418)

* added styles from external stylesheet

* fixed a border color

* codacy improvements

* more codacy fix

* codacy why u be so dumb

* dynamic import rainbow (only if installed) (#4409)

* Tidyup app cards (#4428)

* Moving API to trpc query

Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: hexcowboy <[email protected]>
Co-authored-by: sean-brydon <[email protected]>

* Abstracting one level the redirectUrl for apps

* Moving enum to a better/working place

* Another try

* Missing code

* Correcting categories look in apps page

* ui tweaks

* Breadcrumb wrong font-weight

* Toast is v1 component and copy updated

* Fix TS error

* Fix TS error

* Update AppsLayout.tsx

* Update InstalledAppsLayout.tsx

* translations and disconnect button with icon

* Reverting file

* Test e2e fix on app-store

* Missing testid in button

* Fix to click categories that are visible

* Going directly to category page as a patch

* Fixing stripe e2e test

* Disconnect is now empty with icon

* Disabled stripe test for now as the navigation is completely changed

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: hexcowboy <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
68 files changed
+1284 -231

No files matched your search

+1 -1
View File
@@ -112,7 +112,7 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
)}
<div>
{props.title && <DialogHeader title={props.title} />}
{props.description && <p className="mb-6 text-sm text-gray-500">Optional Description</p>}
{props.description && <p className="mb-6 text-sm text-gray-500">{props.description}</p>}
</div>
</div>
)}
+25 -7
View File
@@ -376,7 +376,7 @@ function UserDropdown({ small }: { small?: boolean }) {
);
}
type NavigationItemType = {
export type NavigationItemType = {
name: string;
href: string;
icon?: SVGComponent;
@@ -417,16 +417,32 @@ const navigation: NavigationItemType[] = [
icon: Icon.FiGrid,
isCurrent: ({ router, item }) => {
const path = router.asPath.split("?")[0];
return !!item.child?.some((child) => path === child.href);
// During Server rendering path is /v2/apps but on client it becomes /apps(weird..)
return (
(path.startsWith(item.href) || path.startsWith("/v2" + item.href)) && !path.includes("routing_forms/")
);
},
child: [
{
name: "app_store",
href: "/apps",
isCurrent: ({ router, item }) => {
const path = router.asPath.split("?")[0];
// During Server rendering path is /v2/apps but on client it becomes /apps(weird..)
return (
(path.startsWith(item.href) || path.startsWith("/v2" + item.href)) &&
!path.includes("routing_forms/") &&
!path.includes("/installed")
);
},
},
{
name: "installed_apps",
href: "/apps/installed",
href: "/apps/installed/calendar",
isCurrent: ({ router }) => {
const path = router.asPath;
return path.startsWith("/apps/installed/") || path.startsWith("/v2/apps/installed/");
},
},
],
},
@@ -538,7 +554,6 @@ const NavigationItem: React.FC<{
</Link>
{item.child &&
isCurrent({ router, isChild, item }) &&
router.asPath.startsWith(item.href) &&
item.child.map((item) => <NavigationItem key={item.name} item={item} isChild />)}
</Fragment>
);
@@ -648,7 +663,10 @@ function DeploymentInfo() {
function SideBarContainer() {
const { status } = useSession();
const router = useRouter();
if (status !== "authenticated") return null;
// Make sure that Sidebar is rendered optimistically so that a refresh of pages when logged in have SideBar from the beginning.
// This improves the experience of refresh on app store pages(when logged in) which are SSG.
// Though when logged out, app store pages would temporarily show SideBar until session status is confirmed.
if (status !== "loading" && status !== "authenticated") return null;
if (router.route.startsWith("/v2/settings/")) return null;
return <SideBar />;
}
@@ -735,12 +753,12 @@ export function ShellMain(props: LayoutProps) {
<div className="hidden w-full ltr:mr-4 rtl:ml-4 sm:block">
{props.heading && (
<h1 className="font-cal mb-1 text-xl font-bold capitalize tracking-wide text-black">
{!isLocaleReady ? null : props.heading}
{!isLocaleReady ? <SkeletonText invisible /> : props.heading}
</h1>
)}
{props.subtitle && (
<p className="hidden text-sm text-neutral-500 sm:block">
{!isLocaleReady ? null : props.subtitle}
{!isLocaleReady ? <SkeletonText invisible /> : props.subtitle}
</p>
)}
</div>
+14 -6
View File
@@ -86,8 +86,8 @@ export default function AllApps({ apps }: AllAppsPropsType) {
router.replace(router.asPath.split("?")[0], undefined, { shallow: true });
}}
className={classNames(
selectedCategory === null ? "bg-gray-200" : "bg-gray-50",
"rounded-md px-4 py-2.5 text-sm font-medium text-gray-900 hover:cursor-pointer hover:bg-gray-200"
selectedCategory === null ? "bg-gray-900 text-gray-50" : "bg-gray-50 text-gray-900",
"rounded-md px-4 py-2.5 text-sm font-medium hover:cursor-pointer hover:bg-gray-900 hover:text-gray-50"
)}>
{t("all_apps")}
</li>
@@ -104,8 +104,8 @@ export default function AllApps({ apps }: AllAppsPropsType) {
}
}}
className={classNames(
selectedCategory === cat ? "bg-gray-200" : "bg-gray-50",
"rounded-md px-4 py-2.5 text-sm font-medium text-gray-900 hover:cursor-pointer hover:bg-gray-200"
selectedCategory === cat ? "bg-gray-900 text-gray-50" : "bg-gray-50 text-gray-900",
"rounded-md px-4 py-2.5 text-sm font-medium hover:cursor-pointer hover:bg-gray-900 hover:text-gray-50"
)}>
{cat[0].toUpperCase() + cat.slice(1)}
</li>
@@ -120,9 +120,17 @@ export default function AllApps({ apps }: AllAppsPropsType) {
</div>
)}
</div>
<div className="grid grid-cols-2 gap-3 md:grid-cols-4" ref={appsContainerRef}>
<div
className="grid gap-3 lg:grid-cols-4 [@media(max-width:1270px)]:grid-cols-3 [@media(max-width:730px)]:grid-cols-2 [@media(max-width:500px)]:grid-cols-1"
ref={appsContainerRef}>
{apps
.filter((app) => (selectedCategory !== null ? app.category === selectedCategory : true))
.filter((app) =>
selectedCategory !== null
? app.categories
? app.categories.includes(selectedCategory)
: app.category === selectedCategory
: true
)
.map((app) => (
<AppCard key={app.name} app={app} credentials={app.credentials} />
))}
+13 -4
View File
@@ -9,6 +9,8 @@ import { App } from "@calcom/types/App";
import { Icon } from "@calcom/ui/Icon";
import Button from "@calcom/ui/v2/core/Button";
import { SkeletonText } from "../skeleton";
interface AppCardProps {
app: App;
credentials?: Credential[];
@@ -16,7 +18,7 @@ interface AppCardProps {
export default function AppCard({ app, credentials }: AppCardProps) {
const { t } = useLocale();
const { isLocaleReady } = useLocale();
const mutation = useAddAppMutation(null, {
onSuccess: () => {
showToast(t("app_successfully_installed"), "success");
@@ -64,16 +66,21 @@ export default function AppCard({ app, credentials }: AppCardProps) {
<InstallAppButton
type={app.type}
isProOnly={app.isProOnly}
wrapperClassName="[@media(max-width:260px)]:w-full"
render={({ useDefaultComponent, ...props }) => {
if (useDefaultComponent) {
props = {
onClick: () => {
mutation.mutate({ type: app.type });
mutation.mutate({ type: app.type, variant: app.variant, slug: app.slug });
},
};
}
return (
<Button color="secondary" StartIcon={Icon.FiPlus} {...props}>
<Button
color="secondary"
className="[@media(max-width:260px)]:w-full [@media(max-width:260px)]:justify-center"
StartIcon={Icon.FiPlus}
{...props}>
{t("install")}
</Button>
);
@@ -85,11 +92,12 @@ export default function AppCard({ app, credentials }: AppCardProps) {
<InstallAppButton
type={app.type}
isProOnly={app.isProOnly}
wrapperClassName="[@media(max-width:260px)]:w-full"
render={({ useDefaultComponent, ...props }) => {
if (useDefaultComponent) {
props = {
onClick: () => {
mutation.mutate({ type: app.type });
mutation.mutate({ type: app.type, variant: app.variant, slug: app.slug });
},
};
}
@@ -97,6 +105,7 @@ export default function AppCard({ app, credentials }: AppCardProps) {
<Button
StartIcon={Icon.FiPlus}
color="secondary"
className="[@media(max-width:260px)]:w-full [@media(max-width:260px)]:justify-center"
data-testid="install-app-button"
{...props}>
{t("install")}
+11 -5
View File
@@ -3,6 +3,7 @@ import { ArrowRight } from "react-feather";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SkeletonText } from "../skeleton";
import Slider from "./Slider";
export default function AppStoreCategories({
@@ -13,7 +14,7 @@ export default function AppStoreCategories({
count: number;
}[];
}) {
const { t } = useLocale();
const { t, isLocaleReady } = useLocale();
return (
<div className="mb-16">
<Slider
@@ -33,11 +34,16 @@ export default function AppStoreCategories({
<Link key={category.name} href={"/apps/categories/" + category.name}>
<a
data-testid={`app-store-category-${category.name}`}
className="relative flex rounded-sm bg-gray-100 px-6 py-4 sm:block">
<div className="self-center">
<h3 className="font-medium capitalize">{category.name}</h3>
className="relative flex rounded-md"
style={{ background: "radial-gradient(farthest-side at top right, #a2abbe 0%, #E3E3E3 100%)" }}>
<div className="w-full self-center bg-[url('/noise.svg')] bg-cover bg-center bg-no-repeat px-6 py-4">
{isLocaleReady ? (
<h3 className="font-medium capitalize">{category.name}</h3>
) : (
<SkeletonText invisible />
)}
<p className="text-sm text-gray-500">
{t("number_apps", { count: category.count })}{" "}
{isLocaleReady ? t("number_apps", { count: category.count }) : <SkeletonText invisible />}{" "}
<ArrowRight className="inline-block h-4 w-4" />
</p>
</div>
+12 -5
View File
@@ -3,8 +3,11 @@ import "@glidejs/glide/dist/css/glide.core.min.css";
import "@glidejs/glide/dist/css/glide.theme.min.css";
import { useEffect, useRef } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Icon } from "@calcom/ui/Icon";
import { SkeletonText } from "../skeleton";
const Slider = <T extends string | unknown>({
title = "",
className = "",
@@ -22,7 +25,7 @@ const Slider = <T extends string | unknown>({
}) => {
const glide = useRef(null);
const slider = useRef<Glide.Properties | null>(null);
const { isLocaleReady } = useLocale();
useEffect(() => {
if (glide.current) {
slider.current = new Glide(glide.current, {
@@ -45,10 +48,14 @@ const Slider = <T extends string | unknown>({
</style>
<div className="glide" ref={glide}>
<div className="flex cursor-default">
{title && (
<div>
<h2 className="mt-0 mb-2 text-lg font-semibold text-gray-900">{title}</h2>
</div>
{isLocaleReady ? (
title && (
<div>
<h2 className="mt-0 mb-2 text-lg font-semibold text-gray-900">{title}</h2>
</div>
)
) : (
<SkeletonText className="h-4 w-24" />
)}
<div className="glide__arrows ml-auto" data-glide-el="controls">
<button data-glide-dir="<" className="mr-4">
+2 -3
View File
@@ -1,9 +1,8 @@
import React, { ComponentProps } from "react";
import HorizontalTabs from "@calcom/ui/v2/core/navigation/tabs/HorizontalTabs";
import Shell from "../Shell";
import { HorizontalTabItemProps } from "../navigation/tabs/HorizontalTabItem";
import type { HorizontalTabItemProps } from "../navigation/tabs/HorizontalTabItem";
import HorizontalTabs from "../navigation/tabs/HorizontalTabs";
const tabs: HorizontalTabItemProps[] = [
{
@@ -0,0 +1,62 @@
import React, { ComponentProps } from "react";
import { InstalledAppVariants } from "@calcom/app-store/utils";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "../../../Icon";
import Shell from "../Shell";
import type { HorizontalTabItemProps } from "../navigation/tabs/HorizontalTabItem";
import HorizontalTabs from "../navigation/tabs/HorizontalTabs";
import type { VerticalTabItemProps } from "../navigation/tabs/VerticalTabItem";
import VerticalTabs from "../navigation/tabs/VerticalTabs";
const tabs: (VerticalTabItemProps | HorizontalTabItemProps)[] = [
{
name: "calendar",
href: "/apps/installed/calendar",
icon: Icon.FiCalendar,
},
{
name: "conferencing",
href: "/apps/installed/conferencing",
icon: Icon.FiVideo,
},
{
name: "payment",
href: "/apps/installed/payment",
icon: Icon.FiCreditCard,
},
{
name: "other",
href: "/apps/installed/other",
icon: Icon.FiGrid,
},
];
export default function InstalledAppsLayout({
children,
...rest
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
const query = trpc.useQuery([
"viewer.integrations",
{ variant: InstalledAppVariants.payment, onlyInstalled: true },
]);
let actualTabs = tabs;
if (query.data?.items.length === 0) {
actualTabs = tabs.filter((tab) => tab.name !== InstalledAppVariants.payment);
}
return (
<Shell {...rest}>
<div className="mt-10 flex flex-col p-2 md:p-0 xl:flex-row">
<div className="hidden xl:block">
<VerticalTabs tabs={actualTabs} sticky />
</div>
<div className="block xl:hidden">
<HorizontalTabs tabNameKey="tabName" tabs={actualTabs} />
</div>
<main className="w-full xl:mx-5 xl:w-4/5 xl:pr-5">{children}</main>
</div>
</Shell>
);
}
export const getLayout = (page: React.ReactElement) => <InstalledAppsLayout>{page}</InstalledAppsLayout>;
@@ -6,6 +6,8 @@ import { MouseEventHandler } from "react";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SkeletonText } from "../../skeleton";
export type HorizontalTabItemProps<T extends string = "tabName"> = {
name: string;
disabled?: boolean;
@@ -28,7 +30,7 @@ const HorizontalTabItem = function <T extends string>({
tabNameKey?: T;
}) {
const router = useRouter();
const { t } = useLocale();
const { t, isLocaleReady } = useLocale();
let newHref = "";
let isCurrent;
const _tabNameKey = tabNameKey || "tabName";
@@ -36,7 +38,7 @@ const HorizontalTabItem = function <T extends string>({
if (href) {
newHref = href;
isCurrent = router.asPath === href;
isCurrent = router.asPath.startsWith(href);
} else if (tabName) {
newHref = "";
isCurrent = router.query[_tabNameKey] === tabName;
@@ -65,7 +67,7 @@ const HorizontalTabItem = function <T extends string>({
props.className
)}
aria-current={isCurrent ? "page" : undefined}>
{t(name)}
{isLocaleReady ? t(name) : <SkeletonText className="h-4 w-24" />}
</a>
</Link>
);
@@ -50,7 +50,7 @@ const VerticalTabItem = function <T extends string>({
const _tabNameKey = tabNameKey || "tabName";
if (href) {
newHref = href;
isCurrent = router.asPath === href;
isCurrent = router.asPath.startsWith(href);
} else if (tabName) {
newHref = "";
isCurrent = router.query[_tabNameKey] === tabName;
+7 -3
View File
@@ -14,12 +14,16 @@ const SkeletonAvatar: React.FC<SkeletonBaseProps> = ({ className }) => {
return <div className={classNames(`mt-1 rounded-full bg-gray-200 ltr:mr-2 rtl:ml-2`, className)} />;
};
const SkeletonText: React.FC<SkeletonBaseProps> = ({ className = "" }) => {
const SkeletonText: React.FC<SkeletonBaseProps & { invisible?: boolean }> = ({
className = "",
invisible = false,
}) => {
return (
<span
className={classNames(
`font-size-0 dark:white-300 inline-block animate-pulse rounded-md bg-gray-300 empty:before:inline-block empty:before:content-['']`,
className
className,
invisible ? "invisible" : ""
)}
/>
);
@@ -28,7 +32,7 @@ const SkeletonText: React.FC<SkeletonBaseProps> = ({ className = "" }) => {
const SkeletonButton: React.FC<SkeletonBaseProps> = ({ className }) => {
return (
<SkeletonContainer>
<div className={classNames(`bg-gray-200`, className)} />
<div className={classNames(`rounded-md bg-gray-200`, className)} />
</SkeletonContainer>
);
};
@@ -12,12 +12,14 @@ export default function DisconnectIntegration({
label,
trashIcon,
isGlobal,
onSuccess,
buttonProps,
}: {
credentialId: number;
label?: string;
trashIcon?: boolean;
isGlobal?: boolean;
onSuccess?: () => void;
buttonProps?: ButtonProps;
}) {
const { t } = useLocale();
@@ -25,11 +27,12 @@ export default function DisconnectIntegration({
const mutation = trpc.useMutation("viewer.deleteCredential", {
onSuccess: () => {
showToast("Integration deleted successfully", "success");
showToast(t("app_removed_successfully"), "success");
setModalOpen(false);
onSuccess && onSuccess();
},
onError: () => {
showToast("Error deleting app", "error");
showToast(t("error_removing_app"), "error");
setModalOpen(false);
},
});
@@ -41,16 +44,17 @@ export default function DisconnectIntegration({
<Button
color={buttonProps?.color || "destructive"}
StartIcon={trashIcon ? Icon.FiTrash : undefined}
size={trashIcon && !label ? "icon" : "base"}
disabled={isGlobal}
{...buttonProps}>
{label}
{label && label}
</Button>
</DialogTrigger>
<DialogContent
title="Remove app"
description="Are you sure you want to remove this app?"
title={t("remove_app")}
description={t("are_you_sure_you_want_to_remove_this_app")}
type="confirmation"
actionText="Yes, remove app"
actionText={t("yes_remove_app")}
Icon={Icon.FiAlertCircle}
actionOnClick={() => mutation.mutate({ id: credentialId })}
/>