page.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import {ReactNode} from 'react';
  2. import styled from '@emotion/styled';
  3. import {FeatureFeedback} from 'sentry/components/featureFeedback';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import DetailsPageBreadcrumbs from 'sentry/components/replays/header/detailsPageBreadcrumbs';
  6. import {CrumbWalker} from 'sentry/components/replays/walker/urlWalker';
  7. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  8. import space from 'sentry/styles/space';
  9. import type {Crumb} from 'sentry/types/breadcrumbs';
  10. import ChooseLayout from 'sentry/views/replays/detail/layout/chooseLayout';
  11. import ReplayMetaData, {
  12. HeaderPlaceholder,
  13. } from 'sentry/views/replays/detail/replayMetaData';
  14. import type {ReplayRecord} from 'sentry/views/replays/types';
  15. type Props = {
  16. children: ReactNode;
  17. orgSlug: string;
  18. crumbs?: Crumb[];
  19. replayRecord?: ReplayRecord;
  20. };
  21. function Page({children, crumbs, orgSlug, replayRecord}: Props) {
  22. const title = replayRecord
  23. ? `${replayRecord.id} - Replays - ${orgSlug}`
  24. : `Replays - ${orgSlug}`;
  25. const header = (
  26. <Header>
  27. <HeaderContent>
  28. <DetailsPageBreadcrumbs orgSlug={orgSlug} replayRecord={replayRecord} />
  29. </HeaderContent>
  30. <ButtonActionsWrapper>
  31. <FeatureFeedback featureName="replay" buttonProps={{size: 'xs'}} />
  32. <ChooseLayout />
  33. </ButtonActionsWrapper>
  34. {replayRecord && crumbs ? (
  35. <CrumbWalker replayRecord={replayRecord} crumbs={crumbs} />
  36. ) : (
  37. <HeaderPlaceholder />
  38. )}
  39. <MetaDataColumn>
  40. <ReplayMetaData replayRecord={replayRecord} />
  41. </MetaDataColumn>
  42. </Header>
  43. );
  44. return (
  45. <SentryDocumentTitle title={title}>
  46. <FullViewport>
  47. {header}
  48. {children}
  49. </FullViewport>
  50. </SentryDocumentTitle>
  51. );
  52. }
  53. const Header = styled(Layout.Header)`
  54. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  55. padding: ${space(2)} ${space(2)} ${space(1.5)} ${space(2)};
  56. }
  57. `;
  58. const HeaderContent = styled(Layout.HeaderContent)`
  59. margin-bottom: 0;
  60. `;
  61. // TODO(replay); This could make a lot of sense to put inside HeaderActions by default
  62. const ButtonActionsWrapper = styled(Layout.HeaderActions)`
  63. display: grid;
  64. grid-template-columns: repeat(2, max-content);
  65. justify-content: flex-end;
  66. gap: ${space(1)};
  67. `;
  68. const MetaDataColumn = styled(Layout.HeaderActions)`
  69. padding-left: ${space(3)};
  70. align-self: end;
  71. `;
  72. const FullViewport = styled('div')`
  73. height: 100vh;
  74. width: 100%;
  75. display: grid;
  76. grid-template-rows: auto 1fr;
  77. overflow: hidden;
  78. /*
  79. * The footer component is a sibling of this div.
  80. * Remove it so the replay can take up the
  81. * entire screen.
  82. */
  83. ~ footer {
  84. display: none;
  85. }
  86. /*
  87. TODO: Set \`body { overflow: hidden; }\` so that the body doesn't wiggle
  88. when you try to scroll something that is non-scrollable.
  89. */
  90. `;
  91. export default Page;