Skip to content
Merged
Changes from 1 commit
Commits
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
In progress
  • Loading branch information
nightnei committed Jun 8, 2026
commit eb254e8574ebf4e08d4bab41198bc788978c0707
93 changes: 42 additions & 51 deletions apps/studio/src/components/studio-code-session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
useMemo,
useRef,
useState,
type PropsWithChildren,
type ReactNode,
type Ref,
type UIEvent,
Expand Down Expand Up @@ -105,7 +104,11 @@ function SessionHeader( { onNewConversation }: { onNewConversation: () => void }
);
}

function StudioCodeDescription( { children }: PropsWithChildren ) {
function NoAuth() {
const isOffline = useOffline();
const { authenticate } = useAuth();
const offlineMessage = __( "You're currently offline." );

return (
<div className="p-8 flex justify-between max-w-3xl gap-4 overflow-hidden">
<div className="flex flex-col">
Expand All @@ -127,67 +130,55 @@ function StudioCodeDescription( { children }: PropsWithChildren ) {
</div>
) ) }
</div>
{ children }
</div>
<IllustrationGrid>
<StudioCodeTabImage />
</IllustrationGrid>
</div>
);
}

function NoAuth() {
const isOffline = useOffline();
const { authenticate } = useAuth();
const offlineMessage = __( "You're currently offline." );

return (
<StudioCodeDescription>
<div className="mt-8">
<Tooltip disabled={ ! isOffline } icon={ offlineIcon } text={ offlineMessage }>
<Button
aria-description={ isOffline ? offlineMessage : '' }
aria-disabled={ isOffline }
variant="primary"
onClick={ () => {
if ( isOffline ) {
return;
}
authenticate();
} }
>
{ __( 'Log in to WordPress.com' ) }
<ArrowIcon />
</Button>
</Tooltip>
</div>
<div className="mt-3 w-[40ch] text-frame-text-secondary a8c-body">
<Tooltip
disabled={ ! isOffline }
icon={ offlineIcon }
text={ offlineMessage }
placement="bottom-start"
>
<span>
{ __( 'A WordPress.com account is required to use Studio Code.' ) }{ ' ' }
<div className="mt-8">
<Tooltip disabled={ ! isOffline } icon={ offlineIcon } text={ offlineMessage }>
<Button
aria-description={ isOffline ? offlineMessage : '' }
aria-disabled={ isOffline }
className="!p-0 text-frame-theme hover:opacity-80 h-auto inline-flex items-center"
variant="primary"
onClick={ () => {
if ( isOffline ) {
return;
}
getIpcApi().authenticate( true );
authenticate();
} }
>
{ __( 'Create a free account' ) }
{ __( 'Log in to WordPress.com' ) }
<ArrowIcon />
</Button>
</span>
</Tooltip>
</Tooltip>
</div>
<div className="mt-3 w-[40ch] text-frame-text-secondary a8c-body">
<Tooltip
disabled={ ! isOffline }
icon={ offlineIcon }
text={ offlineMessage }
placement="bottom-start"
>
<span>
{ __( 'A WordPress.com account is required to use Studio Code.' ) }{ ' ' }
<Button
aria-description={ isOffline ? offlineMessage : '' }
aria-disabled={ isOffline }
className="!p-0 text-frame-theme hover:opacity-80 h-auto inline-flex items-center"
onClick={ () => {
if ( isOffline ) {
return;
}
getIpcApi().authenticate( true );
} }
>
{ __( 'Create a free account' ) }
<ArrowIcon />
</Button>
</span>
</Tooltip>
</div>
</div>
</StudioCodeDescription>
<IllustrationGrid>
<StudioCodeTabImage />
</IllustrationGrid>
</div>
);
}

Expand Down