import { Card, Switch, TableBody, TableCell, Typography, } from "@material-ui/core"; import { AppManifestTableDisplay } from "@saleor/apps/components/AppManifestTableDisplay/AppManifestTableDisplay"; import { InstallWithManifestFormButton } from "@saleor/apps/components/InstallWithManifestFormButton"; import { useAppListContext } from "@saleor/apps/context"; import { appUrl, createAppInstallUrl } from "@saleor/apps/urls"; import { isAppInTunnel } from "@saleor/apps/utils"; import CardTitle from "@saleor/components/CardTitle"; import { IconButton } from "@saleor/components/IconButton"; import { TableButtonWrapper } from "@saleor/components/TableButtonWrapper/TableButtonWrapper"; import TableRowLink from "@saleor/components/TableRowLink"; import { AppListItemFragment, AppsListQuery } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import { DeleteIcon, ResponsiveTable } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; import { ListProps } from "@saleor/types"; import React, { useCallback } from "react"; import { FormattedMessage } from "react-intl"; import { useStyles } from "../../styles"; import { AppPermissions } from "../AppPermissions/AppPermissions"; import AppsSkeleton from "../AppsSkeleton"; export interface InstalledAppsProps extends ListProps { appsList: AppsListQuery["apps"]["edges"]; onRemove: (id: string) => void; displayQuickManifestButton?: boolean; title: string; } const InstalledApps: React.FC = ({ appsList, onRemove, title, displayQuickManifestButton = false, ...props }) => { const classes = useStyles(props); const { activateApp, deactivateApp } = useAppListContext(); const navigate = useNavigator(); const navigateToAppInstallPage = useCallback( (url: string) => { navigate(createAppInstallUrl(url)); }, [navigate], ); const getHandleToggle = (app: AppListItemFragment) => () => { if (app.isActive) { deactivateApp(app.id); } else { activateApp(app.id); } }; return ( ) : ( undefined ) } /> {renderCollection( appsList, (app, index) => app ? ( {app.node.name} {app.node.manifestUrl && isAppInTunnel(app.node.manifestUrl) ? ( ) : null} {app.node.manifestUrl && ( )} onRemove(app.node.id)} > ) : ( ), () => ( ), )} ); }; InstalledApps.displayName = "InstalledApps"; export default InstalledApps;