|
| 1 | +import {Fragment} from 'react'; |
1 | 2 | import styled from '@emotion/styled';
|
2 | 3 |
|
3 | 4 | import {Flex} from 'sentry/components/core/layout';
|
4 | 5 | import ProjectBadge from 'sentry/components/idBadge/projectBadge';
|
5 | 6 | import * as Layout from 'sentry/components/layouts/thirds';
|
6 |
| -import {useDocumentTitle} from 'sentry/components/sentryDocumentTitle'; |
7 |
| -import {ActionsFromContext} from 'sentry/components/workflowEngine/layout/actions'; |
8 |
| -import {BreadcrumbsFromContext} from 'sentry/components/workflowEngine/layout/breadcrumbs'; |
| 7 | +import {HeaderActions} from 'sentry/components/layouts/thirds'; |
9 | 8 | import {space} from 'sentry/styles/space';
|
10 | 9 | import type {AvatarProject} from 'sentry/types/project';
|
11 | 10 |
|
12 | 11 | interface WorkflowEngineDetailLayoutProps {
|
13 | 12 | /**
|
14 | 13 | * The main content for this page
|
15 |
| - * Expected to include `<DetailLayout.Main>` and `<DetailLayout.Sidebar>` components. |
| 14 | + * Expected to include `<DetailLayout.Body>` and `<DetailLayout.Header>` components. |
16 | 15 | */
|
17 | 16 | children: React.ReactNode;
|
18 |
| - project?: AvatarProject; |
19 | 17 | }
|
20 | 18 |
|
21 | 19 | /**
|
22 | 20 | * Precomposed 67/33 layout for Automations / Monitors detail pages.
|
23 | 21 | */
|
24 |
| -function DetailLayout({children, project}: WorkflowEngineDetailLayoutProps) { |
25 |
| - const title = useDocumentTitle(); |
26 |
| - return ( |
27 |
| - <StyledPage> |
28 |
| - <Layout.Header unified> |
29 |
| - <Layout.HeaderContent> |
30 |
| - <BreadcrumbsFromContext /> |
31 |
| - <Layout.Title>{title}</Layout.Title> |
32 |
| - {project && ( |
33 |
| - <ProjectContainer> |
34 |
| - <ProjectBadge project={project} disableLink avatarSize={16} /> |
35 |
| - </ProjectContainer> |
36 |
| - )} |
37 |
| - </Layout.HeaderContent> |
38 |
| - <ActionsFromContext /> |
39 |
| - </Layout.Header> |
40 |
| - <StyledBody>{children}</StyledBody> |
41 |
| - </StyledPage> |
42 |
| - ); |
| 22 | +function DetailLayout({children}: WorkflowEngineDetailLayoutProps) { |
| 23 | + return <StyledPage>{children}</StyledPage>; |
43 | 24 | }
|
44 | 25 |
|
45 | 26 | const ProjectContainer = styled('div')`
|
@@ -79,6 +60,43 @@ function Sidebar({children}: RequiredChildren) {
|
79 | 60 | );
|
80 | 61 | }
|
81 | 62 |
|
82 |
| -const WorkflowEngineDetailLayout = Object.assign(DetailLayout, {Main, Sidebar}); |
| 63 | +function Header({children}: RequiredChildren) { |
| 64 | + return <Layout.Header unified>{children}</Layout.Header>; |
| 65 | +} |
| 66 | + |
| 67 | +function HeaderContent({children}: RequiredChildren) { |
| 68 | + return <Layout.HeaderContent>{children}</Layout.HeaderContent>; |
| 69 | +} |
| 70 | + |
| 71 | +function Actions({children}: RequiredChildren) { |
| 72 | + return ( |
| 73 | + <HeaderActions> |
| 74 | + <Flex gap={space(1)}>{children}</Flex> |
| 75 | + </HeaderActions> |
| 76 | + ); |
| 77 | +} |
| 78 | + |
| 79 | +function Title({title, project}: {title: string; project?: AvatarProject}) { |
| 80 | + return ( |
| 81 | + <Fragment> |
| 82 | + <Layout.Title>{title}</Layout.Title> |
| 83 | + {project && ( |
| 84 | + <ProjectContainer> |
| 85 | + <ProjectBadge project={project} disableLink avatarSize={16} /> |
| 86 | + </ProjectContainer> |
| 87 | + )} |
| 88 | + </Fragment> |
| 89 | + ); |
| 90 | +} |
| 91 | + |
| 92 | +const WorkflowEngineDetailLayout = Object.assign(DetailLayout, { |
| 93 | + Body: StyledBody, |
| 94 | + Main, |
| 95 | + Sidebar, |
| 96 | + Header, |
| 97 | + HeaderContent, |
| 98 | + Actions, |
| 99 | + Title, |
| 100 | +}); |
83 | 101 |
|
84 | 102 | export default WorkflowEngineDetailLayout;
|
0 commit comments