// @ts-strict-ignore import { useAppListContext } from "@dashboard/apps/context"; import { GetV2SaleorAppsResponse } from "@dashboard/apps/marketplace.types"; import { getAppDetails, resolveInstallationOfMarketplaceApp, } from "@dashboard/apps/utils"; import { AppInstallationFragment } from "@dashboard/graphql"; import { Box } from "@saleor/macaw-ui/next"; import React from "react"; import { useIntl } from "react-intl"; import AppListCardActions from "./AppListCardActions"; import AppListCardDescription from "./AppListCardDescription"; import AppListCardIntegrations from "./AppListCardIntegrations"; import AppListCardLinks from "./AppListCardLinks"; interface AppListRowProps { appPair: GetV2SaleorAppsResponse.SaleorApp[]; appInstallationList?: AppInstallationFragment[]; navigateToAppInstallPage?: (manifestUrl: string) => void; navigateToGithubForkPage?: (githubForkUrl: string) => void; } const AppListRow: React.FC = ({ appPair, appInstallationList, navigateToAppInstallPage, navigateToGithubForkPage, }) => { const intl = useIntl(); const { retryAppInstallation, removeAppInstallation } = useAppListContext(); const isSingleApp = appPair.length === 1; const appDetails = React.useCallback( (app: GetV2SaleorAppsResponse.SaleorApp) => getAppDetails({ intl, app, appInstallation: resolveInstallationOfMarketplaceApp( app, appInstallationList, ), navigateToAppInstallPage, navigateToGithubForkPage, retryAppInstallation, removeAppInstallation, }), [ appInstallationList, intl, navigateToAppInstallPage, navigateToGithubForkPage, removeAppInstallation, retryAppInstallation, ], ); return ( {appPair.map(app => ( ))} {appPair.map(app => ( ))} {appPair.map(app => { if (appPair.every(app => !app.integrations?.length)) { return null; } return ( ); })} {appPair.map(app => { const { releaseDate, installationPending, installHandler, githubForkHandler, retryInstallHandler, removeInstallHandler, } = appDetails(app); return ( ); })} ); }; AppListRow.displayName = "AppListRow"; export default AppListRow;