Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13462 from strapi/providers/add-tabs
[marketplace] add providers tabs
- Loading branch information
Showing
9 changed files
with
1,348 additions
and
746 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/core/admin/admin/src/hooks/useFetchMarketplaceProviders/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNotification } from '@strapi/helper-plugin'; | ||
import { fetchMarketplacePlugins } from './utils/api'; | ||
|
||
const useFetchMarketplaceProviders = (notifyLoad) => { | ||
const toggleNotification = useNotification(); | ||
|
||
return useQuery('list-marketplace-providers', () => fetchMarketplacePlugins(), { | ||
onSuccess: () => { | ||
if (notifyLoad) { | ||
notifyLoad(); | ||
} | ||
}, | ||
onError: () => { | ||
toggleNotification({ | ||
type: 'warning', | ||
message: { id: 'notification.error', defaultMessage: 'An error occured' }, | ||
}); | ||
}, | ||
}); | ||
}; | ||
|
||
export default useFetchMarketplaceProviders; |
11 changes: 11 additions & 0 deletions
11
packages/core/admin/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import axios from 'axios'; | ||
|
||
const MARKETPLACE_API_URL = 'https://market-api.strapi.io'; | ||
|
||
const fetchMarketplacePlugins = async () => { | ||
const { data } = await axios.get(`${MARKETPLACE_API_URL}/providers`); | ||
|
||
return data; | ||
}; | ||
|
||
export { fetchMarketplacePlugins }; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/core/admin/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Grid, GridItem } from '@strapi/design-system/Grid'; | ||
import NpmPackageCard from '../NpmPackageCard'; | ||
|
||
const NpmPackagesGrid = ({ | ||
npmPackages, | ||
installedPackageNames, | ||
useYarn, | ||
isInDevelopmentMode, | ||
npmPackageType, | ||
}) => { | ||
return ( | ||
<Grid gap={4}> | ||
{npmPackages.map((npmPackage) => ( | ||
<GridItem col={4} s={6} xs={12} style={{ height: '100%' }} key={npmPackage.id}> | ||
<NpmPackageCard | ||
npmPackage={npmPackage} | ||
installedPackageNames={installedPackageNames} | ||
useYarn={useYarn} | ||
isInDevelopmentMode={isInDevelopmentMode} | ||
npmPackageType={npmPackageType} | ||
/> | ||
</GridItem> | ||
))} | ||
</Grid> | ||
); | ||
}; | ||
|
||
NpmPackagesGrid.defaultProps = { | ||
installedPackageNames: [], | ||
}; | ||
|
||
NpmPackagesGrid.propTypes = { | ||
npmPackages: PropTypes.array.isRequired, | ||
installedPackageNames: PropTypes.arrayOf(PropTypes.string), | ||
useYarn: PropTypes.bool.isRequired, | ||
isInDevelopmentMode: PropTypes.bool.isRequired, | ||
npmPackageType: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default NpmPackagesGrid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.