mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 11:47:54 +01:00
refactor: run prettier on the whole codebase
This commit is contained in:
@@ -1,32 +1,36 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { Dimensions, View } from 'react-native';
|
||||
import Animated, { FadeInDown, FadeOutDown, FadeOutUp } from 'react-native-reanimated';
|
||||
import { DDS } from '../../services/device-detection';
|
||||
import { eSendEvent, 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';
|
||||
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';
|
||||
import React, { useRef, useState } from "react";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import Animated, {
|
||||
FadeInDown,
|
||||
FadeOutDown,
|
||||
FadeOutUp
|
||||
} from "react-native-reanimated";
|
||||
import { DDS } from "../../services/device-detection";
|
||||
import { eSendEvent, 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";
|
||||
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 }) => {
|
||||
const colors = useThemeStore(state => state.colors);
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const email = useRef();
|
||||
const emailInputRef = useRef();
|
||||
const passwordInputRef = useRef();
|
||||
@@ -35,16 +39,16 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
const confirmPassword = useRef();
|
||||
const [error, setError] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const setUser = useUserStore(state => state.setUser);
|
||||
const setLastSynced = useUserStore(state => state.setLastSynced);
|
||||
const setUser = useUserStore((state) => state.setUser);
|
||||
const setLastSynced = useUserStore((state) => state.setLastSynced);
|
||||
|
||||
const validateInfo = () => {
|
||||
if (!password.current || !email.current || !confirmPassword.current) {
|
||||
ToastEvent.show({
|
||||
heading: 'All fields required',
|
||||
message: 'Fill all the fields and try again',
|
||||
type: 'error',
|
||||
context: 'local'
|
||||
heading: "All fields required",
|
||||
message: "Fill all the fields and try again",
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
|
||||
return false;
|
||||
@@ -64,7 +68,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
clearMessage();
|
||||
setEmailVerifyMessage();
|
||||
hideAuth();
|
||||
umami.pageView('/account-created', '/welcome/signup');
|
||||
umami.pageView("/account-created", "/welcome/signup");
|
||||
await sleep(300);
|
||||
if (trial) {
|
||||
PremiumService.sheet(null, null, true);
|
||||
@@ -74,17 +78,19 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
} catch (e) {
|
||||
setLoading(false);
|
||||
ToastEvent.show({
|
||||
heading: 'Signup failed',
|
||||
heading: "Signup failed",
|
||||
message: e.message,
|
||||
type: 'error',
|
||||
context: 'local'
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{loading ? <BaseDialog transparent={true} visible={true} animation="fade" /> : null}
|
||||
{loading ? (
|
||||
<BaseDialog transparent={true} visible={true} animation="fade" />
|
||||
) : null}
|
||||
<Animated.View
|
||||
entering={FadeInDown}
|
||||
exiting={FadeOutUp}
|
||||
@@ -92,32 +98,35 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
borderRadius: DDS.isTab ? 5 : 0,
|
||||
backgroundColor: colors.bg,
|
||||
zIndex: 10,
|
||||
width: '100%',
|
||||
minHeight: '100%'
|
||||
width: "100%",
|
||||
minHeight: "100%"
|
||||
}}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
height: 250,
|
||||
overflow: 'hidden'
|
||||
overflow: "hidden"
|
||||
}}
|
||||
>
|
||||
<SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
|
||||
<SvgView
|
||||
src={SVG(colors.night ? colors.icon : "black")}
|
||||
height={700}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View
|
||||
style={{
|
||||
width: '100%',
|
||||
justifyContent: 'center',
|
||||
alignSelf: 'center',
|
||||
width: "100%",
|
||||
justifyContent: "center",
|
||||
alignSelf: "center",
|
||||
paddingHorizontal: 12,
|
||||
marginBottom: 30,
|
||||
marginTop: Dimensions.get('window').height < 700 ? -75 : 15
|
||||
marginTop: Dimensions.get("window").height < 700 ? -75 : 15
|
||||
}}
|
||||
>
|
||||
<Heading
|
||||
style={{
|
||||
textAlign: 'center'
|
||||
textAlign: "center"
|
||||
}}
|
||||
size={30}
|
||||
color={colors.heading}
|
||||
@@ -126,8 +135,8 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
</Heading>
|
||||
<Paragraph
|
||||
style={{
|
||||
textDecorationLine: 'underline',
|
||||
textAlign: 'center'
|
||||
textDecorationLine: "underline",
|
||||
textAlign: "center"
|
||||
}}
|
||||
onPress={() => {
|
||||
changeMode(0);
|
||||
@@ -139,20 +148,20 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
</View>
|
||||
<View
|
||||
style={{
|
||||
width: DDS.isTab ? '50%' : '100%',
|
||||
width: DDS.isTab ? "50%" : "100%",
|
||||
padding: 12,
|
||||
backgroundColor: colors.bg,
|
||||
flexGrow: 1,
|
||||
alignSelf: 'center'
|
||||
alignSelf: "center"
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
fwdRef={emailInputRef}
|
||||
onChangeText={value => {
|
||||
onChangeText={(value) => {
|
||||
email.current = value;
|
||||
}}
|
||||
testID="input.email"
|
||||
onErrorCheck={e => setError(e)}
|
||||
onErrorCheck={(e) => setError(e)}
|
||||
returnKeyLabel="Next"
|
||||
returnKeyType="next"
|
||||
autoComplete="email"
|
||||
@@ -168,11 +177,11 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
|
||||
<Input
|
||||
fwdRef={passwordInputRef}
|
||||
onChangeText={value => {
|
||||
onChangeText={(value) => {
|
||||
password.current = value;
|
||||
}}
|
||||
testID="input.password"
|
||||
onErrorCheck={e => setError(e)}
|
||||
onErrorCheck={(e) => setError(e)}
|
||||
returnKeyLabel="Next"
|
||||
returnKeyType="next"
|
||||
secureTextEntry
|
||||
@@ -188,11 +197,11 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
|
||||
<Input
|
||||
fwdRef={confirmPasswordInputRef}
|
||||
onChangeText={value => {
|
||||
onChangeText={(value) => {
|
||||
confirmPassword.current = value;
|
||||
}}
|
||||
testID="input.confirmPassword"
|
||||
onErrorCheck={e => setError(e)}
|
||||
onErrorCheck={(e) => setError(e)}
|
||||
returnKeyLabel="Signup"
|
||||
returnKeyType="done"
|
||||
secureTextEntry
|
||||
@@ -208,7 +217,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
<View
|
||||
style={{
|
||||
marginTop: 25,
|
||||
alignSelf: 'center'
|
||||
alignSelf: "center"
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
@@ -219,42 +228,42 @@ export const Signup = ({ changeMode, welcome, trial }) => {
|
||||
loading={loading}
|
||||
onPress={signup}
|
||||
type="accent"
|
||||
title={loading ? null : 'Agree and continue'}
|
||||
title={loading ? null : "Agree and continue"}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<Paragraph
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
position: 'absolute',
|
||||
textAlign: "center",
|
||||
position: "absolute",
|
||||
bottom: 0,
|
||||
alignSelf: 'center',
|
||||
alignSelf: "center",
|
||||
marginBottom: 20
|
||||
}}
|
||||
size={SIZE.xs}
|
||||
color={colors.icon}
|
||||
>
|
||||
By signing up, you agree to our{' '}
|
||||
By signing up, you agree to our{" "}
|
||||
<Paragraph
|
||||
size={SIZE.xs}
|
||||
onPress={() => {
|
||||
openLinkInBrowser('https://notesnook.com/tos', colors);
|
||||
openLinkInBrowser("https://notesnook.com/tos", colors);
|
||||
}}
|
||||
style={{
|
||||
textDecorationLine: 'underline'
|
||||
textDecorationLine: "underline"
|
||||
}}
|
||||
color={colors.accent}
|
||||
>
|
||||
terms of service{' '}
|
||||
terms of service{" "}
|
||||
</Paragraph>
|
||||
and{' '}
|
||||
and{" "}
|
||||
<Paragraph
|
||||
size={SIZE.xs}
|
||||
onPress={() => {
|
||||
openLinkInBrowser('https://notesnook.com/privacy', colors);
|
||||
openLinkInBrowser("https://notesnook.com/privacy", colors);
|
||||
}}
|
||||
style={{
|
||||
textDecorationLine: 'underline'
|
||||
textDecorationLine: "underline"
|
||||
}}
|
||||
color={colors.accent}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user