import { Card, Switch, TableBody, TableCell, TableRow, Typography, } from "@material-ui/core"; import { useAppListContext } from "@saleor/apps/context"; import { appUrl } from "@saleor/apps/urls"; 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 { DeleteIcon, ResponsiveTable } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; import { ListProps } from "@saleor/types"; import clsx from "clsx"; import React from "react"; import { FormattedMessage, useIntl } 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; } const InstalledApps: React.FC = ({ appsList, onRemove, ...props }) => { const intl = useIntl(); const classes = useStyles(props); const { activateApp, deactivateApp } = useAppListContext(); const getHandleToggle = (app: AppListItemFragment) => () => { if (app.isActive) { deactivateApp(app.id); } else { activateApp(app.id); } }; return ( {renderCollection( appsList, (app, index) => app ? ( {app.node.name} {app.node.manifestUrl && ( {app.node.manifestUrl} )} onRemove(app.node.id)} > ) : ( ), () => ( ), )} ); }; InstalledApps.displayName = "InstalledApps"; export default InstalledApps;