A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: make responsive for mobile
thecodrr6ae5b1bc2ac0
diff --git a/apps/web/src/app.js b/apps/web/src/app.jsindex 5c97f2131..438461a7d 100644--- a/apps/web/src/app.js+++ b/apps/web/src/app.js@@ -11,6 +11,7 @@ import Animated from "./components/animated";import NavigationMenu from "./components/navigationmenu";import NavigationContainer from "./navigation/container";import RootNavigator from "./navigation/navigators/rootnavigator";+import EditorNavigator from "./navigation/navigators/editornavigator";function App() {const [show, setShow] = usePersistentState("isContainerVisible", true);@@ -37,6 +38,13 @@ function App() {openLastSession();}, [openLastSession]);+ useEffect(() => {+ EditorNavigator.onNavigate = (route) => {+ setShow(!!!route);+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ },[]);+return (<ThemeProvider><Flex id="app" bg="background" height="100%">@@ -62,7 +70,7 @@ function App() {variant="columnFill"/></Animated.Flex>- <Flex width={[0, 0, "100%"]} className="EditorNavigator" />+ <Flex width={[show ? 0 : "100%", 0, "100%"]} className="EditorNavigator" /></Flex><Box id="dialogContainer" /><Box id="snackbarContainer" />diff --git a/apps/web/src/components/editor/editormenu.js b/apps/web/src/components/editor/editormenu.jsindex 943c74efc..5aab1a7b8 100644--- a/apps/web/src/components/editor/editormenu.js+++ b/apps/web/src/components/editor/editormenu.js@@ -10,6 +10,8 @@ function EditorMenu(props) {return (<Flexsx={{+ height: [0,"100%", "100%"],+ visibility: ["collapse", "visible", "visible"],borderBottom: "1px solid",borderColor: "border",fontSize: 13diff --git a/apps/web/src/components/editor/header.js b/apps/web/src/components/editor/header.jsindex 0192e091a..8255f213d 100644--- a/apps/web/src/components/editor/header.js+++ b/apps/web/src/components/editor/header.js@@ -7,6 +7,7 @@ import TitleBox from "./title-box";import { useStore, SESSION_STATES } from "../../stores/editor-store";import { timeConverter } from "../../utils/time";import { countWords } from "../../utils/string";+import EditorNavigator from "../../navigation/navigators/editornavigator";const TextSeperator = () => {return (@@ -31,6 +32,11 @@ function Header() {return (<Flex><Flex flex="1 1 auto" flexDirection="column">+ <Flex justifyContent="center" alignItems="center"+ sx={{+ paddingTop: [1,2,2],+ }}>+ <Icon.ChevronLeft size={30} onClick={() => EditorNavigator.navigate(null)}/><TitleBoxshouldFocus={sessionState === SESSION_STATES.new}title={title}@@ -39,11 +45,8 @@ function Header() {state.session.title = title;})}- sx={{- paddingTop: 2,- paddingBottom: 0,- }}/>+ </Flex><TextfontSize={"subBody"}mx={2}@@ -51,8 +54,8 @@ function Header() {sx={{display: "flex",alignItems: "center",- marginTop: dateEdited || text.length || id.length ? 0 : 2,- marginBottom: dateEdited || text.length || id.length ? 2 : 0,+ marginTop: dateEdited || text.length || id.length ? 0 : [0,2,2],+ marginBottom: dateEdited || text.length || id.length ? [1,2,2] : 0,}}>{dateEdited > 0 ? (@@ -71,6 +74,9 @@ function Header() {</Text></Flex><Flex+ sx={{+ visibility: ["collapse", "visible", "visible"]+ }}alignItems="center"pr={3}onClick={() => {diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.jsindex 3d0725fac..bad41338c 100644--- a/apps/web/src/components/editor/index.js+++ b/apps/web/src/components/editor/index.js@@ -49,7 +49,7 @@ function Editor() {}}><Header />- <Box id="toolbar" display={["none", "flex", "flex"]} />+ <Flex id="toolbar" /><EditorMenu quill={quillRef.current && quillRef.current.quill} /><ReactQuillid="quill"@@ -71,7 +71,7 @@ function Editor() {}}/></Flex>- {id ? <Properties /> : null}+ <Properties /></Animated.Flex>);}diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.jsindex de2073e79..94bd8c7a2 100644--- a/apps/web/src/components/editor/titlebox.js+++ b/apps/web/src/components/editor/titlebox.js@@ -25,7 +25,6 @@ class TitleBox extends React.Component {fontWeight="heading"fontSize="heading"color="text"- display={["none", "flex", "flex"]}px={2}sx={{borderWidth: 0,diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex b5c78783e..42169a5e2 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -75,3 +75,4 @@ export const Theme = createIcon(Icons.mdiThemeLightDark);export const Checkmark = createIcon(Icons.mdiCheck);export const Properties = createIcon(Icons.mdiDotsHorizontal);+diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex cff0b6e2a..8abbee56b 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -11,6 +11,7 @@ import { showPasswordDialog } from "../dialogs/passworddialog";import { db, COLORS } from "../../common";import { useTheme } from "emotion-theming";import Colors from "../menu/colors";+import { isMobile } from "../../utils/dimensions";function menuItems(note, context) {return [@@ -93,7 +94,8 @@ function Note(props) {const { item, index } = props;const note = item;const selectedNote = useStore((store) => store.selectedNote);- const isOpened = selectedNote === note.id;+ // we will never be opening a note side-by-side in Mobile+ const isOpened = isMobile() ? false : selectedNote === note.id;const theme = useTheme();return (<ListItemdiff --git a/apps/web/src/components/properties/index.js b/apps/web/src/components/properties/index.jsindex 1ee923887..63396ad3e 100644--- a/apps/web/src/components/properties/index.js+++ b/apps/web/src/components/properties/index.js@@ -56,7 +56,6 @@ function Properties() {style={{position: "absolute",right: 0,- width: 300,height: "100%",}}onBlur={() => toggleProperties()}@@ -65,8 +64,8 @@ function Properties() {sx={{overflowY: "auto",overflowX: "hidden",- width: [0, 0, "100%"],height: "100%",+ width: "300px",borderLeft: "1px solid",borderLeftColor: "border",}}diff --git a/apps/web/src/navigation/index.js b/apps/web/src/navigation/index.jsindex 8607d5637..b4ca33fa9 100644--- a/apps/web/src/navigation/index.js+++ b/apps/web/src/navigation/index.js@@ -13,6 +13,7 @@ class Navigator {this.options = options;this.history = [];this.lastRoute = undefined;+ this.onNavigate = () => {};}onLoad = () => {@@ -46,6 +47,8 @@ class Navigator {navigate(routeName, params = {}, force = false) {let route = this.getRoute(routeName);++ this.onNavigate(route);if (!force && (!route || this.lastRoute === route)) {return false;diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex e6f37ec66..47ead7dd4 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -33,7 +33,7 @@ const DEFAULT_SESSION = {};class EditorStore extends BaseStore {session = DEFAULT_SESSION;- arePropertiesVisible = true;+ arePropertiesVisible = false;openLastSession = async () => {// Do not reopen last session on mobilediff --git a/apps/web/src/theme/index.js b/apps/web/src/theme/index.jsindex d1c8928e3..7252d1519 100644--- a/apps/web/src/theme/index.js+++ b/apps/web/src/theme/index.js@@ -12,7 +12,7 @@ class ThemeFactory {construct(config) {return {breakpoints: ["480px", "1000px", "1000px"],- space: [0, 5, 10, 15, 20, 25, 30, 35],+ space: [0, 5, 10, 15, 20, 25, 30, 35] ,sizes: { full: "100%", half: "50%" },radii: { none: 0, default: 5 },colors: new ColorSchemeFactory(config.theme, config.accent),