Skip to content

Commit

Permalink
[Website] Default to the Playground preview on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Sep 27, 2024
1 parent 8be9f83 commit a415c79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/playground/website/src/lib/state/redux/slice-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface UIState {

const query = new URL(document.location.href).searchParams;
const isEmbeddedInAnIframe = window.self !== window.top;
// @TODO: Centralize these breakpoint sizes.
const isMobile = window.innerWidth < 875;

const initialState: UIState = {
activeModal:
Expand All @@ -29,8 +31,11 @@ const initialState: UIState = {
offline: !navigator.onLine,
// Open site manager for direct playground.wordpress.net visitors,
// unless they specifically request seamless mode.
// Don't default to the site manager on mobile, as that would mean
// seeing something that's not Playground filling your entire screen –
// quite a confusing experience.
siteManagerIsOpen:
query.get('mode') !== 'seamless' && !isEmbeddedInAnIframe,
query.get('mode') !== 'seamless' && !isEmbeddedInAnIframe && !isMobile,
};

const uiSlice = createSlice({
Expand Down

0 comments on commit a415c79

Please sign in to comment.