
* Replace withStyleswith useStyles (#1100) * Replace withStyleswith useStyles * Update messages * Use rem as a spacing unit (#1101) * Use rems as spacing units * Fix visual bugs * Update stories * Use macaw-ui as theme provider (#1108) * Use macaw ui as a theme provider * Add react-dom to aliases * Fix jest module resolution * Update useTheme hook usage * Fix test wrapper * Use macaw from git repo * Fix CI * Update stories * Fix aliasing * Extract savebar to macaw ui (#1146) * wip * Use savebar from macaw * Use confirm button from macaw * Improve file structure * Use sidebar context from macaw * Update macaw * Update macaw version * Remove savebar from storybook * Update stories * Use alerts and notifications from macaw (#1166) * Use alerts from macaw * Add notifications from macaw * Update stories * Pin macaw version * Encapsulate limit reached in one component * Remove unused imports * Use backlinks from macaw (#1183) * Use backlink from macaw * Update macaw version * Use macaw sidebar (#1148) * Use sidebar from macaw * Use shipped logo * Use lowercase * Update stories * Use user chip from macaw (#1191) * Use user chip from macaw * Use dedicated components for menu items * Simplify code * Bump version and fix types (#1210) * Rename onBack to onClick * Rename UserChip to UserChipMenu * Rename IMenuItem to SidebarMenuItem * Update macaw version * Fix tables after changes in macaw (#1220) * Update macaw version * Update changelog * Update stories * Fix after rebase * Update to macaw 0.2.0 * Lint files * Update macaw to 0.2.2
114 lines
3.3 KiB
TypeScript
114 lines
3.3 KiB
TypeScript
import { Button, Typography } from "@material-ui/core";
|
|
import CardSpacer from "@saleor/components/CardSpacer";
|
|
import Container from "@saleor/components/Container";
|
|
import Grid from "@saleor/components/Grid";
|
|
import Hr from "@saleor/components/Hr";
|
|
import { sectionNames } from "@saleor/intl";
|
|
import { Backlink } from "@saleor/macaw-ui";
|
|
import { useTheme } from "@saleor/macaw-ui";
|
|
import classNames from "classnames";
|
|
import React from "react";
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
import { App_app } from "../../types/App";
|
|
import { useStyles } from "./styles";
|
|
import useAppConfigLoader from "./useAppConfigLoader";
|
|
import useSettingsBreadcrumbs from "./useSettingsBreadcrumbs";
|
|
|
|
export interface AppDetailsSettingsPageProps {
|
|
backendHost: string;
|
|
data: App_app;
|
|
navigateToDashboard: () => void;
|
|
onBack: () => void;
|
|
onError: () => void;
|
|
}
|
|
|
|
export const AppDetailsSettingsPage: React.FC<AppDetailsSettingsPageProps> = ({
|
|
backendHost,
|
|
data,
|
|
navigateToDashboard,
|
|
onBack,
|
|
onError
|
|
}) => {
|
|
const intl = useIntl();
|
|
const classes = useStyles({});
|
|
const [breadcrumbs, onBreadcrumbClick] = useSettingsBreadcrumbs();
|
|
const { sendThemeToExtension } = useTheme();
|
|
const frameContainer = useAppConfigLoader(data, backendHost, {
|
|
onError,
|
|
onLoad: sendThemeToExtension
|
|
});
|
|
|
|
return (
|
|
<Container>
|
|
<Backlink onClick={onBack}>
|
|
{intl.formatMessage(sectionNames.apps)}
|
|
</Backlink>
|
|
<Grid variant="uniform">
|
|
<div className={classes.breadcrumbContainer}>
|
|
<div className={classes.breadcrumbs}>
|
|
<Typography
|
|
className={classNames(
|
|
classes.breadcrumb,
|
|
classes.breadcrumbDisabled
|
|
)}
|
|
variant="h5"
|
|
>
|
|
{data?.name}
|
|
</Typography>
|
|
{breadcrumbs.map(b => (
|
|
<Typography
|
|
className={classes.breadcrumb}
|
|
variant="h5"
|
|
onClick={() => onBreadcrumbClick(b.value)}
|
|
key={b.label}
|
|
>
|
|
{b.label}
|
|
</Typography>
|
|
))}
|
|
</div>
|
|
</div>
|
|
<div className={classes.appSettingsHeader}>
|
|
<Button
|
|
onClick={navigateToDashboard}
|
|
variant="contained"
|
|
color="primary"
|
|
>
|
|
<FormattedMessage defaultMessage="Dashboard" description="button" />
|
|
</Button>
|
|
<Button
|
|
href={data?.homepageUrl}
|
|
variant="contained"
|
|
color="primary"
|
|
data-tc="open-app"
|
|
target="_blank"
|
|
>
|
|
<FormattedMessage defaultMessage="My App" description="button" />
|
|
</Button>
|
|
<Button
|
|
href={data?.supportUrl}
|
|
variant="contained"
|
|
color="primary"
|
|
data-tc="open-support"
|
|
target="_blank"
|
|
>
|
|
<FormattedMessage
|
|
defaultMessage="Support/FAQ"
|
|
description="button"
|
|
/>
|
|
</Button>
|
|
</div>
|
|
</Grid>
|
|
<CardSpacer />
|
|
|
|
<Hr />
|
|
|
|
<CardSpacer />
|
|
<div ref={frameContainer} className={classes.iframeContainer} />
|
|
<CardSpacer />
|
|
</Container>
|
|
);
|
|
};
|
|
|
|
AppDetailsSettingsPage.displayName = "AppDetailsSettingsPage";
|
|
export default AppDetailsSettingsPage;
|