diff --git a/apps/web/package.json b/apps/web/package.json
index 3c3eff92c..acd47a075 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -16,6 +16,7 @@
"@streetwriters/tinymce-plugins": "^1.5.18",
"@tinymce/tinymce-react": "^3.13.0",
"@types/rebass": "^4.0.10",
+ "allotment": "^1.12.1",
"async-mutex": "^0.3.2",
"axios": "^0.21.4",
"clipboard-polyfill": "^3.0.3",
diff --git a/apps/web/src/app-effects.mobile.js b/apps/web/src/app-effects.mobile.js
index 191aa3f77..a47668a59 100644
--- a/apps/web/src/app-effects.mobile.js
+++ b/apps/web/src/app-effects.mobile.js
@@ -17,7 +17,7 @@ export default function MobileAppEffects({ sliderId, overlayId, setShow }) {
onSliding: (e, { lastSlide, position, lastPosition }) => {
if (!isMobile) return;
const offset = 70;
- const width = 180;
+ const width = 300;
const percent = offset - (position / width) * offset;
const overlay = document.getElementById("overlay");
@@ -32,6 +32,7 @@ export default function MobileAppEffects({ sliderId, overlayId, setShow }) {
onChange: (e, { slide, lastSlide }) => {
if (!lastSlide || !isMobile) return;
toggleSideMenu(slide?.index === 0 ? true : false);
+ console.log("Setting editor", slide?.index === 2 ? true : false);
setIsEditorOpen(slide?.index === 2 ? true : false);
},
});
@@ -43,6 +44,7 @@ export default function MobileAppEffects({ sliderId, overlayId, setShow }) {
useEffect(() => {
if (!isMobile) return;
+ console.log(isEditorOpen);
slideToIndex(isEditorOpen ? 2 : 1);
}, [isMobile, slideToIndex, isEditorOpen]);
diff --git a/apps/web/src/app.css b/apps/web/src/app.css
index dab98e74c..c0455aa16 100644
--- a/apps/web/src/app.css
+++ b/apps/web/src/app.css
@@ -119,3 +119,28 @@ textarea,
background-color: var(--dimPrimary);
color: var(--text);
}
+
+.middle-pane {
+ overflow: hidden;
+ display: flex;
+}
+.editor-pane {
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+}
+.nav-pane {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+}
+.pane::before {
+ width: 1px !important;
+}
+
+:root {
+ --focus-border: var(--primary);
+ --separator-border: var(--border);
+ --sash-size: 10px;
+ --sash-hover-size: 4px;
+}
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 739e73256..75b1ac804 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -1,15 +1,17 @@
-import React, { useState, Suspense } from "react";
+import React, { useState, Suspense, useMemo, useRef, useEffect } from "react";
import { Box, Flex } from "rebass";
import ThemeProvider from "./components/theme-provider";
-import { AnimatedFlex } from "./components/animated";
-import NavigationMenuPlaceholder from "./components/navigationmenu/index.lite";
import StatusBarPlaceholder from "./components/statusbar/index.lite";
import useMobile from "./utils/use-mobile";
import useTablet from "./utils/use-tablet";
import { LazyMotion, domAnimation } from "framer-motion";
import useDatabase from "./hooks/use-database";
import Loader from "./components/loader";
+import { Allotment } from "allotment";
+import "allotment/dist/style.css";
+import Config from "./utils/config";
import EditorLoading from "./components/editor/loading";
+import NavigationMenuPlaceholder from "./components/navigationmenu/index.lite";
const GlobalMenuWrapper = React.lazy(() =>
import("./components/global-menu-wrapper")
@@ -22,9 +24,8 @@ const NavigationMenu = React.lazy(() => import("./components/navigation-menu"));
const StatusBar = React.lazy(() => import("./components/status-bar"));
function App() {
- const [show, setShow] = useState(true);
const isMobile = useMobile();
- const isTablet = useTablet();
+ const [show, setShow] = useState(true);
const [isAppLoaded] = useDatabase();
return (
@@ -52,116 +53,15 @@ function App() {
height="100%"
sx={{ overflow: "hidden" }}
>
-
-
- {
- if (!isMobile) setShow(state || !show);
- },
- }}
- fallback={}
- />
-
-
-
- }
- />
- {isMobile && (
-
- )}
-
-
- }
- component={HashRouter}
- condition={isAppLoaded}
- />
-
-
- }
- component={StatusBar}
- condition={isAppLoaded}
- />
+ {isMobile ? (
+
+ ) : (
+
+ )}
@@ -179,3 +79,194 @@ function SuspenseLoader({ condition, props, component: Component, fallback }) {
);
}
+
+function DesktopAppContents({ isAppLoaded, show, setShow }) {
+ const isTablet = useTablet();
+ const defaultSizes = useMemo(
+ () => [isTablet ? 60 : 180, isTablet ? 240 : 380],
+ [isTablet]
+ );
+ const paneSizes = useMemo(
+ () => Config.get("paneSizes", defaultSizes),
+ [defaultSizes]
+ );
+ const [isNarrow, setIsNarrow] = useState(isTablet);
+ const panesRef = useRef();
+
+ useEffect(() => {
+ panesRef.current.reset();
+ }, [isTablet]);
+
+ return (
+ <>
+
+ {
+ Config.set("paneSizes", sizes);
+ setIsNarrow(sizes[0] <= 132);
+ }}
+ >
+
+
+ {
+ setShow(state || !show);
+ },
+ isTablet: isTablet || isNarrow,
+ }}
+ fallback={}
+ />
+
+
+
+
+
+ }
+ />
+
+
+
+
+
+
+ }
+ component={HashRouter}
+ condition={isAppLoaded}
+ />
+
+
+
+
+ }
+ component={StatusBar}
+ condition={isAppLoaded}
+ />
+ >
+ );
+}
+
+function MobileAppContents({ isAppLoaded }) {
+ return (
+
+
+ {},
+ }}
+ fallback={}
+ />
+
+
+
+ }
+ />
+
+
+
+ }
+ component={HashRouter}
+ condition={isAppLoaded}
+ />
+
+
+ );
+}
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 784746f00..0e499297a 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -227,6 +227,8 @@ function ListContainer(props) {
testId={`${props.type}-action-button`}
onClick={props.button.onClick}
sx={{
+ position: "absolute",
+ bottom: 0,
display: ["block", "block", "none"],
alignSelf: "end",
borderRadius: 100,
diff --git a/apps/web/src/components/navigation-menu/index.js b/apps/web/src/components/navigation-menu/index.js
index 01fc41110..136a5b2b7 100644
--- a/apps/web/src/components/navigation-menu/index.js
+++ b/apps/web/src/components/navigation-menu/index.js
@@ -70,7 +70,7 @@ const NAVIGATION_MENU_WIDTH = "10em";
const NAVIGATION_MENU_TABLET_WIDTH = "4em";
function NavigationMenu(props) {
- const { toggleNavigationContainer } = props;
+ const { toggleNavigationContainer, isTablet } = props;
const [location, previousLocation, state] = useLocation();
const isFocusMode = useAppStore((store) => store.isFocusMode);
const colors = useAppStore((store) => store.colors);
@@ -104,7 +104,6 @@ function NavigationMenu(props) {
id="navigationmenu"
flexDirection="column"
justifyContent="space-between"
- flex={1}
initial={{
opacity: 1,
}}
@@ -114,21 +113,10 @@ function NavigationMenu(props) {
}}
transition={{ duration: 0.3, ease: "easeOut" }}
sx={{
- borderRight: "1px solid",
- borderRightColor: "border",
- minWidth: [
- NAVIGATION_MENU_WIDTH,
- isFocusMode ? 0 : NAVIGATION_MENU_TABLET_WIDTH,
- isFocusMode ? 0 : NAVIGATION_MENU_WIDTH,
- ],
- maxWidth: [
- NAVIGATION_MENU_WIDTH,
- isFocusMode ? 0 : NAVIGATION_MENU_TABLET_WIDTH,
- isFocusMode ? 0 : NAVIGATION_MENU_WIDTH,
- ],
zIndex: 1,
height: "auto",
position: "relative",
+ flex: 1,
}}
bg={"bgSecondary"}
px={0}
@@ -137,6 +125,7 @@ function NavigationMenu(props) {
{routes.map((item) => (
(
{pins.map((pin) => (
- {/* {theme === "light" ? (
-
- ) : (
-
- )} */}
{!isLoggedIn && (
hardNavigate("/login")}
@@ -246,6 +225,7 @@ function NavigationMenu(props) {
)}
-
+ {isTablet ? null : (
+
+ )}
diff --git a/apps/web/src/components/navigation-menu/index.lite.js b/apps/web/src/components/navigation-menu/index.lite.js
index 291861668..4c4e353ab 100644
--- a/apps/web/src/components/navigation-menu/index.lite.js
+++ b/apps/web/src/components/navigation-menu/index.lite.js
@@ -1,60 +1,7 @@
import { Flex } from "rebass";
-import { useStore as useThemeStore } from "../../stores/theme-store";
-import { Button, Text } from "rebass";
-import useTablet from "../../utils/use-tablet";
-import {
- Note,
- Notebook,
- StarOutline,
- Monographs,
- Tag,
- Trash,
- Settings,
- DarkMode,
- LightMode,
- Sync,
- Login,
-} from "../icons";
-import useLocation from "../../hooks/use-location";
-
-const routes = [
- { title: "Notes", path: "/", icon: Note },
- {
- title: "Notebooks",
- path: "/notebooks",
- icon: Notebook,
- },
- {
- title: "Favorites",
- path: "/favorites",
- icon: StarOutline,
- },
- { title: "Tags", path: "/tags", icon: Tag },
- {
- title: "Monographs",
- path: "/monographs",
- icon: Monographs,
- },
- { title: "Trash", path: "/trash", icon: Trash },
-];
-
-const bottomRoutes = [
- {
- title: "Settings",
- path: "/settings",
- icon: Settings,
- },
-];
-
-const NAVIGATION_MENU_WIDTH = "10em";
-const NAVIGATION_MENU_TABLET_WIDTH = "4em";
+import Loader from "../loader";
function NavigationMenu() {
- const isLoggedIn = false;
- const theme = useThemeStore((store) => store.theme);
- const toggleNightMode = useThemeStore((store) => store.toggleNightMode);
- const [location] = useLocation();
-
return (
);
}
export default NavigationMenu;
-
-function NavigationItem(props) {
- const { icon: Icon, color, title, isLoading } = props;
- const isTablet = useTablet();
-
- return (
-
- );
-}
diff --git a/apps/web/src/components/navigation-menu/navigation-item.js b/apps/web/src/components/navigation-menu/navigation-item.js
index c912e5c48..3724fb4fa 100644
--- a/apps/web/src/components/navigation-menu/navigation-item.js
+++ b/apps/web/src/components/navigation-menu/navigation-item.js
@@ -2,7 +2,6 @@ import { Button, Text } from "rebass";
import { useStore as useAppStore } from "../../stores/app-store";
import { useMenuTrigger } from "../../hooks/use-menu";
import useMobile from "../../utils/use-mobile";
-import useTablet from "../../utils/use-tablet";
import * as Icons from "../icons";
function NavigationItem(props) {
@@ -14,11 +13,11 @@ function NavigationItem(props) {
isShortcut,
isNew,
children,
+ isTablet,
} = props;
const toggleSideMenu = useAppStore((store) => store.toggleSideMenu);
const { openMenu } = useMenuTrigger();
const isMobile = useMobile();
- const isTablet = useTablet();
return (