Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const snapshotTestActions = {
let testStore = createTestStore( {
preloadedState: {
betaFeatures: {
features: { remoteSession: false, nativePhpRuntime: false },
features: { remoteSession: false, nativePhpRuntime: false, enableDesksUiSwitch: false },
loading: false,
},
},
Expand All @@ -49,7 +49,7 @@ function createCustomTestStore( nativePhpRuntime = false ) {
const store = createTestStore( {
preloadedState: {
betaFeatures: {
features: { remoteSession: false, nativePhpRuntime },
features: { remoteSession: false, nativePhpRuntime, enableDesksUiSwitch: false },
loading: false,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ function setupHooks( {
isRunning: boolean;
isLoading?: boolean;
} ) {
vi.mocked( useBetaFeatures ).mockReturnValue( { remoteSession } );
vi.mocked( useBetaFeatures ).mockReturnValue( {
remoteSession,
enableDesksUiSwitch: false,
} );
vi.mocked( useAuth, { partial: true } ).mockReturnValue( { isAuthenticated } );
vi.mocked( useRemoteSessionStatus ).mockReturnValue( {
status: isRunning ? { running: true } : undefined,
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/ipc-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ type IpcApi = {
interface FeatureFlags {
enableBlueprints: boolean;
enableStudioCodeUi: boolean;
enableDesksUiSwitch: boolean;
}

interface BetaFeatures {
remoteSession: boolean;
nativePhpRuntime?: boolean;
enableDesksUiSwitch: boolean;
}

interface AppGlobals extends FeatureFlags {
Expand Down
7 changes: 7 additions & 0 deletions apps/studio/src/lib/beta-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface BetaFeatureDefinition {
const BETA_FEATURE_DEFAULTS: Record< keyof BetaFeatures, boolean > = {
remoteSession: false,
nativePhpRuntime: false,
enableDesksUiSwitch: false,
};

/**
Expand All @@ -35,6 +36,12 @@ export function getBetaFeaturesDefinition(): Record< keyof BetaFeatures, BetaFea
default: BETA_FEATURE_DEFAULTS.nativePhpRuntime,
description: __( 'Run Studio sites with native PHP instead of Playground.' ),
},
enableDesksUiSwitch: {
label: __( 'Enable Studio UI Switcher' ),
key: 'enableDesksUiSwitch',
default: BETA_FEATURE_DEFAULTS.enableDesksUiSwitch,
description: __( 'Show the option to switch Studio UI modes.' ),
},
};
}

Expand Down
6 changes: 0 additions & 6 deletions apps/studio/src/lib/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ export const FEATURE_FLAGS: Record< keyof FeatureFlags, FeatureFlagDefinition >
flag: 'enableStudioCodeUi',
default: false,
},
enableDesksUiSwitch: {
label: 'Enable Studio UI Switcher',
env: 'ENABLE_DESKS_UI_SWITCH',
flag: 'enableDesksUiSwitch',
default: false,
},
} as const;

export function getFeatureFlagFromEnv( flag: keyof FeatureFlags ): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const renderWithProvider = ( children: React.ReactElement, nativePhpRuntime = fa
const store = createTestStore( {
preloadedState: {
betaFeatures: {
features: { remoteSession: false, nativePhpRuntime },
features: { remoteSession: false, nativePhpRuntime, enableDesksUiSwitch: false },
loading: false,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useI18n } from '@wordpress/react-i18n';
import { useCallback, useEffect, useRef, useState } from 'react';
import Button from 'src/components/button';
import { FormPathInputComponent } from 'src/components/form-path-input';
import { useFeatureFlags } from 'src/hooks/use-feature-flags';
import { useBetaFeatures } from 'src/hooks/use-beta-features';
import { isWindowsStore } from 'src/lib/app-globals';
import { getIpcApi } from 'src/lib/get-ipc-api';
import { ColorSchemePicker } from 'src/modules/user-settings/components/color-scheme-picker';
Expand Down Expand Up @@ -33,7 +33,7 @@ export const PreferencesTab = ( { onClose }: { onClose: () => void } ) => {
const { __ } = useI18n();
const savedLocale = useI18nLocale();
const dispatch = useAppDispatch();
const { enableDesksUiSwitch } = useFeatureFlags();
const { enableDesksUiSwitch } = useBetaFeatures();

const { data: colorScheme } = useGetColorSchemeQuery();
const { data: editor } = useGetUserEditorQuery();
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/stores/beta-features-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type BetaFeaturesState = {
};

const initialState: BetaFeaturesState = {
features: { remoteSession: false, nativePhpRuntime: false },
features: { remoteSession: false, nativePhpRuntime: false, enableDesksUiSwitch: false },
loading: false,
};

Expand Down