2022-10-20 11:35:31 +00:00
|
|
|
import { PageTab, PageTabs } from "@saleor/macaw-ui";
|
|
|
|
import React, { ComponentProps } from "react";
|
|
|
|
import { useIntl } from "react-intl";
|
|
|
|
|
|
|
|
export type AppPageTabValue =
|
|
|
|
| "THIRD_PARTY"
|
|
|
|
| "WEBHOOKS_AND_EVENTS"
|
|
|
|
| "SALEOR_APPS";
|
|
|
|
|
|
|
|
type AllProps = ComponentProps<typeof PageTabs>;
|
|
|
|
type AvailableProps = Omit<AllProps, "children" | "onChange" | "value"> & {
|
|
|
|
value: AppPageTabValue;
|
|
|
|
showSaleorApps: boolean;
|
|
|
|
onChange(newValue: AppPageTabValue): void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const AppPageTabs = ({ showSaleorApps, ...props }: AvailableProps) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
|
|
<PageTabs {...props}>
|
|
|
|
<PageTab
|
|
|
|
value="THIRD_PARTY"
|
|
|
|
label={intl.formatMessage({
|
|
|
|
defaultMessage: "3rd party apps",
|
|
|
|
id: "J8frvS",
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<PageTab
|
|
|
|
value="WEBHOOKS_AND_EVENTS"
|
2022-10-24 08:22:45 +00:00
|
|
|
id="WEBHOOKS_AND_EVENTS"
|
2022-10-20 11:35:31 +00:00
|
|
|
label={intl.formatMessage({
|
|
|
|
defaultMessage: "Webhooks & Events",
|
|
|
|
id: "UxTSw7",
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
{showSaleorApps && (
|
|
|
|
<PageTab
|
|
|
|
value="SALEOR_APPS"
|
|
|
|
label={intl.formatMessage({
|
|
|
|
defaultMessage: "Saleor Apps",
|
|
|
|
id: "+niGip",
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</PageTabs>
|
|
|
|
);
|
|
|
|
};
|