Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7b9b099
Explore logout experience, first go
Jul 13, 2026
95afbe0
Merge branch 'trunk' of github.com:Automattic/studio into add/logout-…
Jul 14, 2026
ec3d525
Fix non-existent font
Jul 14, 2026
42ce030
Adjust settings
Jul 14, 2026
1e71a43
Adjust remaining elements
Jul 14, 2026
5b721a9
Handle no sites experience
Jul 14, 2026
2e73f87
Merge branch 'trunk' of github.com:Automattic/studio into add/logout-…
Jul 15, 2026
8c45b50
Use agentic mock
Jul 15, 2026
2973fcb
Merge branch 'trunk' of github.com:Automattic/studio into add/logout-…
Jul 16, 2026
979418c
Fix unit tests
Jul 16, 2026
e3b2570
Adjust styles
Jul 16, 2026
f54529b
Merge branch 'trunk' of github.com:Automattic/studio into add/logout-…
Jul 17, 2026
72a67f0
Ensure we don't fetch sites for logged out users
Jul 17, 2026
b20a701
Remove unrelated changes
Jul 17, 2026
9d9cb50
Fix unrelated changes
Jul 17, 2026
5f85bf5
Fix sidebar header, preview, and publish behavior when logged out
Jul 17, 2026
89da0ac
Remove unrelated data-liberation dist changes
Jul 17, 2026
37fa839
Remove stale data-liberation chunk files deleted on trunk
Jul 17, 2026
9d2043b
Distinguish auth loading from signed-out in agentic features
bcotrim Jul 20, 2026
280922e
Move signin banner into new default Overview settings tab
bcotrim Jul 20, 2026
388b307
Return to the chat screen after logging in from the signin banner
bcotrim Jul 20, 2026
c76339d
Rename supportsAgenticOptOut to agenticRequiresAuth
bcotrim Jul 20, 2026
e425ac3
Add pending state to the dropdown Log in button
bcotrim Jul 20, 2026
b4776af
Hide preview snapshots while signed out
bcotrim Jul 20, 2026
328973c
Add pending state to the welcome Sign up button
bcotrim Jul 20, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix sidebar header, preview, and publish behavior when logged out
- Revert sidebar header to simple "+" button (trunk version)
- Disable preview update button when signed out
- Disable pull/push/disconnect when signed out
- Show "Log in" button instead of "Publish" when signed out

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
  • Loading branch information
Kateryna Kodonenko and claude committed Jul 17, 2026
commit 5f85bf50cf94d0d19c8a77696fa2e20794204e22
30 changes: 5 additions & 25 deletions apps/ui/src/components/sidebar-header/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,10 @@ vi.mock( '@tanstack/react-router', () => ( {
useNavigate: () => navigate,
} ) );

vi.mock( '@/components/menu', () => {
const el = ( props: Record< string, unknown > ) => {
const { children, render: trigger, onClick, disabled } = props;
if ( trigger ) return trigger;
if ( onClick ) {
return (
<button type="button" onClick={ onClick as () => void } disabled={ !! disabled }>
{ children as never }
</button>
);
}
return <div>{ children as never }</div>;
};
return { Root: el, Trigger: el, Popup: el, Item: el };
} );

vi.mock( '@/data/core', () => ( {
useConnector: vi.fn(),
} ) );

vi.mock( '@/data/queries/use-agentic-features', () => ( {
useAgenticFeatures: vi.fn( () => ( { enabled: true, reason: null, isReady: true } ) ),
} ) );

vi.mock( '@/hooks/use-traffic-light-space', () => ( {
useTrafficLightSpace: () => false,
} ) );
Expand All @@ -46,14 +26,14 @@ describe( 'SidebarHeader', () => {
useConnectorMock.mockReturnValue( { showsAppMenuButton: true, popupAppMenu } );
} );

it( 'shows a create menu with New chat, New site, and Import options', async () => {
it( 'starts the add-site workflow from the plus button', () => {
render( <SidebarHeader onToggleSidebar={ vi.fn() } /> );

fireEvent.click( screen.getByRole( 'button', { name: 'Create new' } ) );
fireEvent.click( screen.getByRole( 'button', { name: 'Add site' } ) );

expect( await screen.findByText( 'New chat' ) ).toBeInTheDocument();
expect( screen.getByText( 'New site' ) ).toBeInTheDocument();
expect( screen.getByText( 'Import from…' ) ).toBeInTheDocument();
expect( navigate ).toHaveBeenCalledWith( { to: '/onboarding' } );
expect( screen.queryByText( 'New chat' ) ).not.toBeInTheDocument();
expect( screen.queryByText( 'Import from…' ) ).not.toBeInTheDocument();
} );

it( 'hides the sidebar from the header toggle', () => {
Expand Down
42 changes: 10 additions & 32 deletions apps/ui/src/components/sidebar-header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useNavigate } from '@tanstack/react-router';
import { __ } from '@wordpress/i18n';
import { comment, download, globe, menu, plus } from '@wordpress/icons';
import { Icon, IconButton } from '@wordpress/ui';
import * as Menu from '@/components/menu';
import { menu, plus } from '@wordpress/icons';
import { IconButton } from '@wordpress/ui';
import { useConnector } from '@/data/core';
import { useAgenticFeatures } from '@/data/queries/use-agentic-features';
import { useTrafficLightSpace } from '@/hooks/use-traffic-light-space';
import { drawerIcon } from '@/lib/icons';
import styles from './style.module.css';
Expand All @@ -18,7 +16,6 @@ export function SidebarHeader( { onToggleSidebar }: Props ) {
const reserveTrafficLightSpace = useTrafficLightSpace();
const navigate = useNavigate();
const connector = useConnector();
const { enabled: agenticEnabled } = useAgenticFeatures();
const handleOpenAppMenu = ( event: MouseEvent< HTMLButtonElement > ) => {
const rect = event.currentTarget.getBoundingClientRect();
void connector.popupAppMenu( { x: Math.round( rect.left ), y: Math.round( rect.bottom ) } );
Expand All @@ -37,33 +34,14 @@ export function SidebarHeader( { onToggleSidebar }: Props ) {
/>
) }
<div className={ styles.actions }>
<Menu.Root modal={ false }>
<Menu.Trigger
render={
<IconButton
variant="minimal"
tone="neutral"
size="small"
icon={ plus }
label={ __( 'Create new' ) }
/>
}
/>
<Menu.Popup side="bottom" align="end" className={ styles.popup }>
<Menu.Item disabled={ ! agenticEnabled } onClick={ () => void navigate( { to: '/' } ) }>
<Icon icon={ comment } />
<span>{ __( 'New chat' ) }</span>
</Menu.Item>
<Menu.Item onClick={ () => void navigate( { to: '/onboarding' } ) }>
<Icon icon={ globe } />
<span>{ __( 'New site' ) }</span>
</Menu.Item>
<Menu.Item onClick={ () => void navigate( { to: '/onboarding/import' } ) }>
<Icon icon={ download } />
<span>{ __( 'Import from…' ) }</span>
</Menu.Item>
</Menu.Popup>
</Menu.Root>
<IconButton
variant="minimal"
tone="neutral"
size="small"
icon={ plus }
label={ __( 'Add site' ) }
onClick={ () => void navigate( { to: '/onboarding' } ) }
/>
<IconButton
variant="minimal"
tone="neutral"
Expand Down
4 changes: 4 additions & 0 deletions apps/ui/src/components/site-dropdown/main-view.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ vi.mock( '@/data/queries/use-agentic-features', () => ( {
useAgenticFeatures: vi.fn( () => ( { enabled: true, reason: null, isReady: true } ) ),
} ) );

vi.mock( '@/data/queries/use-auth-user', () => ( {
useLogin: () => ( { mutate: vi.fn(), isPending: false } ),
} ) );

vi.mock( '@/data/queries/use-preview-site', () => ( {
usePublishPreviewSite: () => ( { isPending: false, mutate: vi.fn() } ),
} ) );
Expand Down
23 changes: 15 additions & 8 deletions apps/ui/src/components/site-dropdown/main-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useMemo } from 'react';
import * as Menu from '@/components/menu';
import { useConnector } from '@/data/core';
import { useAgenticFeatures } from '@/data/queries/use-agentic-features';
import { useLogin } from '@/data/queries/use-auth-user';
import { useConnectedWpcomSites } from '@/data/queries/use-connected-wpcom-sites';
import { usePublishPreviewSite } from '@/data/queries/use-preview-site';
import {
Expand Down Expand Up @@ -74,6 +75,7 @@ function useIsSiteSyncing( siteId: string ): { push: boolean; pull: boolean } {
export function MainView( { site, activity, onSetupClick, onDisconnectClick }: Props ) {
const connector = useConnector();
const { enabled: agenticEnabled } = useAgenticFeatures();
const login = useLogin();
const { data: snapshots } = useSnapshots();
const { data: connectedSites } = useConnectedWpcomSites( site.id );

Expand Down Expand Up @@ -242,7 +244,7 @@ export function MainView( { site, activity, onSetupClick, onDisconnectClick }: P
className={ styles.rowActionButton }
loading={ isPreviewPending }
loadingAnnouncement={ __( 'Updating preview' ) }
disabled={ isSyncing }
disabled={ isSyncing || ! agenticEnabled }
focusableWhenDisabled
onClick={ handlePreviewClick }
/>
Expand Down Expand Up @@ -284,7 +286,7 @@ export function MainView( { site, activity, onSetupClick, onDisconnectClick }: P
icon={ arrowDown }
label={ isPullPending ? __( 'Pulling from live' ) : __( 'Pull from live' ) }
className={ styles.rowActionButton }
disabled={ isSyncing }
disabled={ isSyncing || ! agenticEnabled }
focusableWhenDisabled
onClick={ handlePullClick }
/>
Expand All @@ -295,20 +297,23 @@ export function MainView( { site, activity, onSetupClick, onDisconnectClick }: P
icon={ arrowUp }
label={ isPushPending ? __( 'Pushing to live' ) : __( 'Push to live' ) }
className={ styles.rowActionButton }
disabled={ isSyncing }
disabled={ isSyncing || ! agenticEnabled }
focusableWhenDisabled
onClick={ handlePushClick }
/>
<Menu.SubmenuRoot>
<Menu.SubmenuTrigger
className={ styles.moreMenuTrigger }
disabled={ isSyncing }
disabled={ isSyncing || ! agenticEnabled }
aria-label={ __( 'More live site actions' ) }
>
<Icon icon={ moreHorizontal } size={ 16 } aria-hidden="true" />
</Menu.SubmenuTrigger>
<Menu.Popup side="right" align="start" className={ styles.moreMenuPopup }>
<Menu.Item disabled={ isSyncing } onClick={ onDisconnectClick }>
<Menu.Item
disabled={ isSyncing || ! agenticEnabled }
onClick={ onDisconnectClick }
>
{ __( 'Disconnect' ) }
</Menu.Item>
</Menu.Popup>
Expand All @@ -319,12 +324,14 @@ export function MainView( { site, activity, onSetupClick, onDisconnectClick }: P
) : (
<EnvironmentActionPanel
title={ __( 'Live' ) }
copy={ __( 'No connected site.' ) }
buttonLabel={ __( 'Publish' ) }
copy={
agenticEnabled ? __( 'No connected site.' ) : __( 'Sign in to publish your site.' )
}
buttonLabel={ agenticEnabled ? __( 'Publish' ) : __( 'Log in' ) }
variant="solid"
tone="brand"
disabled={ isSyncing }
onClick={ onSetupClick }
onClick={ agenticEnabled ? onSetupClick : () => login.mutate() }
/>
) }
</div>
Expand Down
Loading