Skip to content

Commit

Permalink
add submit provider button
Browse files Browse the repository at this point in the history
  • Loading branch information
markkaylor committed Jun 14, 2022
1 parent a7bb953 commit 9c30260
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Expand Up @@ -6,10 +6,12 @@ import { LinkButton } from '@strapi/design-system/v2/LinkButton';
import Upload from '@strapi/icons/Upload';
import { useTracking } from '@strapi/helper-plugin';

const PageHeader = ({ isOnline }) => {
const PageHeader = ({ isOnline, npmPackageType }) => {
const { formatMessage } = useIntl();
const { trackUsage } = useTracking();

const tracking = npmPackageType === 'provider' ? 'didSubmitProvider' : 'didSubmitPlugin';

return (
<HeaderLayout
title={formatMessage({
Expand All @@ -25,13 +27,13 @@ const PageHeader = ({ isOnline }) => {
<LinkButton
startIcon={<Upload />}
variant="tertiary"
href="https://market.strapi.io/submit-plugin"
onClick={() => trackUsage('didSubmitPlugin')}
href={`https://market.strapi.io/submit-${npmPackageType}`}
onClick={() => trackUsage(tracking)}
isExternal
>
{formatMessage({
id: 'admin.pages.MarketPlacePage.submit.plugin.link',
defaultMessage: 'Submit your plugin',
id: `admin.pages.MarketPlacePage.submit.${npmPackageType}.link`,
defaultMessage: `Submit your ${npmPackageType}`,
})}
</LinkButton>
)
Expand All @@ -44,4 +46,5 @@ export default PageHeader;

PageHeader.propTypes = {
isOnline: PropTypes.bool.isRequired,
npmPackageType: PropTypes.string.isRequired,
};
11 changes: 9 additions & 2 deletions packages/core/admin/admin/src/pages/MarketplacePage/index.js
Expand Up @@ -52,6 +52,7 @@ const MarketPlacePage = () => {
const trackUsageRef = useRef(trackUsage);
const toggleNotification = useNotification();
const [searchQuery, setSearchQuery] = useState('');
const [npmPackageType, setNpmPackageType] = useState('plugin');
const { autoReload: isInDevelopmentMode } = useAppInfos();
const isOnline = useNavigatorOnLine();

Expand Down Expand Up @@ -137,7 +138,7 @@ const MarketPlacePage = () => {
return (
<Layout>
<Main>
<PageHeader isOnline={isOnline} />
<PageHeader isOnline={isOnline} npmPackageType={npmPackageType} />
<Flex
width="100%"
direction="column"
Expand Down Expand Up @@ -202,6 +203,11 @@ const MarketPlacePage = () => {
{ target: searchQuery }
);

const handleTabChange = selected => {
const packageType = selected === 0 ? 'plugin' : 'provider';
setNpmPackageType(packageType);
};

// Check if plugins are installed already
const installedPluginNames = installedPluginsResponse.plugins.map(plugin => plugin.packageName);

Expand All @@ -214,7 +220,7 @@ const MarketPlacePage = () => {
defaultMessage: 'Marketplace - Plugins',
})}
/>
<PageHeader isOnline={isOnline} />
<PageHeader isOnline={isOnline} npmPackageType={npmPackageType} />
<ContentLayout>
<Box width="25%" paddingBottom={4}>
<Searchbar
Expand Down Expand Up @@ -244,6 +250,7 @@ const MarketPlacePage = () => {
})}
id="tabs"
variant="simple"
onTabChange={handleTabChange}
>
<Box paddingBottom={4}>
<Tabs>
Expand Down
1 change: 1 addition & 0 deletions packages/core/admin/admin/src/translations/en.json
Expand Up @@ -221,6 +221,7 @@
"admin.pages.MarketPlacePage.search.empty": "No result for \"{target}\"",
"admin.pages.MarketPlacePage.search.placeholder": "Search",
"admin.pages.MarketPlacePage.submit.plugin.link": "Submit your plugin",
"admin.pages.MarketPlacePage.submit.provider.link": "Submit your provider",
"admin.pages.MarketPlacePage.subtitle": "Get more out of Strapi",
"admin.pages.MarketPlacePage.tab-group.label": "Plugins and Providers for Strapi",
"admin.pages.MarketPlacePage.missingPlugin.title": "Missing a plugin?",
Expand Down

0 comments on commit 9c30260

Please sign in to comment.