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
feat: navbar nightmode & signIn
alihamuh684b7ddcd084
diff --git a/apps/web/src/app.js b/apps/web/src/app.jsindex cb610969f..2c78fe7a4 100644--- a/apps/web/src/app.js+++ b/apps/web/src/app.js@@ -5,6 +5,8 @@ import { Flex, Box, Button } from "rebass";import { ThemeProvider } from "./utils/theme";import RootNavigator from "./navigation/navigators/rootnavigator";import "./app.css";+import { askSign } from "./components/dialogs";+import * as Icon from "react-feather";const NavMenuItem = props => {return (@@ -32,6 +34,34 @@ const NavMenuItem = props => {</Button>);};++const NavButtonItem = props => {+ return (+ <Button+ //onClick={() => askSign(Icon.LogIn, "Login", "")}+ onClick={props.onclick}+ variant="nav"+ sx={{+ width: "full",+ borderRadius: "none",+ color: "text",+ textAlign: "center",+ ":hover": {+ backgroundColor: "shade"+ }+ }}+ px={0}+ >+ <props.icon+ size={25}+ strokeWidth={2}+ style={{ marginRight: 3 }}+ fill={"transparent"}+ />+ </Button>+ );+};+var startX, startWidth;function getNavigationViewWidth() {return window.localStorage.getItem("navigationViewWidth");@@ -58,18 +88,23 @@ function App() {}}px={0}>- {Object.values(RootNavigator.routes).map((item, index) => (- <NavMenuItem- onSelected={async () => {- if (RootNavigator.navigate(item.key)) {- setSelectedIndex(index);- }- }}- key={item.key}- item={item}- selected={selectedIndex === index}- />- ))}+ {Object.values(RootNavigator.routes).map((item, index) =>+ item.key ? (+ <NavMenuItem+ onSelected={async () => {+ if (RootNavigator.navigate(item.key)) {+ setSelectedIndex(index);+ }+ }}+ key={item.key}+ item={item}+ selected={selectedIndex === index}+ />+ ) : (+ <NavButtonItem onclick={item.onclick} icon={item.icon} />+ //console.log(item, index)+ )+ )}</Box><Flex flex="1 1 auto" flexDirection="row" alignContent="stretch" px={0}><Flexdiff --git a/apps/web/src/navigation/navbuttons.js b/apps/web/src/navigation/navbuttons.jsnew file mode 100644index 000000000..a06431a09--- /dev/null+++ b/apps/web/src/navigation/navbuttons.js@@ -0,0 +1,16 @@+import { Box } from "rebass";+import React from "react";++export function navButton(key, onclick, icon) {+ return createBtn(key, { onclick, icon });+}++function createBtn(key, props = {}) {+ return {+ [key]: {+ ...props+ }+ };+}++//export default navButton;diff --git a/apps/web/src/navigation/navigators/rootnavigator.js b/apps/web/src/navigation/navigators/rootnavigator.jsindex df49ffe9c..43a2dd69b 100644--- a/apps/web/src/navigation/navigators/rootnavigator.js+++ b/apps/web/src/navigation/navigators/rootnavigator.js@@ -15,7 +15,12 @@ import {createNightMode} from "../routes";import Navigator from "../index";+import { navButton } from "../navbuttons";+import { askSign } from "../../components/dialogs";+import React from "react";+import { changeTheme, isDarkTheme } from "../../utils/theme";+/*For color Search*/const colorRoutes = {...createColorRoute("red", "#ed2d37"),...createColorRoute("orange", "#ec6e05"),@@ -34,8 +39,21 @@ const routes = {...createNormalRoute("favorites", Favorites, Icon.Star),...createNormalRoute("trash", Trash, Icon.Trash2),...createRoute("settings", SettingsContainer, { icon: Icon.Settings }),+ ...navButton(+ "nightmode",+ () => {+ changeTheme();+ },+ Icon.Moon+ ),...colorRoutes,- ...createNormalRoute("sign-in", SignIn, Icon.LogIn) //applied in root naviga /to change later+ ...navButton(+ "signin",+ () => {+ askSign(Icon.LogIn, "Login", "");+ },+ Icon.LogIn+ )};const RootNavigator = new Navigator("RootNavigator", routes, {