refactor: run eslint on the whole project

This commit is contained in:
thecodrr
2022-08-27 15:23:11 +05:00
parent e898ef5d86
commit 15f5fcd521
378 changed files with 52481 additions and 20809 deletions

14
.eslintignore Normal file
View File

@@ -0,0 +1,14 @@
# all
build
coverage
node_modules
dist
# mobile
apps/mobile/native/
# web
apps/web/public/an.js
# editor
packages/editor/styles/

74
.eslintrc.js Normal file
View File

@@ -0,0 +1,74 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/jsx-runtime"
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: "latest",
sourceType: "module"
},
plugins: [
"react",
"@typescript-eslint",
"unused-imports",
"detox",
"jest",
"react-native"
],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_"
}
],
"linebreak-style": ["error", "unix"],
quotes: [
"error",
"double",
{ avoidEscape: true, allowTemplateLiterals: true }
],
semi: ["error", "always"],
"@typescript-eslint/no-empty-function": "off",
"react/prop-types": "off"
},
settings: {
react: {
version: "17"
}
},
overrides: [
{
files: ["apps/mobile/**/**/*.{jsx,tsx,ts,js}"],
env: {
"react-native/react-native": true,
es2021: true,
browser: true,
jest: true,
"jest/globals": true,
"detox/detox": true
},
rules: {
// TODO: remove this gradually
"@typescript-eslint/ban-ts-comment": "off"
}
}
]
};

View File

@@ -1,5 +0,0 @@
e2e
native
rn-build-deps
.github
patches

View File

@@ -1,52 +0,0 @@
module.exports = {
parser: "@typescript-eslint/parser",
env: {
browser: true,
es2021: true,
"react-native/react-native": true
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 12,
es6: true,
sourceType: "module"
},
plugins: [
"react",
"react-native",
"prettier",
"unused-imports",
"@typescript-eslint"
],
rules: {
"react/display-name": 0,
"no-unused-vars": "off",
"react/no-unescaped-entities": "off",
"unused-imports/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": "off",
"prefer-const": "off",
"no-empty": "off",
"react/prop-types": 0,
"react/jsx-filename-extension": [
1,
{ extensions: [".js", ".jsx", "ts", "tsx"] }
],
"prettier/prettier": [
"error",
{},
{
usePrettierrc: true
}
]
}
};

View File

@@ -2,7 +2,6 @@
* @format
*/
import React from "react";
import "react-native";
// Note: test renderer must be required after react-native.
import renderer from "react-test-renderer";

View File

@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { withErrorBoundry } from "./components/exception-handler";

File diff suppressed because one or more lines are too long

View File

@@ -2,12 +2,12 @@ import { Platform } from "react-native";
import { MMKV } from "../database/mmkv";
import { useSettingStore } from "../../stores/use-setting-store";
const WEBSITE_ID = `3c6890ce-8410-49d5-8831-15fb2eb28a21`;
const baseUrl = `https://analytics.streetwriters.co/api/collect`;
const WEBSITE_ID = "3c6890ce-8410-49d5-8831-15fb2eb28a21";
const baseUrl = "https://analytics.streetwriters.co/api/collect";
const UA =
Platform.OS === "ios"
? `Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1`
? "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1"
: `
Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36`;

View File

@@ -21,10 +21,12 @@ export async function deriveCryptoKey(name, data) {
KEYSTORE_CONFIG
);
return credentials.key;
} catch (e) {}
} catch (e) {
console.error(e);
}
}
export async function getCryptoKey(name) {
export async function getCryptoKey(_name) {
try {
if (await Keychain.hasInternetCredentials("notesnook")) {
let credentials = await Keychain.getInternetCredentials(
@@ -35,14 +37,18 @@ export async function getCryptoKey(name) {
} else {
return null;
}
} catch (e) {}
} catch (e) {
console.error(e);
}
}
export async function removeCryptoKey(name) {
export async function removeCryptoKey(_name) {
try {
let result = await Keychain.resetInternetCredentials("notesnook");
return result;
} catch (e) {}
} catch (e) {
console.error(e);
}
}
export async function getRandomBytes(length) {

View File

@@ -99,7 +99,6 @@ async function checkAndCreateDir(path) {
}
} catch (e) {
await RNFetchBlob.fs.mkdir(dir);
} finally {
}
return dir;
}

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Platform } from "react-native";
import * as ScopedStorage from "react-native-scoped-storage";
import Sodium from "react-native-sodium";
@@ -138,7 +137,7 @@ export async function downloadAttachment(hash, global = true) {
console.log("saved file uri: ", fileUri);
presentSheet({
title: `File downloaded`,
title: "File downloaded",
paragraph: `${attachment.metadata.filename} saved to ${
Platform.OS === "android"
? "selected path"

View File

@@ -35,7 +35,7 @@ export async function writeEncrypted(filename, { data, type, key }) {
console.log(filepath);
await RNFetchBlob.fs.writeFile(filepath, data, "base64");
let output = await Sodium.encryptFile(key, {
uri: Platform.OS === "ios" ? filepath : `file://` + filepath,
uri: Platform.OS === "ios" ? filepath : "file://" + filepath,
type: "url"
});
RNFetchBlob.fs.unlink(filepath).catch(console.log);
@@ -43,7 +43,7 @@ export async function writeEncrypted(filename, { data, type, key }) {
console.log("encrypted file output: ", output);
return {
...output,
alg: `xcha-stream`
alg: "xcha-stream"
};
}

View File

@@ -1,8 +1,8 @@
function info(context: string, ...logs: any[]) {
function info(context: string, ...logs: unknown[]) {
console.log(`${new Date().toLocaleDateString()}::info::${context}:`, ...logs);
}
function error(context: string, ...logs: any[]) {
function error(context: string, ...logs: unknown[]) {
console.log(
`${new Date().toLocaleDateString()}::error::${context}: `,
...logs
@@ -10,8 +10,8 @@ function error(context: string, ...logs: any[]) {
}
type Logger = {
info: (context: string, ...logs: any[]) => void;
error: (context: string, ...logs: any[]) => void;
info: (context: string, ...logs: unknown[]) => void;
error: (context: string, ...logs: unknown[]) => void;
};
declare global {

View File

@@ -1,4 +1,3 @@
import React from "react";
import { FlatList, View } from "react-native";
import { useSelectionStore } from "../../stores/use-selection-store";
import { useMessageStore } from "../../stores/use-message-store";

View File

@@ -1,11 +1,7 @@
import React from "react";
import { useThemeStore } from "../../stores/use-theme-store";
import Paragraph from "../ui/typography/paragraph";
import { getStyle } from "./functions";
export const Body = ({ text, style = {} }) => {
const colors = useThemeStore((state) => state.colors);
return (
<Paragraph
style={{

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Linking, View } from "react-native";
//import SettingsBackupAndRestore from '../../screens/settings/backup-restore';
import { eSendEvent, presentSheet } from "../../services/event-manager";
@@ -83,7 +82,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
))}
{buttons.length > 1 &&
buttons.slice(1, 2).map((item, index) => (
buttons.slice(1, 2).map((item) => (
<Button
key={item.title}
title={item.title}
@@ -128,7 +127,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
))}
{buttons.length > 1 &&
buttons.slice(1, 2).map((item, index) => (
buttons.slice(1, 2).map((item) => (
<Button
key={item.title}
title={item.title}

View File

@@ -1,11 +1,8 @@
import React from "react";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";
import Paragraph from "../ui/typography/paragraph";
import { getStyle } from "./functions";
export const Description = ({ text, style = {}, inline }) => {
const colors = useThemeStore((state) => state.colors);
return (
<Paragraph
style={{

View File

@@ -1,4 +1,4 @@
import React, { Fragment } from "react";
import { Fragment } from "react";
import { View } from "react-native";
import { allowedPlatforms } from "../../stores/use-message-store";
import { ProFeatures } from "../dialogs/result/pro-features";

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { FlatList, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { useMessageStore } from "../../stores/use-message-store";

View File

@@ -1,13 +1,9 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../stores/use-theme-store";
import Paragraph from "../ui/typography/paragraph";
import { getStyle } from "./functions";
export const List = ({ items, listType, style = {} }) => {
const colors = useThemeStore((state) => state.colors);
return (
<View
style={{

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Image } from "react-native";
import { getStyle } from "./functions";

View File

@@ -1,12 +1,8 @@
import React from "react";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";
import Heading from "../ui/typography/heading";
import { getStyle } from "./functions";
export const SubHeading = ({ text, style = {} }) => {
const colors = useThemeStore((state) => state.colors);
return (
<Heading
size={SIZE.md + 2}

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useMessageStore } from "../../stores/use-message-store";
import { SIZE } from "../../utils/size";

View File

@@ -1,5 +1,5 @@
import Clipboard from "@react-native-clipboard/clipboard";
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { ScrollView } from "react-native-gesture-handler";
import picker from "../../screens/editor/tiptap/picker";
@@ -35,8 +35,7 @@ const Actions = ({ attachment, setAttachments, fwdRef }) => {
const colors = useThemeStore((state) => state.colors);
const contextId = attachment.metadata.hash;
const [filename, setFilename] = useState(attachment.metadata.filename);
const [currentProgress, setCurrentProgress] =
useAttachmentProgress(attachment);
const [currentProgress] = useAttachmentProgress(attachment);
const [failed, setFailed] = useState(attachment.failed);
const [notes, setNotes] = useState([]);
const [loading, setLoading] = useState({

View File

@@ -1,4 +1,3 @@
import React from "react";
import { TouchableOpacity, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useAttachmentStore } from "../../stores/use-attachment-store";

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import { FlatList } from "react-native-gesture-handler";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
@@ -85,7 +85,7 @@ export const AttachmentDialog = () => {
}, 300);
};
const renderItem = ({ item, index }) => (
const renderItem = ({ item }) => (
<AttachmentItem setAttachments={setAttachments} attachment={item} />
);
@@ -162,7 +162,7 @@ export const AttachmentDialog = () => {
>
<Icon name="attachment" size={60} color={colors.icon} />
<Paragraph>
{note ? `No attachments on this note` : `No attachments`}
{note ? "No attachments on this note" : "No attachments"}
</Paragraph>
</View>
}

View File

@@ -1,11 +1,10 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import {
eSubscribeEvent,
eUnSubscribeEvent
} from "../../services/event-manager";
import { useThemeStore } from "../../stores/use-theme-store";
import { eCloseLoginDialog, eOpenLoginDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import BaseDialog from "../dialog/base-dialog";
import { Toast } from "../toast";

View File

@@ -1,6 +1,5 @@
import React, { useRef, useState } from "react";
import { useRef, useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { useUserStore } from "../../stores/use-user-store";
import {
eSendEvent,
@@ -16,7 +15,6 @@ import { Notice } from "../ui/notice";
import Seperator from "../ui/seperator";
export const ChangePassword = () => {
const colors = useThemeStore((state) => state.colors);
const passwordInputRef = useRef();
const password = useRef();
const oldPasswordInputRef = useRef();
@@ -50,7 +48,7 @@ export const ChangePassword = () => {
await db.user.clearSessions();
await db.user.changePassword(oldPassword.current, password.current);
ToastEvent.show({
heading: `Account password updated`,
heading: "Account password updated",
type: "success",
context: "global"
});

View File

@@ -1,9 +1,6 @@
import { createRef } from "react";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import SettingsService from "../../services/settings";
import { eCloseLoginDialog } from "../../utils/events";
import { tabBarRef } from "../../utils/global-refs";
export const initialAuthMode = createRef(0);
export function hideAuth() {

View File

@@ -1,4 +1,4 @@
import React, { useRef, useState } from "react";
import { useRef, useState } from "react";
import { View } from "react-native";
import ActionSheet from "react-native-actions-sheet";
import { DDS } from "../../services/device-detection";
@@ -45,7 +45,7 @@ export const ForgotPassword = () => {
lastRecoveryEmailTime: Date.now()
});
ToastEvent.show({
heading: `Check your email to reset password`,
heading: "Check your email to reset password",
message: `Recovery email has been sent to ${email.current.toLowerCase()}`,
type: "success",
context: "local",

View File

@@ -1,8 +1,5 @@
import React, { useState } from "react";
import { useState } from "react";
import { View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useThemeStore } from "../../stores/use-theme-store";
import { tabBarRef } from "../../utils/global-refs";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import { Toast } from "../toast";
import { initialAuthMode } from "./common";
@@ -17,11 +14,9 @@ export const AuthMode = {
};
const Auth = ({ navigation, route }) => {
const colors = useThemeStore((state) => state.colors);
const [currentAuthMode, setCurrentAuthMode] = useState(
route?.params?.mode || AuthMode.login
);
const insets = useSafeAreaInsets();
initialAuthMode.current = route?.params.mode || AuthMode.login;
useNavigationFocus(navigation, {
onFocus: () => {

View File

@@ -1,7 +1,6 @@
import React, { useEffect, useRef, useState } from "react";
import { Platform, View } from "react-native";
import { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { DDS } from "../../services/device-detection";
import { eSendEvent, ToastEvent } from "../../services/event-manager";
import { clearMessage } from "../../services/message";
@@ -10,30 +9,22 @@ import SettingsService from "../../services/settings";
import { useUserStore } from "../../stores/use-user-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { db } from "../../common/database";
import { eCloseLoginDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import BaseDialog from "../dialog/base-dialog";
import SheetProvider from "../sheet-provider";
import { Progress } from "../sheets/progress";
import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import Input from "../ui/input";
import { SvgView } from "../ui/svg";
import { BouncingView } from "../ui/transitions/bouncing-view";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { SVG } from "./background";
import { ForgotPassword } from "./forgot-password";
import TwoFactorVerification from "./two-factor";
import Animated, {
FadeInDown,
FadeOutDown,
FadeOutUp
} from "react-native-reanimated";
import Navigation from "../../services/navigation";
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
import { hideAuth } from "./common";
export const Login = ({ changeMode, welcome }) => {
export const Login = ({ changeMode }) => {
const colors = useThemeStore((state) => state.colors);
const email = useRef();
const emailInputRef = useRef();
@@ -42,7 +33,6 @@ export const Login = ({ changeMode, welcome }) => {
const [focused, setFocused] = useState(false);
const [error, setError] = useState(false);
const [loading, setLoading] = useState(false);
const insets = useSafeAreaInsets();
const setUser = useUserStore((state) => state.setUser);
@@ -188,7 +178,7 @@ export const Login = ({ changeMode, welcome }) => {
}}
size={SIZE.md}
>
Don't have an account? Sign up
{"Don't have an account? Sign up"}
</Paragraph>
</View>
<View

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Modal, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { useUserStore } from "../../stores/use-user-store";
@@ -7,14 +7,12 @@ import {
eSendEvent,
eSubscribeEvent,
eUnSubscribeEvent,
presentSheet,
ToastEvent
} from "../../services/event-manager";
import { clearMessage } from "../../services/message";
import PremiumService from "../../services/premium";
import Sync from "../../services/sync";
import { db } from "../../common/database";
import { MMKV } from "../../common/database/mmkv";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import { IconButton } from "../ui/icon-button";
@@ -43,7 +41,6 @@ function getEmail(email) {
export const SessionExpired = () => {
const colors = useThemeStore((state) => state.colors);
const email = useRef();
const emailInputRef = useRef();
const passwordInputRef = useRef();
const password = useRef();
const [visible, setVisible] = useState(false);
@@ -51,14 +48,13 @@ export const SessionExpired = () => {
const setUser = useUserStore((state) => state.setUser);
const [error, setError] = useState(false);
const [loading, setLoading] = useState(false);
const logout = async () => {
try {
await db.user.logout();
await BiometricService.resetCredentials();
await SettingsService.set({
SettingsService.set({
introCompleted: true
});
setVisible(false);
@@ -109,7 +105,6 @@ export const SessionExpired = () => {
};
const login = async (mfa, callback) => {
if (error) return;
setLoading(true);
let user;
try {

View File

@@ -1,21 +1,14 @@
import React, { useRef, useState } from "react";
import { useRef, useState } from "react";
import { Dimensions, View } from "react-native";
import Animated, {
FadeInDown,
FadeOutDown,
FadeOutUp
} from "react-native-reanimated";
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
import { DDS } from "../../services/device-detection";
import { eSendEvent, ToastEvent } from "../../services/event-manager";
import { ToastEvent } from "../../services/event-manager";
import { clearMessage, setEmailVerifyMessage } from "../../services/message";
import Navigation from "../../services/navigation";
import PremiumService from "../../services/premium";
import SettingsService from "../../services/settings";
import { useThemeStore } from "../../stores/use-theme-store";
import { useUserStore } from "../../stores/use-user-store";
import umami from "../../common/analytics";
import { db } from "../../common/database";
import { eCloseLoginDialog } from "../../utils/events";
import { openLinkInBrowser } from "../../utils/functions";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
@@ -23,13 +16,12 @@ import BaseDialog from "../dialog/base-dialog";
import { Button } from "../ui/button";
import Input from "../ui/input";
import { SvgView } from "../ui/svg";
import { BouncingView } from "../ui/transitions/bouncing-view";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { SVG } from "./background";
import { hideAuth } from "./common";
export const Signup = ({ changeMode, welcome, trial }) => {
export const Signup = ({ changeMode, trial }) => {
const colors = useThemeStore((state) => state.colors);
const email = useRef();
const emailInputRef = useRef();

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import { eSendEvent, presentSheet } from "../../services/event-manager";
import { useThemeStore } from "../../stores/use-theme-store";
@@ -157,7 +157,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
}}
>
{codeHelpText[currentMethod.method] ||
`Select how you would like to recieve the code`}
"Select how you would like to recieve the code"}
</Paragraph>
<Seperator />

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { useSelectionStore } from "../../stores/use-selection-store";

View File

@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import { Keyboard, Platform, View } from "react-native";
import Animated, {
Easing,
@@ -6,7 +6,6 @@ import Animated, {
useSharedValue,
withTiming
} from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../e2e/test.ids";
import { editorState } from "../../screens/editor/tiptap/utils";
@@ -22,7 +21,6 @@ export const FloatingButton = ({
color = "accent",
shouldShow = false
}) => {
const insets = useSafeAreaInsets();
const deviceMode = useSettingStore((state) => state.deviceMode);
const selectionMode = useSelectionStore((state) => state.selectionMode);
const translate = useSharedValue(0);

View File

@@ -1,4 +1,3 @@
import React from "react";
import { KeyboardAvoidingView, Platform, SafeAreaView } from "react-native";
import { useSettingStore } from "../../stores/use-setting-store";
import useIsFloatingKeyboard from "../../hooks/use-is-floating-keyboard";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useMessageStore } from "../../stores/use-message-store";
import { useThemeStore } from "../../stores/use-theme-store";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { ViewProps } from "react-native";
import Animated, { FadeOutUp } from "react-native-reanimated";
import { useThemeStore } from "../../stores/use-theme-store";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";

View File

@@ -3,7 +3,6 @@ import { useNoteStore } from "../../stores/use-notes-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { AnnouncementDialog } from "../announcements";
import { AttachmentDialog } from "../attachments";
import Auth from "../auth";
import AuthModal from "../auth/auth-modal";
import { SessionExpired } from "../auth/session-expired";
import { Dialog } from "../dialog";
@@ -24,39 +23,36 @@ import RateAppSheet from "../sheets/rate-app";
import RecoveryKeySheet from "../sheets/recovery-key";
import RestoreDataSheet from "../sheets/restore-data";
const DialogProvider = React.memo(
() => {
const colors = useThemeStore((state) => state.colors);
const loading = useNoteStore((state) => state.loading);
const DialogProvider = () => {
const colors = useThemeStore((state) => state.colors);
const loading = useNoteStore((state) => state.loading);
return (
<>
<Dialog context="global" />
<AddTopicDialog colors={colors} />
<AddNotebookSheet colors={colors} />
<PremiumDialog colors={colors} />
<AuthModal colors={colors} />
<MergeConflicts />
<ExportNotesSheet />
<RecoveryKeySheet colors={colors} />
<SheetProvider />
<SheetProvider context="sync_progress" />
<RestoreDataSheet />
<ResultDialog />
<VaultDialog colors={colors} />
<AddToNotebookSheet colors={colors} />
<RateAppSheet />
<ImagePreview />
<PublishNoteSheet />
<ManageTagsSheet />
<AttachmentDialog />
{loading ? null : <Expiring />}
<AnnouncementDialog />
<SessionExpired />
</>
);
},
() => true
);
return (
<>
<Dialog context="global" />
<AddTopicDialog colors={colors} />
<AddNotebookSheet colors={colors} />
<PremiumDialog colors={colors} />
<AuthModal colors={colors} />
<MergeConflicts />
<ExportNotesSheet />
<RecoveryKeySheet colors={colors} />
<SheetProvider />
<SheetProvider context="sync_progress" />
<RestoreDataSheet />
<ResultDialog />
<VaultDialog colors={colors} />
<AddToNotebookSheet colors={colors} />
<RateAppSheet />
<ImagePreview />
<PublishNoteSheet />
<ManageTagsSheet />
<AttachmentDialog />
{loading ? null : <Expiring />}
<AnnouncementDialog />
<SessionExpired />
</>
);
};
export default DialogProvider;
export default React.memo(DialogProvider, () => true);

View File

@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import {
KeyboardAvoidingView,
Modal,

View File

@@ -1,4 +1,3 @@
import React from "react";
import { ActivityIndicator, StyleSheet, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { DDS } from "../../services/device-detection";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Text } from "react-native";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
@@ -25,7 +24,6 @@ type DialogHeaderProps = {
};
const DialogHeader = ({
icon,
title,
paragraph,
button,

View File

@@ -6,7 +6,7 @@ type DialogInfo = {
paragraph?: string;
positiveText?: string;
negativeText?: string;
positivePress?: (value: any) => void;
positivePress?: (value: unknown) => void;
onClose?: () => void;
positiveType?:
| "transparent"

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { DDS } from "../../services/device-detection";

View File

@@ -1,10 +1,6 @@
import React, { createRef } from "react";
import { Keyboard, LayoutAnimation, UIManager, View } from "react-native";
import {
Transition,
Transitioning,
TransitioningView
} from "react-native-reanimated";
import { View } from "react-native";
import { useMenuStore } from "../../../stores/use-menu-store";
import {
eSubscribeEvent,
@@ -67,7 +63,9 @@ export class AddTopicDialog extends React.Component {
this.close();
Navigation.queueRoutesForUpdate("Notebooks", "Notebook", "TopicNotes");
useMenuStore.getState().setMenuPins();
} catch (e) {}
} catch (e) {
console.error(e);
}
};
componentDidMount() {

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { ScrollView, View } from "react-native";
import { useThemeStore } from "../../../stores/use-theme-store";
import { useMessageStore } from "../../../stores/use-message-store";
@@ -20,13 +20,13 @@ import Paragraph from "../../ui/typography/paragraph";
const offsets = [];
let timeout = null;
const JumpToSectionDialog = ({ scrollRef, data, type, screen }) => {
const JumpToSectionDialog = ({ scrollRef, data, type }) => {
const colors = useThemeStore((state) => state.colors);
const notes = data;
const [visible, setVisible] = useState(false);
const [currentIndex, setCurrentIndex] = useState(null);
const onPress = (item, index) => {
const onPress = (item) => {
let ind = notes.findIndex(
(i) => i.title === item.title && i.type === "header"
);

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../../stores/use-theme-store";
import { DDS } from "../../../services/device-detection";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../../stores/use-theme-store";

View File

@@ -1,5 +1,5 @@
import Clipboard from "@react-native-clipboard/clipboard";
import React, { Component, createRef } from "react";
import { Component, createRef } from "react";
import { InteractionManager, View } from "react-native";
import Share from "react-native-share";
import { notesnook } from "../../../../e2e/test.ids";
@@ -262,7 +262,7 @@ export class VaultDialog extends Component {
db.vault
.changePassword(this.password, this.newPassword)
.then((result) => {
.then(() => {
this.setState({
loading: false
});
@@ -348,7 +348,9 @@ export class VaultDialog extends Component {
context: "local"
});
}
} catch (e) {}
} catch (e) {
console.error(e);
}
this.setState({
loading: false
});
@@ -526,7 +528,7 @@ export class VaultDialog extends Component {
_permanantUnlock() {
db.vault
.remove(this.state.note.id, this.password)
.then((r) => {
.then(() => {
ToastEvent.show({
heading: "Note permanantly unlocked.",
type: "success",
@@ -568,7 +570,9 @@ export class VaultDialog extends Component {
failOnCancel: false,
message: await toTXT(note)
});
} catch (e) {}
} catch (e) {
console.error(e);
}
}
_takeErrorAction(e) {
@@ -628,7 +632,9 @@ export class VaultDialog extends Component {
visible: true
});
}
} catch (e) {}
} catch (e) {
console.error(e);
}
};
render() {
@@ -636,18 +642,12 @@ export class VaultDialog extends Component {
const {
note,
visible,
wrongPassword,
passwordsDontMatch,
novault,
locked,
permanant,
biometricUnlock,
deleteNote,
share,
goToEditor,
fingerprintAccess,
changePassword,
copyNote,
loading,
deleteVault,
clearVault
@@ -806,7 +806,7 @@ export class VaultDialog extends Component {
validationType="confirmPassword"
customValidator={() => this.password}
errorMessage="Passwords do not match."
onErrorCheck={(e) => null}
onErrorCheck={() => null}
marginBottom={0}
autoComplete="password"
returnKeyLabel="Create"

View File

@@ -30,7 +30,8 @@ class ExceptionHandler extends React.Component<{
static getDerivedStateFromError(error: Error) {
return { hasError: true, error: error };
}
componentDidCatch(error: Error, errorInfo: any) {
componentDidCatch(_error: Error) {
// A custom error logging function
}
@@ -65,7 +66,7 @@ class ExceptionHandler extends React.Component<{
}
export const withErrorBoundry = (Element: React.ElementType, name: string) => {
return () => {
return function ErrorBoundary() {
return (
<ExceptionHandler component={name}>
<Element />

View File

@@ -14,65 +14,63 @@ import { LeftMenus } from "./left-menus";
import { RightMenus } from "./right-menus";
import { Title } from "./title";
export const Header = React.memo(
() => {
const colors = useThemeStore((state) => state.colors);
const insets = useSafeAreaInsets();
const [hide, setHide] = useState(true);
const selectionMode = useSelectionStore((state) => state.selectionMode);
const currentScreen = useNavigationStore(
(state) => state.currentScreen?.name
);
const _Header = () => {
const colors = useThemeStore((state) => state.colors);
const insets = useSafeAreaInsets();
const [hide, setHide] = useState(true);
const selectionMode = useSelectionStore((state) => state.selectionMode);
const currentScreen = useNavigationStore(
(state) => state.currentScreen?.name
);
const onScroll = (data) => {
if (data.y > 150) {
if (!hide) return;
setHide(false);
} else {
if (hide) return;
setHide(true);
}
const onScroll = (data) => {
if (data.y > 150) {
if (!hide) return;
setHide(false);
} else {
if (hide) return;
setHide(true);
}
};
useEffect(() => {
eSubscribeEvent(eScrollEvent, onScroll);
return () => {
eUnSubscribeEvent(eScrollEvent, onScroll);
};
}, [hide]);
useEffect(() => {
eSubscribeEvent(eScrollEvent, onScroll);
return () => {
eUnSubscribeEvent(eScrollEvent, onScroll);
};
}, [hide]);
return selectionMode ? null : (
<>
<View
style={[
styles.container,
{
marginTop: Platform.OS === "android" ? insets.top : null,
backgroundColor: colors.bg,
overflow: "hidden",
borderBottomWidth: 1,
borderBottomColor: hide ? "transparent" : colors.nav,
justifyContent: "space-between"
}
]}
>
{currentScreen === "Search" ? (
<SearchBar />
) : (
<>
<View style={styles.leftBtnContainer}>
<LeftMenus />
<Title />
</View>
<RightMenus />
</>
)}
</View>
</>
);
},
() => true
);
return selectionMode ? null : (
<>
<View
style={[
styles.container,
{
marginTop: Platform.OS === "android" ? insets.top : null,
backgroundColor: colors.bg,
overflow: "hidden",
borderBottomWidth: 1,
borderBottomColor: hide ? "transparent" : colors.nav,
justifyContent: "space-between"
}
]}
>
{currentScreen === "Search" ? (
<SearchBar />
) : (
<>
<View style={styles.leftBtnContainer}>
<LeftMenus />
<Title />
</View>
<RightMenus />
</>
)}
</View>
</>
);
};
export const Header = React.memo(_Header, () => true);
const styles = StyleSheet.create({
container: {

View File

@@ -1,4 +1,3 @@
import React from "react";
import { notesnook } from "../../../e2e/test.ids";
import { DDS } from "../../services/device-detection";
import Navigation from "../../services/navigation";

View File

@@ -1,4 +1,4 @@
import React, { useRef } from "react";
import { useRef } from "react";
import { Platform, StyleSheet, View } from "react-native";
import Menu from "react-native-reanimated-material-menu";
import { notesnook } from "../../../e2e/test.ids";
@@ -84,7 +84,7 @@ export const RightMenus = () => {
/>
}
>
{rightButtons.map((item, index) => (
{rightButtons.map((item) => (
<Button
style={{
width: 150,

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { Platform, View } from "react-native";
import Notebook from "../../screens/notebook";
import {

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { View } from "react-native";
import ImageViewer from "react-native-image-zoom-viewer";
import {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,3 @@
import React from "react";
import Animated, { FadeInDown } from "react-native-reanimated";
import { DDS } from "../../services/device-detection";
import { eSendEvent } from "../../services/event-manager";

View File

@@ -42,7 +42,7 @@ import { Walkthrough } from "../walkthroughs";
import { useAppState } from "../../hooks/use-app-state";
const Launcher = React.memo(
() => {
function Launcher() {
const colors = useThemeStore((state) => state.colors);
const setLoading = useNoteStore((state) => state.setLoading);
const loading = useNoteStore((state) => state.loading);
@@ -257,7 +257,9 @@ const Launcher = React.memo(
enabled(false);
password.current = null;
}
} catch (e) {}
} catch (e) {
console.error(e);
}
};
return verifyUser ? (
@@ -325,7 +327,7 @@ const Launcher = React.memo(
maxWidth: "90%"
}}
>
Please verify it's you
{"Please verify it's you"}
</Paragraph>
<Seperator />
<View

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
export const Footer = () => {

View File

@@ -9,7 +9,6 @@ import Paragraph from "../../ui/typography/paragraph";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { SIZE } from "../../../utils/size";
import { useSelectionStore } from "../../../stores/use-selection-store";
import Animated, { FadeInUp, FadeOutUp } from "react-native-reanimated";
export const Header = React.memo(
({
type,

View File

@@ -1,4 +1,4 @@
import React, { useRef, useState } from "react";
import { useRef, useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../../stores/use-theme-store";
import { useMenuStore } from "../../../stores/use-menu-store";
@@ -32,7 +32,9 @@ export const NotebookHeader = ({ notebook, onEditNotebook }) => {
}
setIsPinnedToMenu(db.settings.isPinned(notebook.id));
setMenuPins();
} catch (e) {}
} catch (e) {
console.error(e);
}
};
return (

View File

@@ -20,7 +20,7 @@ import Sort from "../../sheets/sort";
import Heading from "../../ui/typography/heading";
export const SectionHeader = React.memo(
({ item, index, type, color, screen }) => {
function SectionHeader({ item, index, type, color, screen }) {
const colors = useThemeStore((state) => state.colors);
const { fontScale } = useWindowDimensions();
const [groupOptions, setGroupOptions] = useState(

View File

@@ -109,7 +109,7 @@ export const openNote = async (item, isTrash, setSelectedItem) => {
};
export const NoteWrapper = React.memo(
({ item, index, tags, dateBy }) => {
function NoteWrapper({ item, index, tags, dateBy }) {
const isTrash = item.type === "trash";
const setSelectedItem = useSelectionStore((state) => state.setSelectedItem);

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../../e2e/test.ids";
@@ -22,13 +21,7 @@ const navigateToTopic = (topic) => {
TopicNotes.navigate(topic, true);
};
export const NotebookItem = ({
item,
isTopic = false,
notebookID,
isTrash,
dateBy
}) => {
export const NotebookItem = ({ item, isTopic = false, isTrash, dateBy }) => {
const colors = useThemeStore((state) => state.colors);
const notebooksListMode = useSettingStore(
(state) => state.settings.notebooksListMode

View File

@@ -65,7 +65,7 @@ export const openNotebookTopic = (item) => {
};
export const NotebookWrapper = React.memo(
({ item, index, dateBy }) => {
function NotebookWrapper({ item, index, dateBy }) {
const isTrash = item.type === "trash";
return (

View File

@@ -1,5 +1,5 @@
import Clipboard from "@react-native-clipboard/clipboard";
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { View } from "react-native";
import Animated, { SlideInUp, SlideOutDown } from "react-native-reanimated";
import { openVault, ToastEvent } from "../../../services/event-manager";
@@ -121,7 +121,9 @@ export const ActionStrip = ({ note, setActionStrip }) => {
setMenuPins();
setActionStrip(false);
} catch (e) {}
} catch (e) {
console.error(e);
}
},
visible: note.type !== "note"
},
@@ -184,7 +186,7 @@ export const ActionStrip = ({ note, setActionStrip }) => {
visible: note.type === "trash",
onPress: () => {
presentDialog({
title: `Permanent delete`,
title: "Permanent delete",
paragraph: `Are you sure you want to delete this ${note.itemType} permanantly from trash?`,
positiveText: "Delete",
negativeText: "Cancel",
@@ -210,7 +212,9 @@ export const ActionStrip = ({ note, setActionStrip }) => {
onPress: async () => {
try {
await deleteItems(note);
} catch (e) {}
} catch (e) {
console.error(e);
}
setActionStrip(false);
}
},
@@ -246,7 +250,7 @@ export const ActionStrip = ({ note, setActionStrip }) => {
title="Select"
icon="check"
tooltipText="Select Item"
onPress={(event) => {
onPress={() => {
if (!selectionMode) {
setSelectionMode(true);
}

View File

@@ -1,10 +1,9 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../../stores/use-theme-store";
import { useEditorStore } from "../../../stores/use-editor-store";
import { hexToRGBA } from "../../../utils/color-scheme/utils";
export const Filler = ({ item, background }) => {
export const Filler = ({ item }) => {
const colors = useThemeStore((state) => state.colors);
const currentEditingNote = useEditorStore(

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import {
eSubscribeEvent,
eUnSubscribeEvent

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { TouchableOpacity, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useSelectionStore } from "../../../stores/use-selection-store";

View File

@@ -3,7 +3,6 @@ import { View } from "react-native";
import { notesnook } from "../../../../e2e/test.ids";
import { TaggedNotes } from "../../../screens/notes/tagged";
import { useThemeStore } from "../../../stores/use-theme-store";
import { db } from "../../../common/database";
import { SIZE } from "../../../utils/size";
import { Properties } from "../../properties";
import { IconButton } from "../../ui/icon-button";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useMessageStore } from "../../stores/use-message-store";

View File

@@ -14,7 +14,13 @@ import Paragraph from "../ui/typography/paragraph";
import { notesnook } from "../../../e2e/test.ids";
export const Empty = React.memo(
({ loading = true, placeholderData, headerProps, type, screen }) => {
function Empty({
loading = true,
placeholderData,
headerProps,
type,
screen
}) {
const colors = useThemeStore((state) => state.colors);
const insets = useSafeAreaInsets();
const { height } = useWindowDimensions();
@@ -28,12 +34,7 @@ export const Empty = React.memo(
: placeholderData.type || type,
screen === "Notes" ? "notes" : null
);
const color =
colors[
COLORS_NOTE[headerProps.color?.toLowerCase()]
? headerProps.color
: "accent"
];
return (
<View
style={[

View File

@@ -1,5 +1,5 @@
import KeepAwake from "@sayem314/react-native-keep-awake";
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Modal, SafeAreaView, Text, View } from "react-native";
import Animated from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { Text, View } from "react-native";
import { FlatList } from "react-native-gesture-handler";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
@@ -17,7 +17,7 @@ import NotePreview from "./preview";
export default function NoteHistory({ note, fwdRef }) {
const [history, setHistory] = useState([]);
const [loading, setLoading] = useState(true);
const [_loading, setLoading] = useState(true);
const colors = useThemeStore((state) => state.colors);
useEffect(() => {
@@ -57,7 +57,7 @@ export default function NoteHistory({ note, fwdRef }) {
};
const renderItem = useCallback(
({ item, index }) => (
({ item }) => (
<PressableButton
type="grayBg"
onPress={() => preview(item)}

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Editor from "../../screens/editor";
import EditorOverlay from "../../screens/editor/loading";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { ScrollView } from "react-native";
import { FeatureBlock } from "./feature";

View File

@@ -1,18 +1,16 @@
import React, { useState } from "react";
import { useState } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import { LAUNCH_ROCKET } from "../../assets/images/assets";
import { useThemeStore } from "../../stores/use-theme-store";
import { useUserStore } from "../../stores/use-user-store";
import { DDS } from "../../services/device-detection";
import { eSendEvent, presentSheet } from "../../services/event-manager";
import PremiumService from "../../services/premium";
import { getElevation } from "../../utils";
import { db } from "../../common/database";
import {
eClosePremiumDialog,
eCloseProgressDialog,
eOpenLoginDialog,
eOpenResultDialog
eOpenLoginDialog
} from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
@@ -32,7 +30,7 @@ import { Group } from "./group";
import { PricingPlans } from "./pricing-plans";
import { usePricing } from "../../hooks/use-pricing";
export const Component = ({ close, promo, getRef }) => {
export const Component = ({ close, promo }) => {
const colors = useThemeStore((state) => state.colors);
const user = useUserStore((state) => state.user);
const userCanRequestTrial =
@@ -42,7 +40,7 @@ export const Component = ({ close, promo, getRef }) => {
const onPress = async () => {
if (user) {
umami.pageView("/pro-plans", `/pro-screen`);
umami.pageView("/pro-plans", "/pro-screen");
presentSheet({
context: "pricing_plans",
component: (
@@ -51,7 +49,7 @@ export const Component = ({ close, promo, getRef }) => {
});
} else {
close();
umami.pageView("/signup", `/pro-screen`);
umami.pageView("/signup", "/pro-screen");
setTimeout(() => {
eSendEvent(eOpenLoginDialog, AuthMode.trialSignup);
}, 400);
@@ -179,7 +177,9 @@ export const Component = ({ close, promo, getRef }) => {
eSendEvent(eCloseProgressDialog);
await sleep(300);
Walkthrough.present("trialstarted", false, true);
} catch (e) {}
} catch (e) {
console.error(e);
}
}}
title="Try free for 14 days"
type="accent"
@@ -196,7 +196,7 @@ export const Component = ({ close, promo, getRef }) => {
key="calltoaction"
onPress={onPress}
title={
promo ? promo.text : user ? `See all plans` : `Sign up for free`
promo ? promo.text : user ? "See all plans" : "Sign up for free"
}
type={userCanRequestTrial ? "grayAccent" : "accent"}
width={250}
@@ -219,8 +219,8 @@ export const Component = ({ close, promo, getRef }) => {
}}
>
{user
? `On clicking "Try free for 14 days", your free trial will be activated.`
: `After sign up you will be asked to activate your free trial.`}{" "}
? 'On clicking "Try free for 14 days", your free trial will be activated.'
: "After sign up you will be asked to activate your free trial."}{" "}
<Paragraph size={SIZE.xs} style={{ fontWeight: "bold" }}>
No credit card is required.
</Paragraph>
@@ -247,7 +247,7 @@ export const Component = ({ close, promo, getRef }) => {
<Button
onPress={onPress}
title={
promo ? promo.text : user ? `See all plans` : "Sign up for free"
promo ? promo.text : user ? "See all plans" : "Sign up for free"
}
type="accent"
style={{

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import {
@@ -132,7 +132,7 @@ export const Expiring = () => {
marginTop: 10
}}
>
See what's included in Basic & Pro plans
{"See what's included in Basic & Pro plans"}
</Paragraph>
<Seperator />

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Text, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../stores/use-theme-store";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { ScrollView, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Text } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import Animated, { FadeInUp, FadeOutUp } from "react-native-reanimated";
import { editorState } from "../../screens/editor/tiptap/utils";
@@ -21,7 +21,7 @@ import { Button } from "../ui/button";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
export const PremiumToast = ({ close, context = "global", offset = 0 }) => {
export const PremiumToast = ({ context = "global", offset = 0 }) => {
const colors = useThemeStore((state) => state.colors);
const [msg, setMsg] = useState(null);
const timer = useRef();

View File

@@ -1,15 +1,10 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { getElevation } from "../../utils";
import { SIZE } from "../../utils/size";
import { PressableButton } from "../ui/pressable";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
export const PricingItem = ({ product, onPress, compact }) => {
const colors = useThemeStore((state) => state.colors);
return (
<PressableButton
onPress={onPress}

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { ActivityIndicator, Platform, Text, View } from "react-native";
import * as RNIap from "react-native-iap";
import { useThemeStore } from "../../stores/use-theme-store";
@@ -139,7 +139,8 @@ export const PricingPlans = ({
await sleep(500);
presentSheet({
title: "Thank you for subscribing!",
paragraph: `Your Notesnook Pro subscription will be activated soon. If your account is not upgraded to Notesnook Pro, your money will be refunded to you. In case of any issues, please reach out to us at support@streetwriters.co`,
paragraph:
"Your Notesnook Pro subscription will be activated soon. If your account is not upgraded to Notesnook Pro, your money will be refunded to you. In case of any issues, please reach out to us at support@streetwriters.co",
action: async () => {
eSendEvent(eCloseProgressDialog);
},
@@ -189,7 +190,7 @@ export const PricingPlans = ({
onPress={() => {
setUpgrade(true);
}}
title={`Upgrade now`}
title={"Upgrade now"}
type="accent"
width={250}
style={{
@@ -208,9 +209,11 @@ export const PricingPlans = ({
eSendEvent(eCloseProgressDialog);
await sleep(300);
Walkthrough.present("trialstarted", false, true);
} catch (e) {}
} catch (e) {
console.error(e);
}
}}
title={`Try free for 14 days`}
title={"Try free for 14 days"}
type="grayAccent"
width={250}
style={{
@@ -376,7 +379,7 @@ export const PricingPlans = ({
eSendEvent(eOpenLoginDialog, 1);
}, 400);
}}
title={`Sign up for free`}
title={"Sign up for free"}
type="accent"
width={250}
style={{
@@ -451,8 +454,8 @@ export const PricingPlans = ({
}}
>
{user
? `On clicking "Try free for 14 days", your free trial will be activated.`
: `After sign up you will be asked to activate your free trial.`}{" "}
? 'On clicking "Try free for 14 days", your free trial will be activated.'
: "After sign up you will be asked to activate your free trial."}{" "}
<Paragraph size={SIZE.xs} style={{ fontWeight: "bold" }}>
No credit card is required.
</Paragraph>
@@ -510,8 +513,8 @@ export const PricingPlans = ({
size={SIZE.xs}
onPress={() => {
openLinkInBrowser("https://notesnook.com/tos", colors)
.catch((e) => {})
.then((r) => {
.catch(() => {})
.then(() => {
console.log("closed");
});
}}
@@ -527,8 +530,8 @@ export const PricingPlans = ({
size={SIZE.xs}
onPress={() => {
openLinkInBrowser("https://notesnook.com/privacy", colors)
.catch((e) => {})
.then((r) => {
.catch(() => {})
.then(() => {
console.log("closed");
});
}}

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../stores/use-theme-store";

View File

@@ -1,4 +1,4 @@
import React, { useState } from "react";
import { useState } from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../e2e/test.ids";
@@ -14,7 +14,7 @@ import { refreshNotesPage } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { PressableButton } from "../ui/pressable";
export const ColorTags = ({ item, close }) => {
export const ColorTags = ({ item }) => {
const [note, setNote] = useState(item);
const setColorNotes = useMenuStore((state) => state.setColorNotes);
const dimensions = useSettingStore((state) => state.dimensions);

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";

View File

@@ -1,5 +1,4 @@
import Clipboard from "@react-native-clipboard/clipboard";
import React from "react";
import { View } from "react-native";
import { useSettingStore } from "../../stores/use-setting-store";
import { ToastEvent } from "../../services/event-manager";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { Platform, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { DDS } from "../../services/device-detection";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { FlatList } from "react-native-gesture-handler";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
@@ -23,7 +22,7 @@ export const Items = ({ item, buttons, close }) => {
? (width - 24) / columnItemsCount
: (width - 24) / columnItemsCount;
const _renderRowItem = ({ item, index }) => (
const _renderRowItem = ({ item }) => (
<View
onPress={item.func}
key={item.name}
@@ -67,7 +66,7 @@ export const Items = ({ item, buttons, close }) => {
</View>
);
const renderColumnItem = ({ item, index }) => (
const renderColumnItem = ({ item }) => (
<Button
buttonType={{
text: item.on

View File

@@ -1,11 +1,7 @@
import React from "react";
import { ScrollView, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../stores/use-theme-store";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { db } from "../../common/database";
import { eOnNewTopicAdded, refreshNotesPage } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { Button } from "../ui/button";
import { PressableButton } from "../ui/pressable";

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeStore } from "../../stores/use-theme-store";
@@ -69,7 +68,9 @@ export const Synced = ({ item, close }) => {
"https://docs.notesnook.com/how-is-my-data-encrypted/",
colors
);
} catch (e) {}
} catch (e) {
console.error(e);
}
}}
fontSize={SIZE.xs + 1}
title="Learn more"

View File

@@ -1,10 +1,8 @@
import React, { useState } from "react";
import { View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { db } from "../../common/database";
import { eOpenTagsDialog, refreshNotesPage } from "../../utils/events";
import { eOpenTagsDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import { Button } from "../ui/button";
@@ -48,7 +46,7 @@ export const Tags = ({ item, close }) => {
paddingHorizontal: 8
}}
/>
{item.tags.map((item, index) =>
{item.tags.map((item) =>
item ? <TagItem key={item} tag={item} close={close} /> : null
)}
</View>

View File

@@ -1,4 +1,3 @@
import React from "react";
import { View } from "react-native";
import { TopicNotes } from "../../screens/notes/topic-notes";
import { SIZE } from "../../utils/size";

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { ActivityIndicator, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { editorState } from "../../screens/editor/tiptap/utils";
@@ -176,7 +176,7 @@ const SheetProvider = ({ context = "global" }) => {
) : null}
{dialogData?.actionsArray &&
dialogData?.actionsArray.map((item, index) => (
dialogData?.actionsArray.map((item) => (
<Button
onPress={item.action}
key={item.accentText}

View File

@@ -82,7 +82,7 @@ export class AddNotebookSheet extends React.Component {
if (notebook) {
let topicsList = [];
notebook.topics.forEach((item, index) => {
notebook.topics.forEach((item) => {
topicsList.push(item.title);
});
this.id = notebook.id;
@@ -100,7 +100,7 @@ export class AddNotebookSheet extends React.Component {
notebook: null
});
}
sleep(100).then((r) => {
sleep(100).then(() => {
this.actionSheetRef.current?.show();
});
};

Some files were not shown because too many files have changed in this diff Show More