diff --git a/src/app/App.test.tsx b/src/app/App.test.tsx index a4123493d..d86e7b32f 100644 --- a/src/app/App.test.tsx +++ b/src/app/App.test.tsx @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// Copyright (c) 2021-2023 The Pybricks Authors +// Copyright (c) 2021-2026 The Pybricks Authors import { cleanup } from '@testing-library/react'; import React from 'react'; @@ -42,15 +42,7 @@ it.each([false, true])('should render', (darkMode) => { }); describe('documentation pane', () => { - it('should show by default on large screens', () => { - jest.spyOn(window, 'innerWidth', 'get').mockReturnValue(1024); - testRender(); - expect(document.querySelector('.pb-show-docs')).not.toBeNull(); - expect(document.querySelector('.pb-hide-docs')).toBeNull(); - }); - - it('should hide by default on small screens', () => { - jest.spyOn(window, 'innerWidth', 'get').mockReturnValue(800); + it('should hide by default', () => { testRender(); expect(document.querySelector('.pb-show-docs')).toBeNull(); expect(document.querySelector('.pb-hide-docs')).not.toBeNull(); diff --git a/src/app/App.tsx b/src/app/App.tsx index ccf420f51..fbe67409c 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,23 +1,24 @@ // SPDX-License-Identifier: MIT -// Copyright (c) 2020-2023 The Pybricks Authors +// Copyright (c) 2020-2026 The Pybricks Authors import 'react-splitter-layout/lib/index.css'; import './app.scss'; -import { Classes, Spinner } from '@blueprintjs/core'; +import { Button, Classes, Spinner } from '@blueprintjs/core'; +import { Manual } from '@blueprintjs/icons'; import React, { useEffect, useState } from 'react'; + +type SideView = 'off' | 'docs'; import SplitterLayout from 'react-splitter-layout'; import { useLocalStorage, useTernaryDarkMode } from 'usehooks-ts'; import Activities from '../activities/Activities'; import DfuWindowsDriverInstallDialog from '../firmware/dfuWindowsDriverInstallDialog/DfuWindowsDriverInstallDialog'; import { InstallPybricksDialog } from '../firmware/installPybricksDialog/InstallPybricksDialog'; import RestoreOfficialDialog from '../firmware/restoreOfficialDialog/RestoreOfficialDialog'; -import { useSettingIsShowDocsEnabled } from '../settings/hooks'; import SponsorDialog from '../sponsor/SponsorDialog'; import StatusBar from '../status-bar/StatusBar'; import Toolbar from '../toolbar/Toolbar'; import Tour from '../tour/Tour'; -import { isMacOS } from '../utils/os'; -import { useAppLastDocsPageSetting } from './hooks'; +import { docsDefaultPage } from './constants'; import { useI18n } from './i18n'; const Editor = React.lazy(async () => { @@ -47,22 +48,9 @@ const Terminal = React.lazy(async () => { }); const Docs: React.FunctionComponent = () => { - const { setIsSettingShowDocsEnabled } = useSettingIsShowDocsEnabled(); - const { initialDocsPage, setLastDocsPage } = useAppLastDocsPageSetting(); - return (