Skip to content
Merged
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
1 change: 0 additions & 1 deletion apps/studio/e2e/e2e-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { randomUUID } from 'crypto';
import { tmpdir } from 'os';
import path from 'path';
import { isErrnoException } from '@studio/common/lib/is-errno-exception';
import { findLatestBuild, parseElectronApp } from 'electron-playwright-helpers';
import fs from 'fs-extra';
import { _electron as electron, Page, ElectronApplication } from 'playwright';
Expand Down
5 changes: 3 additions & 2 deletions apps/studio/src/components/content-tab-assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { StudioCodeSession } from 'src/components/studio-code-session';
import WelcomeComponent from 'src/components/welcome-message-prompt';
import { LIMIT_OF_PROMPTS_PER_USER, TELEX_HOSTNAME, TELEX_UTM_PARAMS } from 'src/constants';
import { useAuth } from 'src/hooks/use-auth';
import { useFeatureFlags } from 'src/hooks/use-feature-flags';
import { useOffline } from 'src/hooks/use-offline';
import { useThemeDetails } from 'src/hooks/use-theme-details';
import { cx } from 'src/lib/cx';
Expand Down Expand Up @@ -359,7 +358,9 @@ const UnauthenticatedView = ( { onAuthenticate }: { onAuthenticate: () => void }
);

export function ContentTabAssistant( { selectedSite }: ContentTabAssistantProps ) {
const { enableStudioCodeUi } = useFeatureFlags();
const enableStudioCodeUi = useRootSelector(
( state ) => state.betaFeatures.features.enableStudioCodeUi
);

if ( enableStudioCodeUi ) {
return <StudioCodeSession selectedSite={ selectedSite } />;
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/src/components/site-content-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { ContentTabSettings } from 'src/components/content-tab-settings';
import Header from 'src/components/header';
import { SiteIsBeingCreated } from 'src/components/site-is-being-created';
import { MIN_WIDTH_CLASS_TO_MEASURE } from 'src/constants';
import { useBetaFeatures } from 'src/hooks/use-beta-features';
import { TabName } from 'src/hooks/use-content-tabs';
import { useEffectiveTab } from 'src/hooks/use-effective-tab';
import { useFeatureFlags } from 'src/hooks/use-feature-flags';
import { useImportExport } from 'src/hooks/use-import-export';
import { useSiteDetails } from 'src/hooks/use-site-details';
import { cx } from 'src/lib/cx';
Expand All @@ -21,7 +21,7 @@ export function SiteContentTabs() {
const { selectedSite, siteCreationMessages } = useSiteDetails();
const { importState } = useImportExport();
const { effectiveTab, selectedTab, setSelectedTab, tabs } = useEffectiveTab();
const { enableStudioCodeUi } = useFeatureFlags();
const { enableStudioCodeUi } = useBetaFeatures();
const { __ } = useI18n();

// Remount: Avoid focus loss on user tab changes (no remount),
Expand Down
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: { enableStudioCodeUi: false, remoteSession: false, nativePhpRuntime: false },
loading: false,
},
},
Expand All @@ -49,7 +49,7 @@ function createCustomTestStore( nativePhpRuntime = false ) {
const store = createTestStore( {
preloadedState: {
betaFeatures: {
features: { remoteSession: false, nativePhpRuntime },
features: { enableStudioCodeUi: false, remoteSession: false, nativePhpRuntime },
loading: false,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function setupHooks( {
isRunning: boolean;
isLoading?: boolean;
} ) {
vi.mocked( useBetaFeatures ).mockReturnValue( { remoteSession } );
vi.mocked( useBetaFeatures ).mockReturnValue( { enableStudioCodeUi: false, remoteSession } );
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 @@ -99,11 +99,11 @@ type IpcApi = {

interface FeatureFlags {
enableBlueprints: boolean;
enableStudioCodeUi: boolean;
enableDesksUiSwitch: boolean;
}

interface BetaFeatures {
enableStudioCodeUi: boolean;
remoteSession: boolean;
nativePhpRuntime?: boolean;
}
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 @@ -13,6 +13,7 @@ export interface BetaFeatureDefinition {
* Default values for beta features.
*/
const BETA_FEATURE_DEFAULTS: Record< keyof BetaFeatures, boolean > = {
enableStudioCodeUi: false,
remoteSession: false,
nativePhpRuntime: false,
};
Expand All @@ -23,6 +24,12 @@ const BETA_FEATURE_DEFAULTS: Record< keyof BetaFeatures, boolean > = {
*/
export function getBetaFeaturesDefinition(): Record< keyof BetaFeatures, BetaFeatureDefinition > {
return {
enableStudioCodeUi: {
label: __( 'Studio Code Desktop' ),
key: 'enableStudioCodeUi',
default: BETA_FEATURE_DEFAULTS.enableStudioCodeUi,
description: __( 'Try the new Studio Code Desktop assistant.' ),
},
remoteSession: {
label: __( 'Remote Session' ),
key: 'remoteSession',
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 @@ -12,12 +12,6 @@ export const FEATURE_FLAGS: Record< keyof FeatureFlags, FeatureFlagDefinition >
flag: 'enableBlueprints',
default: true,
},
enableStudioCodeUi: {
label: 'Enable Studio Code UI',
env: 'ENABLE_STUDIO_CODE_UI',
flag: 'enableStudioCodeUi',
default: false,
},
enableDesksUiSwitch: {
label: 'Enable Studio UI Switcher',
env: 'ENABLE_DESKS_UI_SWITCH',
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: { enableStudioCodeUi: false, remoteSession: false, nativePhpRuntime },
loading: false,
},
},
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: { enableStudioCodeUi: false, remoteSession: false, nativePhpRuntime: false },
loading: false,
};

Expand Down