mobile: finalize sidebar and list revamp

This commit is contained in:
Ammar Ahmed
2025-02-13 10:41:15 +05:00
committed by Abdullah Atta
parent 7f8dc88c5a
commit 74b5e42492
169 changed files with 2272 additions and 1841 deletions

File diff suppressed because one or more lines are too long

View File

@@ -23,7 +23,7 @@ import { Linking, View } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { eSendEvent, presentSheet } from "../../services/event-manager"; import { eSendEvent, presentSheet } from "../../services/event-manager";
import { eCloseAnnouncementDialog } from "../../utils/events"; import { eCloseAnnouncementDialog } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { PricingPlans } from "../premium/pricing-plans"; import { PricingPlans } from "../premium/pricing-plans";
import SheetProvider from "../sheet-provider"; import SheetProvider from "../sheet-provider";
@@ -75,7 +75,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
<Button <Button
key={item.title} key={item.title}
title={item.title} title={item.title}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
type="transparent" type="transparent"
textStyle={{ textStyle={{
textDecorationLine: "underline" textDecorationLine: "underline"
@@ -95,7 +95,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
<Button <Button
key={item.title} key={item.title}
title={item.title} title={item.title}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
type="plain" type="plain"
onPress={() => onPress(item)} onPress={() => onPress(item)}
width={null} width={null}
@@ -118,7 +118,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
<Button <Button
key={item.title} key={item.title}
title={item.title} title={item.title}
fontSize={SIZE.md} fontSize={AppFontSize.md}
buttonType={{ buttonType={{
color: color ? color : colors.primary.accent, color: color ? color : colors.primary.accent,
text: color text: color
@@ -141,7 +141,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
<Button <Button
key={item.title} key={item.title}
title={item.title} title={item.title}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
type="plain" type="plain"
onPress={() => onPress(item)} onPress={() => onPress(item)}
width={null} width={null}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import React from "react"; import React from "react";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { getStyle } from "./functions"; import { getStyle } from "./functions";
@@ -30,7 +30,7 @@ export const Description = ({ text, style = {}, inline }) => {
...getStyle(style), ...getStyle(style),
textAlign: inline ? "left" : style?.textAlign textAlign: inline ? "left" : style?.textAlign
}} }}
size={inline ? SIZE.sm : SIZE.md} size={inline ? AppFontSize.sm : AppFontSize.md}
> >
{text} {text}
</Paragraph> </Paragraph>

View File

@@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import React from "react"; import React from "react";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import { getStyle } from "./functions"; import { getStyle } from "./functions";
export const SubHeading = ({ text, style = {} }) => { export const SubHeading = ({ text, style = {} }) => {
return ( return (
<Heading <Heading
size={SIZE.md + 2} size={AppFontSize.md + 2}
style={{ style={{
marginHorizontal: 12, marginHorizontal: 12,
marginTop: 12, marginTop: 12,

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { useMessageStore } from "../../stores/use-message-store"; import { useMessageStore } from "../../stores/use-message-store";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import { getStyle } from "./functions"; import { getStyle } from "./functions";
@@ -48,7 +48,7 @@ export const Title = ({ text, style = {}, inline }) => {
flexShrink: 1 flexShrink: 1
}} }}
numberOfLines={1} numberOfLines={1}
size={inline ? SIZE.md : SIZE.xl} size={inline ? AppFontSize.md : AppFontSize.xl}
> >
{inline ? text?.toUpperCase() : text} {inline ? text?.toUpperCase() : text}
</Heading> </Heading>
@@ -67,7 +67,7 @@ export const Title = ({ text, style = {}, inline }) => {
right: 0 right: 0
}} }}
iconSize={24} iconSize={24}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ style={{
borderRadius: 100, borderRadius: 100,
paddingVertical: 0, paddingVertical: 0,

View File

@@ -44,7 +44,7 @@ import SettingsService from "../../services/settings";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { NotesnookModule } from "../../utils/notesnook-module"; import { NotesnookModule } from "../../utils/notesnook-module";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Toast } from "../toast"; import { Toast } from "../toast";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
@@ -313,7 +313,7 @@ const AppLockedScreen = () => {
borderRadius: 150, borderRadius: 150,
marginBottom: 10 marginBottom: 10
}} }}
fontSize={SIZE.md} fontSize={AppFontSize.md}
/> />
</> </>
) : null} ) : null}

View File

@@ -45,7 +45,7 @@ import {
eDBItemUpdate, eDBItemUpdate,
eOnLoadNote eOnLoadNote
} from "../../utils/events"; } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Dialog } from "../dialog"; import { Dialog } from "../dialog";
import { presentDialog } from "../dialog/functions"; import { presentDialog } from "../dialog/functions";
@@ -233,7 +233,7 @@ const Actions = ({
style={{ style={{
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
size={SIZE.lg} size={AppFontSize.lg}
> >
{filename} {filename}
</Heading> </Heading>
@@ -247,15 +247,15 @@ const Actions = ({
gap: 10 gap: 10
}} }}
> >
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{attachment.mimeType} {attachment.mimeType}
</Paragraph> </Paragraph>
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{formatBytes(attachment.size)} {formatBytes(attachment.size)}
</Paragraph> </Paragraph>
{notes.length ? ( {notes.length ? (
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{strings.notes(notes.length)} {strings.notes(notes.length)}
</Paragraph> </Paragraph>
) : null} ) : null}
@@ -268,7 +268,7 @@ const Actions = ({
context: "local" context: "local"
}); });
}} }}
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
{attachment.hash} {attachment.hash}
@@ -292,7 +292,7 @@ const Actions = ({
style={{ style={{
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
size={SIZE.sm} size={AppFontSize.sm}
> >
{strings.listOf()} {strings.dataTypesPlural.note()}: {strings.listOf()} {strings.dataTypesPlural.note()}:
</Heading> </Heading>
@@ -314,7 +314,7 @@ const Actions = ({
}} }}
key={item.id} key={item.id}
> >
<Paragraph size={SIZE.xs}>{item.title}</Paragraph> <Paragraph size={AppFontSize.xs}>{item.title}</Paragraph>
</Pressable> </Pressable>
))} ))}
</> </>
@@ -335,7 +335,7 @@ const Actions = ({
icon={item.icon} icon={item.icon}
loading={loading?.name === item.name} loading={loading?.name === item.name}
type="plain" type="plain"
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
style={{ style={{
borderRadius: 0, borderRadius: 0,
justifyContent: "flex-start", justifyContent: "flex-start",

View File

@@ -25,7 +25,7 @@ import { TouchableOpacity, View } from "react-native";
import { db } from "../../common/database"; import { db } from "../../common/database";
import { useAttachmentProgress } from "../../hooks/use-attachment-progress"; import { useAttachmentProgress } from "../../hooks/use-attachment-progress";
import { useDBItem } from "../../hooks/use-db-item"; import { useDBItem } from "../../hooks/use-db-item";
import { SIZE } from "../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../utils/size";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
import { ProgressCircleComponent } from "../ui/svg/lazy"; import { ProgressCircleComponent } from "../ui/svg/lazy";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
@@ -101,7 +101,7 @@ export const AttachmentItem = ({
paddingHorizontal: 2, paddingHorizontal: 2,
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
> >
<Paragraph <Paragraph
@@ -124,7 +124,7 @@ export const AttachmentItem = ({
}} }}
> >
<Paragraph <Paragraph
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
}} }}
@@ -136,7 +136,10 @@ export const AttachmentItem = ({
</Paragraph> </Paragraph>
{!hideWhenNotDownloading ? ( {!hideWhenNotDownloading ? (
<Paragraph color={colors.secondary.paragraph} size={SIZE.xxs}> <Paragraph
color={colors.secondary.paragraph}
size={AppFontSize.xxs}
>
{strings.fileSize()}: {formatBytes(attachment.size)} {strings.fileSize()}: {formatBytes(attachment.size)}
</Paragraph> </Paragraph>
) : null} ) : null}
@@ -159,7 +162,7 @@ export const AttachmentItem = ({
}} }}
> >
<ProgressCircleComponent <ProgressCircleComponent
size={SIZE.xxl} size={AppFontSize.xxl}
progress={ progress={
currentProgress?.value ? currentProgress?.value / 100 : 0 currentProgress?.value ? currentProgress?.value / 100 : 0
} }

View File

@@ -38,7 +38,7 @@ import { downloadAttachments } from "../../common/filesystem/download-attachment
import { AttachmentGroupProgress } from "../../screens/settings/attachment-group-progress"; import { AttachmentGroupProgress } from "../../screens/settings/attachment-group-progress";
import { presentSheet, ToastManager } from "../../services/event-manager"; import { presentSheet, ToastManager } from "../../services/event-manager";
import { useAttachmentStore } from "../../stores/use-attachment-store"; import { useAttachmentStore } from "../../stores/use-attachment-store";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Dialog } from "../dialog"; import { Dialog } from "../dialog";
import { presentDialog } from "../dialog/functions"; import { presentDialog } from "../dialog/functions";
import { Header } from "../header"; import { Header } from "../header";
@@ -375,7 +375,7 @@ export const AttachmentDialog = ({
marginRight: 10 marginRight: 10
}} }}
color={colors.primary.paragraph} color={colors.primary.paragraph}
size={SIZE.lg} size={AppFontSize.lg}
onPress={onCheck} onPress={onCheck}
/> />
@@ -399,7 +399,7 @@ export const AttachmentDialog = ({
negativeText: strings.cancel() negativeText: strings.cancel()
}); });
}} }}
size={SIZE.lg} size={AppFontSize.lg}
/> />
</View> </View>
</View> </View>
@@ -474,7 +474,7 @@ export const AttachmentDialog = ({
<IconButton <IconButton
type={rechecker.isWorking ? "errorShade" : "plain"} type={rechecker.isWorking ? "errorShade" : "plain"}
name={rechecker.isWorking ? "close" : "check"} name={rechecker.isWorking ? "close" : "check"}
size={SIZE.lg} size={AppFontSize.lg}
color={ color={
rechecker.isWorking ? colors.error.icon : colors.primary.accent rechecker.isWorking ? colors.error.icon : colors.primary.accent
} }
@@ -512,7 +512,7 @@ export const AttachmentDialog = ({
} }
key={item.title} key={item.title}
title={item.title} title={item.title}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
style={{ style={{
borderRadius: 100, borderRadius: 100,
paddingHorizontal: 12, paddingHorizontal: 12,

View File

@@ -20,23 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { createRef } from "react"; import { createRef } from "react";
import { eSendEvent } from "../../services/event-manager"; import { eSendEvent } from "../../services/event-manager";
import { eCloseLoginDialog } from "../../utils/events"; import { eCloseLoginDialog } from "../../utils/events";
import Navigation from "../../services/navigation";
export const AuthMode = {
login: 0,
signup: 1,
welcomeSignup: 2,
trialSignup: 3
};
export const initialAuthMode = createRef(0); export const initialAuthMode = createRef(0);
export function hideAuth() { export function hideAuth() {
eSendEvent(eCloseLoginDialog); eSendEvent(eCloseLoginDialog);
if (initialAuthMode.current === AuthMode.welcomeSignup) {
// if (initialAuthMode.current === 2) { Navigation.replace("FluidPanelsView");
// Navigation.replace( } else {
// { Navigation.goBack();
// name: 'Notes' }
// },
// {
// menu: true
// }
// );
// } else {
// Navigation.goBack();
// }
// tabBarRef.current?.unlock();
} }

View File

@@ -17,35 +17,90 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React, { useState } from "react"; import React, { useState } from "react";
import { View } from "react-native"; import { View } from "react-native";
import { useNavigationFocus } from "../../hooks/use-navigation-focus"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import Navigation from "../../services/navigation";
import { Toast } from "../toast"; import { Toast } from "../toast";
import { initialAuthMode } from "./common"; import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import { AuthMode, initialAuthMode } from "./common";
import { Login } from "./login"; import { Login } from "./login";
import { Signup } from "./signup"; import { Signup } from "./signup";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
export const AuthMode = {
login: 0,
signup: 1,
welcomeSignup: 2,
trialSignup: 3
};
const Auth = ({ navigation, route }) => { const Auth = ({ navigation, route }) => {
const [currentAuthMode, setCurrentAuthMode] = useState( const [currentAuthMode, setCurrentAuthMode] = useState(
route?.params?.mode || AuthMode.login route?.params?.mode || AuthMode.login
); );
const { colors } = useThemeColors();
const insets = useGlobalSafeAreaInsets();
initialAuthMode.current = route?.params.mode || AuthMode.login; initialAuthMode.current = route?.params.mode || AuthMode.login;
useNavigationFocus(navigation, { useNavigationFocus(navigation, {});
onFocus: () => {
//tabBarRef?.current.lock();
initialAuthMode.current = route?.params.mode || AuthMode.login;
}
});
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<View
style={{
position: "absolute",
paddingTop: insets.top,
top: 0,
zIndex: 999,
backgroundColor: colors.secondary.background,
width: "100%"
}}
>
<View
style={{
flexDirection: "row",
alignItems: "center",
paddingHorizontal: 12,
width: "100%",
height: 50,
justifyContent:
initialAuthMode.current !== AuthMode.welcomeSignup
? "space-between"
: "flex-end"
}}
>
{initialAuthMode.current === AuthMode.welcomeSignup ? null : (
<IconButton
name="arrow-left"
onPress={() => {
if (initialAuthMode.current === 2) {
Navigation.replace("FluidPanelsView");
} else {
Navigation.goBack();
}
}}
color={colors.primary.paragraph}
/>
)}
{initialAuthMode.current !== AuthMode.welcomeSignup ? null : (
<Button
title={strings.skip()}
onPress={() => {
Navigation.goBack();
}}
iconSize={16}
type="plain"
iconPosition="right"
icon="chevron-right"
height={25}
iconStyle={{
marginTop: 2
}}
style={{
paddingHorizontal: 6
}}
/>
)}
</View>
</View>
{currentAuthMode !== AuthMode.login ? ( {currentAuthMode !== AuthMode.login ? (
<Signup <Signup
changeMode={(mode) => setCurrentAuthMode(mode)} changeMode={(mode) => setCurrentAuthMode(mode)}

View File

@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { TouchableOpacity, View, useWindowDimensions } from "react-native"; import { TouchableOpacity, View, useWindowDimensions } from "react-native";
@@ -24,10 +25,9 @@ import { SheetManager } from "react-native-actions-sheet";
import { DDS } from "../../services/device-detection"; import { DDS } from "../../services/device-detection";
import { eSendEvent } from "../../services/event-manager"; import { eSendEvent } from "../../services/event-manager";
import Sync from "../../services/sync"; import Sync from "../../services/sync";
import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { eUserLoggedIn } from "../../utils/events"; import { eUserLoggedIn } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import SheetProvider from "../sheet-provider"; import SheetProvider from "../sheet-provider";
import { Progress } from "../sheets/progress"; import { Progress } from "../sheets/progress";
@@ -38,7 +38,6 @@ import Paragraph from "../ui/typography/paragraph";
import { hideAuth } from "./common"; import { hideAuth } from "./common";
import { ForgotPassword } from "./forgot-password"; import { ForgotPassword } from "./forgot-password";
import { useLogin } from "./use-login"; import { useLogin } from "./use-login";
import { strings } from "@notesnook/intl";
const LoginSteps = { const LoginSteps = {
emailAuth: 1, emailAuth: 1,
@@ -71,8 +70,8 @@ export const Login = ({ changeMode }) => {
} }
}, 5000); }, 5000);
}); });
const deviceMode = useSettingStore((state) => state.deviceMode);
const { width, height } = useWindowDimensions(); const { width, height } = useWindowDimensions();
const isTablet = width > 600;
useEffect(() => { useEffect(() => {
async () => { async () => {
setStep(LoginSteps.emailAuth); setStep(LoginSteps.emailAuth);
@@ -96,6 +95,7 @@ export const Login = ({ changeMode }) => {
backgroundColor: colors.primary.background, backgroundColor: colors.primary.background,
zIndex: 10, zIndex: 10,
width: "100%", width: "100%",
height: "100%",
alignSelf: "center" alignSelf: "center"
}} }}
> >
@@ -107,12 +107,12 @@ export const Login = ({ changeMode }) => {
borderBottomWidth: 0.8, borderBottomWidth: 0.8,
marginBottom: 12, marginBottom: 12,
borderBottomColor: colors.primary.border, borderBottomColor: colors.primary.border,
alignSelf: deviceMode !== "mobile" ? "center" : undefined, alignSelf: isTablet ? "center" : undefined,
borderWidth: deviceMode !== "mobile" ? 1 : null, borderWidth: isTablet ? 1 : null,
borderColor: deviceMode !== "mobile" ? colors.primary.border : null, borderColor: isTablet ? colors.primary.border : null,
borderRadius: deviceMode !== "mobile" ? 20 : null, borderRadius: isTablet ? 20 : null,
marginTop: deviceMode !== "mobile" ? 50 : null, marginTop: isTablet ? 50 : null,
width: deviceMode === "mobile" ? null : "50%", width: !isTablet ? null : "50%",
minHeight: height * 0.4 minHeight: height * 0.4
}} }}
> >
@@ -146,7 +146,7 @@ export const Login = ({ changeMode }) => {
marginTop: 10 marginTop: 10
}} }}
extraBold extraBold
size={SIZE.xxl} size={AppFontSize.xxl}
> >
{strings.loginToYourAccount()} {strings.loginToYourAccount()}
</Heading> </Heading>
@@ -226,7 +226,7 @@ export const Login = ({ changeMode }) => {
textStyle={{ textStyle={{
textDecorationLine: "underline" textDecorationLine: "underline"
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
type="plain" type="plain"
/> />
</> </>
@@ -244,11 +244,10 @@ export const Login = ({ changeMode }) => {
login(); login();
}} }}
style={{ style={{
width: 250, width: 250
borderRadius: 100
}} }}
height={50} height={50}
fontSize={SIZE.md} fontSize={AppFontSize.md}
type="accent" type="accent"
title={!loading ? strings.continue() : null} title={!loading ? strings.continue() : null}
/> />
@@ -269,7 +268,7 @@ export const Login = ({ changeMode }) => {
textStyle={{ textStyle={{
textDecorationLine: "underline" textDecorationLine: "underline"
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
type="errorShade" type="errorShade"
/> />
)} )}
@@ -288,12 +287,12 @@ export const Login = ({ changeMode }) => {
}} }}
> >
<Paragraph <Paragraph
size={SIZE.xs + 1} size={AppFontSize.xs + 1}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
{strings.dontHaveAccount()}{" "} {strings.dontHaveAccount()}{" "}
<Paragraph <Paragraph
size={SIZE.xs + 1} size={AppFontSize.xs + 1}
style={{ color: colors.primary.accent }} style={{ color: colors.primary.accent }}
> >
{strings.signUp()} {strings.signUp()}

View File

@@ -34,7 +34,7 @@ import Sync from "../../services/sync";
import { clearAllStores } from "../../stores"; import { clearAllStores } from "../../stores";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { eLoginSessionExpired, eUserLoggedIn } from "../../utils/events"; import { eLoginSessionExpired, eUserLoggedIn } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Dialog } from "../dialog"; import { Dialog } from "../dialog";
import BaseDialog from "../dialog/base-dialog"; import BaseDialog from "../dialog/base-dialog";
@@ -48,18 +48,7 @@ import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { LoginSteps, useLogin } from "./use-login"; import { LoginSteps, useLogin } from "./use-login";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
import { getObfuscatedEmail } from "../../utils/functions";
function getObfuscatedEmail(email) {
if (!email) return "";
const [username, provider] = email.split("@");
if (username.length === 1) return `****@${provider}`;
return email.replace(/(.{1})(.*)(?=@)/, function (gp1, gp2, gp3) {
for (let i = 0; i < gp3.length; i++) {
gp2 += "*";
}
return gp2;
});
}
export const SessionExpired = () => { export const SessionExpired = () => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -193,7 +182,7 @@ export const SessionExpired = () => {
color={colors.error.icon} color={colors.error.icon}
size={50} size={50}
/> />
<Heading size={SIZE.xxxl} color={colors.primary.heading}> <Heading size={AppFontSize.xxxl} color={colors.primary.heading}>
{strings.sessionExpired()} {strings.sessionExpired()}
</Heading> </Heading>
<Paragraph <Paragraph

View File

@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
import { TouchableOpacity, View, useWindowDimensions } from "react-native"; import { TouchableOpacity, View, useWindowDimensions } from "react-native";
import { db } from "../../common/database"; import { db } from "../../common/database";
@@ -24,19 +26,16 @@ import { DDS } from "../../services/device-detection";
import { ToastManager } from "../../services/event-manager"; import { ToastManager } from "../../services/event-manager";
import { clearMessage, setEmailVerifyMessage } from "../../services/message"; import { clearMessage, setEmailVerifyMessage } from "../../services/message";
import PremiumService from "../../services/premium"; import PremiumService from "../../services/premium";
import { useThemeColors } from "@notesnook/theme"; import SettingsService from "../../services/settings";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { openLinkInBrowser } from "../../utils/functions"; import { openLinkInBrowser } from "../../utils/functions";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Input from "../ui/input"; import Input from "../ui/input";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { hideAuth } from "./common"; import { hideAuth } from "./common";
import { useSettingStore } from "../../stores/use-setting-store";
import SettingsService from "../../services/settings";
import { strings } from "@notesnook/intl";
export const Signup = ({ changeMode, trial }) => { export const Signup = ({ changeMode, trial }) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -50,7 +49,8 @@ export const Signup = ({ changeMode, trial }) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const setUser = useUserStore((state) => state.setUser); const setUser = useUserStore((state) => state.setUser);
const setLastSynced = useUserStore((state) => state.setLastSynced); const setLastSynced = useUserStore((state) => state.setLastSynced);
const deviceMode = useSettingStore((state) => state.deviceMode); const isTablet = width > 600;
const { width, height } = useWindowDimensions(); const { width, height } = useWindowDimensions();
const validateInfo = () => { const validateInfo = () => {
if (!password.current || !email.current || !confirmPassword.current) { if (!password.current || !email.current || !confirmPassword.current) {
@@ -103,9 +103,8 @@ export const Signup = ({ changeMode, trial }) => {
style={{ style={{
borderRadius: DDS.isTab ? 5 : 0, borderRadius: DDS.isTab ? 5 : 0,
backgroundColor: colors.primary.background, backgroundColor: colors.primary.background,
zIndex: 10,
width: "100%", width: "100%",
alignSelf: "center" height: "100%"
}} }}
> >
<View <View
@@ -116,12 +115,12 @@ export const Signup = ({ changeMode, trial }) => {
marginBottom: 20, marginBottom: 20,
borderBottomWidth: 0.8, borderBottomWidth: 0.8,
borderBottomColor: colors.primary.border, borderBottomColor: colors.primary.border,
alignSelf: deviceMode !== "mobile" ? "center" : undefined, alignSelf: isTablet ? "center" : undefined,
borderWidth: deviceMode !== "mobile" ? 1 : null, borderWidth: isTablet ? 1 : null,
borderColor: deviceMode !== "mobile" ? colors.primary.border : null, borderColor: isTablet ? colors.primary.border : null,
borderRadius: deviceMode !== "mobile" ? 20 : null, borderRadius: isTablet ? 20 : null,
marginTop: deviceMode !== "mobile" ? 50 : null, marginTop: isTablet ? 50 : null,
width: deviceMode === "mobile" ? null : "50%", width: !isTablet ? null : "50%",
minHeight: height * 0.4 minHeight: height * 0.4
}} }}
> >
@@ -155,7 +154,7 @@ export const Signup = ({ changeMode, trial }) => {
marginBottom: 25, marginBottom: 25,
marginTop: 10 marginTop: 10
}} }}
size={SIZE.xxl} size={AppFontSize.xxl}
> >
{strings.createYourAccount()} {strings.createYourAccount()}
</Heading> </Heading>
@@ -233,12 +232,12 @@ export const Signup = ({ changeMode, trial }) => {
style={{ style={{
marginBottom: 25 marginBottom: 25
}} }}
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
{strings.signupAgreement[0]()} {strings.signupAgreement[0]()}
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
onPress={() => { onPress={() => {
openLinkInBrowser("https://notesnook.com/tos", colors); openLinkInBrowser("https://notesnook.com/tos", colors);
}} }}
@@ -247,11 +246,12 @@ export const Signup = ({ changeMode, trial }) => {
}} }}
color={colors.primary.accent} color={colors.primary.accent}
> >
{" "}
{strings.signupAgreement[1]()} {strings.signupAgreement[1]()}
</Paragraph> </Paragraph>{" "}
{strings.signupAgreement[2]()} {strings.signupAgreement[2]()}
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
onPress={() => { onPress={() => {
openLinkInBrowser("https://notesnook.com/privacy", colors); openLinkInBrowser("https://notesnook.com/privacy", colors);
}} }}
@@ -260,8 +260,9 @@ export const Signup = ({ changeMode, trial }) => {
}} }}
color={colors.primary.accent} color={colors.primary.accent}
> >
{" "}
{strings.signupAgreement[3]()} {strings.signupAgreement[3]()}
</Paragraph> </Paragraph>{" "}
{strings.signupAgreement[4]()} {strings.signupAgreement[4]()}
</Paragraph> </Paragraph>
@@ -270,11 +271,9 @@ export const Signup = ({ changeMode, trial }) => {
type="accent" type="accent"
loading={loading} loading={loading}
onPress={signup} onPress={signup}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
marginRight: 12, width: 250
width: 250,
borderRadius: 100
}} }}
/> />
@@ -290,10 +289,13 @@ export const Signup = ({ changeMode, trial }) => {
paddingVertical: 12 paddingVertical: 12
}} }}
> >
<Paragraph size={SIZE.xs + 1} color={colors.secondary.paragraph}> <Paragraph
size={AppFontSize.xs + 1}
color={colors.secondary.paragraph}
>
{strings.alreadyHaveAccount()}{" "} {strings.alreadyHaveAccount()}{" "}
<Paragraph <Paragraph
size={SIZE.xs + 1} size={AppFontSize.xs + 1}
style={{ color: colors.primary.accent }} style={{ color: colors.primary.accent }}
> >
{strings.login()} {strings.login()}

View File

@@ -30,7 +30,7 @@ import {
ToastManager ToastManager
} from "../../services/event-manager"; } from "../../services/event-manager";
import { eCloseSheet } from "../../utils/events"; import { eCloseSheet } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
import Input from "../ui/input"; import Input from "../ui/input";
@@ -205,7 +205,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo, onCancel }) => {
onSubmitEditing={onNext} onSubmitEditing={onNext}
caretHidden caretHidden
inputStyle={{ inputStyle={{
fontSize: SIZE.lg, fontSize: AppFontSize.lg,
height: 60, height: 60,
textAlign: "center", textAlign: "center",
letterSpacing: 10, letterSpacing: 10,
@@ -288,7 +288,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo, onCancel }) => {
flexShrink: 1 flexShrink: 1
}} }}
> >
<Paragraph size={SIZE.md}>{item.title}</Paragraph> <Paragraph size={AppFontSize.md}>{item.title}</Paragraph>
</View> </View>
</Pressable> </Pressable>
))} ))}

View File

@@ -33,7 +33,7 @@ import { editorState } from "../../screens/editor/tiptap/utils";
import { useSelectionStore } from "../../stores/use-selection-store"; import { useSelectionStore } from "../../stores/use-selection-store";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { getElevationStyle } from "../../utils/elevation"; import { getElevationStyle } from "../../utils/elevation";
import { SIZE, normalize } from "../../utils/size"; import { AppFontSize, normalize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
interface FloatingButtonProps { interface FloatingButtonProps {
@@ -148,7 +148,7 @@ const FloatingButton = ({
: "plus" : "plus"
} }
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.xxxl} size={AppFontSize.xxxl}
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>

View File

@@ -23,6 +23,7 @@ import { useMessageStore } from "../../stores/use-message-store";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { ColorValues } from "../../utils/colors"; import { ColorValues } from "../../utils/colors";
import { hexToRGBA } from "../../utils/colors"; import { hexToRGBA } from "../../utils/colors";
import { defaultBorderRadius } from "../../utils/size";
export const DefaultPlaceholder = ({ color }: { color: string }) => { export const DefaultPlaceholder = ({ color }: { color: string }) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -59,7 +60,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 150, width: 150,
height: 20, height: 20,
backgroundColor: colors.primary.hover, backgroundColor: colors.primary.hover,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginBottom: 10 marginBottom: 10
}} }}
/> />
@@ -68,7 +69,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 250, width: 250,
height: 14, height: 14,
backgroundColor: colors.primary.hover, backgroundColor: colors.primary.hover,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
@@ -111,7 +112,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 150, width: 150,
height: 12, height: 12,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginBottom: 10 marginBottom: 10
}} }}
/> />
@@ -120,7 +121,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 250, width: 250,
height: 16, height: 16,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
</View> </View>
@@ -179,7 +180,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 200, width: 200,
height: 16, height: 16,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
<View <View
@@ -187,7 +188,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: "85%", width: "85%",
height: 13, height: 13,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginTop: 10 marginTop: 10
}} }}
/> />
@@ -203,7 +204,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 50, width: 50,
height: 10, height: 10,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
<View <View
@@ -211,7 +212,7 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {
width: 60, width: 60,
height: 10, height: 10,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginLeft: 10 marginLeft: 10
}} }}
/> />

View File

@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { defaultBorderRadius } from "../../utils/size";
export const SettingsPlaceholder = () => { export const SettingsPlaceholder = () => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -31,7 +32,7 @@ export const SettingsPlaceholder = () => {
width: 100, width: 100,
height: 12, height: 12,
backgroundColor: colors.primary.shade, backgroundColor: colors.primary.shade,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginLeft: 12, marginLeft: 12,
marginBottom: 12 marginBottom: 12
}} }}
@@ -62,7 +63,7 @@ export const SettingsPlaceholder = () => {
width: 150, width: 150,
height: 12, height: 12,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginBottom: 10 marginBottom: 10
}} }}
/> />
@@ -71,7 +72,7 @@ export const SettingsPlaceholder = () => {
width: 250, width: 250,
height: 16, height: 16,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
</View> </View>
@@ -104,7 +105,7 @@ export const SettingsPlaceholder = () => {
width: 150, width: 150,
height: 12, height: 12,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginBottom: 10 marginBottom: 10
}} }}
/> />
@@ -113,7 +114,7 @@ export const SettingsPlaceholder = () => {
width: 250, width: 250,
height: 16, height: 16,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
</View> </View>

View File

@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { ScopedThemeProvider } from "@notesnook/theme";
import React, { PropsWithChildren, useEffect, useRef, useState } from "react"; import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
import { import {
ColorValue, ColorValue,
@@ -30,11 +31,8 @@ import {
} from "react-native"; } from "react-native";
import useIsFloatingKeyboard from "../../hooks/use-is-floating-keyboard"; import useIsFloatingKeyboard from "../../hooks/use-is-floating-keyboard";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { BouncingView } from "../ui/transitions/bouncing-view";
import { ScopedThemeProvider } from "@notesnook/theme";
import SettingsService from "../../services/settings";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { useAppState } from "../../hooks/use-app-state"; import { BouncingView } from "../ui/transitions/bouncing-view";
export interface BaseDialogProps extends PropsWithChildren { export interface BaseDialogProps extends PropsWithChildren {
animation?: "fade" | "none" | "slide" | undefined; animation?: "fade" | "none" | "slide" | undefined;

View File

@@ -22,7 +22,7 @@ import { ActivityIndicator, StyleSheet, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../e2e/test.ids"; import { notesnook } from "../../../e2e/test.ids";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { getColorLinearShade } from "../../utils/colors"; import { getColorLinearShade } from "../../utils/colors";
@@ -57,7 +57,10 @@ const DialogButtons = ({
]} ]}
> >
{loading ? ( {loading ? (
<ActivityIndicator color={colors.primary.accent} size={SIZE.lg} /> <ActivityIndicator
color={colors.primary.accent}
size={AppFontSize.lg}
/>
) : doneText ? ( ) : doneText ? (
<View <View
style={{ style={{
@@ -68,7 +71,7 @@ const DialogButtons = ({
<Icon <Icon
color={colors.primary.accent} color={colors.primary.accent}
name="check-circle-outline" name="check-circle-outline"
size={SIZE.md} size={AppFontSize.md}
/> />
<Paragraph color={colors.primary.accent}>{" " + doneText}</Paragraph> <Paragraph color={colors.primary.accent}>{" " + doneText}</Paragraph>
</View> </View>
@@ -84,7 +87,7 @@ const DialogButtons = ({
> >
<Button <Button
onPress={onPressNegative} onPress={onPressNegative}
fontSize={SIZE.md} fontSize={AppFontSize.md}
testID={notesnook.ids.default.dialog.no} testID={notesnook.ids.default.dialog.no}
type="plain" type="plain"
bold bold
@@ -93,7 +96,7 @@ const DialogButtons = ({
{onPressPositive ? ( {onPressPositive ? (
<Button <Button
onPress={onPressPositive} onPress={onPressPositive}
fontSize={SIZE.md} fontSize={AppFontSize.md}
testID={notesnook.ids.default.dialog.yes} testID={notesnook.ids.default.dialog.yes}
style={{ style={{
marginLeft: 10 marginLeft: 10

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { Text, View, ViewStyle } from "react-native"; import { Text, View, ViewStyle } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { PressableProps } from "../ui/pressable"; import { PressableProps } from "../ui/pressable";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
@@ -82,7 +82,7 @@ const DialogHeader = ({
> >
<Heading <Heading
style={{ textAlign: centered ? "center" : "left" }} style={{ textAlign: centered ? "center" : "left" }}
size={SIZE.lg} size={AppFontSize.lg}
> >
{title}{" "} {title}{" "}
{titlePart ? ( {titlePart ? (

View File

@@ -39,7 +39,7 @@ import { Button } from "../ui/button";
import { getContainerBorder } from "../../utils/colors"; import { getContainerBorder } from "../../utils/colors";
import { Notice } from "../ui/notice"; import { Notice } from "../ui/notice";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
import { br } from "../../utils/size"; import { defaultBorderRadius } from "../../utils/size";
export const Dialog = ({ context = "global" }) => { export const Dialog = ({ context = "global" }) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -126,7 +126,7 @@ export const Dialog = ({ context = "global" }) => {
...getElevationStyle(5), ...getElevationStyle(5),
width: DDS.isTab ? 400 : "85%", width: DDS.isTab ? 400 : "85%",
maxHeight: 450, maxHeight: 450,
borderRadius: br, borderRadius: defaultBorderRadius,
backgroundColor: colors.primary.background, backgroundColor: colors.primary.background,
paddingTop: 12, paddingTop: 12,
...getContainerBorder(colors.primary.border, 0.5), ...getContainerBorder(colors.primary.border, 0.5),

View File

@@ -39,7 +39,7 @@ import {
eCloseAppLocKPasswordDailog, eCloseAppLocKPasswordDailog,
eOpenAppLockPasswordDialog eOpenAppLockPasswordDialog
} from "../../../utils/events"; } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { sleep } from "../../../utils/time"; import { sleep } from "../../../utils/time";
import BaseDialog from "../../dialog/base-dialog"; import BaseDialog from "../../dialog/base-dialog";
import DialogButtons from "../../dialog/dialog-buttons"; import DialogButtons from "../../dialog/dialog-buttons";
@@ -192,7 +192,7 @@ export const AppLockPassword = () => {
height: 25, height: 25,
marginRight: 5 marginRight: 5
}} }}
size={SIZE.lg} size={AppFontSize.lg}
/> />
) )
} }
@@ -248,7 +248,7 @@ export const AppLockPassword = () => {
setSecureTextEntry(true); setSecureTextEntry(true);
}); });
}} }}
iconSize={SIZE.lg} iconSize={AppFontSize.lg}
type="plain" type="plain"
iconColor={ iconColor={
accountPass ? colors.primary.accent : colors.primary.icon accountPass ? colors.primary.accent : colors.primary.icon

View File

@@ -27,7 +27,7 @@ import {
import { Image as ImageType } from "react-native-image-crop-picker"; import { Image as ImageType } from "react-native-image-crop-picker";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import { Notice } from "../../ui/notice"; import { Notice } from "../../ui/notice";
@@ -80,7 +80,7 @@ export default function AttachImage({
style={{ style={{
width: 100, width: 100,
height: 100, height: 100,
borderRadius: 5, borderRadius: defaultBorderRadius,
backgroundColor: "black", backgroundColor: "black",
marginRight: 6 marginRight: 6
}} }}
@@ -105,7 +105,7 @@ export default function AttachImage({
}} }}
> >
<IconButton <IconButton
size={SIZE.lg} size={AppFontSize.lg}
name={compress ? "checkbox-marked" : "checkbox-blank-outline"} name={compress ? "checkbox-marked" : "checkbox-blank-outline"}
color={compress ? colors.primary.accent : colors.primary.icon} color={compress ? colors.primary.accent : colors.primary.icon}
style={{ style={{
@@ -122,7 +122,7 @@ export default function AttachImage({
flexShrink: 1, flexShrink: 1,
marginLeft: 3 marginLeft: 3
}} }}
size={SIZE.sm} size={AppFontSize.sm}
> >
{strings.compress()} ({strings.recommended().toLowerCase()}) {strings.compress()} ({strings.recommended().toLowerCase()})
</Paragraph> </Paragraph>

View File

@@ -39,7 +39,7 @@ import {
eOpenJumpToDialog, eOpenJumpToDialog,
eScrollEvent eScrollEvent
} from "../../../utils/events"; } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import BaseDialog from "../../dialog/base-dialog"; import BaseDialog from "../../dialog/base-dialog";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
@@ -158,7 +158,7 @@ const JumpToSectionDialog = () => {
> >
{loading ? ( {loading ? (
<ActivityIndicator <ActivityIndicator
size={SIZE.lg} size={AppFontSize.lg}
color={colors.primary.accent} color={colors.primary.accent}
style={{ style={{
marginBottom: 20 marginBottom: 20
@@ -196,7 +196,7 @@ const JumpToSectionDialog = () => {
}} }}
> >
<Paragraph <Paragraph
size={SIZE.sm} size={AppFontSize.sm}
color={ color={
currentIndex === index currentIndex === index
? colors.static.white ? colors.static.white

View File

@@ -34,7 +34,7 @@ import {
eUnSubscribeEvent eUnSubscribeEvent
} from "../../../services/event-manager"; } from "../../../services/event-manager";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import BaseDialog from "../../dialog/base-dialog"; import BaseDialog from "../../dialog/base-dialog";
import { presentDialog } from "../../dialog/functions"; import { presentDialog } from "../../dialog/functions";
@@ -216,7 +216,7 @@ const PDFPreview = () => {
style={{ style={{
marginRight: 12 marginRight: 12
}} }}
size={SIZE.xxl} size={AppFontSize.xxl}
/> />
</View> </View>

View File

@@ -21,7 +21,7 @@ import { useThemeColors } from "@notesnook/theme";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { View } from "react-native"; import { View } from "react-native";
import { eSendEvent, eSubscribeEvent } from "../../../services/event-manager"; import { eSendEvent, eSubscribeEvent } from "../../../services/event-manager";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import BaseDialog from "../../dialog/base-dialog"; import BaseDialog from "../../dialog/base-dialog";
import DialogContainer from "../../dialog/dialog-container"; import DialogContainer from "../../dialog/dialog-container";
@@ -131,7 +131,7 @@ export default function Progress() {
textAlign: "center" textAlign: "center"
}} }}
color={colors.primary.paragraph} color={colors.primary.paragraph}
size={SIZE.lg} size={AppFontSize.lg}
> >
{data?.title} {data?.title}
</Heading> </Heading>

View File

@@ -27,7 +27,7 @@ import {
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { getElevationStyle } from "../../../utils/elevation"; import { getElevationStyle } from "../../../utils/elevation";
import { eCloseResultDialog, eOpenResultDialog } from "../../../utils/events"; import { eCloseResultDialog, eOpenResultDialog } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import BaseDialog from "../../dialog/base-dialog"; import BaseDialog from "../../dialog/base-dialog";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
@@ -78,7 +78,7 @@ const ResultDialog = () => {
}} }}
> >
<Heading <Heading
size={SIZE.lg} size={AppFontSize.lg}
textBreakStrategy="balanced" textBreakStrategy="balanced"
style={{ style={{
alignSelf: "center", alignSelf: "center",
@@ -94,12 +94,12 @@ const ResultDialog = () => {
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.md} size={AppFontSize.md}
style={{ style={{
alignSelf: "center", alignSelf: "center",
textAlign: "center", textAlign: "center",
maxWidth: "80%", maxWidth: "80%",
lineHeight: SIZE.sm + 5 lineHeight: AppFontSize.sm + 5
}} }}
> >
{dialogData.paragraph} {dialogData.paragraph}
@@ -134,7 +134,7 @@ const ResultDialog = () => {
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
onPress={close} onPress={close}
fontSize={SIZE.md + 2} fontSize={AppFontSize.md + 2}
/> />
</View> </View>
</View> </View>

View File

@@ -27,7 +27,7 @@ import {
eCloseResultDialog, eCloseResultDialog,
eOpenPremiumDialog eOpenPremiumDialog
} from "../../../utils/events"; } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { sleep } from "../../../utils/time"; import { sleep } from "../../../utils/time";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
export const ProFeatures = ({ count = 6 }) => { export const ProFeatures = ({ count = 6 }) => {
@@ -69,11 +69,15 @@ export const ProFeatures = ({ count = 6 }) => {
paddingHorizontal: 0, paddingHorizontal: 0,
marginBottom: 10, marginBottom: 10,
alignItems: "center", alignItems: "center",
borderRadius: 5, borderRadius: defaultBorderRadius,
justifyContent: "flex-start" justifyContent: "flex-start"
}} }}
> >
<Icon size={SIZE.lg} color={colors.primary.accent} name="check" /> <Icon
size={AppFontSize.lg}
color={colors.primary.accent}
name="check"
/>
<Paragraph style={{ marginLeft: 5, flexShrink: 1 }}> <Paragraph style={{ marginLeft: 5, flexShrink: 1 }}>
{item.content} {item.content}
</Paragraph> </Paragraph>
@@ -86,7 +90,7 @@ export const ProFeatures = ({ count = 6 }) => {
await sleep(300); await sleep(300);
eSendEvent(eOpenPremiumDialog); eSendEvent(eOpenPremiumDialog);
}} }}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
textDecorationLine: "underline", textDecorationLine: "underline",
color: colors.secondary.paragraph color: colors.secondary.paragraph

View File

@@ -28,7 +28,7 @@ import {
import { RouteName } from "../../stores/use-navigation-store"; import { RouteName } from "../../stores/use-navigation-store";
import { useSelectionStore } from "../../stores/use-selection-store"; import { useSelectionStore } from "../../stores/use-selection-store";
import { eScrollEvent } from "../../utils/events"; import { eScrollEvent } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { IconButtonProps } from "../ui/icon-button"; import { IconButtonProps } from "../ui/icon-button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
@@ -121,7 +121,7 @@ export const Header = ({
: strings.searchInRoute(title)} : strings.searchInRoute(title)}
</Paragraph> </Paragraph>
) : ( ) : (
<Heading size={SIZE.lg}>{title}</Heading> <Heading size={AppFontSize.lg}>{title}</Heading>
)} )}
<RightMenus rightButton={rightButton} /> <RightMenus rightButton={rightButton} />

View File

@@ -25,7 +25,7 @@ import {
eUnSubscribeEvent eUnSubscribeEvent
} from "../../services/event-manager"; } from "../../services/event-manager";
import { eScrollEvent } from "../../utils/events"; import { eScrollEvent } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Tag from "../ui/tag"; import Tag from "../ui/tag";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
@@ -75,7 +75,7 @@ export const Title = ({
{!visible ? ( {!visible ? (
<Heading <Heading
numberOfLines={1} numberOfLines={1}
size={SIZE.lg} size={AppFontSize.lg}
style={{ style={{
flexWrap: "wrap", flexWrap: "wrap",
marginTop: Platform.OS === "ios" ? -1 : 0 marginTop: Platform.OS === "ios" ? -1 : 0
@@ -83,7 +83,7 @@ export const Title = ({
color={accentColor || colors.primary.heading} color={accentColor || colors.primary.heading}
> >
{isTag ? ( {isTag ? (
<Heading size={SIZE.xl} color={colors.primary.accent}> <Heading size={AppFontSize.xl} color={colors.primary.accent}>
# #
</Heading> </Heading>
) : null} ) : null}

View File

@@ -23,31 +23,27 @@ import React from "react";
import { Linking, ScrollView, useWindowDimensions, View } from "react-native"; import { Linking, ScrollView, useWindowDimensions, View } from "react-native";
import { SwiperFlatList } from "react-native-swiper-flatlist"; import { SwiperFlatList } from "react-native-swiper-flatlist";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation"; import Navigation from "../../services/navigation";
import SettingsService from "../../services/settings"; import { AppFontSize } from "../../utils/size";
import { useSettingStore } from "../../stores/use-setting-store";
import { getElevationStyle } from "../../utils/elevation";
import { eOpenLoginDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { AuthMode } from "../auth";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import SettingsService from "../../services/settings";
import { AuthMode } from "../auth/common";
const Intro = ({ navigation }) => { const Intro = () => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
const { width, height } = useWindowDimensions(); const { width, height } = useWindowDimensions();
const deviceMode = useSettingStore((state) => state.deviceMode);
const insets = useGlobalSafeAreaInsets(); const insets = useGlobalSafeAreaInsets();
const isTablet = width > 600;
const renderItem = React.useCallback( const renderItem = React.useCallback(
({ item }) => ( ({ item }: { item: (typeof strings.introData)[0] }) => (
<View <View
style={{ style={{
justifyContent: "center", justifyContent: "center",
width: deviceMode !== "mobile" ? width / 2 : width, width: isTablet ? width / 2 : width,
paddingHorizontal: paddingHorizontal: isTablet ? (width / 2) * 0.05 : width * 0.05
deviceMode !== "mobile" ? (width / 2) * 0.05 : width * 0.05
}} }}
> >
<View <View
@@ -88,21 +84,21 @@ const Intro = ({ navigation }) => {
marginBottom: 5 marginBottom: 5
}} }}
extraBold extraBold
size={SIZE.xxl} size={AppFontSize.xxl}
> >
{heading()} {heading()}
</Heading> </Heading>
))} ))}
{item.body ? ( {item.body ? (
<Paragraph size={SIZE.sm}>{item.body()}</Paragraph> <Paragraph size={AppFontSize.sm}>{item.body()}</Paragraph>
) : null} ) : null}
{item.tesimonial ? ( {item.tesimonial ? (
<Paragraph <Paragraph
style={{ style={{
fontStyle: "italic", fontStyle: "italic",
fontSize: SIZE.lg fontSize: AppFontSize.lg
}} }}
onPress={() => { onPress={() => {
Linking.openURL(item.link); Linking.openURL(item.link);
@@ -114,31 +110,37 @@ const Intro = ({ navigation }) => {
</View> </View>
</View> </View>
), ),
[colors.primary.accent, colors.secondary.background, deviceMode, width] [colors.primary.accent, colors.secondary.background, isTablet, width]
); );
return ( return (
<ScrollView <ScrollView
testID="notesnook.splashscreen" testID="notesnook.splashscreen"
style={{ style={{
width: "100%" width: "100%",
backgroundColor: colors.primary.background
}} }}
> >
<View <View
style={{ style={[
width: deviceMode !== "mobile" ? width / 2 : "100%", {
backgroundColor: colors.secondary.background, width: "100%",
borderBottomWidth: 1, backgroundColor: colors.secondary.background,
borderBottomColor: colors.primary.border, borderBottomWidth: 1,
alignSelf: deviceMode !== "mobile" ? "center" : undefined, borderBottomColor: colors.primary.border,
borderWidth: deviceMode !== "mobile" ? 1 : null, paddingTop: insets.top + 10,
borderColor: deviceMode !== "mobile" ? colors.primary.border : null, paddingBottom: insets.top + 10,
borderRadius: deviceMode !== "mobile" ? 20 : null, minHeight: height * 0.7 - (insets.top + insets.bottom)
marginTop: deviceMode !== "mobile" ? 50 : null, },
paddingTop: insets.top + 10, isTablet && {
paddingBottom: insets.top + 10, width: width / 2,
minHeight: height * 0.7 - (insets.top + insets.bottom) alignSelf: "center",
}} borderWidth: 1,
borderColor: colors.primary.border,
borderRadius: 20,
marginTop: 50
}
]}
> >
<SwiperFlatList <SwiperFlatList
autoplay autoplay
@@ -170,23 +172,12 @@ const Intro = ({ navigation }) => {
<Button <Button
width={250} width={250}
onPress={async () => { onPress={async () => {
eSendEvent(eOpenLoginDialog, AuthMode.welcomeSignup); SettingsService.set({ introCompleted: true });
setTimeout(() => { Navigation.push("Auth", {
SettingsService.set({ mode: AuthMode.welcomeSignup
introCompleted: true });
});
Navigation.replace("Notes", {
canGoBack: false
});
}, 1000);
}} }}
style={{ fontSize={AppFontSize.md}
paddingHorizontal: 24,
alignSelf: "center",
...getElevationStyle(5),
borderRadius: 100
}}
fontSize={SIZE.md}
type="accent" type="accent"
title={strings.getStarted()} title={strings.getStarted()}
/> />

File diff suppressed because one or more lines are too long

View File

@@ -23,7 +23,7 @@ import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { DefaultAppStyles } from "../../../utils/styles"; import { DefaultAppStyles } from "../../../utils/styles";
import AppIcon from "../../ui/AppIcon"; import AppIcon from "../../ui/AppIcon";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -41,7 +41,7 @@ export const NotebookHeader = ({
<View <View
style={{ style={{
paddingHorizontal: DefaultAppStyles.GAP, paddingHorizontal: DefaultAppStyles.GAP,
marginVertical: DefaultAppStyles.GAP, marginTop: DefaultAppStyles.GAP,
backgroundColor: colors.secondary.background backgroundColor: colors.secondary.background
}} }}
> >
@@ -52,14 +52,16 @@ export const NotebookHeader = ({
paddingVertical: 25 paddingVertical: 25
}} }}
> >
<AppIcon name="notebook" size={SIZE.xxl} /> <AppIcon name="notebook" size={AppFontSize.xxl} />
<Heading size={SIZE.lg}>{notebook.title}</Heading>
{notebook.description ? ( <View>
<Paragraph size={SIZE.sm} color={colors.primary.paragraph}> <Heading size={AppFontSize.lg}>{notebook.title}</Heading>
{notebook.description} {notebook.description ? (
</Paragraph> <Paragraph size={AppFontSize.sm} color={colors.primary.paragraph}>
) : null} {notebook.description}
</Paragraph>
) : null}
</View>
<View <View
style={{ style={{
@@ -67,11 +69,11 @@ export const NotebookHeader = ({
gap: DefaultAppStyles.GAP_SMALL gap: DefaultAppStyles.GAP_SMALL
}} }}
> >
<Paragraph size={SIZE.xxs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xxs} color={colors.secondary.paragraph}>
{strings.notes(totalNotes || 0)} {strings.notes(totalNotes || 0)}
</Paragraph> </Paragraph>
<Paragraph color={colors.secondary.paragraph} size={SIZE.xxs}> <Paragraph color={colors.secondary.paragraph} size={AppFontSize.xxs}>
{getFormattedDate(notebook.dateModified, "date-time")} {getFormattedDate(notebook.dateModified, "date-time")}
</Paragraph> </Paragraph>
</View> </View>

View File

@@ -21,12 +21,12 @@ import { GroupHeader, GroupOptions, ItemType } from "@notesnook/core";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { useWindowDimensions, View } from "react-native"; import { View } from "react-native";
import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled"; import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import SettingsService from "../../../services/settings"; import SettingsService from "../../../services/settings";
import { RouteName } from "../../../stores/use-navigation-store"; import { RouteName } from "../../../stores/use-navigation-store";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { DefaultAppStyles } from "../../../utils/styles"; import { DefaultAppStyles } from "../../../utils/styles";
import Sort from "../../sheets/sort"; import Sort from "../../sheets/sort";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
@@ -56,8 +56,6 @@ export const SectionHeader = React.memo<
onOpenJumpToDialog onOpenJumpToDialog
}: SectionHeaderProps) { }: SectionHeaderProps) {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
const { fontScale } = useWindowDimensions();
const groupBy = strings.groupByStrings[groupOptions.groupBy]();
const isCompactModeEnabled = useIsCompactModeEnabled( const isCompactModeEnabled = useIsCompactModeEnabled(
dataType as "note" | "notebook" dataType as "note" | "notebook"
); );
@@ -66,8 +64,7 @@ export const SectionHeader = React.memo<
<View <View
style={{ style={{
width: "100%", width: "100%",
paddingHorizontal: DefaultAppStyles.GAP, paddingHorizontal: DefaultAppStyles.GAP
marginVertical: DefaultAppStyles.GAP
}} }}
> >
<View <View
@@ -79,7 +76,7 @@ export const SectionHeader = React.memo<
justifyContent: "space-between", justifyContent: "space-between",
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: colors.primary.border, borderColor: colors.primary.border,
paddingBottom: DefaultAppStyles.GAP_VERTICAL paddingVertical: DefaultAppStyles.GAP_VERTICAL_SMALL
}} }}
> >
<Pressable <Pressable
@@ -94,14 +91,16 @@ export const SectionHeader = React.memo<
}} }}
> >
<Heading <Heading
size={SIZE.sm} size={AppFontSize.xxs}
style={{ style={{
alignSelf: "center", alignSelf: "center",
textAlignVertical: "center" textAlignVertical: "center"
}} }}
color={colors.primary.accent} color={colors.primary.accent}
> >
{!item.title || item.title === "" ? strings.pinned() : item.title} {!item.title || item.title === ""
? strings.pinned().toUpperCase()
: item.title.toUpperCase()}
</Heading> </Heading>
</Pressable> </Pressable>
@@ -120,6 +119,7 @@ export const SectionHeader = React.memo<
? "sort-ascending" ? "sort-ascending"
: "sort-descending" : "sort-descending"
} }
color={colors.secondary.icon}
onPress={() => { onPress={() => {
if (!screen) return; if (!screen) return;
presentSheet({ presentSheet({
@@ -130,7 +130,7 @@ export const SectionHeader = React.memo<
width: 25, width: 25,
height: 25 height: 25
}} }}
size={SIZE.lg - 2} size={AppFontSize.lg - 2}
/> />
<IconButton <IconButton
hidden={ hidden={
@@ -156,19 +156,20 @@ export const SectionHeader = React.memo<
: "normal" : "normal"
}); });
}} }}
size={SIZE.lg - 2} size={AppFontSize.lg - 2}
/> />
</> </>
) : null} ) : null}
<IconButton {/* <IconButton
style={{ style={{
width: 25, width: 25,
height: 25 height: 25
}} }}
color={colors.secondary.icon}
name={"chevron-down"} name={"chevron-down"}
size={SIZE.lg - 2} size={SIZE.lg - 2}
/> /> */}
</View> </View>
</View> </View>
</View> </View>

View File

@@ -32,9 +32,13 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled"; import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled";
import useNavigationStore from "../../../stores/use-navigation-store"; import useNavigationStore from "../../../stores/use-navigation-store";
import { useRelationStore } from "../../../stores/use-relation-store"; import { useRelationStore } from "../../../stores/use-relation-store";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { NotebooksWithDateEdited, TagsWithDateEdited } from "@notesnook/common"; import {
getFormattedDate,
NotebooksWithDateEdited,
TagsWithDateEdited
} from "@notesnook/common";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
import { notesnook } from "../../../../e2e/test.ids"; import { notesnook } from "../../../../e2e/test.ids";
import useIsSelected from "../../../hooks/use-selected"; import useIsSelected from "../../../hooks/use-selected";
@@ -48,6 +52,7 @@ import { ReminderTime } from "../../ui/reminder-time";
import { TimeSince } from "../../ui/time-since"; import { TimeSince } from "../../ui/time-since";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
import dayjs from "dayjs";
type NoteItemProps = { type NoteItemProps = {
item: Note | BaseTrashItem<Note>; item: Note | BaseTrashItem<Note>;
@@ -97,11 +102,27 @@ const NoteItem = ({
flexShrink: 1 flexShrink: 1
}} }}
> >
{compactMode ? null : (
<Paragraph
style={{
fontSize: AppFontSize.xxs,
color: colors.secondary.paragraph
}}
>
{getFormattedDate(
date,
dayjs(date).isBefore(dayjs().subtract(1, "day").hour(23))
? "date"
: "time"
)}
</Paragraph>
)}
{compactMode ? ( {compactMode ? (
<Paragraph <Paragraph
numberOfLines={1} numberOfLines={1}
color={color?.colorCode || primaryColors.heading} color={color?.colorCode || primaryColors.heading}
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
paddingRight: 10 paddingRight: 10
}} }}
@@ -112,7 +133,7 @@ const NoteItem = ({
<Heading <Heading
numberOfLines={1} numberOfLines={1}
color={color?.colorCode || primaryColors.heading} color={color?.colorCode || primaryColors.heading}
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
paddingRight: 10 paddingRight: 10
}} }}
@@ -142,7 +163,7 @@ const NoteItem = ({
justifyContent: "flex-start", justifyContent: "flex-start",
alignItems: "center", alignItems: "center",
width: "100%", width: "100%",
marginTop: 5, marginTop: DefaultAppStyles.GAP_VERTICAL_SMALL,
columnGap: 8, columnGap: 8,
rowGap: 4, rowGap: 4,
flexWrap: "wrap" flexWrap: "wrap"
@@ -153,7 +174,7 @@ const NoteItem = ({
{item.conflicted ? ( {item.conflicted ? (
<Icon <Icon
name="alert-circle" name="alert-circle"
size={SIZE.sm} size={AppFontSize.sm}
color={colors.error.accent} color={colors.error.accent}
/> />
) : null} ) : null}
@@ -162,7 +183,7 @@ const NoteItem = ({
<Icon <Icon
testID="sync-off" testID="sync-off"
name="sync-off" name="sync-off"
size={SIZE.sm} size={AppFontSize.sm}
color={primaryColors.icon} color={primaryColors.icon}
/> />
) : null} ) : null}
@@ -171,20 +192,11 @@ const NoteItem = ({
<Icon <Icon
testID="pencil-lock" testID="pencil-lock"
name="pencil-lock" name="pencil-lock"
size={SIZE.sm} size={AppFontSize.sm}
color={primaryColors.icon} color={primaryColors.icon}
/> />
) : null} ) : null}
<TimeSince
style={{
fontSize: SIZE.xxs,
color: colors.secondary.paragraph
}}
time={date}
updateFrequency={Date.now() - date < 60000 ? 2000 : 60000}
/>
{attachmentsCount > 0 ? ( {attachmentsCount > 0 ? (
<View <View
style={{ style={{
@@ -195,12 +207,12 @@ const NoteItem = ({
> >
<Icon <Icon
name="attachment" name="attachment"
size={SIZE.sm} size={AppFontSize.sm}
color={primaryColors.icon} color={primaryColors.icon}
/> />
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xxs} size={AppFontSize.xxs}
> >
{attachmentsCount} {attachmentsCount}
</Paragraph> </Paragraph>
@@ -211,7 +223,7 @@ const NoteItem = ({
<Icon <Icon
testID="icon-pinned" testID="icon-pinned"
name="pin-outline" name="pin-outline"
size={SIZE.xs} size={AppFontSize.xs}
color={color?.colorCode || primaryColors.accent} color={color?.colorCode || primaryColors.accent}
/> />
) : null} ) : null}
@@ -220,7 +232,7 @@ const NoteItem = ({
<Icon <Icon
name="lock" name="lock"
testID="note-locked-icon" testID="note-locked-icon"
size={SIZE.sm} size={AppFontSize.sm}
color={primaryColors.icon} color={primaryColors.icon}
/> />
) : null} ) : null}
@@ -229,7 +241,7 @@ const NoteItem = ({
<Icon <Icon
testID="icon-star" testID="icon-star"
name="star-outline" name="star-outline"
size={SIZE.sm} size={AppFontSize.sm}
color="orange" color="orange"
/> />
) : null} ) : null}
@@ -240,9 +252,9 @@ const NoteItem = ({
disabled disabled
color={color?.colorCode} color={color?.colorCode}
textStyle={{ textStyle={{
fontSize: SIZE.xxxs fontSize: AppFontSize.xxxs
}} }}
iconSize={SIZE.xxxs} iconSize={AppFontSize.xxxs}
style={{ style={{
height: "auto" height: "auto"
}} }}
@@ -271,11 +283,11 @@ const NoteItem = ({
> >
<AppIcon <AppIcon
name="book-outline" name="book-outline"
size={SIZE.xxxs} size={AppFontSize.xxxs}
color={colors.secondary.icon} color={colors.secondary.icon}
/> />
<Paragraph <Paragraph
size={SIZE.xxxs} size={AppFontSize.xxxs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
{item.title} {item.title}
@@ -298,7 +310,7 @@ const NoteItem = ({
}} }}
> >
<Paragraph <Paragraph
size={SIZE.xxxs} size={AppFontSize.xxxs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
#{item.title} #{item.title}
@@ -312,7 +324,7 @@ const NoteItem = ({
<> <>
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xxs} size={AppFontSize.xxs}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -326,7 +338,7 @@ const NoteItem = ({
<Paragraph <Paragraph
color={primaryColors.accent} color={primaryColors.accent}
size={SIZE.xxs} size={AppFontSize.xxs}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -352,7 +364,7 @@ const NoteItem = ({
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
size={SIZE.sm} size={AppFontSize.sm}
color={colors.error.accent} color={colors.error.accent}
/> />
) : null} ) : null}
@@ -361,7 +373,7 @@ const NoteItem = ({
<Icon <Icon
name="lock" name="lock"
testID="note-locked-icon" testID="note-locked-icon"
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -373,7 +385,7 @@ const NoteItem = ({
<Icon <Icon
testID="icon-star" testID="icon-star"
name="star-outline" name="star-outline"
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -383,7 +395,7 @@ const NoteItem = ({
<TimeSince <TimeSince
style={{ style={{
fontSize: SIZE.xxs, fontSize: AppFontSize.xxs,
color: colors.secondary.paragraph, color: colors.secondary.paragraph,
marginRight: 6 marginRight: 6
}} }}
@@ -398,7 +410,7 @@ const NoteItem = ({
<AppIcon <AppIcon
name={selected ? "checkbox-outline" : "checkbox-blank-outline"} name={selected ? "checkbox-outline" : "checkbox-blank-outline"}
color={selected ? colors.selected.icon : colors.primary.icon} color={selected ? colors.selected.icon : colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
/> />
</> </>
) : ( ) : (
@@ -406,7 +418,7 @@ const NoteItem = ({
testID={notesnook.listitem.menu} testID={notesnook.listitem.menu}
color={colors.secondary.icon} color={colors.secondary.icon}
name="dots-horizontal" name="dots-horizontal"
size={SIZE.lg} size={AppFontSize.lg}
onPress={() => !noOpen && Properties.present(item)} onPress={() => !noOpen && Properties.present(item)}
style={{ style={{
justifyContent: "center", justifyContent: "center",

View File

@@ -25,7 +25,7 @@ import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../../e2e/test.ids"; import { notesnook } from "../../../../e2e/test.ids";
import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled"; import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Properties } from "../../properties"; import { Properties } from "../../properties";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -61,7 +61,7 @@ export const NotebookItem = ({
> >
{compactMode ? ( {compactMode ? (
<Paragraph <Paragraph
size={SIZE.sm} size={AppFontSize.sm}
numberOfLines={1} numberOfLines={1}
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
@@ -71,7 +71,7 @@ export const NotebookItem = ({
</Paragraph> </Paragraph>
) : ( ) : (
<Heading <Heading
size={SIZE.md} size={AppFontSize.md}
numberOfLines={1} numberOfLines={1}
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
@@ -83,7 +83,7 @@ export const NotebookItem = ({
{!item.description || compactMode ? null : ( {!item.description || compactMode ? null : (
<Paragraph <Paragraph
size={SIZE.sm} size={AppFontSize.sm}
numberOfLines={2} numberOfLines={2}
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
@@ -100,14 +100,14 @@ export const NotebookItem = ({
justifyContent: "flex-start", justifyContent: "flex-start",
alignItems: "center", alignItems: "center",
marginTop: 5, marginTop: 5,
height: SIZE.md + 2 height: AppFontSize.md + 2
}} }}
> >
{isTrash ? ( {isTrash ? (
<> <>
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
textAlignVertical: "center", textAlignVertical: "center",
marginRight: 6 marginRight: 6
@@ -121,7 +121,7 @@ export const NotebookItem = ({
</Paragraph> </Paragraph>
<Paragraph <Paragraph
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
textAlignVertical: "center", textAlignVertical: "center",
marginRight: 6 marginRight: 6
@@ -134,7 +134,7 @@ export const NotebookItem = ({
) : ( ) : (
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -144,7 +144,7 @@ export const NotebookItem = ({
)} )}
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -155,7 +155,7 @@ export const NotebookItem = ({
{item.pinned ? ( {item.pinned ? (
<Icon <Icon
name="pin-outline" name="pin-outline"
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
marginRight: 10, marginRight: 10,
marginTop: 2 marginTop: 2
@@ -176,7 +176,7 @@ export const NotebookItem = ({
<> <>
<Paragraph <Paragraph
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginRight: 6 marginRight: 6
}} }}
@@ -190,7 +190,7 @@ export const NotebookItem = ({
color={colors.primary.heading} color={colors.primary.heading}
name="dots-horizontal" name="dots-horizontal"
testID={notesnook.ids.notebook.menu} testID={notesnook.ids.notebook.menu}
size={SIZE.xl} size={AppFontSize.xl}
onPress={() => Properties.present(item)} onPress={() => Properties.present(item)}
style={{ style={{
justifyContent: "center", justifyContent: "center",

View File

@@ -22,7 +22,7 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { notesnook } from "../../../../e2e/test.ids"; import { notesnook } from "../../../../e2e/test.ids";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { Properties } from "../../properties"; import { Properties } from "../../properties";
import ReminderSheet from "../../sheets/reminder"; import ReminderSheet from "../../sheets/reminder";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
@@ -62,7 +62,7 @@ const ReminderItem = React.memo(
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
}} }}
size={SIZE.md} size={AppFontSize.md}
> >
{item.title} {item.title}
</Heading> </Heading>
@@ -89,7 +89,7 @@ const ReminderItem = React.memo(
<View <View
style={{ style={{
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
flexDirection: "row", flexDirection: "row",
paddingHorizontal: 6, paddingHorizontal: 6,
alignItems: "center", alignItems: "center",
@@ -102,11 +102,11 @@ const ReminderItem = React.memo(
> >
<Icon <Icon
name="bell-off-outline" name="bell-off-outline"
size={SIZE.md} size={AppFontSize.md}
color={colors.error.icon} color={colors.error.icon}
/> />
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ marginLeft: 5 }} style={{ marginLeft: 5 }}
> >
@@ -118,7 +118,7 @@ const ReminderItem = React.memo(
<View <View
style={{ style={{
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
borderRadius: 5, borderRadius: defaultBorderRadius,
flexDirection: "row", flexDirection: "row",
paddingHorizontal: 6, paddingHorizontal: 6,
alignItems: "center", alignItems: "center",
@@ -131,11 +131,11 @@ const ReminderItem = React.memo(
> >
<Icon <Icon
name="reload" name="reload"
size={SIZE.md} size={AppFontSize.md}
color={colors.primary.accent} color={colors.primary.accent}
/> />
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ marginLeft: 5 }} style={{ marginLeft: 5 }}
> >
@@ -147,7 +147,7 @@ const ReminderItem = React.memo(
<ReminderTime <ReminderTime
reminder={item} reminder={item}
checkIsActive={false} checkIsActive={false}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ style={{
justifyContent: "flex-start", justifyContent: "flex-start",
height: 25, height: 25,
@@ -160,7 +160,7 @@ const ReminderItem = React.memo(
testID={notesnook.listitem.menu} testID={notesnook.listitem.menu}
color={colors.primary.paragraph} color={colors.primary.paragraph}
name="dots-horizontal" name="dots-horizontal"
size={SIZE.xl} size={AppFontSize.xl}
onPress={() => Properties.present(item, isSheet)} onPress={() => Properties.present(item, isSheet)}
style={{ style={{
justifyContent: "center", justifyContent: "center",

View File

@@ -24,7 +24,7 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled"; import { useIsCompactModeEnabled } from "../../../hooks/use-is-compact-mode-enabled";
import useIsSelected from "../../../hooks/use-selected"; import useIsSelected from "../../../hooks/use-selected";
import { useSelectionStore } from "../../../stores/use-selection-store"; import { useSelectionStore } from "../../../stores/use-selection-store";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Item, TrashItem } from "@notesnook/core"; import { Item, TrashItem } from "@notesnook/core";
export const SelectionIcon = ({ item }: { item: Item }) => { export const SelectionIcon = ({ item }: { item: Item }) => {
@@ -52,7 +52,7 @@ export const SelectionIcon = ({ item }: { item: Item }) => {
> >
{selected ? ( {selected ? (
<Icon <Icon
size={compactMode ? SIZE.xl - 2 : SIZE.xl} size={compactMode ? AppFontSize.xl - 2 : AppFontSize.xl}
color={selected ? colors.selected.accent : colors.primary.icon} color={selected ? colors.selected.accent : colors.primary.icon}
name={"check"} name={"check"}
/> />

View File

@@ -23,7 +23,7 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { notesnook } from "../../../../e2e/test.ids"; import { notesnook } from "../../../../e2e/test.ids";
import { TaggedNotes } from "../../../screens/notes/tagged"; import { TaggedNotes } from "../../../screens/notes/tagged";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Properties } from "../../properties"; import { Properties } from "../../properties";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -60,9 +60,9 @@ const TagItem = React.memo(
flexShrink: 1 flexShrink: 1
}} }}
> >
<Heading size={SIZE.md}> <Heading size={AppFontSize.md}>
<Heading <Heading
size={SIZE.md} size={AppFontSize.md}
style={{ style={{
color: colors.primary.accent color: colors.primary.accent
}} }}
@@ -73,7 +73,7 @@ const TagItem = React.memo(
</Heading> </Heading>
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginTop: 5 marginTop: 5
}} }}
@@ -85,7 +85,7 @@ const TagItem = React.memo(
<IconButton <IconButton
color={colors.primary.heading} color={colors.primary.heading}
name="dots-horizontal" name="dots-horizontal"
size={SIZE.xl} size={AppFontSize.xl}
onPress={() => { onPress={() => {
Properties.present(item); Properties.present(item);
}} }}

View File

@@ -21,16 +21,24 @@ import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { Dimensions, View } from "react-native"; import { Dimensions, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useMessageStore } from "../../stores/use-message-store"; import { Message, useMessageStore } from "../../stores/use-message-store";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
export const Card = ({ color }: { color?: string }) => { export const Card = ({
color,
customMessage
}: {
color?: string;
customMessage?: Omit<Message, "data">;
}) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
color = color ? color : colors.primary.accent; color = color ? color : colors.primary.accent;
const messageBoardState = useMessageStore((state) => state.message); const messageBoardState = useMessageStore(
(state) => customMessage || state.message
);
const announcements = useMessageStore((state) => state.announcements); const announcements = useMessageStore((state) => state.announcements);
const fontScale = Dimensions.get("window").fontScale; const fontScale = Dimensions.get("window").fontScale;
@@ -40,7 +48,7 @@ export const Card = ({ color }: { color?: string }) => {
style={{ style={{
width: "100%", width: "100%",
paddingHorizontal: DefaultAppStyles.GAP, paddingHorizontal: DefaultAppStyles.GAP,
marginTop: DefaultAppStyles.GAP paddingVertical: DefaultAppStyles.GAP_VERTICAL
}} }}
> >
<Pressable <Pressable
@@ -51,11 +59,7 @@ export const Card = ({ color }: { color?: string }) => {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
paddingHorizontal: DefaultAppStyles.GAP_SMALL, width: "100%"
width: "100%",
backgroundColor: colors.secondary.background,
borderWidth: 1,
borderColor: colors.primary.border
}} }}
> >
<View <View
@@ -75,7 +79,7 @@ export const Card = ({ color }: { color?: string }) => {
}} }}
> >
<Icon <Icon
size={SIZE.xxxl} size={AppFontSize.xxxl}
color={ color={
messageBoardState.type === "error" ? colors.error.icon : color messageBoardState.type === "error" ? colors.error.icon : color
} }
@@ -95,11 +99,15 @@ export const Card = ({ color }: { color?: string }) => {
flexWrap: "nowrap", flexWrap: "nowrap",
flexShrink: 1 flexShrink: 1
}} }}
size={AppFontSize.xs}
color={colors.primary.heading} color={colors.primary.heading}
> >
{messageBoardState.actionText} {messageBoardState.actionText}
</Paragraph> </Paragraph>
<Paragraph color={colors.secondary.paragraph} size={SIZE.xxs}> <Paragraph
color={colors.secondary.paragraph}
size={AppFontSize.xxs}
>
{messageBoardState.message} {messageBoardState.message}
</Paragraph> </Paragraph>
</View> </View>
@@ -119,7 +127,7 @@ export const Card = ({ color }: { color?: string }) => {
color={ color={
messageBoardState.type === "error" ? colors.error.icon : color messageBoardState.type === "error" ? colors.error.icon : color
} }
size={SIZE.lg} size={AppFontSize.lg}
/> />
</View> </View>
)} )}

View File

@@ -24,7 +24,7 @@ import { notesnook } from "../../../e2e/test.ids";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { TTip, useTip } from "../../services/tip-manager"; import { TTip, useTip } from "../../services/tip-manager";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { SIZE } from "../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../utils/size";
import { Tip } from "../tip"; import { Tip } from "../tip";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Seperator from "../ui/seperator"; import Seperator from "../ui/seperator";
@@ -109,7 +109,7 @@ export const Empty = React.memo(function Empty({
}} }}
style={{ style={{
alignSelf: "flex-start", alignSelf: "flex-start",
borderRadius: 5, borderRadius: defaultBorderRadius,
height: 40 height: 40
}} }}
/> />
@@ -125,12 +125,12 @@ export const Empty = React.memo(function Empty({
}} }}
> >
<Heading>{placeholder?.title}</Heading> <Heading>{placeholder?.title}</Heading>
<Paragraph size={SIZE.sm} textBreakStrategy="balanced"> <Paragraph size={AppFontSize.sm} textBreakStrategy="balanced">
{placeholder?.loading} {placeholder?.loading}
</Paragraph> </Paragraph>
<Seperator /> <Seperator />
<ActivityIndicator <ActivityIndicator
size={SIZE.lg} size={AppFontSize.lg}
color={color || colors.primary.accent} color={color || colors.primary.accent}
/> />
</View> </View>

View File

@@ -27,7 +27,7 @@ import {
} from "react-native-drax"; } from "react-native-drax";
import { fluidTabsRef } from "../../utils/global-refs"; import { fluidTabsRef } from "../../utils/global-refs";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { useSideBarDraggingStore } from "../side-menu/dragging-store"; import { useSideBarDraggingStore } from "../side-menu/dragging-store";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
@@ -78,13 +78,15 @@ function ReorderableList<T extends { id: string }>({
return isHidden && !dragging ? null : ( return isHidden && !dragging ? null : (
<View <View
style={{ style={{
flexDirection: "row" flexDirection: "row",
width: "100%"
}} }}
> >
<View <View
style={{ style={{
opacity: isHidden ? 0.4 : 1,
flexGrow: 1, flexGrow: 1,
opacity: isHidden ? 0.4 : 1 flexShrink: 1
}} }}
> >
{renderDraggableItem(info, props)} {renderDraggableItem(info, props)}
@@ -93,13 +95,12 @@ function ReorderableList<T extends { id: string }>({
<IconButton <IconButton
name={!isHidden ? "minus" : "plus"} name={!isHidden ? "minus" : "plus"}
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
top={0} top={0}
bottom={0} bottom={0}
onPress={() => { onPress={() => {
const _hiddenItems = hiddenItemsState.slice(); const _hiddenItems = hiddenItemsState.slice();
const index = _hiddenItems.indexOf(info.item.id); const index = _hiddenItems.indexOf(info.item.id);
if (index === -1) { if (index === -1) {
_hiddenItems.push(info.item?.id); _hiddenItems.push(info.item?.id);
} else { } else {

View File

@@ -38,7 +38,7 @@ import Navigation from "../../services/navigation";
import Sync from "../../services/sync"; import Sync from "../../services/sync";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { eOnLoadNote, eShowMergeDialog } from "../../utils/events"; import { eOnLoadNote, eShowMergeDialog } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import BaseDialog from "../dialog/base-dialog"; import BaseDialog from "../dialog/base-dialog";
import DialogButtons from "../dialog/dialog-buttons"; import DialogButtons from "../dialog/dialog-buttons";
import DialogContainer from "../dialog/dialog-container"; import DialogContainer from "../dialog/dialog-container";
@@ -164,7 +164,7 @@ const MergeConflicts = () => {
<Paragraph <Paragraph
style={{ flexWrap: "wrap" }} style={{ flexWrap: "wrap" }}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
> >
<Text <Text
style={{ style={{
@@ -203,7 +203,7 @@ const MergeConflicts = () => {
borderRadius: 100, borderRadius: 100,
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
/> />
) : null} ) : null}
<View style={{ width: 10 }} /> <View style={{ width: 10 }} />
@@ -220,7 +220,7 @@ const MergeConflicts = () => {
borderRadius: 100, borderRadius: 100,
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
color={colors.error.paragraph} color={colors.error.paragraph}
onPress={() => { onPress={() => {
setDialogVisible(true); setDialogVisible(true);
@@ -238,7 +238,7 @@ const MergeConflicts = () => {
marginLeft: 10 marginLeft: 10
}} }}
type="accent" type="accent"
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
title={ title={
keeping && !isDiscarded ? strings.undo() : strings.keep() keeping && !isDiscarded ? strings.undo() : strings.keep()
} }

View File

@@ -30,7 +30,7 @@ import { db } from "../../common/database";
import { useDBItem } from "../../hooks/use-db-item"; import { useDBItem } from "../../hooks/use-db-item";
import { presentSheet } from "../../services/event-manager"; import { presentSheet } from "../../services/event-manager";
import { openLinkInBrowser } from "../../utils/functions"; import { openLinkInBrowser } from "../../utils/functions";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import DialogHeader from "../dialog/dialog-header"; import DialogHeader from "../dialog/dialog-header";
import SheetProvider from "../sheet-provider"; import SheetProvider from "../sheet-provider";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
@@ -97,7 +97,7 @@ const HistoryItem = ({
{!item ? null : ( {!item ? null : (
<> <>
<Paragraph>{getDate(item.dateCreated, item.dateModified)}</Paragraph> <Paragraph>{getDate(item.dateCreated, item.dateModified)}</Paragraph>
<Paragraph color={colors.secondary.paragraph} size={SIZE.xs}> <Paragraph color={colors.secondary.paragraph} size={AppFontSize.xs}>
{getTimeAgo(item.dateModified)} {getTimeAgo(item.dateModified)}
</Paragraph> </Paragraph>
</> </>
@@ -170,7 +170,7 @@ export default function NoteHistory({
> >
{_loading ? ( {_loading ? (
<ActivityIndicator <ActivityIndicator
size={SIZE.xl} size={AppFontSize.xl}
color={colors.primary.accent} color={colors.primary.accent}
/> />
) : ( ) : (
@@ -187,7 +187,7 @@ export default function NoteHistory({
/> />
</View> </View>
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ style={{
alignSelf: "center" alignSelf: "center"

View File

@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { useThemeColors } from "@notesnook/theme";
import React, { useState } from "react"; import React, { useState } from "react";
import { ActivityIndicator, Platform, ScrollView, View } from "react-native"; import { ActivityIndicator, Platform, ScrollView, View } from "react-native";
import { LAUNCH_ROCKET } from "../../assets/images/assets"; import { LAUNCH_ROCKET } from "../../assets/images/assets";
@@ -24,17 +25,13 @@ import { db } from "../../common/database";
import { usePricing } from "../../hooks/use-pricing"; import { usePricing } from "../../hooks/use-pricing";
import { DDS } from "../../services/device-detection"; import { DDS } from "../../services/device-detection";
import { eSendEvent, presentSheet } from "../../services/event-manager"; import { eSendEvent, presentSheet } from "../../services/event-manager";
import { useThemeColors } from "@notesnook/theme"; import Navigation from "../../services/navigation";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { getElevationStyle } from "../../utils/elevation"; import { getElevationStyle } from "../../utils/elevation";
import { import { eClosePremiumDialog, eCloseSheet } from "../../utils/events";
eClosePremiumDialog, import { AppFontSize } from "../../utils/size";
eCloseSheet,
eOpenLoginDialog
} from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { AuthMode } from "../auth"; import { AuthMode } from "../auth/common";
import SheetProvider from "../sheet-provider"; import SheetProvider from "../sheet-provider";
import { Toast } from "../toast"; import { Toast } from "../toast";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
@@ -66,9 +63,9 @@ export const Component = ({ close, promo }) => {
}); });
} else { } else {
close(); close();
setTimeout(() => { Navigation.navigate("Auth", {
eSendEvent(eOpenLoginDialog, AuthMode.trialSignup); mode: AuthMode.trialSignup
}, 400); });
} }
}; };
@@ -137,14 +134,14 @@ export const Component = ({ close, promo }) => {
<Heading <Heading
key="heading" key="heading"
size={SIZE.lg} size={AppFontSize.lg}
style={{ style={{
alignSelf: "center", alignSelf: "center",
paddingTop: 20 paddingTop: 20
}} }}
> >
Notesnook{" "} Notesnook{" "}
<Heading size={SIZE.lg} color={colors.primary.accent}> <Heading size={AppFontSize.lg} color={colors.primary.accent}>
Pro Pro
</Heading> </Heading>
</Heading> </Heading>
@@ -154,7 +151,7 @@ export const Component = ({ close, promo }) => {
style={{ style={{
marginBottom: 20 marginBottom: 20
}} }}
size={SIZE.md} size={AppFontSize.md}
color={colors.primary.accent} color={colors.primary.accent}
/> />
) : ( ) : (
@@ -163,7 +160,7 @@ export const Component = ({ close, promo }) => {
alignSelf: "center", alignSelf: "center",
marginBottom: 20 marginBottom: 20
}} }}
size={SIZE.md} size={AppFontSize.md}
> >
( (
{Platform.OS === "android" {Platform.OS === "android"
@@ -176,7 +173,7 @@ export const Component = ({ close, promo }) => {
<Paragraph <Paragraph
key="description" key="description"
size={SIZE.md} size={AppFontSize.md}
style={{ style={{
paddingHorizontal: 12, paddingHorizontal: 12,
textAlign: "center", textAlign: "center",
@@ -231,7 +228,7 @@ export const Component = ({ close, promo }) => {
{!user || userCanRequestTrial ? ( {!user || userCanRequestTrial ? (
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
alignSelf: "center", alignSelf: "center",
textAlign: "center", textAlign: "center",
@@ -242,7 +239,7 @@ export const Component = ({ close, promo }) => {
{user {user
? 'On clicking "Try free for 14 days", your free trial will be activated.' ? '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."}{" "} : "After sign up you will be asked to activate your free trial."}{" "}
<Paragraph size={SIZE.xs} style={{ fontWeight: "bold" }}> <Paragraph size={AppFontSize.xs} style={{ fontWeight: "bold" }}>
No credit card is required. No credit card is required.
</Paragraph> </Paragraph>
</Paragraph> </Paragraph>

View File

@@ -32,7 +32,7 @@ import {
eOpenResultDialog, eOpenResultDialog,
eOpenTrialEndingDialog eOpenTrialEndingDialog
} from "../../utils/events"; } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import BaseDialog from "../dialog/base-dialog"; import BaseDialog from "../dialog/base-dialog";
import DialogContainer from "../dialog/dialog-container"; import DialogContainer from "../dialog/dialog-container";
@@ -127,7 +127,7 @@ export const Expiring = () => {
paddingTop: 0, paddingTop: 0,
paddingBottom: 20 paddingBottom: 20
}} }}
size={SIZE.md + 2} size={AppFontSize.md + 2}
> >
Upgrade now to continue using all the pro features after Upgrade now to continue using all the pro features after
your trial ends your trial ends
@@ -143,7 +143,7 @@ export const Expiring = () => {
await sleep(300); await sleep(300);
eSendEvent(eOpenPremiumDialog, promo); eSendEvent(eOpenPremiumDialog, promo);
}} }}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
textDecorationLine: "underline", textDecorationLine: "underline",
color: colors.secondary.paragraph, color: colors.secondary.paragraph,
@@ -176,7 +176,7 @@ export const Expiring = () => {
promo?.discount > 30 ? null : promo promo?.discount > 30 ? null : promo
); );
}} }}
fontSize={SIZE.md + 2} fontSize={AppFontSize.md + 2}
style={{ style={{
marginBottom: status.extend ? 0 : 10, marginBottom: status.extend ? 0 : 10,
marginTop: 10, marginTop: 10,
@@ -201,7 +201,7 @@ export const Expiring = () => {
button: "Continue" button: "Continue"
}); });
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
height={30} height={30}
style={{ style={{
marginBottom: 10 marginBottom: 10

View File

@@ -21,7 +21,7 @@ import React from "react";
import { Text, View } from "react-native"; import { Text, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../utils/size";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { ProTag } from "./pro-tag"; import { ProTag } from "./pro-tag";
@@ -53,7 +53,7 @@ export const FeatureBlock = ({
marginLeft: 5, marginLeft: 5,
flexShrink: 1 flexShrink: 1
}} }}
size={SIZE.sm} size={AppFontSize.sm}
> >
{content} {content}
</Paragraph> </Paragraph>
@@ -65,12 +65,12 @@ export const FeatureBlock = ({
justifyContent: "center", justifyContent: "center",
padding: 10, padding: 10,
marginRight: 10, marginRight: 10,
borderRadius: 5, borderRadius: defaultBorderRadius,
minWidth: 100 minWidth: 100
}} }}
> >
<Icon color={colors.primary.icon} name={icon} size={SIZE.xl} /> <Icon color={colors.primary.icon} name={icon} size={AppFontSize.xl} />
<Paragraph size={SIZE.md}> <Paragraph size={AppFontSize.md}>
<Text style={{ color: colors.primary.accent }}>{highlight}</Text> <Text style={{ color: colors.primary.accent }}>{highlight}</Text>
{content ? "\n" + content : null} {content ? "\n" + content : null}
</Paragraph> </Paragraph>
@@ -78,7 +78,7 @@ export const FeatureBlock = ({
{pro ? ( {pro ? (
<> <>
<View style={{ height: 5 }} /> <View style={{ height: 5 }} />
<ProTag width={50} size={SIZE.xs} background={proTagBg} /> <ProTag width={50} size={AppFontSize.xs} background={proTagBg} />
</> </>
) : ( ) : (
<View <View

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { ScrollView, View } from "react-native"; import { ScrollView, View } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { FeatureBlock } from "./feature"; import { FeatureBlock } from "./feature";
@@ -33,18 +33,25 @@ export const Group = ({ item, index }) => {
<View <View
style={{ style={{
paddingHorizontal: 12, paddingHorizontal: 12,
backgroundColor: index % 2 !== 0 ? colors.primary.background : colors.secondary.background, backgroundColor:
index % 2 !== 0
? colors.primary.background
: colors.secondary.background,
paddingVertical: 40 paddingVertical: 40
}} }}
> >
{item?.pro ? ( {item?.pro ? (
<ProTag <ProTag
size={SIZE.sm} size={AppFontSize.sm}
background={index % 2 === 0 ? colors.primary.background : colors.secondary.background} background={
index % 2 === 0
? colors.primary.background
: colors.secondary.background
}
/> />
) : null} ) : null}
<Heading>{item.title}</Heading> <Heading>{item.title}</Heading>
<Paragraph size={SIZE.md}>{item.detail}</Paragraph> <Paragraph size={AppFontSize.md}>{item.detail}</Paragraph>
{item.features && ( {item.features && (
<ScrollView <ScrollView
@@ -60,7 +67,11 @@ export const Group = ({ item, index }) => {
{...item} {...item}
detail={item.detail} detail={item.detail}
pro={item.pro} pro={item.pro}
proTagBg={index % 2 === 0 ? colors.primary.background : colors.secondary.background} proTagBg={
index % 2 === 0
? colors.primary.background
: colors.secondary.background
}
/> />
))} ))}
</ScrollView> </ScrollView>
@@ -70,7 +81,7 @@ export const Group = ({ item, index }) => {
style={{ style={{
marginTop: 10 marginTop: 10
}} }}
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
{item.info} {item.info}

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { Text } from "react-native"; import { Text } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
export const Offer = ({ export const Offer = ({
@@ -36,7 +36,7 @@ export const Offer = ({
textAlign: "center", textAlign: "center",
paddingVertical: padding paddingVertical: padding
}} }}
size={SIZE.xxxl} size={AppFontSize.xxxl}
> >
GET {off} GET {off}
<Text style={{ color: colors.primary.accent }}>%</Text> OFF!{"\n"} <Text style={{ color: colors.primary.accent }}>%</Text> OFF!{"\n"}

View File

@@ -35,7 +35,7 @@ import {
eOpenPremiumDialog, eOpenPremiumDialog,
eShowGetPremium eShowGetPremium
} from "../../utils/events"; } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
@@ -120,7 +120,7 @@ export const PremiumToast = ({ context = "global", offset = 0 }) => {
flexWrap: "wrap" flexWrap: "wrap"
}} }}
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.md} size={AppFontSize.md}
> >
{msg.title} {msg.title}
</Heading> </Heading>
@@ -129,7 +129,7 @@ export const PremiumToast = ({ context = "global", offset = 0 }) => {
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
}} }}
size={SIZE.sm} size={AppFontSize.sm}
color={colors.primary.paragraph} color={colors.primary.paragraph}
> >
{msg.desc} {msg.desc}

View File

@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { Platform, View } from "react-native"; import { Platform, View } from "react-native";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
@@ -59,13 +59,13 @@ export const PricingItem = ({
> >
{!compact && ( {!compact && (
<View> <View>
<Heading size={SIZE.lg - 2}> <Heading size={AppFontSize.lg - 2}>
{product?.type === "yearly" || product?.offerType === "yearly" {product?.type === "yearly" || product?.offerType === "yearly"
? "Yearly" ? "Yearly"
: "Monthly"} : "Monthly"}
</Heading> </Heading>
{product?.info && ( {product?.info && (
<Paragraph size={SIZE.xs}>{product.info}</Paragraph> <Paragraph size={AppFontSize.xs}>{product.info}</Paragraph>
)} )}
</View> </View>
)} )}
@@ -75,13 +75,13 @@ export const PricingItem = ({
style={{ style={{
textDecorationLine: strikethrough ? "line-through" : undefined textDecorationLine: strikethrough ? "line-through" : undefined
}} }}
size={SIZE.sm} size={AppFontSize.sm}
> >
<Heading <Heading
style={{ style={{
textDecorationLine: strikethrough ? "line-through" : undefined textDecorationLine: strikethrough ? "line-through" : undefined
}} }}
size={SIZE.lg - 2} size={AppFontSize.lg - 2}
> >
{Platform.OS === "android" {Platform.OS === "android"
? (product.data as RNIap.SubscriptionAndroid | undefined) ? (product.data as RNIap.SubscriptionAndroid | undefined)

View File

@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
import { ActivityIndicator, Platform, Text, View } from "react-native"; import { ActivityIndicator, Platform, Text, View } from "react-native";
import * as RNIap from "react-native-iap"; import * as RNIap from "react-native-iap";
@@ -27,18 +29,19 @@ import {
presentSheet, presentSheet,
ToastManager ToastManager
} from "../../services/event-manager"; } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import PremiumService from "../../services/premium"; import PremiumService from "../../services/premium";
import { useThemeColors } from "@notesnook/theme"; import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { import {
eClosePremiumDialog, eClosePremiumDialog,
eCloseSheet, eCloseSheet,
eCloseSimpleDialog, eCloseSimpleDialog
eOpenLoginDialog
} from "../../utils/events"; } from "../../utils/events";
import { openLinkInBrowser } from "../../utils/functions"; import { openLinkInBrowser } from "../../utils/functions";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { AuthMode } from "../auth/common";
import { Dialog } from "../dialog"; import { Dialog } from "../dialog";
import BaseDialog from "../dialog/base-dialog"; import BaseDialog from "../dialog/base-dialog";
import { presentDialog } from "../dialog/functions"; import { presentDialog } from "../dialog/functions";
@@ -47,8 +50,6 @@ import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { Walkthrough } from "../walkthroughs"; import { Walkthrough } from "../walkthroughs";
import { PricingItem } from "./pricing-item"; import { PricingItem } from "./pricing-item";
import { useSettingStore } from "../../stores/use-setting-store";
import { strings } from "@notesnook/intl";
const UUID_PREFIX = "0bdaea"; const UUID_PREFIX = "0bdaea";
const UUID_VERSION = "4"; const UUID_VERSION = "4";
@@ -290,7 +291,7 @@ export const PricingPlans = ({
style={{ style={{
alignSelf: "center" alignSelf: "center"
}} }}
size={SIZE.lg} size={AppFontSize.lg}
> >
{(Platform.OS === "android" {(Platform.OS === "android"
? (monthlyPlan?.product as RNIap.SubscriptionAndroid | undefined) ? (monthlyPlan?.product as RNIap.SubscriptionAndroid | undefined)
@@ -373,7 +374,7 @@ export const PricingPlans = ({
<Heading <Heading
style={{ style={{
paddingTop: 15, paddingTop: 15,
fontSize: SIZE.lg fontSize: AppFontSize.lg
}} }}
> >
Special offer for you Special offer for you
@@ -390,7 +391,7 @@ export const PricingPlans = ({
alignSelf: "center", alignSelf: "center",
textAlign: "center" textAlign: "center"
}} }}
size={SIZE.xxl} size={AppFontSize.xxl}
> >
{Platform.OS === "android" {Platform.OS === "android"
? (product.data as RNIap.SubscriptionAndroid) ? (product.data as RNIap.SubscriptionAndroid)
@@ -411,7 +412,7 @@ export const PricingPlans = ({
alignSelf: "center", alignSelf: "center",
textAlign: "center" textAlign: "center"
}} }}
size={SIZE.md} size={AppFontSize.md}
> >
then {getStandardPrice()} {product?.offerType}. then {getStandardPrice()} {product?.offerType}.
</Paragraph> </Paragraph>
@@ -557,9 +558,9 @@ export const PricingPlans = ({
onPress={() => { onPress={() => {
eSendEvent(eClosePremiumDialog); eSendEvent(eClosePremiumDialog);
eSendEvent(eCloseSheet); eSendEvent(eCloseSheet);
setTimeout(() => { Navigation.navigate("Auth", {
eSendEvent(eOpenLoginDialog, 1); mode: AuthMode.login
}, 400); });
}} }}
title={"Sign up for free"} title={"Sign up for free"}
type="accent" type="accent"
@@ -574,7 +575,7 @@ export const PricingPlans = ({
promo && promo &&
!promo.promoCode.startsWith("com.streetwriters.notesnook") ? ( !promo.promoCode.startsWith("com.streetwriters.notesnook") ? (
<Paragraph <Paragraph
size={SIZE.md} size={AppFontSize.md}
textBreakStrategy="balanced" textBreakStrategy="balanced"
style={{ style={{
alignSelf: "center", alignSelf: "center",
@@ -629,7 +630,7 @@ export const PricingPlans = ({
{!user || !upgrade ? ( {!user || !upgrade ? (
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
alignSelf: "center", alignSelf: "center",
textAlign: "center", textAlign: "center",
@@ -640,7 +641,7 @@ export const PricingPlans = ({
{user {user
? 'On clicking "Try free for 14 days", your free trial will be activated.' ? '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."}{" "} : "After sign up you will be asked to activate your free trial."}{" "}
<Paragraph size={SIZE.xs} style={{ fontWeight: "bold" }}> <Paragraph size={AppFontSize.xs} style={{ fontWeight: "bold" }}>
No credit card is required. No credit card is required.
</Paragraph> </Paragraph>
</Paragraph> </Paragraph>
@@ -651,7 +652,7 @@ export const PricingPlans = ({
{Platform.OS === "ios" ? ( {Platform.OS === "ios" ? (
<Paragraph <Paragraph
textBreakStrategy="balanced" textBreakStrategy="balanced"
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ style={{
alignSelf: "center", alignSelf: "center",
@@ -665,7 +666,7 @@ export const PricingPlans = ({
</Paragraph> </Paragraph>
) : ( ) : (
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ style={{
alignSelf: "center", alignSelf: "center",
@@ -685,7 +686,7 @@ export const PricingPlans = ({
}} }}
> >
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
style={{ style={{
maxWidth: "100%", maxWidth: "100%",
@@ -694,7 +695,7 @@ export const PricingPlans = ({
> >
By subscribing, you agree to our{" "} By subscribing, you agree to our{" "}
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
onPress={() => { onPress={() => {
openLinkInBrowser("https://notesnook.com/tos") openLinkInBrowser("https://notesnook.com/tos")
.catch(() => {}) .catch(() => {})
@@ -709,7 +710,7 @@ export const PricingPlans = ({
</Paragraph> </Paragraph>
and{" "} and{" "}
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
onPress={() => { onPress={() => {
openLinkInBrowser("https://notesnook.com/privacy") openLinkInBrowser("https://notesnook.com/privacy")
.catch(() => {}) .catch(() => {})

View File

@@ -31,7 +31,7 @@ import { useMenuStore } from "../../stores/use-menu-store";
import { useRelationStore } from "../../stores/use-relation-store"; import { useRelationStore } from "../../stores/use-relation-store";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { refreshNotesPage } from "../../utils/events"; import { refreshNotesPage } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import ColorPicker from "../dialogs/color-picker"; import ColorPicker from "../dialogs/color-picker";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import NativeTooltip from "../../utils/tooltip"; import NativeTooltip from "../../utils/tooltip";
@@ -85,7 +85,12 @@ const ColorItem = ({ item, note }: { item: Color; note: Note }) => {
}} }}
> >
{isLinked ? ( {isLinked ? (
<Icon testID="icon-check" name="check" color="white" size={SIZE.lg} /> <Icon
testID="icon-check"
name="check"
color="white"
size={AppFontSize.lg}
/>
) : null} ) : null}
</Pressable> </Pressable>
); );
@@ -151,7 +156,7 @@ export const ColorTags = ({ item }: { item: Note }) => {
icon="plus" icon="plus"
iconPosition="right" iconPosition="right"
height={30} height={30}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ style={{
marginRight: 5, marginRight: 5,
borderRadius: 100, borderRadius: 100,
@@ -178,7 +183,7 @@ export const ColorTags = ({ item }: { item: Note }) => {
testID="icon-plus" testID="icon-plus"
name="plus" name="plus"
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
/> />
</Pressable> </Pressable>
) )

View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react"; import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { getFormattedDate } from "@notesnook/common"; import { getFormattedDate } from "@notesnook/common";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
@@ -47,10 +47,10 @@ export const DateMeta = ({ item }) => {
paddingVertical: 3 paddingVertical: 3
}} }}
> >
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{strings.dateDescFromKey(key)} {strings.dateDescFromKey(key)}
</Paragraph> </Paragraph>
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{getFormattedDate(item[key], "date-time")} {getFormattedDate(item[key], "date-time")}
</Paragraph> </Paragraph>
</View> </View>

View File

@@ -27,7 +27,7 @@ import { eSendEvent, presentSheet } from "../../services/event-manager";
import { ColorValues } from "../../utils/colors"; import { ColorValues } from "../../utils/colors";
import { eOnLoadNote } from "../../utils/events"; import { eOnLoadNote } from "../../utils/events";
import { fluidTabsRef } from "../../utils/global-refs"; import { fluidTabsRef } from "../../utils/global-refs";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import SheetProvider from "../sheet-provider"; import SheetProvider from "../sheet-provider";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
@@ -39,6 +39,7 @@ import { Items } from "./items";
import Notebooks from "./notebooks"; import Notebooks from "./notebooks";
import { TagStrip, Tags } from "./tags"; import { TagStrip, Tags } from "./tags";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { DefaultAppStyles } from "../../utils/styles";
const Line = ({ top = 6, bottom = 6 }) => { const Line = ({ top = 6, bottom = 6 }) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
@@ -81,13 +82,14 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
data={[0]} data={[0]}
keyExtractor={() => "properties-scroll-item"} keyExtractor={() => "properties-scroll-item"}
renderItem={() => ( renderItem={() => (
<View> <View
style={{
gap: DefaultAppStyles.GAP_VERTICAL
}}
>
<View <View
style={{ style={{
paddingHorizontal: 12, paddingHorizontal: DefaultAppStyles.GAP
marginTop: 5,
zIndex: 10,
marginBottom: 5
}} }}
> >
<View <View
@@ -119,12 +121,12 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
) : item.type === "tag" ? ( ) : item.type === "tag" ? (
<Icon <Icon
name="pound" name="pound"
size={SIZE.lg} size={AppFontSize.lg}
color={colors.primary.icon} color={colors.primary.icon}
/> />
) : null} ) : null}
<Heading size={SIZE.lg}>{item.title}</Heading> <Heading size={AppFontSize.lg}>{item.title}</Heading>
</View> </View>
{item.type === "note" ? ( {item.type === "note" ? (
@@ -132,7 +134,7 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
name="open-in-new" name="open-in-new"
type="plain" type="plain"
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
style={{ style={{
alignSelf: "flex-start" alignSelf: "flex-start"
}} }}
@@ -169,7 +171,7 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
backgroundColor: "transparent", backgroundColor: "transparent",
paddingHorizontal: 0 paddingHorizontal: 0
}} }}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
/> />
) : null} ) : null}
</View> </View>
@@ -184,15 +186,8 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
</> </>
) : null} ) : null}
{item.type === "note" ? ( {item.type === "note" ? (
<View <Notebooks note={item} close={close} />
style={{
paddingHorizontal: 12
}}
>
<Notebooks note={item} close={close} />
</View>
) : null} ) : null}
<Items <Items
item={item} item={item}
buttons={buttons} buttons={buttons}

View File

@@ -20,13 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Item } from "@notesnook/core"; import { Item } from "@notesnook/core";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { Dimensions, ScrollView, View } from "react-native"; import { Dimensions, View } from "react-native";
import SwiperFlatList from "react-native-swiper-flatlist";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { Action, ActionId, useActions } from "../../hooks/use-actions"; import { Action, ActionId, useActions } from "../../hooks/use-actions";
import { useStoredRef } from "../../hooks/use-stored-ref"; import { useStoredRef } from "../../hooks/use-stored-ref";
import { DDS } from "../../services/device-detection"; import { DDS } from "../../services/device-detection";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
@@ -66,6 +67,9 @@ const COLUMN_BAR_ITEMS: ActionId[] = [
"pin", "pin",
"default-notebook", "default-notebook",
"add-shortcut", "add-shortcut",
"reorder",
"rename-color",
"rename-tag",
"trash" "trash"
]; ];
@@ -89,8 +93,8 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
const columnItemWidth = const columnItemWidth =
deviceMode !== "mobile" deviceMode !== "mobile"
? (width - 16) / columnItemsCount ? (width - DefaultAppStyles.GAP) / columnItemsCount
: (width - 16) / columnItemsCount; : (width - DefaultAppStyles.GAP) / columnItemsCount;
const topBarItems = selectedActions const topBarItems = selectedActions
.filter((item) => TOP_BAR_ITEMS.indexOf(item.id) > -1) .filter((item) => TOP_BAR_ITEMS.indexOf(item.id) > -1)
@@ -134,7 +138,7 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
onPress={item.onPress} onPress={item.onPress}
type={item.checked ? "shade" : "secondary"} type={item.checked ? "shade" : "secondary"}
style={{ style={{
height: columnItemWidth - 8, height: columnItemWidth / 1.5,
width: columnItemWidth - 8, width: columnItemWidth - 8,
borderRadius: 10, borderRadius: 10,
justifyContent: "center", justifyContent: "center",
@@ -145,7 +149,13 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
<Icon <Icon
allowFontScaling allowFontScaling
name={item.icon} name={item.icon}
size={DDS.isTab ? SIZE.xxl : shouldShrink ? SIZE.xxl : SIZE.lg} size={
DDS.isTab
? AppFontSize.xxl
: shouldShrink
? AppFontSize.xxl
: AppFontSize.lg
}
color={ color={
item.checked item.checked
? item.activeColor || colors.primary.accent ? item.activeColor || colors.primary.accent
@@ -157,7 +167,7 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
</Pressable> </Pressable>
<Paragraph <Paragraph
size={SIZE.xxs} size={AppFontSize.xxs}
textBreakStrategy="simple" textBreakStrategy="simple"
style={{ textAlign: "center" }} style={{ textAlign: "center" }}
> >
@@ -189,7 +199,7 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
title={item.title} title={item.title}
icon={item.icon} icon={item.icon}
type={item.checked ? "inverted" : "plain"} type={item.checked ? "inverted" : "plain"}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
style={{ style={{
borderRadius: 0, borderRadius: 0,
justifyContent: "flex-start", justifyContent: "flex-start",
@@ -218,24 +228,21 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
key={item.id} key={item.id}
testID={"icon-" + item.id} testID={"icon-" + item.id}
style={{ style={{
alignSelf: "flex-start", width: columnItemWidth - 8
paddingHorizontal: 0,
flex: 1
}} }}
> >
<View <View
style={{ style={{
height: topBarItemHeight, height: columnItemWidth / 2,
width: columnItemWidth - DefaultAppStyles.GAP_SMALL,
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center"
marginBottom: DDS.isTab ? 7 : 3.5,
borderRadius: 100
}} }}
> >
<Icon <Icon
name={item.icon} name={item.icon}
allowFontScaling allowFontScaling
size={DDS.isTab ? SIZE.xxl : SIZE.md + 4} size={DDS.isTab ? AppFontSize.xxl : AppFontSize.md + 4}
color={ color={
item.checked item.checked
? item.activeColor || colors.primary.accent ? item.activeColor || colors.primary.accent
@@ -248,7 +255,7 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
<Paragraph <Paragraph
textBreakStrategy="simple" textBreakStrategy="simple"
size={SIZE.xxs} size={AppFontSize.xxs}
style={{ textAlign: "center" }} style={{ textAlign: "center" }}
> >
{item.title} {item.title}
@@ -260,42 +267,79 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
colors.error.icon, colors.error.icon,
colors.primary.accent, colors.primary.accent,
colors.secondary.icon, colors.secondary.icon,
topBarItemHeight, columnItemWidth,
topBarSorting topBarSorting
] ]
); );
return item.type === "note" ? ( const getTopBarItemChunksOfFour = () => {
<> const chunks = [];
<ScrollView for (let i = 0; i < topBarItems.length; i += 5) {
horizontal chunks.push(topBarItems.slice(i, i + 5));
style={{ }
paddingHorizontal: 16, return chunks;
marginTop: 6, };
marginBottom: 6
}}
showsHorizontalScrollIndicator={false}
contentContainerStyle={{
paddingRight: 25,
gap: 15
}}
>
{topBarItems.map(renderTopBarItem)}
</ScrollView>
<View return (
style={{ <View
flexDirection: "row", style={{
flexWrap: "wrap", gap: DefaultAppStyles.GAP
marginTop: 10, }}
gap: 5, >
paddingHorizontal: DefaultAppStyles.GAP {item.type === "note" ? (
}} <>
> <View>
{bottomGridItems.map((item) => renderRowItem({ item }))} <SwiperFlatList
</View> data={getTopBarItemChunksOfFour()}
</> autoplay={false}
) : ( showPagination
<View>{columnItems.map(renderColumnItem)}</View> paginationStyleItemActive={{
borderRadius: 2,
backgroundColor: colors.selected.background,
height: 6,
marginHorizontal: 2
}}
paginationStyleItemInactive={{
borderRadius: 2,
backgroundColor: colors.secondary.background,
height: 6,
marginHorizontal: 2
}}
paginationStyle={{
position: "relative",
marginHorizontal: 2,
marginBottom: 0,
marginTop: DefaultAppStyles.GAP
}}
renderItem={({ item, index }) => (
<View
style={{
flexDirection: "row",
paddingHorizontal: DefaultAppStyles.GAP,
gap: 5,
width: width
}}
>
{item.map(renderTopBarItem)}
</View>
)}
/>
</View>
<View
style={{
flexDirection: "row",
flexWrap: "wrap",
gap: 5,
paddingHorizontal: DefaultAppStyles.GAP
}}
>
{bottomGridItems.map((item) => renderRowItem({ item }))}
</View>
</>
) : (
<View>{columnItems.map(renderColumnItem)}</View>
)}
</View>
); );
}; };

View File

@@ -25,7 +25,7 @@ import { db } from "../../common/database";
import NotebookScreen from "../../screens/notebook"; import NotebookScreen from "../../screens/notebook";
import { eSendEvent, presentSheet } from "../../services/event-manager"; import { eSendEvent, presentSheet } from "../../services/event-manager";
import { eClearEditor } from "../../utils/events"; import { eClearEditor } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
@@ -72,7 +72,7 @@ export default function Notebooks({ note, close, full }) {
<Icon <Icon
name="book-outline" name="book-outline"
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.sm} size={AppFontSize.sm}
style={{ style={{
marginRight: 5 marginRight: 5
}} }}
@@ -82,7 +82,7 @@ export default function Notebooks({ note, close, full }) {
style={{ style={{
maxWidth: "50%" maxWidth: "50%"
}} }}
size={SIZE.sm} size={AppFontSize.sm}
> >
{item.title} {item.title}
</Heading> </Heading>
@@ -92,40 +92,46 @@ export default function Notebooks({ note, close, full }) {
return noteNotebooks.length === 0 ? null : ( return noteNotebooks.length === 0 ? null : (
<View <View
style={{ style={{
width: "100%", paddingHorizontal: 12
borderRadius: 10,
marginTop: 6
}} }}
> >
{full <View
? noteNotebooks.map(renderItem) style={{
: noteNotebooks.slice(0, 1).map(renderItem)} width: "100%",
borderRadius: 10,
marginTop: 6
}}
>
{full
? noteNotebooks.map(renderItem)
: noteNotebooks.slice(0, 1).map(renderItem)}
{noteNotebooks.length > 1 && !full ? ( {noteNotebooks.length > 1 && !full ? (
<Button <Button
title={strings.viewAllLinkedNotebooks()} title={strings.viewAllLinkedNotebooks()}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ style={{
alignSelf: "flex-end", alignSelf: "flex-end",
marginRight: 12, marginRight: 12,
paddingHorizontal: 0, paddingHorizontal: 0,
backgroundColor: "transparent" backgroundColor: "transparent"
}} }}
type="plain" type="plain"
textStyle={{ textStyle={{
textDecorationLine: "underline" textDecorationLine: "underline"
}} }}
height={20} height={20}
onPress={() => { onPress={() => {
presentSheet({ presentSheet({
context: "properties", context: "properties",
component: (ref, close) => ( component: (ref, close) => (
<Notebooks note={note} close={close} full={true} /> <Notebooks note={note} close={close} full={true} />
) )
}); });
}} }}
/> />
) : undefined} ) : undefined}
</View>
</View> </View>
); );
} }

View File

@@ -21,7 +21,7 @@ import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { useUserStore } from "../../stores/use-user-store"; import { useUserStore } from "../../stores/use-user-store";
import { openLinkInBrowser } from "../../utils/functions"; import { openLinkInBrowser } from "../../utils/functions";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
@@ -40,8 +40,8 @@ export const Synced = ({ item, close }) => {
padding: DefaultAppStyles.GAP_VERTICAL_SMALL, padding: DefaultAppStyles.GAP_VERTICAL_SMALL,
paddingHorizontal: DefaultAppStyles.GAP_SMALL paddingHorizontal: DefaultAppStyles.GAP_SMALL
}} }}
fontSize={SIZE.xxxs} fontSize={AppFontSize.xxxs}
iconSize={SIZE.xs} iconSize={AppFontSize.xs}
icon="shield-key-outline" icon="shield-key-outline"
type="shade" type="shade"
title="Encrypted and synced" title="Encrypted and synced"

View File

@@ -22,7 +22,7 @@ import { View } from "react-native";
import { db } from "../../common/database"; import { db } from "../../common/database";
import { TaggedNotes } from "../../screens/notes/tagged"; import { TaggedNotes } from "../../screens/notes/tagged";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import ManageTagsSheet from "../sheets/manage-tags"; import ManageTagsSheet from "../sheets/manage-tags";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
@@ -57,7 +57,7 @@ export const Tags = ({ item, close }) => {
icon="plus" icon="plus"
iconPosition="right" iconPosition="right"
height={30} height={30}
fontSize={SIZE.sm - 1} fontSize={AppFontSize.sm - 1}
style={{ style={{
height: 35, height: 35,
borderRadius: 100 borderRadius: 100
@@ -117,7 +117,7 @@ const TagItem = ({ tag, close }) => {
title={"#" + tag.title} title={"#" + tag.title}
type="plain" type="plain"
height={20} height={20}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={style} style={style}
textStyle={{ textStyle={{
color: colors.secondary.paragraph color: colors.secondary.paragraph

View File

@@ -37,7 +37,7 @@ import { useSelectionStore } from "../../stores/use-selection-store";
import { deleteItems } from "../../utils/functions"; import { deleteItems } from "../../utils/functions";
import { fluidTabsRef } from "../../utils/global-refs"; import { fluidTabsRef } from "../../utils/global-refs";
import { updateNotebook } from "../../utils/notebooks"; import { updateNotebook } from "../../utils/notebooks";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { presentDialog } from "../dialog/functions"; import { presentDialog } from "../dialog/functions";
@@ -164,7 +164,7 @@ export const SelectionHeader = React.memo(
.getState() .getState()
.setAll(allSelected ? [] : [...((await items?.ids()) || [])]); .setAll(allSelected ? [] : [...((await items?.ids()) || [])]);
}} }}
size={SIZE.lg} size={AppFontSize.lg}
color={allSelected ? colors.primary.accent : colors.primary.icon} color={allSelected ? colors.primary.accent : colors.primary.icon}
name="select-all" name="select-all"
/> />
@@ -276,7 +276,7 @@ export const SelectionHeader = React.memo(
].map((item) => ].map((item) =>
!item.visible ? null : ( !item.visible ? null : (
<IconButton <IconButton
size={SIZE.lg} size={AppFontSize.lg}
type="plain" type="plain"
name={item.icon} name={item.icon}
key={item.title} key={item.title}
@@ -293,7 +293,7 @@ export const SelectionHeader = React.memo(
</View> </View>
<IconButton <IconButton
size={SIZE.lg} size={AppFontSize.lg}
onPress={() => { onPress={() => {
clearSelection(); clearSelection();
}} }}

View File

@@ -27,7 +27,7 @@ import {
} from "../../services/event-manager"; } from "../../services/event-manager";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { eCloseSheet, eOpenSheet } from "../../utils/events"; import { eCloseSheet, eOpenSheet } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { sleep } from "../../utils/time"; import { sleep } from "../../utils/time";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import SheetWrapper from "../ui/sheet"; import SheetWrapper from "../ui/sheet";
@@ -180,7 +180,7 @@ const SheetProvider = ({ context = "global" }) => {
type="plain" type="plain"
key={v} key={v}
textStyle={{ fontWeight: "normal" }} textStyle={{ fontWeight: "normal" }}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
icon="check" icon="check"
width="100%" width="100%"
style={{ style={{
@@ -223,7 +223,7 @@ const SheetProvider = ({ context = "global" }) => {
marginBottom: 10 marginBottom: 10
}} }}
width="100%" width="100%"
fontSize={SIZE.md} fontSize={AppFontSize.md}
/> />
))} ))}
@@ -234,14 +234,14 @@ const SheetProvider = ({ context = "global" }) => {
marginTop: 10, marginTop: 10,
textDecorationLine: "underline" textDecorationLine: "underline"
}} }}
size={SIZE.xs} size={AppFontSize.xs}
onPress={data.learnMorePress} onPress={data.learnMorePress}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
> >
<Icon <Icon
color={colors.primary.icon} color={colors.primary.icon}
name="information-outline" name="information-outline"
size={SIZE.xs} size={AppFontSize.xs}
/>{" "} />{" "}
{data.learnMore} {data.learnMore}
</Paragraph> </Paragraph>

View File

@@ -35,7 +35,7 @@ import { useNotebookStore } from "../../../stores/use-notebook-store";
import { useRelationStore } from "../../../stores/use-relation-store"; import { useRelationStore } from "../../../stores/use-relation-store";
import { eOnNotebookUpdated } from "../../../utils/events"; import { eOnNotebookUpdated } from "../../../utils/events";
import { getParentNotebookId } from "../../../utils/notebooks"; import { getParentNotebookId } from "../../../utils/notebooks";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Input from "../../ui/input"; import Input from "../../ui/input";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
@@ -118,7 +118,7 @@ export const AddNotebookSheet = ({
paddingHorizontal: 12 paddingHorizontal: 12
}} }}
> >
<Heading size={SIZE.lg}> <Heading size={AppFontSize.lg}>
{notebook ? strings.editNotebook() : strings.newNotebook()} {notebook ? strings.editNotebook() : strings.newNotebook()}
</Heading> </Heading>
@@ -160,7 +160,7 @@ export const AddNotebookSheet = ({
title={notebook ? strings.save() : strings.add()} title={notebook ? strings.save() : strings.add()}
type="accent" type="accent"
height={45} height={45}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
paddingHorizontal: 24, paddingHorizontal: 24,
width: "100%" width: "100%"

View File

@@ -44,7 +44,7 @@ import { useRelationStore } from "../../../stores/use-relation-store";
import { useSelectionStore } from "../../../stores/use-selection-store"; import { useSelectionStore } from "../../../stores/use-selection-store";
import { useSettingStore } from "../../../stores/use-setting-store"; import { useSettingStore } from "../../../stores/use-setting-store";
import { updateNotebook } from "../../../utils/notebooks"; import { updateNotebook } from "../../../utils/notebooks";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import SheetProvider from "../../sheet-provider"; import SheetProvider from "../../sheet-provider";
@@ -314,7 +314,7 @@ const MoveNoteSheet = ({
> >
{loading ? ( {loading ? (
<ActivityIndicator <ActivityIndicator
size={SIZE.lg} size={AppFontSize.lg}
color={colors.primary.accent} color={colors.primary.accent}
/> />
) : ( ) : (

View File

@@ -24,7 +24,7 @@ import { notesnook } from "../../../../e2e/test.ids";
import { useTotalNotes } from "../../../hooks/use-db-item"; import { useTotalNotes } from "../../../hooks/use-db-item";
import { useNotebook } from "../../../hooks/use-notebook"; import { useNotebook } from "../../../hooks/use-notebook";
import useNavigationStore from "../../../stores/use-navigation-store"; import useNavigationStore from "../../../stores/use-navigation-store";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
@@ -147,7 +147,7 @@ export const NotebookItem = ({
> >
{nestedNotebooks?.placeholders.length ? ( {nestedNotebooks?.placeholders.length ? (
<IconButton <IconButton
size={SIZE.xl} size={AppFontSize.xl}
color={isSelected ? colors.selected.icon : colors.primary.icon} color={isSelected ? colors.selected.icon : colors.primary.icon}
onPress={() => { onPress={() => {
if (!item?.id) return; if (!item?.id) return;
@@ -166,7 +166,7 @@ export const NotebookItem = ({
) : null} ) : null}
<IconButton <IconButton
size={SIZE.xl} size={AppFontSize.xl}
color={ color={
isSelected isSelected
? colors.selected.icon ? colors.selected.icon
@@ -198,7 +198,7 @@ export const NotebookItem = ({
color={ color={
isFocused ? colors.selected.paragraph : colors.secondary.paragraph isFocused ? colors.selected.paragraph : colors.secondary.paragraph
} }
size={SIZE.sm} size={AppFontSize.sm}
> >
{item?.title} {item?.title}
</Paragraph> </Paragraph>
@@ -212,7 +212,7 @@ export const NotebookItem = ({
}} }}
> >
{item?.id && totalNotes?.(item?.id) ? ( {item?.id && totalNotes?.(item?.id) ? (
<Paragraph size={SIZE.sm} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.sm} color={colors.secondary.paragraph}>
{totalNotes(item?.id)} {totalNotes(item?.id)}
</Paragraph> </Paragraph>
) : null} ) : null}
@@ -238,7 +238,7 @@ export const NotebookItem = ({
bottom={0} bottom={0}
top={0} top={0}
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.xl} size={AppFontSize.xl}
/> />
</View> </View>
</Pressable> </Pressable>

View File

@@ -32,7 +32,7 @@ import {
import { editorController } from "../../../screens/editor/tiptap/utils"; import { editorController } from "../../../screens/editor/tiptap/utils";
import { eSendEvent, presentSheet } from "../../../services/event-manager"; import { eSendEvent, presentSheet } from "../../../services/event-manager";
import { eUnlockNote } from "../../../utils/events"; import { eUnlockNote } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -101,15 +101,15 @@ const TabItemComponent = (props: {
{props.tab.session?.noteLocked ? ( {props.tab.session?.noteLocked ? (
<> <>
{props.tab.session?.locked ? ( {props.tab.session?.locked ? (
<Icon size={SIZE.md} name="lock" /> <Icon size={AppFontSize.md} name="lock" />
) : ( ) : (
<Icon size={SIZE.md} name="lock-open-outline" /> <Icon size={AppFontSize.md} name="lock-open-outline" />
)} )}
</> </>
) : null} ) : null}
{props.tab.session?.readonly ? ( {props.tab.session?.readonly ? (
<Icon size={SIZE.md} name="pencil-lock" /> <Icon size={AppFontSize.md} name="pencil-lock" />
) : null} ) : null}
<Paragraph <Paragraph
@@ -119,7 +119,7 @@ const TabItemComponent = (props: {
: colors.primary.paragraph : colors.primary.paragraph
} }
numberOfLines={1} numberOfLines={1}
size={SIZE.md} size={AppFontSize.md}
> >
{props.tab.session?.noteId {props.tab.session?.noteId
? item?.title || strings.untitledNote() ? item?.title || strings.untitledNote()
@@ -136,7 +136,7 @@ const TabItemComponent = (props: {
> >
<IconButton <IconButton
name="pin" name="pin"
size={SIZE.lg} size={AppFontSize.lg}
color={props.tab.pinned ? colors.primary.accent : colors.primary.icon} color={props.tab.pinned ? colors.primary.accent : colors.primary.icon}
onPress={() => { onPress={() => {
useTabStore.getState().updateTab(props.tab.id, { useTabStore.getState().updateTab(props.tab.id, {
@@ -152,7 +152,7 @@ const TabItemComponent = (props: {
{!props.tab?.pinned ? ( {!props.tab?.pinned ? (
<IconButton <IconButton
name="close" name="close"
size={SIZE.lg} size={AppFontSize.lg}
color={colors.primary.icon} color={colors.primary.icon}
onPress={() => { onPress={() => {
const isLastTab = useTabStore.getState().tabs.length === 1; const isLastTab = useTabStore.getState().tabs.length === 1;
@@ -215,7 +215,7 @@ export default function EditorTabs({
alignItems: "center" alignItems: "center"
}} }}
> >
<Heading size={SIZE.lg}>{strings.tabs()}</Heading> <Heading size={AppFontSize.lg}>{strings.tabs()}</Heading>
<IconButton <IconButton
onPress={() => { onPress={() => {
useTabStore.getState().newTab(); useTabStore.getState().newTab();

View File

@@ -41,7 +41,7 @@ import Exporter from "../../../services/exporter";
import PremiumService from "../../../services/premium"; import PremiumService from "../../../services/premium";
import { useUserStore } from "../../../stores/use-user-store"; import { useUserStore } from "../../../stores/use-user-store";
import { getElevationStyle } from "../../../utils/elevation"; import { getElevationStyle } from "../../../utils/elevation";
import { SIZE, ph, pv } from "../../../utils/size"; import { AppFontSize, defaultBorderRadius, ph, pv } from "../../../utils/size";
import { sleep } from "../../../utils/time"; import { sleep } from "../../../utils/time";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
@@ -203,7 +203,7 @@ const ExportNotesSheet = ({
<View <View
style={{ style={{
backgroundColor: colors.primary.shade, backgroundColor: colors.primary.shade,
borderRadius: 5, borderRadius: defaultBorderRadius,
height: 60, height: 60,
width: 60, width: 60,
justifyContent: "center", justifyContent: "center",
@@ -215,7 +215,7 @@ const ExportNotesSheet = ({
color={ color={
item.pro ? colors.primary.accent : colors.primary.icon item.pro ? colors.primary.accent : colors.primary.icon
} }
size={SIZE.xxxl + 10} size={AppFontSize.xxxl + 10}
/> />
</View> </View>
<View <View
@@ -224,7 +224,7 @@ const ExportNotesSheet = ({
}} }}
> >
{!item.pro ? <ProTag size={12} /> : null} {!item.pro ? <ProTag size={12} /> : null}
<Heading style={{ marginLeft: 10 }} size={SIZE.md}> <Heading style={{ marginLeft: 10 }} size={AppFontSize.md}>
{item.title} {item.title}
</Heading> </Heading>
{/* <Paragraph {/* <Paragraph
@@ -294,7 +294,7 @@ const ExportNotesSheet = ({
} }
type="accent" type="accent"
width={250} width={250}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
marginTop: 10, marginTop: 10,
borderRadius: 100 borderRadius: 100
@@ -323,7 +323,7 @@ const ExportNotesSheet = ({
title={strings.share()} title={strings.share()}
type="secondaryAccented" type="secondaryAccented"
width={250} width={250}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
marginTop: 10, marginTop: 10,
borderRadius: 100 borderRadius: 100
@@ -351,7 +351,7 @@ const ExportNotesSheet = ({
title={strings.exportAgain()} title={strings.exportAgain()}
type="inverted" type="inverted"
width={250} width={250}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
marginTop: 10, marginTop: 10,
borderRadius: 100 borderRadius: 100
@@ -384,7 +384,7 @@ ExportNotesSheet.present = async (ids?: string[], allNotes?: boolean) => {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
...getElevationStyle(5), ...getElevationStyle(5),
borderRadius: 5, borderRadius: defaultBorderRadius,
paddingVertical: pv paddingVertical: pv
}, },
buttonContainer: { buttonContainer: {
@@ -395,7 +395,7 @@ const styles = StyleSheet.create({
paddingVertical: pv, paddingVertical: pv,
paddingHorizontal: ph, paddingHorizontal: ph,
marginTop: 10, marginTop: 10,
borderRadius: 5, borderRadius: defaultBorderRadius,
width: "100%", width: "100%",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
@@ -405,7 +405,7 @@ const styles = StyleSheet.create({
buttonText: { buttonText: {
//fontFamily: "sans-serif", //fontFamily: "sans-serif",
color: "white", color: "white",
fontSize: SIZE.sm, fontSize: AppFontSize.sm,
marginLeft: 5 marginLeft: 5
}, },
overlay: { overlay: {

View File

@@ -21,7 +21,7 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import FileViewer from "react-native-file-viewer"; import FileViewer from "react-native-file-viewer";
import { ToastManager } from "../../../services/event-manager"; import { ToastManager } from "../../../services/event-manager";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
export const ShareComponent = ({ uri, name, padding }) => { export const ShareComponent = ({ uri, name, padding }) => {
@@ -35,7 +35,7 @@ export const ShareComponent = ({ uri, name, padding }) => {
title={strings.open()} title={strings.open()}
type="accent" type="accent"
width="100%" width="100%"
fontSize={SIZE.md} fontSize={AppFontSize.md}
onPress={async () => { onPress={async () => {
FileViewer.open(uri, { FileViewer.open(uri, {
showOpenWithDialog: true, showOpenWithDialog: true,
@@ -53,7 +53,7 @@ export const ShareComponent = ({ uri, name, padding }) => {
title={strings.share()} title={strings.share()}
type="shade" type="shade"
width="100%" width="100%"
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
marginTop: 10 marginTop: 10
}} }}

View File

@@ -28,7 +28,7 @@ import { ToastManager } from "../../../services/event-manager";
import PremiumService from "../../../services/premium"; import PremiumService from "../../../services/premium";
import { useUserStore } from "../../../stores/use-user-store"; import { useUserStore } from "../../../stores/use-user-store";
import { openLinkInBrowser } from "../../../utils/functions"; import { openLinkInBrowser } from "../../../utils/functions";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
@@ -147,11 +147,11 @@ Logged in: ${user ? "yes" : "no"}`,
style={{ style={{
borderWidth: 1, borderWidth: 1,
borderColor: colors.primary.border, borderColor: colors.primary.border,
borderRadius: 5, borderRadius: defaultBorderRadius,
padding: 12, padding: 12,
fontFamily: "OpenSans-Regular", fontFamily: "OpenSans-Regular",
marginBottom: 10, marginBottom: 10,
fontSize: SIZE.md, fontSize: AppFontSize.md,
color: colors.primary.heading color: colors.primary.heading
}} }}
placeholderTextColor={colors.primary.placeholder} placeholderTextColor={colors.primary.placeholder}
@@ -180,18 +180,18 @@ Logged in: ${user ? "yes" : "no"}`,
style={{ style={{
borderWidth: 1, borderWidth: 1,
borderColor: colors.primary.border, borderColor: colors.primary.border,
borderRadius: 5, borderRadius: defaultBorderRadius,
padding: 12, padding: 12,
fontFamily: "OpenSans-Regular", fontFamily: "OpenSans-Regular",
maxHeight: 200, maxHeight: 200,
fontSize: SIZE.sm, fontSize: AppFontSize.sm,
marginBottom: 2.5, marginBottom: 2.5,
color: colors.primary.paragraph color: colors.primary.paragraph
}} }}
placeholderTextColor={colors.primary.placeholder} placeholderTextColor={colors.primary.placeholder}
/> />
<Paragraph <Paragraph
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
>{`App version: ${getVersion()} Platform: ${ >{`App version: ${getVersion()} Platform: ${
Platform.OS Platform.OS
@@ -208,7 +208,7 @@ Logged in: ${user ? "yes" : "no"}`,
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginTop: 10, marginTop: 10,
textAlign: "center" textAlign: "center"
@@ -217,7 +217,9 @@ Logged in: ${user ? "yes" : "no"}`,
{strings.issueNotice[0]()}{" "} {strings.issueNotice[0]()}{" "}
<Text <Text
onPress={() => { onPress={() => {
Linking.openURL("https://github.com/streetwriters/notesnook/issues"); Linking.openURL(
"https://github.com/streetwriters/notesnook/issues"
);
}} }}
style={{ style={{
textDecorationLine: "underline", textDecorationLine: "underline",

View File

@@ -33,7 +33,7 @@ import { db } from "../../../common/database";
import { useDBItem } from "../../../hooks/use-db-item"; import { useDBItem } from "../../../hooks/use-db-item";
import { editorController } from "../../../screens/editor/tiptap/utils"; import { editorController } from "../../../screens/editor/tiptap/utils";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Input from "../../ui/input"; import Input from "../../ui/input";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
@@ -122,7 +122,7 @@ const ListBlockItem = ({
<View <View
style={{ style={{
borderRadius: 5, borderRadius: defaultBorderRadius,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
height: 25, height: 25,
minWidth: 25, minWidth: 25,
@@ -130,7 +130,7 @@ const ListBlockItem = ({
justifyContent: "center" justifyContent: "center"
}} }}
> >
<Paragraph color={colors.secondary.paragraph} size={SIZE.xs}> <Paragraph color={colors.secondary.paragraph} size={AppFontSize.xs}>
{item.type.toUpperCase()} {item.type.toUpperCase()}
</Paragraph> </Paragraph>
</View> </View>
@@ -254,7 +254,7 @@ export default function LinkNote(props: {
gap: 10 gap: 10
}} }}
> >
<Paragraph color={colors.secondary.paragraph} size={SIZE.xs}> <Paragraph color={colors.secondary.paragraph} size={AppFontSize.xs}>
{strings.linkNoteSelectedNote()} {strings.linkNoteSelectedNote()}
</Paragraph> </Paragraph>
<Pressable <Pressable
@@ -284,7 +284,10 @@ export default function LinkNote(props: {
> >
<Paragraph numberOfLines={1}>{selectedNote?.title}</Paragraph> <Paragraph numberOfLines={1}>{selectedNote?.title}</Paragraph>
<Paragraph color={colors.secondary.paragraph} size={SIZE.xs}> <Paragraph
color={colors.secondary.paragraph}
size={AppFontSize.xs}
>
{strings.tapToDeselect()} {strings.tapToDeselect()}
</Paragraph> </Paragraph>
</View> </View>
@@ -296,7 +299,7 @@ export default function LinkNote(props: {
marginBottom: 12 marginBottom: 12
}} }}
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
> >
{strings.linkNoteToSection()} {strings.linkNoteToSection()}
</Paragraph> </Paragraph>

View File

@@ -43,7 +43,7 @@ import {
} from "../../../stores/item-selection-store"; } from "../../../stores/item-selection-store";
import { useRelationStore } from "../../../stores/use-relation-store"; import { useRelationStore } from "../../../stores/use-relation-store";
import { useTagStore } from "../../../stores/use-tag-store"; import { useTagStore } from "../../../stores/use-tag-store";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import Input from "../../ui/input"; import Input from "../../ui/input";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -250,7 +250,7 @@ const ManageTagsSheet = (props: {
button={{ button={{
icon: "magnify", icon: "magnify",
color: colors.primary.accent, color: colors.primary.accent,
size: SIZE.lg, size: AppFontSize.lg,
onPress: () => {} onPress: () => {}
}} }}
testID="tag-input" testID="tag-input"
@@ -284,10 +284,14 @@ const ManageTagsSheet = (props: {
onPress={onSubmit} onPress={onSubmit}
type="selected" type="selected"
> >
<Heading size={SIZE.sm} color={colors.selected.heading}> <Heading size={AppFontSize.sm} color={colors.selected.heading}>
{strings.add()} {'"' + "#" + query + '"'} {strings.add()} {'"' + "#" + query + '"'}
</Heading> </Heading>
<Icon name="plus" color={colors.selected.icon} size={SIZE.lg} /> <Icon
name="plus"
color={colors.selected.icon}
size={AppFontSize.lg}
/>
</Pressable> </Pressable>
) : null} ) : null}
@@ -403,13 +407,13 @@ const TagItem = ({
/> />
)} )}
{tag ? ( {tag ? (
<Paragraph size={SIZE.sm}>{"#" + tag?.title}</Paragraph> <Paragraph size={AppFontSize.sm}>{"#" + tag?.title}</Paragraph>
) : ( ) : (
<View <View
style={{ style={{
width: 200, width: 200,
height: 30, height: 30,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
/> />
)} )}

View File

@@ -35,7 +35,7 @@ import {
findRootNotebookId, findRootNotebookId,
getParentNotebookId getParentNotebookId
} from "../../../utils/notebooks"; } from "../../../utils/notebooks";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import { presentDialog } from "../../dialog/functions"; import { presentDialog } from "../../dialog/functions";
@@ -322,7 +322,7 @@ const NotebookItem = ({
false false
); );
}} }}
size={SIZE.lg} size={AppFontSize.lg}
/> />
</View> </View>
</Pressable> </Pressable>

View File

@@ -30,7 +30,7 @@ import { presentSheet } from "../../../services/event-manager";
import Navigation from "../../../services/navigation"; import Navigation from "../../../services/navigation";
import { createItemSelectionStore } from "../../../stores/item-selection-store"; import { createItemSelectionStore } from "../../../stores/item-selection-store";
import { updateNotebook } from "../../../utils/notebooks"; import { updateNotebook } from "../../../utils/notebooks";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Dialog } from "../../dialog"; import { Dialog } from "../../dialog";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
@@ -131,7 +131,7 @@ export const MoveNotes = ({
button={{ button={{
icon: "magnify", icon: "magnify",
color: colors.primary.accent, color: colors.primary.accent,
size: SIZE.lg, size: AppFontSize.lg,
onPress: () => {} onPress: () => {}
}} }}
testID="search-input" testID="search-input"
@@ -270,7 +270,7 @@ const SelectableNoteItem = React.memo(
<Paragraph <Paragraph
numberOfLines={1} numberOfLines={1}
color={colors?.secondary.paragraph} color={colors?.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
> >
{item.headline} {item.headline}
</Paragraph> </Paragraph>

View File

@@ -26,7 +26,7 @@ import { features } from "../../../features";
import { eSendEvent, presentSheet } from "../../../services/event-manager"; import { eSendEvent, presentSheet } from "../../../services/event-manager";
import SettingsService from "../../../services/settings"; import SettingsService from "../../../services/settings";
import { eCloseSheet } from "../../../utils/events"; import { eCloseSheet } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -56,7 +56,7 @@ const NewFeature = ({
maxHeight: "100%" maxHeight: "100%"
}} }}
> >
<Heading color={colors.secondary.heading} size={SIZE.md}> <Heading color={colors.secondary.heading} size={AppFontSize.md}>
{strings.newVersionHighlights(version)} {strings.newVersionHighlights(version)}
</Heading> </Heading>
@@ -74,7 +74,7 @@ const NewFeature = ({
marginBottom: 10 marginBottom: 10
}} }}
> >
<Heading size={SIZE.lg - 2}>{item.title}</Heading> <Heading size={AppFontSize.lg - 2}>{item.title}</Heading>
<Paragraph selectable>{item.body}</Paragraph> <Paragraph selectable>{item.body}</Paragraph>
</View> </View>
))} ))}

View File

@@ -43,7 +43,7 @@ import { useSelectionStore } from "../../../stores/use-selection-store";
import { eOnNotebookUpdated } from "../../../utils/events"; import { eOnNotebookUpdated } from "../../../utils/events";
import { deleteItems } from "../../../utils/functions"; import { deleteItems } from "../../../utils/functions";
import { findRootNotebookId } from "../../../utils/notebooks"; import { findRootNotebookId } from "../../../utils/notebooks";
import { SIZE, normalize } from "../../../utils/size"; import { AppFontSize, normalize } from "../../../utils/size";
import { Properties } from "../../properties"; import { Properties } from "../../properties";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
@@ -264,7 +264,7 @@ export const NotebookSheet = () => {
width: normalize(50) width: normalize(50)
}} }}
> >
<Icon name="plus" color="white" size={SIZE.xxl} /> <Icon name="plus" color="white" size={AppFontSize.xxl} />
</View> </View>
</Pressable> </Pressable>
</View> </View>
@@ -283,7 +283,7 @@ export const NotebookSheet = () => {
alignItems: "center" alignItems: "center"
}} }}
> >
<Paragraph size={SIZE.xs} color={colors.primary.icon}> <Paragraph size={AppFontSize.xs} color={colors.primary.icon}>
{strings.notebooks()} {strings.notebooks()}
</Paragraph> </Paragraph>
<View <View
@@ -539,7 +539,7 @@ const NotebookItem = ({
> >
{nestedNotebooks?.placeholders.length ? ( {nestedNotebooks?.placeholders.length ? (
<IconButton <IconButton
size={SIZE.lg} size={AppFontSize.lg}
color={isSelected ? colors.selected.icon : colors.primary.icon} color={isSelected ? colors.selected.icon : colors.primary.icon}
onPress={() => { onPress={() => {
if (!item?.id) return; if (!item?.id) return;
@@ -566,7 +566,7 @@ const NotebookItem = ({
{enabled ? ( {enabled ? (
<IconButton <IconButton
size={SIZE.lg} size={AppFontSize.lg}
color={isSelected ? colors.selected.icon : colors.primary.icon} color={isSelected ? colors.selected.icon : colors.primary.icon}
top={0} top={0}
left={0} left={0}
@@ -589,7 +589,7 @@ const NotebookItem = ({
color={ color={
isFocused ? colors.selected.paragraph : colors.secondary.paragraph isFocused ? colors.selected.paragraph : colors.secondary.paragraph
} }
size={SIZE.sm} size={AppFontSize.sm}
> >
{item?.title} {item?.title}
</Paragraph> </Paragraph>
@@ -603,7 +603,7 @@ const NotebookItem = ({
}} }}
> >
{item?.id && totalNotes?.(item?.id) ? ( {item?.id && totalNotes?.(item?.id) ? (
<Paragraph size={SIZE.sm} color={colors.secondary.paragraph}> <Paragraph size={AppFontSize.sm} color={colors.secondary.paragraph}>
{totalNotes(item?.id)} {totalNotes(item?.id)}
</Paragraph> </Paragraph>
) : null} ) : null}
@@ -622,7 +622,7 @@ const NotebookItem = ({
bottom={0} bottom={0}
top={0} top={0}
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.xl} size={AppFontSize.xl}
/> />
</View> </View>
</Pressable> </Pressable>

View File

@@ -22,7 +22,7 @@ import { View } from "react-native";
import useSyncProgress from "../../../hooks/use-sync-progress"; import useSyncProgress from "../../../hooks/use-sync-progress";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
import { ProgressBarComponent } from "../../ui/svg/lazy"; import { ProgressBarComponent } from "../../ui/svg/lazy";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -52,7 +52,7 @@ export const Progress = () => {
paddingBottom: 15 paddingBottom: 15
}} }}
> >
<Heading size={SIZE.lg}>{strings.syncingHeading()}</Heading> <Heading size={AppFontSize.lg}>{strings.syncingHeading()}</Heading>
<Paragraph>{strings.syncingDesc()}</Paragraph> <Paragraph>{strings.syncingDesc()}</Paragraph>
<Seperator /> <Seperator />
<View <View

View File

@@ -27,7 +27,7 @@ import Navigation from "../../../services/navigation";
import { useAttachmentStore } from "../../../stores/use-attachment-store"; import { useAttachmentStore } from "../../../stores/use-attachment-store";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { openLinkInBrowser } from "../../../utils/functions"; import { openLinkInBrowser } from "../../../utils/functions";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
@@ -158,7 +158,7 @@ const PublishNoteSheet = ({
marginTop: 10, marginTop: 10,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
padding: 12, padding: 12,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
> >
<View <View
@@ -167,8 +167,10 @@ const PublishNoteSheet = ({
flexShrink: 1 flexShrink: 1
}} }}
> >
<Heading size={SIZE.md}>{strings.publishedAt()}:</Heading> <Heading size={AppFontSize.md}>
<Paragraph size={SIZE.sm} numberOfLines={1}> {strings.publishedAt()}:
</Heading>
<Paragraph size={AppFontSize.sm} numberOfLines={1}>
{publishUrl} {publishUrl}
</Paragraph> </Paragraph>
<Paragraph <Paragraph
@@ -179,7 +181,7 @@ const PublishNoteSheet = ({
console.error(e); console.error(e);
} }
}} }}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
marginTop: 5, marginTop: 5,
color: colors.primary.paragraph color: colors.primary.paragraph
@@ -200,7 +202,7 @@ const PublishNoteSheet = ({
}); });
}} }}
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.lg} size={AppFontSize.lg}
name="content-copy" name="content-copy"
/> />
</View> </View>
@@ -218,7 +220,7 @@ const PublishNoteSheet = ({
marginBottom: 10, marginBottom: 10,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
paddingVertical: 12, paddingVertical: 12,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginTop: 10 marginTop: 10
}} }}
> >
@@ -228,7 +230,7 @@ const PublishNoteSheet = ({
setIsLocked(!isLocked); setIsLocked(!isLocked);
}} }}
color={isLocked ? colors.selected.icon : colors.primary.icon} color={isLocked ? colors.selected.icon : colors.primary.icon}
size={SIZE.xl} size={AppFontSize.xl}
name={ name={
isLocked isLocked
? "check-circle-outline" ? "check-circle-outline"
@@ -242,7 +244,9 @@ const PublishNoteSheet = ({
flexShrink: 1 flexShrink: 1
}} }}
> >
<Heading size={SIZE.md}>{strings.monographPassHeading()}</Heading> <Heading size={AppFontSize.md}>
{strings.monographPassHeading()}
</Heading>
<Paragraph>{strings.monographPassDesc()}</Paragraph> <Paragraph>{strings.monographPassDesc()}</Paragraph>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
@@ -257,7 +261,7 @@ const PublishNoteSheet = ({
alignItems: "center", alignItems: "center",
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
paddingVertical: 12, paddingVertical: 12,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
> >
<IconButton <IconButton
@@ -265,7 +269,7 @@ const PublishNoteSheet = ({
setSelfDestruct(!selfDestruct); setSelfDestruct(!selfDestruct);
}} }}
color={selfDestruct ? colors.selected.icon : colors.primary.icon} color={selfDestruct ? colors.selected.icon : colors.primary.icon}
size={SIZE.xl} size={AppFontSize.xl}
name={ name={
selfDestruct selfDestruct
? "check-circle-outline" ? "check-circle-outline"
@@ -279,7 +283,7 @@ const PublishNoteSheet = ({
flexShrink: 1 flexShrink: 1
}} }}
> >
<Heading size={SIZE.md}> <Heading size={AppFontSize.md}>
{strings.monographSelfDestructHeading()} {strings.monographSelfDestructHeading()}
</Heading> </Heading>
<Paragraph>{strings.monographSelfDestructDesc()}</Paragraph> <Paragraph>{strings.monographSelfDestructDesc()}</Paragraph>
@@ -318,7 +322,7 @@ const PublishNoteSheet = ({
<> <>
<Button <Button
onPress={deletePublishedNote} onPress={deletePublishedNote}
fontSize={SIZE.md} fontSize={AppFontSize.md}
type="error" type="error"
title={strings.unpublish()} title={strings.unpublish()}
style={{ style={{
@@ -330,7 +334,7 @@ const PublishNoteSheet = ({
<Seperator half /> <Seperator half />
<Button <Button
onPress={publishNote} onPress={publishNote}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
width: isPublished ? "49%" : 250, width: isPublished ? "49%" : 250,
borderRadius: isPublished ? 5 : 100 borderRadius: isPublished ? 5 : 100
@@ -345,7 +349,7 @@ const PublishNoteSheet = ({
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xs} size={AppFontSize.xs}
style={{ style={{
textAlign: "center", textAlign: "center",
marginTop: 10, marginTop: 10,

View File

@@ -27,7 +27,7 @@ import { clearMessage } from "../../../services/message";
import SettingsService from "../../../services/settings"; import SettingsService from "../../../services/settings";
import { STORE_LINK } from "../../../utils/constants"; import { STORE_LINK } from "../../../utils/constants";
import { eCloseRateDialog, eOpenRateDialog } from "../../../utils/events"; import { eCloseRateDialog, eOpenRateDialog } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
import SheetWrapper from "../../ui/sheet"; import SheetWrapper from "../../ui/sheet";
@@ -87,12 +87,12 @@ const RateAppSheet = () => {
}} }}
> >
<Heading>{strings.rateAppHeading()}</Heading> <Heading>{strings.rateAppHeading()}</Heading>
<Paragraph size={SIZE.md}>{strings.rateAppDesc()}</Paragraph> <Paragraph size={AppFontSize.md}>{strings.rateAppDesc()}</Paragraph>
<Seperator half /> <Seperator half />
<Button <Button
onPress={rateApp} onPress={rateApp}
fontSize={SIZE.md} fontSize={AppFontSize.md}
width="100%" width="100%"
type="accent" type="accent"
title={strings.rateApp()} title={strings.rateApp()}
@@ -115,14 +115,14 @@ const RateAppSheet = () => {
setVisible(false); setVisible(false);
clearMessage(); clearMessage();
}} }}
fontSize={SIZE.md} fontSize={AppFontSize.md}
type="error" type="error"
width="48%" width="48%"
title={strings.never()} title={strings.never()}
/> />
<Button <Button
onPress={onClose} onPress={onClose}
fontSize={SIZE.md} fontSize={AppFontSize.md}
width="48%" width="48%"
type="secondary" type="secondary"
title={strings.later()} title={strings.later()}

View File

@@ -36,7 +36,7 @@ import {
import { clearMessage } from "../../../services/message"; import { clearMessage } from "../../../services/message";
import SettingsService from "../../../services/settings"; import SettingsService from "../../../services/settings";
import { eOpenRecoveryKeyDialog } from "../../../utils/events"; import { eOpenRecoveryKeyDialog } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { sleep } from "../../../utils/time"; import { sleep } from "../../../utils/time";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
@@ -235,14 +235,14 @@ class RecoveryKeySheet extends React.Component {
<View <View
style={{ style={{
borderRadius: 5, borderRadius: defaultBorderRadius,
padding: 12, padding: 12,
marginTop: 10 marginTop: 10
}} }}
> >
<Paragraph <Paragraph
color={colors.primary.paragraph} color={colors.primary.paragraph}
size={SIZE.sm} size={AppFontSize.sm}
numberOfLines={2} numberOfLines={2}
selectable selectable
style={{ style={{
@@ -294,7 +294,7 @@ class RecoveryKeySheet extends React.Component {
title={strings.copyToClipboard()} title={strings.copyToClipboard()}
width="100%" width="100%"
type="secondaryAccented" type="secondaryAccented"
fontSize={SIZE.md} fontSize={AppFontSize.md}
/> />
<Seperator /> <Seperator />
<Button <Button
@@ -302,7 +302,7 @@ class RecoveryKeySheet extends React.Component {
onPress={this.saveQRCODE} onPress={this.saveQRCODE}
width="100%" width="100%"
type="secondaryAccented" type="secondaryAccented"
fontSize={SIZE.md} fontSize={AppFontSize.md}
icon="qrcode" icon="qrcode"
/> />
<Seperator /> <Seperator />
@@ -312,7 +312,7 @@ class RecoveryKeySheet extends React.Component {
width="100%" width="100%"
type="secondaryAccented" type="secondaryAccented"
icon="text" icon="text"
fontSize={SIZE.md} fontSize={AppFontSize.md}
/> />
<Seperator /> <Seperator />
@@ -322,13 +322,13 @@ class RecoveryKeySheet extends React.Component {
width="100%" width="100%"
type="secondaryAccented" type="secondaryAccented"
icon="cloud" icon="cloud"
fontSize={SIZE.md} fontSize={AppFontSize.md}
/> />
<Seperator /> <Seperator />
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.sm} size={AppFontSize.sm}
numberOfLines={2} numberOfLines={2}
style={{ style={{
width: "100%", width: "100%",
@@ -343,7 +343,7 @@ class RecoveryKeySheet extends React.Component {
title={strings.done()} title={strings.done()}
width="100%" width="100%"
type="error" type="error"
fontSize={SIZE.md} fontSize={AppFontSize.md}
onPress={this.close} onPress={this.close}
/> />
</View> </View>

View File

@@ -35,7 +35,7 @@ import { eSendEvent, presentSheet } from "../../../services/event-manager";
import { useRelationStore } from "../../../stores/use-relation-store"; import { useRelationStore } from "../../../stores/use-relation-store";
import { eOnLoadNote } from "../../../utils/events"; import { eOnLoadNote } from "../../../utils/events";
import { fluidTabsRef } from "../../../utils/global-refs"; import { fluidTabsRef } from "../../../utils/global-refs";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import SheetProvider from "../../sheet-provider"; import SheetProvider from "../../sheet-provider";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button"; import { IconButton } from "../../ui/icon-button";
@@ -106,7 +106,7 @@ const ListBlockItem = ({
<View <View
style={{ style={{
borderRadius: 5, borderRadius: defaultBorderRadius,
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
width: 25, width: 25,
height: 25, height: 25,
@@ -114,7 +114,7 @@ const ListBlockItem = ({
justifyContent: "center" justifyContent: "center"
}} }}
> >
<Paragraph color={colors.secondary.paragraph} size={SIZE.xs}> <Paragraph color={colors.secondary.paragraph} size={AppFontSize.xs}>
{item.type.toUpperCase()} {item.type.toUpperCase()}
</Paragraph> </Paragraph>
</View> </View>
@@ -327,7 +327,7 @@ const ListNoteItem = ({
}} }}
> >
<IconButton <IconButton
size={SIZE.xl} size={AppFontSize.xl}
onPress={() => { onPress={() => {
if (!item?.id) return; if (!item?.id) return;
useExpandedStore.getState().setExpanded(item?.id); useExpandedStore.getState().setExpanded(item?.id);
@@ -354,7 +354,10 @@ const ListNoteItem = ({
}} }}
> >
{loading ? ( {loading ? (
<ActivityIndicator color={colors.primary.accent} size={SIZE.lg} /> <ActivityIndicator
color={colors.primary.accent}
size={AppFontSize.lg}
/>
) : ( ) : (
<> <>
{listType === "linkedNotes" ? ( {listType === "linkedNotes" ? (

View File

@@ -30,7 +30,7 @@ import {
presentSheet presentSheet
} from "../../../services/event-manager"; } from "../../../services/event-manager";
import { useRelationStore } from "../../../stores/use-relation-store"; import { useRelationStore } from "../../../stores/use-relation-store";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import DialogHeader from "../../dialog/dialog-header"; import DialogHeader from "../../dialog/dialog-header";
import List from "../../list"; import List from "../../list";
import SheetProvider from "../../sheet-provider"; import SheetProvider from "../../sheet-provider";
@@ -119,7 +119,7 @@ export const RelationsList = ({
onPress={() => { onPress={() => {
onAdd?.(); onAdd?.();
}} }}
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
// width="100%" // width="100%"
type="inverted" type="inverted"
icon="plus" icon="plus"

View File

@@ -29,7 +29,7 @@ import {
} from "../../../services/event-manager"; } from "../../../services/event-manager";
import Notifications from "../../../services/notifications"; import Notifications from "../../../services/notifications";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import List from "../../list"; import List from "../../list";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
@@ -135,7 +135,7 @@ export default function ReminderNotify({
marginTop: 10 marginTop: 10
}} }}
> >
<Paragraph size={SIZE.xs}>{strings.remindMeIn()}:</Paragraph> <Paragraph size={AppFontSize.xs}>{strings.remindMeIn()}:</Paragraph>
{QuickActions.map((item) => { {QuickActions.map((item) => {
return ( return (
<Button <Button
@@ -143,7 +143,7 @@ export default function ReminderNotify({
key={item.title} key={item.title}
title={item.title} title={item.title}
height={30} height={30}
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ marginLeft: 10, borderRadius: 100 }} style={{ marginLeft: 10, borderRadius: 100 }}
onPress={() => onSnooze(item.time)} onPress={() => onSnooze(item.time)}
/> />
@@ -168,7 +168,7 @@ export default function ReminderNotify({
<Paragraph <Paragraph
style={{ style={{
color: colors.secondary.paragraph, color: colors.secondary.paragraph,
fontSize: SIZE.xs, fontSize: AppFontSize.xs,
marginBottom: 10 marginBottom: 10
}} }}
> >

View File

@@ -31,7 +31,7 @@ import {
ToastManager, ToastManager,
presentSheet presentSheet
} from "../../../services/event-manager"; } from "../../../services/event-manager";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Input from "../../ui/input"; import Input from "../../ui/input";
@@ -228,7 +228,7 @@ export default function ReminderSheet({
maxHeight: "100%" maxHeight: "100%"
}} }}
> >
<Heading size={SIZE.lg}> <Heading size={AppFontSize.lg}>
{reminder ? strings.editReminder() : strings.newReminder()} {reminder ? strings.editReminder() : strings.newReminder()}
</Heading> </Heading>
@@ -324,7 +324,7 @@ export default function ReminderSheet({
style={{ style={{
backgroundColor: colors.secondary.background, backgroundColor: colors.secondary.background,
padding: 12, padding: 12,
borderRadius: 5, borderRadius: defaultBorderRadius,
marginBottom: 12 marginBottom: 12
}} }}
> >
@@ -382,7 +382,7 @@ export default function ReminderSheet({
type={ type={
selectedDays.indexOf(index) > -1 ? "selected" : "plain" selectedDays.indexOf(index) > -1 ? "selected" : "plain"
} }
fontSize={SIZE.sm - 1} fontSize={AppFontSize.sm - 1}
style={{ style={{
width: 40, width: 40,
height: 40, height: 40,
@@ -410,7 +410,7 @@ export default function ReminderSheet({
? "selected" ? "selected"
: "plain" : "plain"
} }
fontSize={SIZE.sm - 1} fontSize={AppFontSize.sm - 1}
style={{ style={{
width: 40, width: 40,
height: 40, height: 40,
@@ -480,7 +480,7 @@ export default function ReminderSheet({
title={date ? date.toLocaleDateString() : strings.selectDate()} title={date ? date.toLocaleDateString() : strings.selectDate()}
type={date ? "secondaryAccented" : "secondary"} type={date ? "secondaryAccented" : "secondary"}
icon="calendar" icon="calendar"
fontSize={SIZE.md} fontSize={AppFontSize.md}
onPress={() => { onPress={() => {
showDatePicker(); showDatePicker();
}} }}
@@ -493,7 +493,7 @@ export default function ReminderSheet({
reminderMode === ReminderModes.Permanent ? null : ( reminderMode === ReminderModes.Permanent ? null : (
<View <View
style={{ style={{
borderRadius: 5, borderRadius: defaultBorderRadius,
flexDirection: "row", flexDirection: "row",
paddingVertical: 6, paddingVertical: 6,
paddingHorizontal: 12, paddingHorizontal: 12,
@@ -504,7 +504,10 @@ export default function ReminderSheet({
}} }}
> >
<> <>
<Paragraph size={SIZE.xs} color={colors.secondary.paragraph}> <Paragraph
size={AppFontSize.xs}
color={colors.secondary.paragraph}
>
{recurringMode === RecurringModes.Daily {recurringMode === RecurringModes.Daily
? strings.reminderRepeatStrings.day( ? strings.reminderRepeatStrings.day(
dayjs(date).format("hh:mm A") dayjs(date).format("hh:mm A")
@@ -598,7 +601,7 @@ export default function ReminderSheet({
title={strings.save()} title={strings.save()}
type="accent" type="accent"
height={45} height={45}
fontSize={SIZE.md} fontSize={AppFontSize.md}
style={{ style={{
paddingHorizontal: 24, paddingHorizontal: 24,
marginTop: 10, marginTop: 10,

View File

@@ -31,16 +31,26 @@ import { db } from "../../../common/database";
import { eSendEvent } from "../../../services/event-manager"; import { eSendEvent } from "../../../services/event-manager";
import Navigation from "../../../services/navigation"; import Navigation from "../../../services/navigation";
import { RouteName } from "../../../stores/use-navigation-store"; import { RouteName } from "../../../stores/use-navigation-store";
import { useNotebookStore } from "../../../stores/use-notebook-store";
import { useTagStore } from "../../../stores/use-tag-store";
import { GROUP, SORT } from "../../../utils/constants"; import { GROUP, SORT } from "../../../utils/constants";
import { eGroupOptionsUpdated, refreshNotesPage } from "../../../utils/events"; import { eGroupOptionsUpdated, refreshNotesPage } from "../../../utils/events";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { DefaultAppStyles } from "../../../utils/styles"; import { DefaultAppStyles } from "../../../utils/styles";
import AppIcon from "../../ui/AppIcon"; import AppIcon from "../../ui/AppIcon";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => { const Sort = ({
type,
screen,
hideGroupOptions
}: {
type: ItemType;
screen?: RouteName;
hideGroupOptions?: boolean;
}) => {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
const [groupOptions, setGroupOptions] = useState( const [groupOptions, setGroupOptions] = useState(
db.settings.getGroupOptions( db.settings.getGroupOptions(
@@ -54,7 +64,12 @@ const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => {
await db.settings.setGroupOptions(groupType, _groupOptions); await db.settings.setGroupOptions(groupType, _groupOptions);
setGroupOptions(_groupOptions); setGroupOptions(_groupOptions);
setTimeout(() => { setTimeout(() => {
Navigation.queueRoutesForUpdate(screen); if (screen) Navigation.queueRoutesForUpdate(screen);
if (type === "notebook") {
useNotebookStore.getState().refresh();
} else if (type === "tag") {
useTagStore.getState().refresh();
}
eSendEvent(eGroupOptionsUpdated, groupType); eSendEvent(eGroupOptionsUpdated, groupType);
eSendEvent(refreshNotesPage); eSendEvent(refreshNotesPage);
}, 1); }, 1);
@@ -88,7 +103,7 @@ const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => {
}} }}
> >
<Heading <Heading
size={SIZE.md} size={AppFontSize.md}
style={{ style={{
alignSelf: "center" alignSelf: "center"
}} }}
@@ -119,7 +134,7 @@ const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => {
} }
height={30} height={30}
iconPosition="right" iconPosition="right"
fontSize={SIZE.sm} fontSize={AppFontSize.sm}
type="plain" type="plain"
style={{ style={{
paddingHorizontal: DefaultAppStyles.GAP_SMALL paddingHorizontal: DefaultAppStyles.GAP_SMALL
@@ -135,95 +150,16 @@ const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => {
borderBottomColor: colors.primary.border borderBottomColor: colors.primary.border
}} }}
> >
{groupOptions?.groupBy === "abc" ? ( {Object.keys(SORT).map((item) =>
<Button (item === "dueDate" && screen !== "Reminders") ||
type="secondary" (screen !== "Tags" &&
title={strings.title()} screen !== "Reminders" &&
height={40} item === "dateModified") ||
iconPosition="left" ((screen === "Tags" || screen === "Reminders") &&
icon={"check"} item === "dateEdited") ? null : (
buttonType={{ text: colors.primary.accent }}
fontSize={SIZE.sm}
iconSize={SIZE.md}
/>
) : (
Object.keys(SORT).map((item) =>
(item === "dueDate" && screen !== "Reminders") ||
(screen !== "Tags" &&
screen !== "Reminders" &&
item === "dateModified") ||
((screen === "Tags" || screen === "Reminders") &&
item === "dateEdited") ? null : (
<Pressable
key={item}
type={groupOptions?.sortBy === item ? "selected" : "plain"}
noborder
style={{
width: "100%",
justifyContent: "space-between",
height: 40,
flexDirection: "row",
borderRadius: 0,
paddingHorizontal: DefaultAppStyles.GAP
}}
onPress={async () => {
const _groupOptions: GroupOptions = {
...groupOptions,
sortBy:
type === "trash"
? "dateDeleted"
: (item as SortOptions["sortBy"])
};
await updateGroupOptions(_groupOptions);
}}
>
<Paragraph>
{strings.sortByStrings[
item as keyof typeof strings.sortByStrings
]()}
</Paragraph>
{groupOptions.sortBy === item ? (
<AppIcon
size={SIZE.lg}
name="check"
color={colors.selected.accent}
/>
) : null}
</Pressable>
)
)
)}
</View>
<>
<View
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: DefaultAppStyles.GAP,
paddingVertical: DefaultAppStyles.GAP_VERTICAL
}}
>
<Heading size={SIZE.md}>{strings.groupBy()}</Heading>
</View>
<View
style={{
borderRadius: 0,
flexDirection: "row",
flexWrap: "wrap"
}}
>
{Object.keys(GROUP).map((item) => (
<Pressable <Pressable
key={item} key={item}
type={ type={groupOptions?.sortBy === item ? "selected" : "plain"}
groupOptions?.groupBy === GROUP[item as keyof typeof GROUP]
? "selected"
: "plain"
}
noborder noborder
style={{ style={{
width: "100%", width: "100%",
@@ -245,22 +181,87 @@ const Sort = ({ type, screen }: { type: ItemType; screen: RouteName }) => {
}} }}
> >
<Paragraph> <Paragraph>
{strings.groupByStrings[ {strings.sortByStrings[
item as keyof typeof strings.groupByStrings item as keyof typeof strings.sortByStrings
]()} ]()}
</Paragraph> </Paragraph>
{groupOptions.groupBy === item ? ( {groupOptions.sortBy === item ? (
<AppIcon <AppIcon
size={SIZE.lg} size={AppFontSize.lg}
name="check" name="check"
color={colors.selected.accent} color={colors.selected.accent}
/> />
) : null} ) : null}
</Pressable> </Pressable>
))} )
</View> )}
</> </View>
{!hideGroupOptions ? (
<>
<View
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: DefaultAppStyles.GAP,
paddingVertical: DefaultAppStyles.GAP_VERTICAL
}}
>
<Heading size={AppFontSize.md}>{strings.groupBy()}</Heading>
</View>
<View
style={{
borderRadius: 0,
flexDirection: "row",
flexWrap: "wrap"
}}
>
{Object.keys(GROUP).map((item) => (
<Pressable
key={item}
type={
groupOptions?.groupBy === GROUP[item as keyof typeof GROUP]
? "selected"
: "plain"
}
noborder
style={{
width: "100%",
justifyContent: "space-between",
height: 40,
flexDirection: "row",
borderRadius: 0,
paddingHorizontal: DefaultAppStyles.GAP
}}
onPress={async () => {
const _groupOptions: GroupOptions = {
...groupOptions,
groupBy: item as GroupOptions["groupBy"]
};
await updateGroupOptions(_groupOptions);
}}
>
<Paragraph>
{strings.groupByStrings[
item as keyof typeof strings.groupByStrings
]()}
</Paragraph>
{groupOptions.groupBy === item ? (
<AppIcon
size={AppFontSize.lg}
name="check"
color={colors.selected.accent}
/>
) : null}
</Pressable>
))}
</View>
</>
) : null}
</View> </View>
); );
}; };

View File

@@ -21,7 +21,7 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import Heading from "../../ui/typography/heading"; import Heading from "../../ui/typography/heading";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
@@ -86,7 +86,7 @@ const TableOfContentsItem: React.FC<{
? colors.selected.paragraph ? colors.selected.paragraph
: colors.primary.paragraph : colors.primary.paragraph
} }
size={SIZE.md} size={AppFontSize.md}
> >
{item?.title || strings.newNote()} {item?.title || strings.newNote()}
</Paragraph> </Paragraph>
@@ -112,7 +112,7 @@ const TableOfContents = ({ toc, close }: TableOfContentsProps) => {
alignItems: "center" alignItems: "center"
}} }}
> >
<Heading size={SIZE.lg}>{strings.toc()}</Heading> <Heading size={AppFontSize.lg}>{strings.toc()}</Heading>
</View> </View>
<FlatList <FlatList

View File

@@ -25,7 +25,7 @@ import Config from "react-native-config";
import deviceInfoModule from "react-native-device-info"; import deviceInfoModule from "react-native-device-info";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import { STORE_LINK } from "../../../utils/constants"; import { STORE_LINK } from "../../../utils/constants";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator"; import Seperator from "../../ui/seperator";
import { SvgView } from "../../ui/svg"; import { SvgView } from "../../ui/svg";
@@ -102,7 +102,7 @@ export const Update = ({ version: appVersion, fwdRef }) => {
{!version ? ( {!version ? (
<> <>
<ProgressBarComponent <ProgressBarComponent
size={SIZE.xxl} size={AppFontSize.xxl}
indeterminate={true} indeterminate={true}
color={colors.primary.accent} color={colors.primary.accent}
borderWidth={0} borderWidth={0}
@@ -113,13 +113,13 @@ export const Update = ({ version: appVersion, fwdRef }) => {
style={{ style={{
marginTop: 5 marginTop: 5
}} }}
size={SIZE.md} size={AppFontSize.md}
> >
{strings.checkNewVersion()} {strings.checkNewVersion()}
</Paragraph> </Paragraph>
</> </>
) : ( ) : (
<Paragraph size={SIZE.md}>{strings.noUpdates()}</Paragraph> <Paragraph size={AppFontSize.md}>{strings.noUpdates()}</Paragraph>
)} )}
</View> </View>
</> </>
@@ -161,7 +161,7 @@ export const Update = ({ version: appVersion, fwdRef }) => {
width: "100%" width: "100%"
}} }}
> >
<Heading size={SIZE.md}>{strings.releaseNotes()}:</Heading> <Heading size={AppFontSize.md}>{strings.releaseNotes()}:</Heading>
{version.body ? ( {version.body ? (
<Paragraph <Paragraph

View File

@@ -27,14 +27,16 @@ import useSyncProgress from "../../../hooks/use-sync-progress";
import { presentSheet } from "../../../services/event-manager"; import { presentSheet } from "../../../services/event-manager";
import Navigation from "../../../services/navigation"; import Navigation from "../../../services/navigation";
import { SyncStatus, useUserStore } from "../../../stores/use-user-store"; import { SyncStatus, useUserStore } from "../../../stores/use-user-store";
import { SIZE } from "../../../utils/size"; import { getObfuscatedEmail } from "../../../utils/functions";
import { AppFontSize } from "../../../utils/size";
import { DefaultAppStyles } from "../../../utils/styles"; import { DefaultAppStyles } from "../../../utils/styles";
import { AuthMode } from "../../auth/common";
import { Card } from "../../list/card"; import { Card } from "../../list/card";
import AppIcon from "../../ui/AppIcon"; import AppIcon from "../../ui/AppIcon";
import { Button } from "../../ui/button";
import { Pressable } from "../../ui/pressable"; import { Pressable } from "../../ui/pressable";
import { TimeSince } from "../../ui/time-since"; import { TimeSince } from "../../ui/time-since";
import Paragraph from "../../ui/typography/paragraph"; import Paragraph from "../../ui/typography/paragraph";
import Sync from "../../../services/sync";
export const UserSheet = () => { export const UserSheet = () => {
const ref = useSheetRef(); const ref = useSheetRef();
@@ -58,7 +60,6 @@ export const UserSheet = () => {
style={{ style={{
width: "100%", width: "100%",
justifyContent: "center", justifyContent: "center",
paddingHorizontal: DefaultAppStyles.GAP,
gap: DefaultAppStyles.GAP gap: DefaultAppStyles.GAP
}} }}
> >
@@ -66,19 +67,23 @@ export const UserSheet = () => {
<View <View
style={{ style={{
flexDirection: "row", flexDirection: "row",
alignItems: "center" alignItems: "center",
paddingHorizontal: DefaultAppStyles.GAP,
gap: DefaultAppStyles.GAP_SMALL
}} }}
> >
<Image {userProfile?.profilePicture ? (
source={{ <Image
uri: userProfile?.profilePicture source={{
}} uri: userProfile?.profilePicture
style={{ }}
width: 40, style={{
height: 40, width: 40,
borderRadius: 10 height: 40,
}} borderRadius: 10
/> }}
/>
) : null}
<View <View
style={{ style={{
@@ -87,27 +92,17 @@ export const UserSheet = () => {
justifyContent: "space-between" justifyContent: "space-between"
}} }}
> >
<View style={{ marginLeft: 10 }}> <View>
<Paragraph size={SIZE.xs}>{userProfile?.fullName}</Paragraph> <Paragraph size={AppFontSize.xs}>
{userProfile?.fullName || getObfuscatedEmail(user.email)}
</Paragraph>
<Paragraph <Paragraph
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
}} }}
size={SIZE.xxs} size={AppFontSize.xxs}
color={colors.secondary.heading} color={colors.secondary.heading}
> >
<AppIcon
name="checkbox-blank-circle"
size={10}
allowFontScaling
color={
!user || lastSyncStatus === SyncStatus.Failed
? colors.error.icon
: isOffline
? colors.static.orange
: colors.success.icon
}
/>{" "}
{!user ? ( {!user ? (
strings.notLoggedIn() strings.notLoggedIn()
) : lastSynced && lastSynced !== "Never" ? ( ) : lastSynced && lastSynced !== "Never" ? (
@@ -122,7 +117,7 @@ export const UserSheet = () => {
{!syncing ? ( {!syncing ? (
<TimeSince <TimeSince
style={{ style={{
fontSize: SIZE.xxs, fontSize: AppFontSize.xxs,
color: colors.secondary.paragraph color: colors.secondary.paragraph
}} }}
updateFrequency={30 * 1000} updateFrequency={30 * 1000}
@@ -133,13 +128,25 @@ export const UserSheet = () => {
</> </>
) : ( ) : (
strings.never() strings.never()
)} )}{" "}
<AppIcon
name="checkbox-blank-circle"
size={10}
allowFontScaling
color={
!user || lastSyncStatus === SyncStatus.Failed
? colors.error.icon
: isOffline
? colors.static.orange
: colors.success.icon
}
/>
</Paragraph> </Paragraph>
</View> </View>
{syncing ? ( {syncing ? (
<ActivityIndicator <ActivityIndicator
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.xxl} size={AppFontSize.xxl}
/> />
) : null} ) : null}
</View> </View>
@@ -150,11 +157,24 @@ export const UserSheet = () => {
width: "100%" width: "100%"
}} }}
> >
<Card /> <Card
customMessage={{
visible: true,
message: strings.notLoggedIn(),
actionText: strings.loginMessageActionText(),
icon: "account-outline",
onPress: () => {
ref.current?.hide();
Navigation.navigate("Auth", {
mode: AuthMode.login
});
}
}}
/>
</View> </View>
)} )}
{user ? ( {/* {user ? (
<View <View
style={{ style={{
paddingVertical: DefaultAppStyles.GAP_SMALL, paddingVertical: DefaultAppStyles.GAP_SMALL,
@@ -176,8 +196,10 @@ export const UserSheet = () => {
justifyContent: "space-between" justifyContent: "space-between"
}} }}
> >
<Paragraph size={SIZE.xxs}>{strings.storage()}</Paragraph> <Paragraph size={AppFontSize.xxs}>{strings.storage()}</Paragraph>
<Paragraph size={SIZE.xxs}>50/100MB {strings.used()}</Paragraph> <Paragraph size={AppFontSize.xxs}>
50/100MB {strings.used()}
</Paragraph>
</View> </View>
<View <View
style={{ style={{
@@ -209,10 +231,13 @@ export const UserSheet = () => {
}} }}
> >
<View> <View>
<Paragraph size={SIZE.sm}>{strings.freePlan()}</Paragraph> <Paragraph size={AppFontSize.sm}>{strings.freePlan()}</Paragraph>
<Paragraph color={colors.secondary.paragraph} size={SIZE.xxxs}> <Paragraph
color={colors.secondary.paragraph}
size={AppFontSize.xxxs}
>
{strings.viewAllLimits()} {strings.viewAllLimits()}
<AppIcon name="information" size={SIZE.xxxs} /> <AppIcon name="information" size={AppFontSize.xxxs} />
</Paragraph> </Paragraph>
</View> </View>
@@ -220,7 +245,7 @@ export const UserSheet = () => {
title={strings.upgradeNow()} title={strings.upgradeNow()}
onPress={() => {}} onPress={() => {}}
type="accent" type="accent"
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
style={{ style={{
paddingHorizontal: DefaultAppStyles.GAP_SMALL, paddingHorizontal: DefaultAppStyles.GAP_SMALL,
height: "auto", height: "auto",
@@ -229,7 +254,8 @@ export const UserSheet = () => {
/> />
</View> </View>
</View> </View>
) : null} ) : null} */}
<View <View
style={{ style={{
borderBottomWidth: 1, borderBottomWidth: 1,
@@ -245,9 +271,11 @@ export const UserSheet = () => {
> >
{[ {[
{ {
icon: "account-outline", icon: "reload",
title: strings.editProfile(), title: strings.syncNow(),
onPress: () => {}, onPress: () => {
Sync.run();
},
hidden: !user hidden: !user
}, },
{ {
@@ -255,7 +283,6 @@ export const UserSheet = () => {
title: strings.settings(), title: strings.settings(),
onPress: () => { onPress: () => {
ref.current?.hide(); ref.current?.hide();
Navigation.closeDrawer();
Navigation.navigate("Settings"); Navigation.navigate("Settings");
} }
}, },
@@ -277,7 +304,7 @@ export const UserSheet = () => {
flexDirection: "row", flexDirection: "row",
justifyContent: "flex-start", justifyContent: "flex-start",
gap: DefaultAppStyles.GAP_SMALL, gap: DefaultAppStyles.GAP_SMALL,
paddingHorizontal: DefaultAppStyles.GAP_SMALL paddingHorizontal: DefaultAppStyles.GAP
}} }}
onPress={() => { onPress={() => {
item.onPress(); item.onPress();
@@ -286,7 +313,7 @@ export const UserSheet = () => {
<AppIcon <AppIcon
color={colors.secondary.icon} color={colors.secondary.icon}
name={item.icon} name={item.icon}
size={SIZE.xl} size={AppFontSize.xl}
/> />
<Paragraph>{item.title}</Paragraph> <Paragraph>{item.title}</Paragraph>
</Pressable> </Pressable>

View File

@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { Image, View } from "react-native"; import { View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context"; import { SafeAreaView } from "react-native-safe-area-context";
import { import {
NavigationState, NavigationState,
@@ -31,13 +31,17 @@ import {
} from "react-native-tab-view"; } from "react-native-tab-view";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { db } from "../../common/database"; import { db } from "../../common/database";
import { useGroupOptions } from "../../hooks/use-group-options";
import { presentSheet, ToastManager } from "../../services/event-manager";
import Navigation from "../../services/navigation"; import Navigation from "../../services/navigation";
import { useUserStore } from "../../stores/use-user-store"; import { useThemeStore } from "../../stores/use-theme-store";
import { deleteItems } from "../../utils/functions"; import { deleteItems } from "../../utils/functions";
import { rootNavigatorRef } from "../../utils/global-refs"; import { AppFontSize } from "../../utils/size";
import { SIZE } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { AddNotebookSheet } from "../sheets/add-notebook";
import { MoveNotebookSheet } from "../sheets/move-notebook"; import { MoveNotebookSheet } from "../sheets/move-notebook";
import Sort from "../sheets/sort";
import { IconButton } from "../ui/icon-button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { SideMenuHome } from "./side-menu-home"; import { SideMenuHome } from "./side-menu-home";
@@ -47,6 +51,9 @@ import {
useSideMenuNotebookSelectionStore, useSideMenuNotebookSelectionStore,
useSideMenuTagsSelectionStore useSideMenuTagsSelectionStore
} from "./stores"; } from "./stores";
import { presentDialog } from "../dialog/functions";
import { strings } from "@notesnook/intl";
import { useTagStore } from "../../stores/use-tag-store";
const renderScene = SceneMap({ const renderScene = SceneMap({
home: SideMenuHome, home: SideMenuHome,
notebooks: SideMenuNotebooks, notebooks: SideMenuNotebooks,
@@ -70,10 +77,6 @@ export const SideMenu = React.memo(
{ {
key: "tags", key: "tags",
title: "Tags" title: "Tags"
},
{
key: "settings",
title: "Settings"
} }
]); ]);
@@ -92,6 +95,7 @@ export const SideMenu = React.memo(
onIndexChange={setIndex} onIndexChange={setIndex}
swipeEnabled={false} swipeEnabled={false}
animationEnabled={false} animationEnabled={false}
lazy={true}
/> />
</SafeAreaView> </SafeAreaView>
); );
@@ -99,78 +103,16 @@ export const SideMenu = React.memo(
() => true () => true
); );
const SettingsIcon = (props: {
route: Route;
isFocused: boolean;
jumpTo: (routeName: string) => void;
}) => {
const { colors } = useThemeColors();
const userProfile = useUserStore((state) => state.profile);
const user = useUserStore((state) => state.user);
return (
<Pressable
key={props.route.key}
onPress={() => {
rootNavigatorRef.navigate("Settings");
// if (!user) {
// rootNavigatorRef.navigate("Settings");
// return;
// }
// UserSheet.present();
}}
style={{
borderRadius: 10,
paddingVertical: 2,
width: "25%"
}}
type={props.isFocused ? "selected" : "plain"}
>
{userProfile?.profilePicture ? (
<Image
source={{
uri: userProfile?.profilePicture
}}
style={{
width: SIZE.lg,
height: SIZE.lg,
borderRadius: 100
}}
/>
) : (
<Icon
name="cog-outline"
color={props.isFocused ? colors.primary.accent : colors.primary.icon}
size={SIZE.lg}
/>
)}
<Paragraph
color={
props.isFocused
? colors.primary.paragraph
: colors.secondary.paragraph
}
style={{
opacity: props.isFocused ? 1 : 0.6
}}
size={SIZE.xxxs - 1}
>
{userProfile?.fullName
? userProfile.fullName.split(" ")[0]
: props.route.title}
</Paragraph>
</Pressable>
);
};
const TabBar = ( const TabBar = (
props: SceneRendererProps & { props: SceneRendererProps & {
navigationState: NavigationState<Route>; navigationState: NavigationState<Route>;
options: Record<string, TabDescriptor<Route>> | undefined; options: Record<string, TabDescriptor<Route>> | undefined;
} }
) => { ) => {
const { colors } = useThemeColors(); const { colors, isDark } = useThemeColors();
const groupOptions = useGroupOptions(
props.navigationState.index === 1 ? "notebook" : "tags"
);
const notebookSelectionEnabled = useSideMenuNotebookSelectionStore( const notebookSelectionEnabled = useSideMenuNotebookSelectionStore(
(state) => state.enabled (state) => state.enabled
); );
@@ -183,8 +125,6 @@ const TabBar = (
switch (key) { switch (key) {
case "home": case "home":
return "home-outline"; return "home-outline";
case "settings":
return "cog-outline";
case "notebooks": case "notebooks":
return "book-outline"; return "book-outline";
case "tags": case "tags":
@@ -202,7 +142,9 @@ const TabBar = (
justifyContent: "space-between", justifyContent: "space-between",
backgroundColor: colors.primary.background, backgroundColor: colors.primary.background,
paddingHorizontal: DefaultAppStyles.GAP, paddingHorizontal: DefaultAppStyles.GAP,
paddingVertical: DefaultAppStyles.GAP_SMALL paddingVertical: DefaultAppStyles.GAP_SMALL,
borderTopWidth: 1,
borderTopColor: colors.primary.border
}} }}
> >
{isSelectionEnabled ? ( {isSelectionEnabled ? (
@@ -287,11 +229,11 @@ const TabBar = (
<Icon <Icon
name={item.icon} name={item.icon}
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
/> />
<Paragraph <Paragraph
color={colors.secondary.paragraph} color={colors.secondary.paragraph}
size={SIZE.xxxs - 1} size={AppFontSize.xxxs - 1}
> >
{item.title} {item.title}
</Paragraph> </Paragraph>
@@ -301,65 +243,159 @@ const TabBar = (
</> </>
) : ( ) : (
<> <>
{props.navigationState.routes.map((route, index) => { <View
const isFocused = props.navigationState.index === index; style={{
flexDirection: "row",
gap: DefaultAppStyles.GAP_SMALL
}}
>
{props.navigationState.routes.map((route, index) => {
const isFocused = props.navigationState.index === index;
return route.key === "settings" ? ( return (
<SettingsIcon <Pressable
isFocused={isFocused} key={route.key}
jumpTo={props.jumpTo} onPress={() => {
route={route} props.jumpTo(route.key);
/> switch (route.key) {
) : ( case "notebooks":
<Pressable Navigation.routeNeedsUpdate(
key={route.key} "Notebooks",
onPress={() => { Navigation.routeUpdateFunctions.Notebooks
props.jumpTo(route.key); );
switch (route.key) { break;
case "notebooks": case "tags":
Navigation.routeNeedsUpdate( Navigation.routeNeedsUpdate(
"Notebooks", "Tags",
Navigation.routeUpdateFunctions.Notebooks Navigation.routeUpdateFunctions.Tags
); );
break; break;
case "tags": default:
Navigation.routeNeedsUpdate( break;
"Tags", }
Navigation.routeUpdateFunctions.Tags }}
); style={{
break; borderRadius: 10,
default: opacity: isFocused ? 1 : 0.6,
break; paddingVertical: 2,
width: 40,
height: 40
}}
type={isFocused ? "selected" : "plain"}
>
<Icon
name={getIcon(route.key)}
color={
isFocused ? colors.primary.accent : colors.primary.icon
}
size={AppFontSize.lg}
/>
</Pressable>
);
})}
</View>
<View
style={{
flexDirection: "row",
alignItems: "center",
gap: DefaultAppStyles.GAP_SMALL
}}
>
{props.navigationState.index > 0 ? (
<>
<IconButton
name="plus"
size={AppFontSize.lg - 2}
onPress={() => {
if (props.navigationState.index === 1) {
AddNotebookSheet.present();
} else {
presentDialog({
title: strings.addTag(),
paragraph: strings.addTagDesc(),
input: true,
positiveText: "Add",
positivePress: async (tag) => {
if (tag) {
await db.tags.add({
title: tag
});
useTagStore.getState().refresh();
return true;
}
ToastManager.show({
context: "local",
type: "error",
message: strings.allFieldsRequired()
});
return false;
}
});
}
}}
style={{
width: 35,
height: 35
}}
/>
<IconButton
name={
groupOptions.sortDirection === "asc"
? "sort-ascending"
: "sort-descending"
} }
color={colors.secondary.icon}
onPress={() => {
presentSheet({
component: (
<Sort
type={
props.navigationState.index === 1
? "notebook"
: "tag"
}
hideGroupOptions
/>
)
});
}}
style={{
width: 35,
height: 35
}}
size={AppFontSize.lg - 2}
/>
{/* <IconButton
name="magnify"
color={colors.secondary.icon}
onPress={() => {}}
style={{
width: 35,
height: 35
}}
size={SIZE.lg - 2}
/> */}
</>
) : null}
{props.navigationState.index === 0 ? (
<IconButton
onPress={() => {
useThemeStore.getState().setColorScheme();
}} }}
style={{ style={{
borderRadius: 10, width: 28,
opacity: isFocused ? 1 : 0.6, height: 28
paddingVertical: 2,
width: "25%"
}} }}
type={isFocused ? "selected" : "plain"} color={colors.primary.icon}
> name={isDark ? "weather-night" : "weather-sunny"}
<Icon size={AppFontSize.lg - 2}
name={getIcon(route.key)} />
color={ ) : null}
isFocused ? colors.primary.accent : colors.primary.icon </View>
}
size={SIZE.lg}
/>
<Paragraph
color={
isFocused
? colors.primary.paragraph
: colors.secondary.paragraph
}
size={SIZE.xxxs - 1}
>
{route.title}
</Paragraph>
</Pressable>
);
})}
</> </>
)} )}
</View> </View>

View File

@@ -31,7 +31,7 @@ import useNavigationStore, {
import { useNoteStore } from "../../stores/use-notes-store"; import { useNoteStore } from "../../stores/use-notes-store";
import { useTrashStore } from "../../stores/use-trash-store"; import { useTrashStore } from "../../stores/use-trash-store";
import { SideMenuItem } from "../../utils/menu-items"; import { SideMenuItem } from "../../utils/menu-items";
import { SIZE } from "../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
@@ -138,13 +138,16 @@ function _MenuItem({
style={{ style={{
width: "100%", width: "100%",
alignSelf: "center", alignSelf: "center",
borderRadius: 5, borderRadius: defaultBorderRadius,
flexDirection: "row", flexDirection: "row",
paddingHorizontal: DefaultAppStyles.GAP_SMALL, paddingHorizontal: DefaultAppStyles.GAP_SMALL,
justifyContent: "space-between", justifyContent: "space-between",
alignItems: "center", alignItems: "center",
paddingVertical: DefaultAppStyles.GAP_VERTICAL paddingVertical: DefaultAppStyles.GAP_VERTICAL
}} }}
onLayout={(e) => {
console.log(e.nativeEvent.layout);
}}
> >
<View <View
style={{ style={{
@@ -154,7 +157,7 @@ function _MenuItem({
}} }}
> >
{renderIcon ? ( {renderIcon ? (
renderIcon(item, SIZE.md) renderIcon(item, AppFontSize.md)
) : ( ) : (
<Icon <Icon
style={{ style={{
@@ -170,7 +173,7 @@ function _MenuItem({
? colors.selected.paragraph ? colors.selected.paragraph
: colors.secondary.icon : colors.secondary.icon
} }
size={SIZE.md} size={AppFontSize.md}
/> />
)} )}
@@ -178,7 +181,7 @@ function _MenuItem({
color={ color={
isFocused ? colors.primary.paragraph : colors.secondary.paragraph isFocused ? colors.primary.paragraph : colors.secondary.paragraph
} }
size={SIZE.sm} size={AppFontSize.sm}
> >
{item.title} {item.title}
</Paragraph> </Paragraph>
@@ -186,7 +189,7 @@ function _MenuItem({
{menuItemCount > 0 ? ( {menuItemCount > 0 ? (
<Paragraph <Paragraph
size={SIZE.xxs} size={AppFontSize.xxs}
color={ color={
isFocused ? colors.primary.paragraph : colors.secondary.paragraph isFocused ? colors.primary.paragraph : colors.secondary.paragraph
} }

View File

@@ -18,14 +18,66 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { View } from "react-native"; import { Image, View } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store"; import { NOTESNOOK_LOGO_SVG } from "../../assets/images/assets";
import { SIZE } from "../../utils/size"; import { useUserStore } from "../../stores/use-user-store";
import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { UserSheet } from "../sheets/user";
import AppIcon from "../ui/AppIcon";
import { IconButton, IconButtonProps } from "../ui/icon-button"; import { IconButton, IconButtonProps } from "../ui/icon-button";
import { Pressable } from "../ui/pressable";
import { SvgView } from "../ui/svg"; import { SvgView } from "../ui/svg";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
const SettingsIcon = () => {
const { colors } = useThemeColors();
const userProfile = useUserStore((state) => state.profile);
return (
<Pressable
onPress={() => {
UserSheet.present();
}}
style={{
width: 40,
height: 40
}}
>
{userProfile?.profilePicture ? (
<Image
source={{
uri: userProfile?.profilePicture
}}
style={{
width: 25,
height: 25,
borderRadius: 100
}}
/>
) : (
<AppIcon
name="cog-outline"
color={colors.primary.icon}
size={AppFontSize.lg}
/>
)}
{/* <Paragraph
color={colors.secondary.paragraph}
style={{
opacity: 1
}}
size={SIZE.xxxs - 1}
>
{userProfile?.fullName
? userProfile.fullName.split(" ")[0]
: strings.settings()}
</Paragraph> */}
</Pressable>
);
};
export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => { export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
const { colors, isDark } = useThemeColors(); const { colors, isDark } = useThemeColors();
return ( return (
@@ -34,7 +86,10 @@ export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
flexDirection: "row", flexDirection: "row",
justifyContent: "space-between", justifyContent: "space-between",
alignItems: "center", alignItems: "center",
marginBottom: DefaultAppStyles.GAP borderBottomWidth: 1,
borderBottomColor: colors.primary.border,
paddingBottom: DefaultAppStyles.GAP,
paddingHorizontal: DefaultAppStyles.GAP
}} }}
> >
<View <View
@@ -52,26 +107,10 @@ export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
borderRadius: 10 borderRadius: 10
}} }}
> >
<SvgView <SvgView width={28} height={28} src={NOTESNOOK_LOGO_SVG} />
width={28}
height={28}
src={`<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_24_33)">
<path d="M1024 0H0V1024H1024V0Z" fill="black"/>
<path d="M724.985 682.919C707.73 733.33 673.15 775.984 627.397 803.291C581.645 830.598 527.687 840.787 475.128 832.044C422.568 823.301 374.814 796.194 340.365 755.546C305.916 714.898 287.006 663.347 287 610.064V499.814L366.121 532.867V610.019C366.114 630.798 370.555 651.337 379.145 670.256C387.735 689.176 400.276 706.037 415.925 719.707C418.895 722.294 421.978 724.814 425.161 727.166C448.518 744.554 476.563 754.518 505.655 755.763C506.645 755.763 507.601 755.842 508.58 755.864C509.559 755.887 510.83 755.864 511.955 755.864C513.08 755.864 514.205 755.864 515.33 755.864C516.455 755.864 517.265 755.864 518.255 755.763C547.336 754.515 575.371 744.56 598.726 727.188C601.899 724.837 604.981 722.328 607.963 719.741C628.519 701.761 643.619 678.375 651.545 652.241L724.985 682.919Z" fill="white"/>
<path d="M737 414V610.065C737 612.596 737 615.139 736.842 617.67L657.879 584.651V414C657.866 376.316 643.272 340.099 617.154 312.934C591.035 285.77 555.419 269.766 517.765 268.274C480.11 266.782 443.339 279.918 415.154 304.931C386.968 329.944 369.554 364.893 366.56 402.457C366.279 406.26 366.121 410.119 366.121 414V462.712L287 429.637V189H512C571.674 189 628.903 212.705 671.099 254.901C713.295 297.097 737 354.326 737 414Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_24_33">
<rect width="1024" height="1024" rx="200" fill="white"/>
</clipPath>
</defs>
</svg>
`}
/>
</View> </View>
<Heading size={SIZE.lg}>Notesnook</Heading> <Heading size={AppFontSize.lg}>Notesnook</Heading>
</View> </View>
<View <View
@@ -90,22 +129,11 @@ export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
height: 28 height: 28
}} }}
color={colors.primary.icon} color={colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
/> />
))} ))}
<IconButton <SettingsIcon />
onPress={() => {
useThemeStore.getState().setColorScheme();
}}
style={{
width: 28,
height: 28
}}
color={colors.primary.icon}
name={isDark ? "weather-night" : "weather-sunny"}
size={SIZE.lg}
/>
</View> </View>
</View> </View>
); );

View File

@@ -22,7 +22,6 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { DraxProvider, DraxScrollView } from "react-native-drax"; import { DraxProvider, DraxScrollView } from "react-native-drax";
import { db } from "../../common/database"; import { db } from "../../common/database";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { useMenuStore } from "../../stores/use-menu-store"; import { useMenuStore } from "../../stores/use-menu-store";
import { useSettingStore } from "../../stores/use-setting-store"; import { useSettingStore } from "../../stores/use-setting-store";
import { MenuItemsList } from "../../utils/menu-items"; import { MenuItemsList } from "../../utils/menu-items";
@@ -51,15 +50,19 @@ export function SideMenuHome() {
width: "100%", width: "100%",
paddingTop: DefaultAppStyles.GAP_SMALL, paddingTop: DefaultAppStyles.GAP_SMALL,
backgroundColor: colors.primary.background, backgroundColor: colors.primary.background,
gap: DefaultAppStyles.GAP, gap: DefaultAppStyles.GAP
paddingHorizontal: DefaultAppStyles.GAP
}} }}
> >
<SideMenuHeader /> <SideMenuHeader />
{!isAppLoading && introCompleted ? ( {!isAppLoading && introCompleted ? (
<DraxProvider> <DraxProvider>
<DraxScrollView nestedScrollEnabled={false}> <DraxScrollView
nestedScrollEnabled={false}
style={{
paddingHorizontal: DefaultAppStyles.GAP
}}
>
<ReorderableList <ReorderableList
onListOrderChanged={(data) => { onListOrderChanged={(data) => {
db.settings.setSideBarOrder("routes", data); db.settings.setSideBarOrder("routes", data);

View File

@@ -0,0 +1,61 @@
/*
This file is part of the Notesnook project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from "react";
import { View } from "react-native";
import { SideMenuHeader } from "./side-menu-header";
import Paragraph from "../ui/typography/paragraph";
import { AppFontSize } from "../../utils/size";
import { useThemeColors } from "@notesnook/theme";
import { DefaultAppStyles } from "../../utils/styles";
type SideMenuListEmptyProps = {
placeholder: string;
};
export const SideMenuListEmpty = (props: SideMenuListEmptyProps) => {
const { colors } = useThemeColors();
return (
<View
style={{
width: "100%",
height: "100%"
}}
>
<View
style={{
backgroundColor: colors.primary.background,
paddingTop: DefaultAppStyles.GAP_SMALL
}}
>
<SideMenuHeader />
</View>
<View
style={{
alignItems: "center",
justifyContent: "center",
flexGrow: 1
}}
>
<Paragraph size={AppFontSize.xs} color={colors.secondary.paragraph}>
{props.placeholder}
</Paragraph>
</View>
</View>
);
};

View File

@@ -18,32 +18,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { Notebook } from "@notesnook/core"; import { Notebook } from "@notesnook/core";
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { FlatList, ListRenderItemInfo, View } from "react-native"; import { FlatList, TextInput, View } from "react-native";
import { UseBoundStore } from "zustand"; import { UseBoundStore } from "zustand";
import { db } from "../../common/database"; import { db } from "../../common/database";
import { useTotalNotes } from "../../hooks/use-db-item"; import { useTotalNotes } from "../../hooks/use-db-item";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import NotebookScreen from "../../screens/notebook"; import NotebookScreen from "../../screens/notebook";
import { import {
eSubscribeEvent, eSubscribeEvent,
eUnSubscribeEvent eUnSubscribeEvent
} from "../../services/event-manager"; } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { TreeItem } from "../../stores/create-notebook-tree-stores"; import { TreeItem } from "../../stores/create-notebook-tree-stores";
import { SelectionStore } from "../../stores/item-selection-store"; import { SelectionStore } from "../../stores/item-selection-store";
import useNavigationStore from "../../stores/use-navigation-store"; import useNavigationStore from "../../stores/use-navigation-store";
import { useNotebooks } from "../../stores/use-notebook-store"; import { useNotebooks } from "../../stores/use-notebook-store";
import { eOnNotebookUpdated } from "../../utils/events"; import { eOnNotebookUpdated } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize, defaultBorderRadius } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { Properties } from "../properties"; import { Properties } from "../properties";
import { AddNotebookSheet } from "../sheets/add-notebook";
import AppIcon from "../ui/AppIcon"; import AppIcon from "../ui/AppIcon";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { SideMenuHeader } from "./side-menu-header"; import { SideMenuHeader } from "./side-menu-header";
import { SideMenuListEmpty } from "./side-menu-list-empty";
import { import {
useSideMenuNotebookExpandedStore, useSideMenuNotebookExpandedStore,
useSideMenuNotebookSelectionStore, useSideMenuNotebookSelectionStore,
@@ -229,7 +230,7 @@ const NotebookItem = ({
width: "100%", width: "100%",
alignItems: "center", alignItems: "center",
flexDirection: "row", flexDirection: "row",
borderRadius: 5, borderRadius: defaultBorderRadius,
paddingRight: DefaultAppStyles.GAP_SMALL paddingRight: DefaultAppStyles.GAP_SMALL
}} }}
> >
@@ -240,10 +241,12 @@ const NotebookItem = ({
}} }}
> >
<IconButton <IconButton
size={SIZE.md} size={AppFontSize.md}
color={selected ? colors.selected.icon : colors.primary.icon} color={selected ? colors.selected.icon : colors.primary.icon}
onPress={() => { onPress={() => {
onToggleExpanded?.(); if (item.hasChildren) {
onToggleExpanded?.();
}
}} }}
top={0} top={0}
left={0} left={0}
@@ -252,16 +255,22 @@ const NotebookItem = ({
style={{ style={{
width: 32, width: 32,
height: 32, height: 32,
borderRadius: 5 borderRadius: defaultBorderRadius
}} }}
name={expanded ? "chevron-down" : "chevron-right"} name={
!item.hasChildren
? "book-outline"
: expanded
? "chevron-down"
: "chevron-right"
}
/> />
<Paragraph <Paragraph
color={ color={
isFocused ? colors.selected.paragraph : colors.secondary.paragraph isFocused ? colors.selected.paragraph : colors.secondary.paragraph
} }
size={SIZE.xs} size={AppFontSize.sm}
> >
{notebook?.title} {notebook?.title}
</Paragraph> </Paragraph>
@@ -290,7 +299,10 @@ const NotebookItem = ({
) : ( ) : (
<> <>
{totalNotes(notebook?.id) ? ( {totalNotes(notebook?.id) ? (
<Paragraph size={SIZE.xxs} color={colors.secondary.paragraph}> <Paragraph
size={AppFontSize.xxs}
color={colors.secondary.paragraph}
>
{totalNotes?.(notebook?.id)} {totalNotes?.(notebook?.id)}
</Paragraph> </Paragraph>
) : null} ) : null}
@@ -304,17 +316,36 @@ const NotebookItem = ({
export const SideMenuNotebooks = () => { export const SideMenuNotebooks = () => {
const tree = useSideMenuNotebookTreeStore((state) => state.tree); const tree = useSideMenuNotebookTreeStore((state) => state.tree);
const [notebooks, loading] = useNotebooks(); const [notebooks, loading] = useNotebooks();
const insets = useGlobalSafeAreaInsets(); const { colors } = useThemeColors();
const [filteredNotebooks, setFilteredNotebooks] = React.useState(notebooks);
const searchTimer = React.useRef<NodeJS.Timeout>();
const lastQuery = React.useRef<string>();
const loadRootNotebooks = React.useCallback(async () => { const loadRootNotebooks = React.useCallback(async () => {
if (!notebooks) return; if (!filteredNotebooks) return;
const _notebooks: Notebook[] = []; const _notebooks: Notebook[] = [];
for (let i = 0; i < notebooks.placeholders.length; i++) { for (let i = 0; i < filteredNotebooks.placeholders.length; i++) {
_notebooks[i] = (await notebooks?.item(i))?.item as Notebook; _notebooks[i] = (await filteredNotebooks?.item(i))?.item as Notebook;
} }
useSideMenuNotebookTreeStore.getState().addNotebooks("root", _notebooks, 0); useSideMenuNotebookTreeStore.getState().addNotebooks("root", _notebooks, 0);
}, [filteredNotebooks]);
const updateNotebooks = React.useCallback(() => {
if (lastQuery.current) {
db.lookup
.notebooks(lastQuery.current)
.sorted()
.then((filtered) => {
setFilteredNotebooks(filtered);
});
} else {
setFilteredNotebooks(notebooks);
}
}, [notebooks]); }, [notebooks]);
useEffect(() => {
updateNotebooks();
}, [updateNotebooks]);
useEffect(() => { useEffect(() => {
(async () => { (async () => {
if (!loading) { if (!loading) {
@@ -352,34 +383,71 @@ export const SideMenuNotebooks = () => {
}); });
}, []); }, []);
const renderItem = React.useCallback((info: ListRenderItemInfo<TreeItem>) => { const renderItem = React.useCallback(
return <NotebookItemWrapper index={info.index} item={info.item} />; (info: { item: TreeItem; index: number }) => {
}, []); return <NotebookItemWrapper index={info.index} item={info.item} />;
},
[]
);
return ( return (
<FlatList <View
style={{ style={{
paddingHorizontal: DefaultAppStyles.GAP, height: "100%"
paddingTop: DefaultAppStyles.GAP_SMALL
}} }}
data={tree} >
keyExtractor={(item) => item.notebook.id} {!notebooks || notebooks.placeholders.length === 0 ? (
windowSize={3} <SideMenuListEmpty
ListHeaderComponent={ placeholder={strings.emptyPlaceholders("notebook")}
<SideMenuHeader
rightButtons={[
{
name: "plus",
onPress: () => {
AddNotebookSheet.present();
}
}
]}
/> />
} ) : (
stickyHeaderIndices={[0]} <>
renderItem={renderItem} <FlatList
/> data={tree}
bounces={false}
bouncesZoom={false}
overScrollMode="never"
ListHeaderComponent={
<View
style={{
backgroundColor: colors.primary.background,
paddingTop: DefaultAppStyles.GAP_SMALL
}}
>
<SideMenuHeader />
</View>
}
renderItem={renderItem}
/>
<View
style={{
width: "100%",
paddingHorizontal: DefaultAppStyles.GAP,
backgroundColor: colors.primary.background,
borderTopColor: colors.primary.border,
borderTopWidth: 1
}}
>
<TextInput
placeholder="Filter notebooks..."
style={{
fontFamily: "Inter-Regular",
fontSize: AppFontSize.xs
}}
cursorColor={colors.primary.accent}
onChangeText={async (value) => {
searchTimer.current && clearTimeout(searchTimer.current);
searchTimer.current = setTimeout(async () => {
lastQuery.current = value;
updateNotebooks();
}, 500);
}}
placeholderTextColor={colors.primary.placeholder}
/>
</View>
</>
)}
</View>
); );
}; };
@@ -390,6 +458,7 @@ const NotebookItemWrapper = ({
item: TreeItem; item: TreeItem;
index: number; index: number;
}) => { }) => {
const { colors } = useThemeColors();
const expanded = useSideMenuNotebookExpandedStore( const expanded = useSideMenuNotebookExpandedStore(
(state) => state.expanded[item.notebook.id] (state) => state.expanded[item.notebook.id]
); );
@@ -425,26 +494,34 @@ const NotebookItemWrapper = ({
}, [item.notebook.id]); }, [item.notebook.id]);
return ( return (
<NotebookItem <View
item={item} style={{
index={index} paddingHorizontal: DefaultAppStyles.GAP,
expanded={expanded} marginTop: index === 0 ? DefaultAppStyles.GAP : 0
onToggleExpanded={() => {
useSideMenuNotebookExpandedStore
.getState()
.setExpanded(item.notebook.id);
}} }}
selected={selected} >
selectionEnabled={selectionEnabled} <NotebookItem
selectionStore={useSideMenuNotebookSelectionStore} item={item}
onItemUpdate={onItemUpdate} index={index}
focused={focused} expanded={expanded}
onPress={() => { onToggleExpanded={() => {
NotebookScreen.navigate(item.notebook, false); useSideMenuNotebookExpandedStore
}} .getState()
onLongPress={() => { .setExpanded(item.notebook.id);
Properties.present(item.notebook, false); }}
}} selected={selected}
/> selectionEnabled={selectionEnabled}
selectionStore={useSideMenuNotebookSelectionStore}
onItemUpdate={onItemUpdate}
focused={focused}
onPress={() => {
NotebookScreen.navigate(item.notebook, false);
Navigation.closeDrawer();
}}
onLongPress={() => {
Properties.present(item.notebook, false);
}}
/>
</View>
); );
}; };

View File

@@ -20,22 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Tag, VirtualizedGrouping } from "@notesnook/core"; import { Tag, VirtualizedGrouping } from "@notesnook/core";
import { useThemeColors } from "@notesnook/theme"; import { useThemeColors } from "@notesnook/theme";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { View } from "react-native"; import { TextInput, View } from "react-native";
import { FlashList } from "react-native-actions-sheet/dist/src/views/FlashList"; import { FlashList } from "@shopify/flash-list";
import { db } from "../../common/database"; import { DatabaseLogger, db } from "../../common/database";
import { useDBItem, useTotalNotes } from "../../hooks/use-db-item"; import { useDBItem, useTotalNotes } from "../../hooks/use-db-item";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { TaggedNotes } from "../../screens/notes/tagged"; import { TaggedNotes } from "../../screens/notes/tagged";
import useNavigationStore from "../../stores/use-navigation-store"; import useNavigationStore from "../../stores/use-navigation-store";
import { useTags } from "../../stores/use-tag-store"; import { useTags } from "../../stores/use-tag-store";
import { SIZE } from "../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles"; import { DefaultAppStyles } from "../../utils/styles";
import { Properties } from "../properties"; import { Properties } from "../properties";
import AppIcon from "../ui/AppIcon"; import AppIcon from "../ui/AppIcon";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
import { SideMenuHeader } from "./side-menu-header"; import { SideMenuHeader } from "./side-menu-header";
import { SideMenuListEmpty } from "./side-menu-list-empty";
import { useSideMenuTagsSelectionStore } from "./stores"; import { useSideMenuTagsSelectionStore } from "./stores";
import { strings } from "@notesnook/intl";
import Navigation from "../../services/navigation";
const TagItem = (props: { const TagItem = (props: {
tags: VirtualizedGrouping<Tag>; tags: VirtualizedGrouping<Tag>;
@@ -60,100 +62,120 @@ const TagItem = (props: {
} }
}, [item]); }, [item]);
return item ? ( return (
<Pressable <View
type={isSelected || isFocused ? "selected" : "transparent"}
onLongPress={() => {
Properties.present(item);
}}
testID={`tag-item-${props.id}`}
onPress={() => {
if (enabled) {
useSideMenuTagsSelectionStore
.getState()
.markAs(item, isSelected ? "deselected" : "selected");
if (
useSideMenuTagsSelectionStore.getState().getSelectedItemIds()
.length === 0
) {
useSideMenuTagsSelectionStore.setState({
enabled: false
});
}
} else {
TaggedNotes.navigate(item, false);
}
}}
style={{ style={{
justifyContent: "space-between", paddingHorizontal: DefaultAppStyles.GAP,
width: "100%", marginTop: (props.id as number) === 0 ? DefaultAppStyles.GAP : 0
alignItems: "center",
flexDirection: "row",
borderRadius: 5,
paddingRight: DefaultAppStyles.GAP_SMALL
}} }}
> >
<View {item ? (
style={{ <Pressable
flexDirection: "row", type={isSelected || isFocused ? "selected" : "transparent"}
alignItems: "center" onLongPress={() => {
}} Properties.present(item);
> }}
<View testID={`tag-item-${props.id}`}
onPress={() => {
if (enabled) {
useSideMenuTagsSelectionStore
.getState()
.markAs(item, isSelected ? "deselected" : "selected");
if (
useSideMenuTagsSelectionStore.getState().getSelectedItemIds()
.length === 0
) {
useSideMenuTagsSelectionStore.setState({
enabled: false
});
}
} else {
TaggedNotes.navigate(item, false);
Navigation.closeDrawer();
}
}}
style={{ style={{
width: 32, justifyContent: "space-between",
height: 32, width: "100%",
justifyContent: "center", alignItems: "center",
alignItems: "center" flexDirection: "row",
borderRadius: defaultBorderRadius,
paddingRight: DefaultAppStyles.GAP_SMALL
}} }}
> >
<AppIcon <View
size={SIZE.md} style={{
color={isFocused ? colors.selected.icon : colors.secondary.icon} flexDirection: "row",
name="pound" alignItems: "center"
/> }}
</View> >
<View
style={{
width: 32,
height: 32,
justifyContent: "center",
alignItems: "center"
}}
>
<AppIcon
size={AppFontSize.md}
color={isFocused ? colors.selected.icon : colors.secondary.icon}
name="pound"
/>
</View>
<Paragraph <Paragraph
color={ color={
isFocused ? colors.selected.paragraph : colors.secondary.paragraph isFocused
} ? colors.selected.paragraph
size={SIZE.xs} : colors.secondary.paragraph
> }
{item?.title} size={AppFontSize.sm}
</Paragraph> >
</View> {item?.title}
{enabled ? (
<View
style={{
width: 22,
height: 22,
justifyContent: "center",
alignItems: "center"
}}
>
<AppIcon
name={isSelected ? "checkbox-outline" : "checkbox-blank-outline"}
color={isSelected ? colors.selected.icon : colors.primary.icon}
/>
</View>
) : (
<>
{item?.id && totalNotes.totalNotes?.(item?.id) ? (
<Paragraph size={SIZE.xxs} color={colors.secondary.paragraph}>
{totalNotes.totalNotes(item?.id)}
</Paragraph> </Paragraph>
) : null} </View>
</>
)} {enabled ? (
</Pressable> <View
) : null; style={{
width: 22,
height: 22,
justifyContent: "center",
alignItems: "center"
}}
>
<AppIcon
name={
isSelected ? "checkbox-outline" : "checkbox-blank-outline"
}
color={isSelected ? colors.selected.icon : colors.primary.icon}
/>
</View>
) : (
<>
{item?.id && totalNotes.totalNotes?.(item?.id) ? (
<Paragraph
size={AppFontSize.xxs}
color={colors.secondary.paragraph}
>
{totalNotes.totalNotes(item?.id)}
</Paragraph>
) : null}
</>
)}
</Pressable>
) : null}
</View>
);
}; };
export const SideMenuTags = () => { export const SideMenuTags = () => {
const [tags] = useTags(); const [tags] = useTags();
const insets = useGlobalSafeAreaInsets(); const { colors } = useThemeColors();
const [filteredTags, setFilteredTags] = React.useState(tags);
const searchTimer = React.useRef<NodeJS.Timeout>();
const lastQuery = React.useRef<string>();
useEffect(() => { useEffect(() => {
useSideMenuTagsSelectionStore.setState({ useSideMenuTagsSelectionStore.setState({
@@ -180,28 +202,91 @@ export const SideMenuTags = () => {
}); });
}, []); }, []);
const updateTags = React.useCallback(() => {
if (lastQuery.current) {
console.log("Looking up...", lastQuery.current);
db.lookup
.tags(lastQuery.current.trim())
.sorted()
.then(async (filtered) => {
setFilteredTags(filtered);
});
} else {
setFilteredTags(tags);
}
}, [tags]);
useEffect(() => {
updateTags();
}, [updateTags]);
const renderItem = React.useCallback( const renderItem = React.useCallback(
(info: { index: number }) => { (info: { index: number }) => {
return <TagItem id={info.index} tags={tags!} />; return <TagItem id={info.index} tags={filteredTags!} />;
}, },
[tags] [filteredTags]
); );
return ( return (
<View <View
style={{ style={{
paddingHorizontal: DefaultAppStyles.GAP,
paddingTop: DefaultAppStyles.GAP_SMALL, paddingTop: DefaultAppStyles.GAP_SMALL,
width: "100%", width: "100%",
height: "100%" height: "100%"
}} }}
> >
<SideMenuHeader /> {!tags || tags?.placeholders.length === 0 ? (
<FlashList <SideMenuListEmpty placeholder={strings.emptyPlaceholders("tag")} />
data={tags?.placeholders} ) : (
estimatedItemSize={32} <>
renderItem={renderItem} <FlashList
/> data={filteredTags?.placeholders}
bounces={false}
estimatedItemSize={35}
bouncesZoom={false}
overScrollMode="never"
ListHeaderComponent={
<View
style={{
backgroundColor: colors.primary.background
}}
>
<SideMenuHeader />
</View>
}
renderItem={renderItem}
/>
<View
style={{
width: "100%",
paddingHorizontal: DefaultAppStyles.GAP,
backgroundColor: colors.primary.background,
borderTopColor: colors.primary.border,
borderTopWidth: 1
}}
>
<TextInput
placeholder="Filter tags..."
style={{
fontFamily: "Inter-Regular",
fontSize: AppFontSize.xs
}}
cursorColor={colors.primary.accent}
onChangeText={async (value) => {
searchTimer.current && clearTimeout(searchTimer.current);
searchTimer.current = setTimeout(async () => {
try {
lastQuery.current = value;
updateTags();
} catch (e) {
DatabaseLogger.error(e);
}
}, 500);
}}
placeholderTextColor={colors.primary.placeholder}
/>
</View>
</>
)}
</View> </View>
); );
}; };

View File

@@ -25,14 +25,13 @@ import { ActivityIndicator, Image, Platform, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import useSyncProgress from "../../hooks/use-sync-progress"; import useSyncProgress from "../../hooks/use-sync-progress";
import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation"; import Navigation from "../../services/navigation";
import Sync from "../../services/sync"; import Sync from "../../services/sync";
import { useThemeStore } from "../../stores/use-theme-store"; import { useThemeStore } from "../../stores/use-theme-store";
import { SyncStatus, useUserStore } from "../../stores/use-user-store"; import { SyncStatus, useUserStore } from "../../stores/use-user-store";
import { eOpenLoginDialog } from "../../utils/events";
import { fluidTabsRef } from "../../utils/global-refs"; import { fluidTabsRef } from "../../utils/global-refs";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { AuthMode } from "../auth/common";
import { IconButton } from "../ui/icon-button"; import { IconButton } from "../ui/icon-button";
import { Pressable } from "../ui/pressable"; import { Pressable } from "../ui/pressable";
import { TimeSince } from "../ui/time-since"; import { TimeSince } from "../ui/time-since";
@@ -97,7 +96,7 @@ export const UserStatus = () => {
) : ( ) : (
<Icon <Icon
name="cog-outline" name="cog-outline"
size={SIZE.lg - 2} size={AppFontSize.lg - 2}
color={colors.secondary.icon} color={colors.secondary.icon}
style={{ style={{
paddingLeft: 8 paddingLeft: 8
@@ -113,7 +112,7 @@ export const UserStatus = () => {
> >
<Paragraph <Paragraph
numberOfLines={1} numberOfLines={1}
size={SIZE.sm} size={AppFontSize.sm}
color={colors.primary.heading} color={colors.primary.heading}
> >
{!user || !userProfile?.fullName {!user || !userProfile?.fullName
@@ -125,7 +124,7 @@ export const UserStatus = () => {
style={{ style={{
flexWrap: "wrap" flexWrap: "wrap"
}} }}
size={SIZE.xs} size={AppFontSize.xs}
color={colors.secondary.heading} color={colors.secondary.heading}
> >
{!user ? ( {!user ? (
@@ -142,7 +141,7 @@ export const UserStatus = () => {
{!syncing ? ( {!syncing ? (
<TimeSince <TimeSince
style={{ style={{
fontSize: SIZE.xs, fontSize: AppFontSize.xs,
color: colors.secondary.paragraph color: colors.secondary.paragraph
}} }}
time={lastSynced} time={lastSynced}
@@ -184,7 +183,7 @@ export const UserStatus = () => {
}} }}
name="theme-light-dark" name="theme-light-dark"
color={isDark ? colors.primary.accent : colors.primary.icon} color={isDark ? colors.primary.accent : colors.primary.icon}
size={SIZE.lg} size={AppFontSize.lg}
style={{ style={{
borderRadius: 100, borderRadius: 100,
width: 40, width: 40,
@@ -207,7 +206,9 @@ export const UserStatus = () => {
Sync.run(); Sync.run();
} else { } else {
fluidTabsRef.current?.closeDrawer(); fluidTabsRef.current?.closeDrawer();
eSendEvent(eOpenLoginDialog); Navigation.navigate("Auth", {
mode: AuthMode.login
});
} }
}} }}
> >
@@ -215,13 +216,13 @@ export const UserStatus = () => {
syncing ? ( syncing ? (
<ActivityIndicator <ActivityIndicator
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.xl} size={AppFontSize.xl}
/> />
) : lastSyncStatus === SyncStatus.Failed ? ( ) : lastSyncStatus === SyncStatus.Failed ? (
<Icon <Icon
color={colors.error.icon} color={colors.error.icon}
name="sync-alert" name="sync-alert"
size={SIZE.lg} size={AppFontSize.lg}
allowFontScaling allowFontScaling
/> />
) : ( ) : (
@@ -229,14 +230,14 @@ export const UserStatus = () => {
allowFontScaling allowFontScaling
color={colors.primary.icon} color={colors.primary.icon}
name="sync" name="sync"
size={SIZE.lg} size={AppFontSize.lg}
/> />
) )
) : ( ) : (
<Icon <Icon
allowFontScaling allowFontScaling
color={colors.primary.accent} color={colors.primary.accent}
size={SIZE.lg} size={AppFontSize.lg}
name="login" name="login"
/> />
)} )}

View File

@@ -24,7 +24,7 @@ import { MMKV } from "../../common/database/mmkv";
import { eSendEvent, presentSheet } from "../../services/event-manager"; import { eSendEvent, presentSheet } from "../../services/event-manager";
import { TTip } from "../../services/tip-manager"; import { TTip } from "../../services/tip-manager";
import { eCloseSheet } from "../../utils/events"; import { eCloseSheet } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Seperator from "../ui/seperator"; import Seperator from "../ui/seperator";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
@@ -70,8 +70,8 @@ export const Tip = ({
<Button <Button
title={strings.tip()} title={strings.tip()}
icon="information" icon="information"
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
iconSize={SIZE.xs} iconSize={AppFontSize.xs}
style={{ style={{
width: undefined, width: undefined,
height: 22, height: 22,
@@ -91,8 +91,8 @@ export const Tip = ({
title={strings.neverShowAgain()} title={strings.neverShowAgain()}
type="secondary" type="secondary"
icon="close" icon="close"
fontSize={SIZE.xs} fontSize={AppFontSize.xs}
iconSize={SIZE.xs} iconSize={AppFontSize.xs}
onPress={() => { onPress={() => {
MMKV.setItem("neverShowSheetTips", "true"); MMKV.setItem("neverShowSheetTips", "true");
eSendEvent(eCloseSheet); eSendEvent(eCloseSheet);
@@ -114,7 +114,7 @@ export const Tip = ({
<Paragraph <Paragraph
style={textStyle} style={textStyle}
color={colors.primary.paragraph} color={colors.primary.paragraph}
size={SIZE.md} size={AppFontSize.md}
> >
{tip.text()} {tip.text()}
</Paragraph> </Paragraph>

View File

@@ -37,7 +37,7 @@ import {
} from "../../services/event-manager"; } from "../../services/event-manager";
import { getElevationStyle } from "../../utils/elevation"; import { getElevationStyle } from "../../utils/elevation";
import { eHideToast, eShowToast } from "../../utils/events"; import { eHideToast, eShowToast } from "../../utils/events";
import { SIZE } from "../../utils/size"; import { AppFontSize } from "../../utils/size";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import Heading from "../ui/typography/heading"; import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph"; import Paragraph from "../ui/typography/paragraph";
@@ -162,7 +162,7 @@ export const Toast = ({ context = "global" }) => {
? "information" ? "information"
: "close" : "close"
} }
size={isFullToastMessage ? SIZE.xxxl : SIZE.xl} size={isFullToastMessage ? AppFontSize.xxxl : AppFontSize.xl}
color={ color={
toastOptions?.icon toastOptions?.icon
? toastOptions?.icon ? toastOptions?.icon
@@ -185,7 +185,7 @@ export const Toast = ({ context = "global" }) => {
{isFullToastMessage ? ( {isFullToastMessage ? (
<Heading <Heading
color={!isDark ? colors.static.black : colors.static.white} color={!isDark ? colors.static.black : colors.static.white}
size={SIZE.sm} size={AppFontSize.sm}
> >
{toastOptions.heading} {toastOptions.heading}
</Heading> </Heading>
@@ -194,7 +194,7 @@ export const Toast = ({ context = "global" }) => {
{toastOptions.message || toastOptions.heading ? ( {toastOptions.message || toastOptions.heading ? (
<Paragraph <Paragraph
color={!isDark ? colors.static.black : colors.static.white} color={!isDark ? colors.static.black : colors.static.white}
size={SIZE.xs} size={AppFontSize.xs}
> >
{toastOptions.message || toastOptions.heading} {toastOptions.message || toastOptions.heading}
</Paragraph> </Paragraph>
@@ -205,7 +205,7 @@ export const Toast = ({ context = "global" }) => {
{toastOptions.func ? ( {toastOptions.func ? (
<Button <Button
testID={notesnook.toast.button} testID={notesnook.toast.button}
fontSize={SIZE.md} fontSize={AppFontSize.md}
type={toastOptions.type === "error" ? "errorShade" : "transparent"} type={toastOptions.type === "error" ? "errorShade" : "transparent"}
onPress={toastOptions.func} onPress={toastOptions.func}
title={toastOptions.actionText} title={toastOptions.actionText}

View File

@@ -20,7 +20,7 @@ import { useThemeColors } from "@notesnook/theme";
import React from "react"; import React from "react";
import { ColorValue, TextProps } from "react-native"; import { ColorValue, TextProps } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
export interface IconProps extends TextProps { export interface IconProps extends TextProps {
/** /**
@@ -48,6 +48,10 @@ export interface IconProps extends TextProps {
export default function AppIcon(props: IconProps) { export default function AppIcon(props: IconProps) {
const { colors } = useThemeColors(); const { colors } = useThemeColors();
return ( return (
<Icon size={SIZE.md} color={colors.primary.icon} {...(props as any)} /> <Icon
size={AppFontSize.md}
color={colors.primary.icon}
{...(props as any)}
/>
); );
} }

View File

@@ -30,7 +30,7 @@ import {
} from "react-native"; } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { useUserStore } from "../../../stores/use-user-store"; import { useUserStore } from "../../../stores/use-user-store";
import { SIZE } from "../../../utils/size"; import { defaultBorderRadius, AppFontSize } from "../../../utils/size";
import NativeTooltip from "../../../utils/tooltip"; import NativeTooltip from "../../../utils/tooltip";
import { ProTag } from "../../premium/pro-tag"; import { ProTag } from "../../premium/pro-tag";
import { Pressable, PressableProps, useButton } from "../pressable"; import { Pressable, PressableProps, useButton } from "../pressable";
@@ -66,9 +66,9 @@ export const Button = ({
loading = false, loading = false,
title = null, title = null,
icon, icon,
fontSize = SIZE.sm, fontSize = AppFontSize.sm,
type = "transparent", type = "transparent",
iconSize = SIZE.md, iconSize = AppFontSize.md,
style = {}, style = {},
accentColor, accentColor,
accentText = "#ffffff", accentText = "#ffffff",
@@ -127,7 +127,7 @@ export const Button = ({
? width * growFactor ? width * growFactor
: (width as DimensionValue) || undefined, : (width as DimensionValue) || undefined,
paddingHorizontal: 12, paddingHorizontal: 12,
borderRadius: 5, borderRadius: defaultBorderRadius,
alignSelf: "center", alignSelf: "center",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",

View File

@@ -22,7 +22,7 @@ import React from "react";
import { ColorValue, GestureResponderEvent, TextStyle } from "react-native"; import { ColorValue, GestureResponderEvent, TextStyle } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { RGB_Linear_Shade, hexToRGBA } from "../../../utils/colors"; import { RGB_Linear_Shade, hexToRGBA } from "../../../utils/colors";
import { SIZE } from "../../../utils/size"; import { AppFontSize } from "../../../utils/size";
import NativeTooltip from "../../../utils/tooltip"; import NativeTooltip from "../../../utils/tooltip";
import { Pressable, PressableProps } from "../pressable"; import { Pressable, PressableProps } from "../pressable";
export interface IconButtonProps extends PressableProps { export interface IconButtonProps extends PressableProps {
@@ -44,7 +44,7 @@ export const IconButton = ({
name, name,
color, color,
style, style,
size = SIZE.xxl, size = AppFontSize.xxl,
iconStyle = {}, iconStyle = {},
left = 10, left = 10,
right = 10, right = 10,

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