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
fix: resolve all warnings
thecodrr9aa7a1318906
diff --git a/apps/web/src/common/dialog-controller.tsx b/apps/web/src/common/dialog-controller.tsxindex 4b113b9cb..630155785 100644--- a/apps/web/src/common/dialog-controller.tsx+++ b/apps/web/src/common/dialog-controller.tsx@@ -1,6 +1,6 @@import ReactDOM from "react-dom";import Dialogs from "../components/dialogs";-import { hardNavigate, hashNavigate } from "../navigation";+import { hardNavigate } from "../navigation";import ThemeProvider from "../components/theme-provider";import { qclone } from "qclone";import { store as notebookStore } from "../stores/notebook-store";@@ -46,7 +46,7 @@ function showDialog<TId extends DialogIds, TReturnType>(openDialogs[id] = false;ReactDOM.unmountComponentAtNode(container);container.remove();- hashNavigate("/", { replace: true, notify: false });+ closeOpenedDialog();resolve(result);};const PropDialog = render(Dialogs[id], perform);@@ -59,7 +59,9 @@ function showDialog<TId extends DialogIds, TReturnType>(}export function closeOpenedDialog() {- const dialogs = document.querySelectorAll(".ReactModalPortal");+ const dialogs = document.querySelectorAll(+ ".ReactModalPortal,[data-react-modal-body-trap]"+ );dialogs.forEach((elem) => elem.remove());}diff --git a/apps/web/src/components/dialogs/feature-dialog.tsx b/apps/web/src/components/dialogs/feature-dialog.tsxindex 3e6272522..350589c83 100644--- a/apps/web/src/components/dialogs/feature-dialog.tsx+++ b/apps/web/src/components/dialogs/feature-dialog.tsx@@ -5,6 +5,7 @@ import { getHomeRoute, hardNavigate } from "../../navigation";import { appVersion } from "../../utils/version";import Config from "../../utils/config";import { isTesting } from "../../utils/platform";+import { useEffect } from "react";type CallToAction = {title: string;@@ -65,12 +66,14 @@ type FeatureDialogProps = {};function FeatureDialog(props: FeatureDialogProps) {- const { featureName } = props;+ const { featureName, onClose } = props;const feature = features[featureName];- if (!feature || (feature.shouldShow && !feature.shouldShow())) {- props.onClose(false);- return null;- }++ useEffect(() => {+ if (!feature || (feature.shouldShow && !feature.shouldShow())) {+ onClose(false);+ }+ }, [feature, onClose]);return (<Dialogdiff --git a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx b/apps/web/src/components/dialogs/toolbar-config-dialog.tsxindex c0ded30f2..501c40a6c 100644--- a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx+++ b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx@@ -105,6 +105,7 @@ export function ToolbarConfigDialog(props: ToolbarConfigDialogProps) {<Flex>{getAllPresets().map((preset) => (<Label+ key={preset.id}variant="text.body"sx={{ alignItems: "center", width: "auto", mr: 2 }}>@@ -245,15 +246,22 @@ type TreeNodeComponentProps = {onRemoveItem?: (item: TreeNode) => void;};function TreeNodeComponent(props: TreeNodeComponentProps) {- const { item, activeItem, onRemoveGroup, onRemoveItem, onAddSubGroup } =- props;+ const {+ item,+ activeItem,+ onRemoveGroup,+ onRemoveItem,+ onAddSubGroup,+ ...restProps+ } = props;if (activeItem && isCollapsed(item, activeItem)) return null;const isDraggable = !isTrash(item);if (isGroup(item) || isSubgroup(item)) {return (<SortableWrapper- {...props}+ {...restProps}+ item={item}draggable={isDraggable}onRemove={onRemoveGroup}onAdd={isGroup(item) ? onAddSubGroup : undefined}@@ -279,7 +287,8 @@ function TreeNodeComponent(props: TreeNodeComponentProps) {return (<SortableWrapper- {...props}+ {...restProps}+ item={item}draggable={isDraggable}onRemove={onRemoveItem}sx={{diff --git a/apps/web/src/components/editor/title-box.tsx b/apps/web/src/components/editor/title-box.tsxindex 0dcf74a36..f1641f00c 100644--- a/apps/web/src/components/editor/title-box.tsx+++ b/apps/web/src/components/editor/title-box.tsx@@ -10,7 +10,7 @@ type TitleBoxProps = {function TitleBox(props: TitleBoxProps) {const { readonly, setTitle, title, nonce } = props;- const [currentTitle, setCurrentTitle] = useState<string>();+ const [currentTitle, setCurrentTitle] = useState<string>("");useEffect(() => {setCurrentTitle(title);diff --git a/apps/web/src/components/loaders/list-loader.tsx b/apps/web/src/components/loaders/list-loader.tsxindex ea633a354..1d86a9bca 100644--- a/apps/web/src/components/loaders/list-loader.tsx+++ b/apps/web/src/components/loaders/list-loader.tsx@@ -29,7 +29,7 @@ export const ListLoader = memo(function ListLoader() {</Flex></Flex>{Lines.map((width) => (- <Box sx={{ py: 2, px: 1 }}>+ <Box key={width} sx={{ py: 2, px: 1 }}><Skeletonheight={16}baseColor="var(--border)"diff --git a/apps/web/src/components/loaders/navigation-loader.tsx b/apps/web/src/components/loaders/navigation-loader.tsxindex 64ec42739..1ddc14fc4 100644--- a/apps/web/src/components/loaders/navigation-loader.tsx+++ b/apps/web/src/components/loaders/navigation-loader.tsx@@ -16,8 +16,9 @@ export const NavigationLoader = memo(function NavigationLoader() {}}bg={"bgSecondary"}>- {[0, 1, 2, 3, 4, 5].map(() => (+ {[0, 1, 2, 3, 4, 5].map((i) => (<Flex+ key={i}px={2}py={"9px"}mx={1}diff --git a/apps/web/src/components/navigation-menu/index.js b/apps/web/src/components/navigation-menu/index.jsindex e9f7fe066..852bff700 100644--- a/apps/web/src/components/navigation-menu/index.js+++ b/apps/web/src/components/navigation-menu/index.js@@ -239,8 +239,6 @@ function NavigationMenu(props) {variant={"icon"}title="Toggle dark/light mode"sx={{- position: "absolute",- right: "2px",bg: "transparent",borderRadius: "default",":hover:not(disabled)": {@@ -249,7 +247,6 @@ function NavigationMenu(props) {},}}onClick={(e) => {- e.stopPropagation();setFollowSystemTheme(false);toggleNightMode();}}diff --git a/apps/web/src/components/navigation-menu/navigation-item.js b/apps/web/src/components/navigation-menu/navigation-item.jsindex 3724fb4fa..ff211373f 100644--- a/apps/web/src/components/navigation-menu/navigation-item.js+++ b/apps/web/src/components/navigation-menu/navigation-item.js@@ -1,4 +1,4 @@-import { Button, Text } from "rebass";+import { Button, Flex, Text } from "rebass";import { useStore as useAppStore } from "../../stores/app-store";import { useMenuTrigger } from "../../hooks/use-menu";import useMobile from "../../utils/use-mobile";@@ -20,15 +20,13 @@ function NavigationItem(props) {const isMobile = useMobile();return (- <Button- data-test-id={`navitem-${title.toLowerCase()}`}+ <Flexbg={props.selected ? "bgSecondaryHover" : "transparent"}- px={2}- py={"9px"}- mx={1}- mt={isTablet ? 1 : "3px"}sx={{borderRadius: "default",+ mx: 1,+ mt: isTablet ? 1 : "3px",+ alignItems: "center",position: "relative",":first-of-type": { mt: 1 },":last-of-type": { mb: 1 },@@ -37,57 +35,66 @@ function NavigationItem(props) {filter: "brightness(100%)",},}}- label={title}- title={title}- onContextMenu={(e) => {- if (!props.menu) return;- e.preventDefault();- openMenu(props.menu.items, props.menu.extraData, false);- }}- onClick={() => {- if (isMobile) toggleSideMenu(false);- props.onClick();- }}- display="flex"- justifyContent={isTablet ? "center" : "flex-start"}- alignItems="center">- <Icon- size={isTablet ? 18 : 15}- color={color || (props.selected ? "primary" : "icon")}- rotate={isLoading}- />- {isNew && (- <Icons.Circle- size={6}- sx={{ position: "absolute", bottom: "8px", left: "23px" }}- color={"primary"}- />- )}- {isShortcut && (- <Icons.Shortcut- size={8}- sx={{ position: "absolute", bottom: "8px", left: "6px" }}- color={color || "icon"}- />- )}-- <Text- display={isTablet ? "none" : "block"}- variant="body"- fontSize="subtitle"+ <Button+ data-test-id={`navitem-${title.toLowerCase()}`}+ bg={"transparent"}sx={{- whiteSpace: "nowrap",- overflow: "hidden",- textOverflow: "ellipsis",- fontWeight: props.selected ? "bold" : "normal",+ px: 2,+ flex: 1,}}- ml={1}+ label={title}+ title={title}+ onContextMenu={(e) => {+ if (!props.menu) return;+ e.preventDefault();+ openMenu(props.menu.items, props.menu.extraData, false);+ }}+ onClick={() => {+ if (isMobile) toggleSideMenu(false);+ props.onClick();+ }}+ display="flex"+ justifyContent={isTablet ? "center" : "flex-start"}+ alignItems="center">- {title}- </Text>+ <Icon+ size={isTablet ? 18 : 15}+ color={color || (props.selected ? "primary" : "icon")}+ rotate={isLoading}+ />+ {isNew && (+ <Icons.Circle+ size={6}+ sx={{ position: "absolute", bottom: "8px", left: "23px" }}+ color={"primary"}+ />+ )}+ {isShortcut && (+ <Icons.Shortcut+ size={8}+ sx={{ position: "absolute", bottom: "8px", left: "6px" }}+ color={color || "icon"}+ />+ )}++ <Text+ display={isTablet ? "none" : "block"}+ variant="body"+ fontSize="subtitle"+ sx={{+ whiteSpace: "nowrap",+ overflow: "hidden",+ textOverflow: "ellipsis",+ fontWeight: props.selected ? "bold" : "normal",+ }}+ ml={1}+ >+ {title}+ </Text>+ </Button>{children}- </Button>+ </Flex>);}export default NavigationItem;diff --git a/apps/web/src/components/scroll-container/index.js b/apps/web/src/components/scroll-container/index.jsindex e8d74e1e1..2eb702581 100644--- a/apps/web/src/components/scroll-container/index.js+++ b/apps/web/src/components/scroll-container/index.js@@ -70,7 +70,7 @@ export function FlexScrollContainer({{...props}className={className}style={{- overflow: "scroll",+ overflow: "auto",position: "relative",flex: "1 1 auto",...viewStyle,diff --git a/apps/web/src/interfaces/storage.ts b/apps/web/src/interfaces/storage.tsindex 133dd6198..43b473c75 100644--- a/apps/web/src/interfaces/storage.ts+++ b/apps/web/src/interfaces/storage.ts@@ -25,6 +25,7 @@ export class NNStorage {}read<T>(key: string): Promise<T | null> {+ if (!key) return Promise.resolve(null);return this.database.getItem(key);}diff --git a/apps/web/src/navigation/hash-routes.js b/apps/web/src/navigation/hash-routes.jsindex 8d02d5c28..ffb18f936 100644--- a/apps/web/src/navigation/hash-routes.js+++ b/apps/web/src/navigation/hash-routes.js@@ -25,14 +25,12 @@ import {} from "../common/dialog-controller";import { hashNavigate } from ".";import { Suspense } from "react";-import EditorLoading from "../components/editor/loading";import EditorPlaceholder from "../components/editor/-placeholder";import { EditorLoader } from "../components/loaders/editor-loader";const Editor = React.lazy(() => import("../components/editor"));const hashroutes = {"/": () => {- closeOpenedDialog();return !editorStore.get().session.state && <EditorPlaceholder />;},"/email/verify": () => {diff --git a/apps/web/src/utils/use-hash-location.ts b/apps/web/src/utils/use-hash-location.tsindex 98554d924..f5e320cdf 100644--- a/apps/web/src/utils/use-hash-location.ts+++ b/apps/web/src/utils/use-hash-location.ts@@ -28,10 +28,11 @@ export default function useHashLocation() {useEffect(() => {// this function is called whenever the hash changesconst handler = (e: HashChangeEvent) => {- const notify = (e as any).notify === undefined ? true : (e as any).notify;+ const update = (e as any).notify === undefined ? true : (e as any).notify;+ console.log(currentLocation());setLoc({location: currentLocation(),- update: notify,+ update,});setQueryParams(currentQuery());};