import styled from '@emotion/styled';
import ErrorBoundary from 'sentry/components/errorBoundary';
import ReplayTimeline from 'sentry/components/replays/breadcrumbs/replayTimeline';
import ReplayView from 'sentry/components/replays/replayView';
import space from 'sentry/styles/space';
import useFullscreen from 'sentry/utils/replays/hooks/useFullscreen';
import {LayoutKey} from 'sentry/utils/replays/hooks/useReplayLayout';
import useUrlParams from 'sentry/utils/useUrlParams';
import Breadcrumbs from 'sentry/views/replays/detail/breadcrumbs';
import FocusArea from 'sentry/views/replays/detail/focusArea';
import FocusTabs from 'sentry/views/replays/detail/focusTabs';
import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';
import FluidPanel from 'sentry/views/replays/detail/layout/fluidPanel';
import SplitPanel from 'sentry/views/replays/detail/layout/splitPanel';
import SideTabs from 'sentry/views/replays/detail/sideTabs';
import TagPanel from 'sentry/views/replays/detail/tagPanel';
const MIN_VIDEO_WIDTH = {px: 325};
const MIN_CONTENT_WIDTH = {px: 325};
const MIN_SIDEBAR_WIDTH = {px: 325};
const MIN_VIDEO_HEIGHT = {px: 200};
const MIN_CONTENT_HEIGHT = {px: 200};
type Props = {
layout?: LayoutKey;
};
function ReplayLayout({layout = LayoutKey.topbar}: Props) {
const {ref: fullscreenRef, toggle: toggleFullscreen} = useFullscreen();
const timeline = (
);
const video = (
);
if (layout === 'video_only') {
return (
{timeline}
{video}
);
}
const focusArea = (
}>
);
if (layout === 'no_video') {
return (
{timeline}
,
min: MIN_SIDEBAR_WIDTH,
}}
/>
);
}
if (layout === 'top') {
const mainSplit = (
);
return (
{timeline}
,
min: MIN_SIDEBAR_WIDTH,
}}
/>
);
}
const sideVideoCrumbs = (
,
min: MIN_SIDEBAR_WIDTH,
}}
/>
);
if (layout === 'sidebar_right') {
return (
{timeline}
);
}
if (layout === 'sidebar_left') {
return (
{timeline}
);
}
// layout === 'topbar' or default
const crumbsWithTitle = (
);
return (
{timeline}
),
min: MIN_VIDEO_HEIGHT,
}}
bottom={{
content: focusArea,
default: '60%',
min: MIN_CONTENT_HEIGHT,
}}
/>
);
}
function SideCrumbsTags() {
const {getParamValue} = useUrlParams('t_side', 'crumbs');
const sideTabs = ;
if (getParamValue() === 'tags') {
return (
);
}
return (
);
}
const BodyContent = styled('main')`
background: ${p => p.theme.background};
width: 100%;
height: 100%;
display: grid;
grid-template-rows: auto 1fr;
overflow: hidden;
padding: ${space(2)};
`;
const SmallMarginFocusTabs = styled(FocusTabs)`
margin-bottom: ${space(1)};
`;
const SmallMarginSideTabs = styled(SideTabs)`
margin-bottom: ${space(1)};
`;
const VideoSection = styled(FluidHeight)`
height: 100%;
background: ${p => p.theme.background};
gap: ${space(1)};
:fullscreen {
padding: ${space(1)};
}
`;
export default ReplayLayout;