Skip to content

Commit 933269d

Browse files
committed
feat: add feature flag to control diff sidebar visibility
Introduce NEXT_PUBLIC_ENABLE_DIFF_SIDEBAR environment variable to enable/disable the diff sidebar button and keyboard shortcut globally.
1 parent b755fce commit 933269d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ GITHUB_APP_ID=123456
2424
GITHUB_PRIVATE_KEY_BASE_64=base 64 encoded version of the private key - see README.md for more info
2525
ENCRYPTION_PUBLIC_KEY_BASE_64=base 64 encoded version of the public key
2626
ENCRYPTION_PRIVATE_KEY_BASE_64=base 64 encoded version of the private key
27+
NEXT_PUBLIC_ENABLE_DIFF_SIDEBAR=true

src/features/sidebar/view/SecondarySplitHeader.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import useDiffbarOpen from "@/features/sidebar/data/useDiffbarOpen"
1111
import ToggleMobileToolbarButton from "./internal/secondary/ToggleMobileToolbarButton"
1212
import { useProjectSelection } from "@/features/projects/data"
1313

14+
const isDiffFeatureEnabled = process.env.NEXT_PUBLIC_ENABLE_DIFF_SIDEBAR === "true"
15+
1416
const SecondarySplitHeader = ({
1517
mobileToolbar,
1618
children
@@ -48,11 +50,13 @@ const SecondarySplitHeader = ({
4850
)}
4951
</Stack>
5052
</Box>
51-
<ToggleDiffButton
52-
isDiffbarOpen={isDiffbarOpen}
53-
onClick={setDiffbarOpen}
54-
isDiffAvailable={!!specification?.diffURL}
55-
/>
53+
{isDiffFeatureEnabled && (
54+
<ToggleDiffButton
55+
isDiffbarOpen={isDiffbarOpen}
56+
onClick={setDiffbarOpen}
57+
isDiffAvailable={!!specification?.diffURL}
58+
/>
59+
)}
5660
</Box>
5761
{mobileToolbar && (
5862
<Collapse in={isMobileToolbarVisible}>

src/features/sidebar/view/internal/ClientSplitView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import PrimaryContainer from "./primary/Container"
1010
import SecondaryContainer from "./secondary/Container"
1111
import RightContainer from "./tertiary/RightContainer"
1212

13+
const isDiffFeatureEnabled = process.env.NEXT_PUBLIC_ENABLE_DIFF_SIDEBAR === "true"
14+
1315
const ClientSplitView = ({
1416
sidebar,
1517
children,
@@ -51,7 +53,7 @@ const ClientSplitView = ({
5153

5254
useKeyboardShortcut(event => {
5355
const isActionKey = isMac() ? event.metaKey : event.ctrlKey
54-
if (isActionKey && event.key === "k") {
56+
if (isDiffFeatureEnabled && isActionKey && event.key === "k") {
5557
event.preventDefault()
5658
setRightSidebarOpen(!isRightSidebarOpen)
5759
}

0 commit comments

Comments
 (0)