Skip to content

Commit 6bf2eee

Browse files
committed
fix: container header size
1 parent 7793486 commit 6bf2eee

6 files changed

Lines changed: 43 additions & 17 deletions

File tree

apps/web/src/app/metrics-and-insights/code-review-efficiency/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { ChartSizeCommentCorrelation } from "./components/chart-size-comment-cor
3333
import { TableTeamOverview } from "./components/table-team-overview";
3434
import { TableReviewDistribution } from "./components/table-review-distribution";
3535
import { useCodeReviewEfficiencyPage } from "./useCodeReviewEfficiencyPage";
36+
import { useLargerPageContainer } from "../../../providers/page.provider";
3637

3738
export const CodeReviewEfficiencyPage = () => {
3839
const {
@@ -46,9 +47,10 @@ export const CodeReviewEfficiencyPage = () => {
4647
reviewers,
4748
handleColumnClick,
4849
} = useCodeReviewEfficiencyPage();
50+
useLargerPageContainer("lg");
4951

5052
return (
51-
<PageContainer size="lg">
53+
<PageContainer>
5254
<Breadcrumbs items={[{ label: "Metrics & Insights" }]} />
5355

5456
<Group gap={5}>

apps/web/src/app/metrics-and-insights/pr-flow/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ChartSizeCycleCorrelation } from "./components/chart-size-cycle-correla
2828
import { ChartThroughput } from "./components/chart-throughput";
2929
import { TableTeamOverview } from "./components/table-team-overview";
3030
import { usePrFlowPage } from "./usePrFlowPage";
31+
import { useLargerPageContainer } from "../../../providers/page.provider";
3132

3233
export const PrFlowPage = () => {
3334
const {
@@ -39,8 +40,10 @@ export const PrFlowPage = () => {
3940
handleThroughputClick,
4041
} = usePrFlowPage();
4142

43+
useLargerPageContainer("lg");
44+
4245
return (
43-
<PageContainer size="lg">
46+
<PageContainer>
4447
<Breadcrumbs items={[{ label: "Metrics & Insights" }]} />
4548

4649
<Group gap={5}>

apps/web/src/app/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ export const AppPage = ({ children }: AppProps) => {
2424
if (shouldShowPaywall && !isSandbox) {
2525
showPaywallNotification();
2626
goToPaywall();
27-
28-
return <></>;
2927
}
3028

3129
return (
3230
<>
3331
{isSandbox && <SandboxBanner />}
3432
{workspace && <AppSpotlight workspaceId={workspace.id} />}
35-
<AppShell key={workspace?.id} topOffset={isSandbox ? SANDBOX_BANNER_HEIGHT : 0}>
33+
<AppShell
34+
key={workspace?.id}
35+
topOffset={isSandbox ? SANDBOX_BANNER_HEIGHT : 0}
36+
>
3637
{children ? children : <Outlet />}
3738
</AppShell>
3839
</>

apps/web/src/components/app-shell/header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
useMantineTheme,
66
Burger,
77
} from "@mantine/core";
8-
import { usePageStore } from "../../providers/page.provider";
8+
import { containerSizes, usePageStore } from "../../providers/page.provider";
99

1010
interface HeaderProps {
1111
onToggleMenu: () => void;
@@ -19,7 +19,7 @@ export const Header = ({
1919
isMobile,
2020
}: HeaderProps): React.ReactElement => {
2121
const theme = useMantineTheme();
22-
const { fullWidth } = usePageStore();
22+
const { fullWidth, containerSize } = usePageStore();
2323

2424
return (
2525
<AppShell.Header px={0} bg={theme.colors.dark[8]}>
@@ -44,6 +44,7 @@ export const Header = ({
4444
fluid={fullWidth}
4545
w={isMobile ? undefined : "100%"}
4646
m={isMobile ? 0 : undefined}
47+
maw={isMobile ? undefined : containerSizes[containerSize]}
4748
>
4849
<Group
4950
justify="space-between"

apps/web/src/components/page-container/page-container.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
11
import { Container } from "@mantine/core";
22
import type { ReactNode } from "react";
3-
import { usePageStore } from "../../providers/page.provider";
3+
import { containerSizes, usePageStore } from "../../providers/page.provider";
44
import { useScreenSize } from "../../providers/screen.provider";
5+
56
interface PageContainerProps {
67
children?: ReactNode;
78
pt?: number;
89
pb?: number;
9-
size?: "md" | "lg" | "xl";
1010
}
1111

12-
const containerSizes = {
13-
md: undefined,
14-
lg: 1200,
15-
xl: 1600,
16-
};
17-
1812
export const PageContainer = ({
1913
children,
2014
pt = 40,
2115
pb = 40,
22-
size = "md",
2316
}: PageContainerProps) => {
2417
const { fullWidth } = usePageStore();
2518
const { isSmallScreen } = useScreenSize();
19+
const { containerSize } = usePageStore();
2620

2721
return (
2822
<Container
2923
fluid={fullWidth}
3024
pt={pt}
3125
pb={pb}
3226
px={fullWidth && !isSmallScreen ? "xl" : undefined}
33-
maw={containerSizes[size]}
27+
maw={containerSizes[containerSize]}
3428
>
3529
{children}
3630
</Container>

apps/web/src/providers/page.provider.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@ import { useEffect } from "react";
44

55
interface PageStore {
66
fullWidth: boolean;
7+
containerSize: ContainerSize;
78
setFullWidth: (value: boolean) => void;
9+
setContainerSize: (value: ContainerSize) => void;
810
}
911

12+
export const containerSizes = {
13+
md: undefined,
14+
lg: 1200,
15+
xl: 1600,
16+
};
17+
18+
export type ContainerSize = keyof typeof containerSizes;
19+
1020
export const usePageStore = create<PageStore>()(
1121
devtools(
1222
(set) => ({
23+
containerSize: "md" as ContainerSize,
1324
fullWidth: false,
1425
setFullWidth: (value: boolean) => set(() => ({ fullWidth: value })),
26+
setContainerSize: (value: ContainerSize) =>
27+
set((state) => ({ ...state, containerSize: value })),
1528
}),
1629
{ name: "page-store" },
1730
),
@@ -28,3 +41,15 @@ export const useFullWidthPage = () => {
2841
};
2942
}, [setFullWidth]);
3043
};
44+
45+
export const useLargerPageContainer = (size: ContainerSize) => {
46+
const { setContainerSize } = usePageStore();
47+
48+
useEffect(() => {
49+
setContainerSize(size);
50+
51+
return () => {
52+
setContainerSize("md");
53+
};
54+
}, [size, setContainerSize]);
55+
};

0 commit comments

Comments
 (0)