2023-01-19 11:54:57 +00:00
|
|
|
import { AppInstallationFragment } from "@dashboard/graphql";
|
2023-01-16 09:45:12 +00:00
|
|
|
import { GetV2SaleorAppsResponse } from "@dashboard/new-apps/marketplace.types";
|
2023-01-19 11:54:57 +00:00
|
|
|
import { resolveInstallationOfMarketplaceApp } from "@dashboard/new-apps/utils";
|
2023-01-10 10:04:30 +00:00
|
|
|
import { Skeleton } from "@material-ui/lab";
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import AppListCard from "../AppListCard";
|
|
|
|
import { useStyles } from "./styles";
|
|
|
|
|
|
|
|
interface AllAppListProps {
|
|
|
|
appList?: GetV2SaleorAppsResponse.SaleorApp[];
|
2023-01-19 11:54:57 +00:00
|
|
|
appInstallationList?: AppInstallationFragment[];
|
2023-01-10 10:04:30 +00:00
|
|
|
navigateToAppInstallPage?: (manifestUrl: string) => void;
|
2023-02-07 10:59:06 +00:00
|
|
|
navigateToGithubForkPage?: (githubForkUrl: string) => void;
|
2023-01-10 10:04:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const AllAppList: React.FC<AllAppListProps> = ({
|
|
|
|
appList,
|
2023-01-19 11:54:57 +00:00
|
|
|
appInstallationList,
|
2023-01-10 10:04:30 +00:00
|
|
|
navigateToAppInstallPage,
|
2023-02-07 10:59:06 +00:00
|
|
|
navigateToGithubForkPage,
|
2023-01-10 10:04:30 +00:00
|
|
|
}) => {
|
|
|
|
const classes = useStyles();
|
|
|
|
|
|
|
|
if (!appList) {
|
|
|
|
return <Skeleton />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={classes.appListWrapper}>
|
|
|
|
{appList.map(app => (
|
|
|
|
<AppListCard
|
|
|
|
key={app.name.en}
|
|
|
|
app={app}
|
2023-01-19 11:54:57 +00:00
|
|
|
appInstallation={resolveInstallationOfMarketplaceApp(
|
|
|
|
app,
|
|
|
|
appInstallationList,
|
|
|
|
)}
|
2023-01-10 10:04:30 +00:00
|
|
|
navigateToAppInstallPage={navigateToAppInstallPage}
|
2023-02-07 10:59:06 +00:00
|
|
|
navigateToGithubForkPage={navigateToGithubForkPage}
|
2023-01-10 10:04:30 +00:00
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default AllAppList;
|