diff --git a/apps/web/src/app-effects.mobile.ts b/apps/web/src/app-effects.mobile.ts index a1e566898..1bec0cab4 100644 --- a/apps/web/src/app-effects.mobile.ts +++ b/apps/web/src/app-effects.mobile.ts @@ -58,9 +58,8 @@ export default function MobileAppEffects({ overlay.style.pointerEvents = "none"; } }, - onChange: (e, { slide, lastSlide }) => { - if (!lastSlide || !isMobile) return; - toggleSideMenu(slide?.index === 1 ? true : false); + onChange: (e, { slide }) => { + toggleSideMenu(slide?.index === 0 ? true : false); setIsEditorOpen(slide?.index === 3 ? true : false); } }); diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx index 55d6ea224..3cf095bbb 100644 --- a/apps/web/src/app.tsx +++ b/apps/web/src/app.tsx @@ -125,19 +125,23 @@ function DesktopAppContents({ show, setShow }: DesktopAppContentsProps) { const middlePane = useRef(null); useEffect(() => { - if (show) middlePane.current?.expand(); - else middlePane.current?.collapse(); - }, [show]); + setIsNarrow(isTablet); + }, [isTablet]); - useEffect(() => { - if (isFocusMode) { - const middlePaneSize = middlePane.current?.getSize() || 20; - navPane.current?.collapse(); - // the middle pane has to be resized because collapsing the nav - // pane increases the middle pane's size every time. - middlePane.current?.resize(middlePaneSize); - } else navPane.current?.expand(); - }, [isFocusMode]); + // useEffect(() => { + // if (show) middlePane.current?.expand(); + // else middlePane.current?.collapse(); + // }, [show]); + + // useEffect(() => { + // if (isFocusMode) { + // const middlePaneSize = middlePane.current?.getSize() || 20; + // navPane.current?.collapse(); + // // the middle pane has to be resized because collapsing the nav + // // pane increases the middle pane's size every time. + // middlePane.current?.resize(middlePaneSize); + // } else navPane.current?.expand(); + // }, [isFocusMode]); return ( <> @@ -148,45 +152,67 @@ function DesktopAppContents({ show, setShow }: DesktopAppContentsProps) { }} > - setIsNarrow(size <= 5)} - collapsible - collapsedSize={3.5} - > - { - setShow(state || !show); - }} - isTablet={isNarrow} - /> - - - - - - - - - + {!isFocusMode && isTablet ? ( + + { + setShow(state || !show); + }} + isTablet={isNarrow} + /> + + ) : ( + !isFocusMode && ( + <> + setIsNarrow(size <= 5)} + collapsible + collapsedSize={3.5} + > + { + setShow(state || !show); + }} + isTablet={isNarrow} + /> + + + + ) + )} + {!isFocusMode && show && ( + <> + + + + + + + + )} + . import { Button, Flex, Text } from "@theme-ui/components"; import { useState } from "react"; import { + ArrowLeft, Cross, EditorFullWidth, EditorNormalWidth, @@ -74,6 +75,7 @@ import { useStore as useUserStore } from "../../stores/user-store"; import { db } from "../../common/db"; import { showPublishView } from "../publish-view"; import { restrictToHorizontalAxis } from "@dnd-kit/modifiers"; +import useMobile from "../../hooks/use-mobile"; export function EditorActionBar() { const editorMargins = useEditorStore((store) => store.editorMargins); @@ -89,6 +91,8 @@ export function EditorActionBar() { const monographs = useMonographStore((store) => store.monographs); const isNotePublished = activeSession && db.monographs.isPublished(activeSession.id); + const isMobile = useMobile(); + const setIsEditorOpen = useAppStore((store) => store.setIsEditorOpen); const tools = [ { @@ -107,6 +111,7 @@ export function EditorActionBar() { title: isNotePublished ? "Published" : "Publish", icon: isNotePublished ? Published : Publish, hidden: !isLoggedIn, + hideOnMobile: true, enabled: activeSession && (activeSession.type === "default" || activeSession.type === "readonly"), @@ -120,6 +125,7 @@ export function EditorActionBar() { title: editorMargins ? "Disable editor margins" : "Enable editor margins", icon: editorMargins ? EditorNormalWidth : EditorFullWidth, enabled: true, + hideOnMobile: true, onClick: () => useEditorStore.getState().toggleEditorMargins() }, { @@ -187,7 +193,24 @@ export function EditorActionBar() { return ( <> - + {isMobile ? ( + + + + ) : ( + + )} {tools.map((tool) => ( )} diff --git a/apps/web/src/components/notice/index.tsx b/apps/web/src/components/notice/index.tsx index a6c20a17a..76b56d704 100644 --- a/apps/web/src/components/notice/index.tsx +++ b/apps/web/src/components/notice/index.tsx @@ -40,8 +40,8 @@ function Notice() { cursor: "pointer", borderRadius: "default", ":hover": { bg: "hover" }, - alignItems: "center", - minWidth: 250 + alignItems: "center" + // minWidth: 250 }} p={1} onClick={() => NoticeData.action()} @@ -53,11 +53,30 @@ function Notice() { color="accent" sx={{ bg: "shade", mr: 2, p: 2, borderRadius: 80 }} /> - - + + {NoticeData.title} - + {NoticeData.subtitle} diff --git a/apps/web/src/hooks/use-slider.ts b/apps/web/src/hooks/use-slider.ts index d13929be7..2619940f5 100644 --- a/apps/web/src/hooks/use-slider.ts +++ b/apps/web/src/hooks/use-slider.ts @@ -91,7 +91,6 @@ export default function useSlider( const slideToIndex = useCallback( (index: number) => { if (!slides || !ref.current || index >= slides.length) return; - console.log(slides[index].offset, slides[index].width); const slider = ref.current; setTimeout(() => { slider.scrollTo({ diff --git a/apps/web/src/stores/app-store.ts b/apps/web/src/stores/app-store.ts index d3e971c40..2c058d5c7 100644 --- a/apps/web/src/stores/app-store.ts +++ b/apps/web/src/stores/app-store.ts @@ -198,10 +198,9 @@ class AppStore extends BaseStore { }; toggleSideMenu = (toggleState: boolean) => { + console.log("toggling side menu"); this.set( - (state) => - (state.isSideMenuOpen = - toggleState != null ? toggleState : !state.isSideMenuOpen) + (state) => (state.isSideMenuOpen = toggleState ?? !state.isSideMenuOpen) ); }; diff --git a/packages/editor/src/toolbar/toolbar.tsx b/packages/editor/src/toolbar/toolbar.tsx index 59e69b767..79b81d18f 100644 --- a/packages/editor/src/toolbar/toolbar.tsx +++ b/packages/editor/src/toolbar/toolbar.tsx @@ -92,11 +92,11 @@ export function Toolbar(props: ToolbarProps) {