refactor: move AppList to features with slot props (#28100)
* refactor: move AppSetDefaultLinkDialog to features + inline QueryCell + fix broken type import Co-Authored-By: [email protected] <[email protected]> * refactor: move AppList to features with slot props + delete AppListCard switcher Co-Authored-By: [email protected] <[email protected]> * fix: correct ConnectedApps type to avoid double nesting of items Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: bot_apk <[email protected]>
This commit is contained in:
10 files changed
+104
-133
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import type { AppListCardProps } from "@calcom/ui/components/app-list-card";
|
||||
import { AppListCard } from "@calcom/ui/components/app-list-card";
|
||||
|
||||
export default function AppListCardPlatformWrapper(props: AppListCardProps) {
|
||||
const logo = `https://app.cal.com${props.logo}`;
|
||||
return <AppListCard {...props} logo={logo} />;
|
||||
}
|
||||
+53
-55
@@ -1,11 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import AccountDialog from "@calcom/app-store/office365video/components/AccountDialog";
|
||||
import { AppList } from "@calcom/features/apps/components/AppList";
|
||||
import type { UpdateUsersDefaultConferencingAppParams } from "@calcom/features/apps/components/AppSetDefaultLinkDialog";
|
||||
import DisconnectIntegrationModal from "@calcom/features/apps/components/DisconnectIntegrationModal";
|
||||
import type { BulkUpdatParams } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
|
||||
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { GOOGLE_MEET, OFFICE_365_VIDEO, ZOOM } from "@calcom/platform-constants";
|
||||
import { QueryCell } from "@calcom/trpc/components/QueryCell";
|
||||
import type { App } from "@calcom/types/App";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import {
|
||||
@@ -17,16 +19,12 @@ import {
|
||||
} from "@calcom/ui/components/dropdown";
|
||||
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
||||
import { SkeletonContainer, SkeletonText } from "@calcom/ui/components/skeleton";
|
||||
import { AppList } from "@calcom/web/modules/apps/components/AppList";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useReducer, useState } from "react";
|
||||
import { AtomsWrapper } from "../../src/components/atoms-wrapper";
|
||||
import { useToast } from "../../src/components/ui/use-toast";
|
||||
import { cn } from "../../src/lib/utils";
|
||||
import type {
|
||||
BulkUpdatParams,
|
||||
UpdateUsersDefaultConferencingAppParams,
|
||||
} from "./ConferencingAppsViewWebWrapper";
|
||||
import AppListCardPlatformWrapper from "./AppListCardPlatformWrapper";
|
||||
import { useAtomBulkUpdateEventTypesToDefaultLocation } from "./hooks/useAtomBulkUpdateEventTypesToDefaultLocation";
|
||||
import { useAtomGetEventTypes } from "./hooks/useAtomGetEventTypes";
|
||||
import {
|
||||
@@ -286,56 +284,56 @@ export const ConferencingAppsViewPlatformWrapper = ({
|
||||
borderInShellHeader={true}>
|
||||
<>
|
||||
<div className="bg-default w-full sm:mx-0 xl:mt-0">
|
||||
<QueryCell
|
||||
query={installedIntegrationsQuery}
|
||||
customLoader={<SkeletonLoader className={customClassNames?.skeletonClassName} />}
|
||||
success={({ data }) => {
|
||||
if (!data.items.length) {
|
||||
return (
|
||||
<EmptyScreen
|
||||
Icon="calendar"
|
||||
headline={t("no_category_apps", {
|
||||
category: t("conferencing").toLowerCase(),
|
||||
})}
|
||||
description={t("no_category_apps_description_conferencing")}
|
||||
buttonRaw={
|
||||
<AddConferencingButtonPlatform
|
||||
installedApps={data?.items}
|
||||
buttonClassName={customClassNames?.addButtonClassName}
|
||||
dropdownClassName={customClassNames?.addDropdownClassName}
|
||||
/>
|
||||
}
|
||||
className={customClassNames?.emptyScreenClassName}
|
||||
iconWrapperClassName={customClassNames?.emptyScreenIconWrapperClassName}
|
||||
iconClassName={customClassNames?.emptyScreenIconClassName}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<AppList
|
||||
listClassName={cn(
|
||||
"rounded-lg rounded-t-none border-t-0 max-w-full",
|
||||
customClassNames?.appListClassName
|
||||
)}
|
||||
appCardClassName={customClassNames?.appCardClassName}
|
||||
appCardMenuClassName={customClassNames?.appCardMenuClassName}
|
||||
handleDisconnect={handleDisconnect}
|
||||
data={data}
|
||||
variant="conferencing"
|
||||
defaultConferencingApp={defaultConferencingApp}
|
||||
handleUpdateUserDefaultConferencingApp={handleUpdateUserDefaultConferencingApp}
|
||||
handleBulkUpdateDefaultLocation={handleBulkUpdateDefaultLocation}
|
||||
isBulkUpdateDefaultLocationPending={bulkUpdateEventTypesToDefaultLocation?.isPending}
|
||||
eventTypes={eventTypesQuery?.eventTypes}
|
||||
isEventTypesFetching={isEventTypesFetching}
|
||||
handleConnectDisconnectIntegrationMenuToggle={
|
||||
handleConnectDisconnectIntegrationMenuToggle
|
||||
}
|
||||
handleBulkEditDialogToggle={handleBulkEditDialogToggle}
|
||||
{installedIntegrationsQuery.status === "pending" ? (
|
||||
<SkeletonLoader className={customClassNames?.skeletonClassName} />
|
||||
) : installedIntegrationsQuery.status === "error" ? (
|
||||
<EmptyScreen
|
||||
Icon="calendar"
|
||||
headline={t("no_category_apps", {
|
||||
category: t("conferencing").toLowerCase(),
|
||||
})}
|
||||
description={t("no_category_apps_description_conferencing")}
|
||||
/>
|
||||
) : !installedIntegrationsQuery.data.items.length ? (
|
||||
<EmptyScreen
|
||||
Icon="calendar"
|
||||
headline={t("no_category_apps", {
|
||||
category: t("conferencing").toLowerCase(),
|
||||
})}
|
||||
description={t("no_category_apps_description_conferencing")}
|
||||
buttonRaw={
|
||||
<AddConferencingButtonPlatform
|
||||
installedApps={installedIntegrationsQuery.data?.items}
|
||||
buttonClassName={customClassNames?.addButtonClassName}
|
||||
dropdownClassName={customClassNames?.addDropdownClassName}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
className={customClassNames?.emptyScreenClassName}
|
||||
iconWrapperClassName={customClassNames?.emptyScreenIconWrapperClassName}
|
||||
iconClassName={customClassNames?.emptyScreenIconClassName}
|
||||
/>
|
||||
) : (
|
||||
<AppList
|
||||
listClassName={cn(
|
||||
"rounded-lg rounded-t-none border-t-0 max-w-full",
|
||||
customClassNames?.appListClassName
|
||||
)}
|
||||
appCardClassName={customClassNames?.appCardClassName}
|
||||
appCardMenuClassName={customClassNames?.appCardMenuClassName}
|
||||
handleDisconnect={handleDisconnect}
|
||||
data={installedIntegrationsQuery.data}
|
||||
variant="conferencing"
|
||||
defaultConferencingApp={defaultConferencingApp}
|
||||
handleUpdateUserDefaultConferencingApp={handleUpdateUserDefaultConferencingApp}
|
||||
handleBulkUpdateDefaultLocation={handleBulkUpdateDefaultLocation}
|
||||
isBulkUpdateDefaultLocationPending={bulkUpdateEventTypesToDefaultLocation?.isPending}
|
||||
eventTypes={eventTypesQuery?.eventTypes}
|
||||
isEventTypesFetching={isEventTypesFetching}
|
||||
handleConnectDisconnectIntegrationMenuToggle={handleConnectDisconnectIntegrationMenuToggle}
|
||||
handleBulkEditDialogToggle={handleBulkEditDialogToggle}
|
||||
AppListCardComponent={AppListCardPlatformWrapper}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<DisconnectIntegrationModal
|
||||
handleModelClose={handleModelClose}
|
||||
|
||||
Reference in new issue
Block a user