Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

update tip manager

ammarahm-edad8a9d3d1498
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index 80151f639..5d92b3e0b 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -16,6 +16,7 @@ import Seperator from '../Seperator';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
import { Properties } from '../Properties';
+import { Notice } from '../Notice';
export const TagsSection = () => {
const menuPins = useMenuStore(state => state.menuPins);
@@ -78,6 +79,13 @@ export const TagsSection = () => {
style={{
flexGrow: 1
}}
+ ListEmptyComponent={
+ <Notice
+ size="small"
+ type="information"
+ text="Add shortcuts for notebooks, topics and tags here."
+ />
+ }
contentContainerStyle={{
flexGrow: 1
}}
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 238cb5bb9..2cbfb7e21 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -1,6 +1,5 @@
import React from 'react';
import { FlatList, View } from 'react-native';
-import Animated from 'react-native-reanimated';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { notesnook } from '../../../e2e/test.ids';
import { useTracked } from '../../provider';
@@ -8,7 +7,6 @@ import { Actions } from '../../provider/Actions';
import { useSettingStore, useUserStore } from '../../provider/stores';
import { DDS } from '../../services/DeviceDetection';
import { eSendEvent } from '../../services/EventManager';
-import { DrawerScale } from '../../utils/Animations';
import {
ACCENT,
COLOR_SCHEME,
@@ -79,19 +77,13 @@ export const Menu = React.memo(
backgroundColor: colors.nav
}}
>
- <Animated.View
+ <View
style={{
height: '100%',
width: '100%',
backgroundColor: deviceMode !== 'mobile' ? colors.nav : colors.bg,
-
paddingTop: insets.top,
- borderRadius: 10,
- transform: [
- {
- scale: deviceMode !== 'mobile' ? 1 : DrawerScale
- }
- ]
+ borderRadius: 10
}}
>
<FlatList
@@ -150,7 +142,7 @@ export const Menu = React.memo(
>
<UserSection noTextMode={noTextMode} />
</View>
- </Animated.View>
+ </View>
</View>
);
},
diff --git a/apps/mobile/src/components/Notice/index.js b/apps/mobile/src/components/Notice/index.js
index 4094842a6..ac22594a6 100644
--- a/apps/mobile/src/components/Notice/index.js
+++ b/apps/mobile/src/components/Notice/index.js
@@ -1,12 +1,14 @@
import React from 'react';
import { View } from 'react-native';
import { useTracked } from '../../provider';
+import { SIZE } from '../../utils/SizeUtils';
import { ActionIcon } from '../ActionIcon';
import Paragraph from '../Typography/Paragraph';
-export const Notice = ({ type, text }) => {
+export const Notice = ({ type, text, size }) => {
const [state] = useTracked();
const colors = state.colors;
+ const isSmall = size === 'small';
return (
<View
@@ -14,15 +16,24 @@ export const Notice = ({ type, text }) => {
padding: 12,
flexDirection: 'row',
backgroundColor: colors.nav,
- borderRadius: 10
+ borderRadius: isSmall ? 5 : 10
}}
>
- <ActionIcon name={type} color={type === 'alert' ? colors.errorText : colors.icon} />
+ <ActionIcon
+ size={isSmall ? SIZE.xs + 1 : SIZE.xxl}
+ name={type}
+ customStyle={{
+ width: isSmall ? null : 40,
+ height: isSmall ? null : 40
+ }}
+ color={type === 'alert' ? colors.errorText : colors.accent}
+ />
<Paragraph
style={{
marginLeft: 10,
flexShrink: 1
}}
+ size={isSmall ? SIZE.xs + 1 : SIZE.sm}
>
{text}
</Paragraph>
diff --git a/apps/mobile/src/components/SimpleList/empty.js b/apps/mobile/src/components/SimpleList/empty.js
index 776e9b70e..985f1d6ab 100644
--- a/apps/mobile/src/components/SimpleList/empty.js
+++ b/apps/mobile/src/components/SimpleList/empty.js
@@ -1,20 +1,16 @@
import React from 'react';
-import { ActivityIndicator, Image, useWindowDimensions, View } from 'react-native';
+import { useWindowDimensions, View } from 'react-native';
+import * as Progress from 'react-native-progress';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { notesnook } from '../../../e2e/test.ids';
import { useTracked } from '../../provider';
-import { TipManager, useTip } from '../../services/tip-manager';
-import { getElevation } from '../../utils';
+import { useTip } from '../../services/tip-manager';
import { COLORS_NOTE } from '../../utils/Colors';
-import { normalize, SIZE } from '../../utils/SizeUtils';
+import { SIZE } from '../../utils/SizeUtils';
import { Button } from '../Button';
-import { Placeholder } from '../ListPlaceholders';
-import Seperator from '../Seperator';
import { Tip } from '../Tip';
-import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-export const Empty = ({ loading = true, placeholderData, absolute, headerProps, type, screen }) => {
+export const Empty = ({ loading = true, placeholderData, headerProps, type, screen }) => {
const [state] = useTracked();
const { colors } = state;
const insets = useSafeAreaInsets();
@@ -23,47 +19,79 @@ export const Empty = ({ loading = true, placeholderData, absolute, headerProps,
screen === 'Notes' ? 'first-note' : placeholderData.type || type,
screen === 'Notes' ? 'notes' : null
);
+ const color =
+ colors[COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'];
return (
<View
style={[
{
- position: absolute ? 'absolute' : 'relative',
- zIndex: absolute ? 10 : null,
- height: height - 140 - insets.top,
+ height: height - (140 + insets.top),
width: '80%',
justifyContent: 'center',
alignSelf: 'center'
}
]}
>
- <Tip
- color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
- tip={tip}
- />
{!loading ? (
- <Button
- type="accent"
- title={placeholderData.button}
- iconPosition="right"
- icon="arrow-right"
- onPress={placeholderData.action}
- accentColor={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
- accentText="light"
- style={{
- marginTop: 10,
- alignSelf: 'flex-start',
- borderRadius: 100,
- height: 40
- }}
- />
+ <>
+ <Tip
+ color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
+ tip={tip}
+ style={{
+ backgroundColor: 'transparent',
+ paddingHorizontal: 0
+ }}
+ />
+ {placeholderData.button && (
+ <Button
+ type="grayAccent"
+ title={placeholderData.button}
+ iconPosition="right"
+ icon="arrow-right"
+ onPress={placeholderData.action}
+ accentColor={
+ COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'
+ }
+ accentText="light"
+ style={{
+ alignSelf: 'flex-start',
+ borderRadius: 5,
+ height: 40
+ }}
+ />
+ )}
+ </>
) : (
- <ActivityIndicator
- style={{
- height: 35
- }}
- color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}
- />
+ <>
+ <View
+ style={{
+ alignSelf: 'center',
+ alignItems: 'center'
+ }}
+ >
+ <Progress.Bar
+ unfilledColor={colors.nav}
+ borderWidth={0}
+ indeterminate
+ width={70}
+ color={color}
+ indeterminateAnimationDuration={2000}
+ borderRadius={100}
+ />
+ <Paragraph
+ style={{
+ textAlign: 'center',
+ marginTop: 5
+ }}
+ size={SIZE.md}
+ textBreakStrategy="balanced"
+ color={colors.icon}
+ >
+ {loading ? placeholderData.loading : placeholderData.paragraph}
+ </Paragraph>
+ </View>
+ </>
)}
</View>
);
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index bb96bfddb..2eafc3488 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -118,7 +118,6 @@ const SimpleList = ({
);
let styles = {
- height: '100%',
width: '100%',
minHeight: 1,
minWidth: 1,
diff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.js
index 867ff7671..a9a7c728f 100644
--- a/apps/mobile/src/components/SimpleList/sectionheader.js
+++ b/apps/mobile/src/components/SimpleList/sectionheader.js
@@ -37,6 +37,7 @@ export const SectionHeader = ({ item, index, type, color, screen }) => {
useTooltipHandler('sectionheader', () => {
let popup =
TipManager.popup('sortmenu') || TipManager.popup('jumpto') || TipManager.popup('compactmode');
+ if (!popup) return;
switch (popup.id) {
case 'sortmenu':
tooltip.show(sortRef, popup.text, 'top');
diff --git a/apps/mobile/src/components/Tip/index.tsx b/apps/mobile/src/components/Tip/index.tsx
index cf7e6322d..847290afe 100644
--- a/apps/mobile/src/components/Tip/index.tsx
+++ b/apps/mobile/src/components/Tip/index.tsx
@@ -1,8 +1,10 @@
import React from 'react';
import { Image, TextStyle, View, ViewStyle } from 'react-native';
import { useTracked } from '../../provider';
-import { presentSheet } from '../../services/EventManager';
+import { eSendEvent, presentSheet } from '../../services/EventManager';
import { TTip } from '../../services/tip-manager';
+import { eCloseProgressDialog } from '../../utils/Events';
+import { MMKV } from '../../utils/mmkv';
import { SIZE } from '../../utils/SizeUtils';
import { Button } from '../Button';
import Seperator from '../Seperator';
@@ -49,11 +51,9 @@ export const Tip = ({
<Button
//@ts-ignore
title="TIP"
- type="grayAccent"
icon="information"
fontSize={SIZE.xs}
iconSize={SIZE.xs}
- accentText={color}
style={{
width: null,
height: 22,
@@ -74,6 +74,10 @@ export const Tip = ({
icon="close"
fontSize={SIZE.xs}
iconSize={SIZE.xs}
+ onPress={() => {
+ MMKV.setItem('neverShowSheetTips', 'true');
+ eSendEvent(eCloseProgressDialog);
+ }}
style={{
width: null,
height: 25,
@@ -92,16 +96,22 @@ export const Tip = ({
{tip.text}
</Paragraph>
{tip.image && !noImage && (
- <Image
- source={{ uri: tip.image }}
+ <View
style={{
- width: '100%',
- height: 200,
- marginTop: 10,
borderRadius: 10,
- alignSelf: 'center'
+ overflow: 'hidden',
+ marginTop: 10
}}
- />
+ >
+ <Image
+ source={{ uri: tip.image }}
+ style={{
+ width: '100%',
+ height: 230,
+ alignSelf: 'center'
+ }}
+ />
+ </View>
)}
{tip.button && (
@@ -127,9 +137,10 @@ export const Tip = ({
) : null;
};
-Tip.present = (tip: TTip) => {
+Tip.present = async (tip: TTip) => {
if (!tip) return;
- console.log(tip);
+ let dontShow = await MMKV.getItem('neverShowSheetTips');
+ if (dontShow) return;
presentSheet({
component: (
<Tip
diff --git a/apps/mobile/src/services/tipmanager.ts b/apps/mobile/src/services/tipmanager.ts
index 0b9a49f89..5726a5c79 100644
--- a/apps/mobile/src/services/tipmanager.ts
+++ b/apps/mobile/src/services/tipmanager.ts
@@ -29,29 +29,25 @@ type Context =
export type TTip = {
text: string;
contexts: Context[];
- image: string;
+ image?: string;
button?: TipButton;
};
const tips: TTip[] = [
{
text: 'You can swipe left anywhere in the app to start a new note',
- image: 'https://picsum.photos/400/500',
contexts: ['notes', 'first-note']
},
{
text: 'Long press on any item in list to open quick actions menu.',
- image: 'https://picsum.photos/400/500',
contexts: ['notes', 'notebook', 'notebook', 'tags']
},
{
text: 'Monographs enable you to share your notes in a secure and private way',
- image: 'https://picsum.photos/400/500',
contexts: ['monographs']
},
{
text: 'Monographs can be encrypted with a secret key and shared with anyone',
- image: 'https://picsum.photos/400/500',
contexts: ['monographs']
}
];
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index 27df7469c..28e371f53 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -117,11 +117,11 @@ export const Home = ({ navigation }) => {
placeholderText={`Notes you write appear here`}
jumpToDialog={true}
placeholderData={{
- heading: 'Your notes',
+ heading: 'Notes',
paragraph: 'You have not added any notes yet.',
button: 'Add your first note',
action: _onPressBottomButton,
- loading: 'Loading your notes.'
+ loading: 'Loading your notes'
}}
/>