react-code-dataset / wp-calypso /client /my-sites /plugins /plugin-management-v2 /plugin-manage-subscription /index.tsx
react-code-dataset / wp-calypso /client /my-sites /plugins /plugin-management-v2 /plugin-manage-subscription /index.tsx
Download wp-calypso/client/my-sites/plugins/plugin-management-v2/plugin-manage-subscription/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/plugins/plugin-management-v2/plugin-manage-subscription/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/plugins/plugin-management-v2/plugin-manage-subscription/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/plugins/plugin-management-v2/plugin-manage-subscription/index.tsx
1.16 kB
| import { useTranslate } from 'i18n-calypso'; | |
| import PopoverMenuItem from 'calypso/components/popover-menu/item'; | |
| import { getPluginPurchased } from 'calypso/lib/plugins/utils'; | |
| import { useSelector } from 'calypso/state'; | |
| import { getSitePurchases } from 'calypso/state/purchases/selectors'; | |
| import type { PluginComponentProps } from '../types'; | |
| import type { SiteDetails } from '@automattic/data-stores'; | |
| import type { ReactElement } from 'react'; | |
| import '../style.scss'; | |
| interface Props { | |
| site: SiteDetails; | |
| plugin: PluginComponentProps; | |
| } | |
| type Purchase = { | |
| id?: number; | |
| }; | |
| export default function PluginManageSubcription( { site, plugin }: Props ): ReactElement | null { | |
| const translate = useTranslate(); | |
| const purchases = useSelector( ( state ) => getSitePurchases( state, site.ID ) ); | |
| const currentPurchase: Purchase = getPluginPurchased( plugin, purchases ); | |
| return currentPurchase?.id ? ( | |
| <> | |
| <PopoverMenuItem | |
| className="plugin-management-v2__actions" | |
| icon="credit-card" | |
| href={ `/me/purchases/${ site.domain }/${ currentPurchase.id }` } | |
| > | |
| { translate( 'Manage Subscription' ) } | |
| </PopoverMenuItem> | |
| </> | |
| ) : null; | |
| } | |