Skip to content

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

add some empty list placeholders

ammarahm-ed59301fe6fb5e
diff --git a/apps/mobile/src/common/common.js b/apps/mobile/src/common/common.js
index c13ee0f6d..fadae5dd4 100755
--- a/apps/mobile/src/common/common.js
+++ b/apps/mobile/src/common/common.js
@@ -57,14 +57,14 @@ export const COLOR_SCHEME_DARK = {
//FONT SIZE
export const SIZE = {
- xxs: 10 * PixelRatio.getFontScale(),
- xs: 12 * PixelRatio.getFontScale(),
- sm: 14 * PixelRatio.getFontScale(),
- md: 18 * PixelRatio.getFontScale(),
- lg: 24 * PixelRatio.getFontScale(),
- xl: 28 * PixelRatio.getFontScale(),
- xxl: 32 * PixelRatio.getFontScale(),
- xxxl: 36 * PixelRatio.getFontScale(),
+ xxs: 10,
+ xs: 12,
+ sm: 15,
+ md: 18,
+ lg: 24,
+ xl: 28,
+ xxl: 32,
+ xxxl: 36,
};
export const br = 5; // border radius
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 66cee95fc..e8eeaac06 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -241,7 +241,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
<Text
style={{
fontFamily: WEIGHT.regular,
- fontSize: SIZE.xs,
+ fontSize: SIZE.xs + 1,
color: colors.icon,
}}>
#{item}
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index e81318b51..b2a248e6b 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -255,12 +255,10 @@ const NoteItem = props => {
}}
textStyle={{
color: colors.pri,
-
fontFamily: WEIGHT.regular,
fontSize: SIZE.sm,
}}>
- <Icon name="arrow-left" size={SIZE.sm} color={colors.icon} />
- {' '}Restore
+ Restore
</MenuItem>
<MenuItem
onPress={() => {
@@ -273,29 +271,21 @@ const NoteItem = props => {
fontFamily: WEIGHT.regular,
fontSize: SIZE.sm,
}}>
- <Icon name="trash" size={SIZE.sm} color={colors.icon} />
- {' '}Remove
+ Remove
</MenuItem>
</>
) : (
<>
<MenuItem
- style={{
- height: 35,
- }}
textStyle={{
color: colors.pri,
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="star" size={SIZE.xs} color={colors.icon} />
- {' '}Pin
+ Pin
</MenuItem>
<MenuItem
- style={{
- height: 35,
- }}
onPress={() => {
hideMenu();
ToastEvent.show(
@@ -312,22 +302,17 @@ const NoteItem = props => {
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="star" size={SIZE.xs} color={colors.icon} />
- {' '}Favorite
+ Favorite
</MenuItem>
<MenuItem
- style={{
- height: 35,
- }}
textStyle={{
color: colors.pri,
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="share" size={SIZE.xs} color={colors.icon} />
- {' '}Share
+ Share
</MenuItem>
<MenuItem
@@ -341,34 +326,26 @@ const NoteItem = props => {
hideMore: true,
});
}}
- style={{
- height: 35,
- }}
textStyle={{
color: colors.pri,
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="arrow-right" size={SIZE.xs} color={colors.icon} />
- {' '}Move
+ Move
</MenuItem>
<MenuItem
onPress={() => {
show = 'vault';
hideMenu(true);
}}
- style={{
- height: 35,
- }}
textStyle={{
color: colors.pri,
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="lock" size={SIZE.xs} color={colors.icon} />
- {' '}Lock
+ Lock
</MenuItem>
<MenuItem
@@ -376,66 +353,12 @@ const NoteItem = props => {
show = 'delete';
hideMenu();
}}
- style={{
- height: 35,
- }}
textStyle={{
color: colors.pri,
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- <Icon name="trash" size={SIZE.xs} color={colors.icon} />
- {' '}Delete
- </MenuItem>
- <MenuDivider />
- <MenuItem
- disabled={true}
- textStyle={{
- color: colors.icon,
-
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.xxs,
- }}
- style={{
- paddingVertical: 0,
- margin: 0,
- height: 35,
- }}>
- Notebook: School Notes
- </MenuItem>
- <MenuItem
- disabled={true}
- textStyle={{
- color: colors.icon,
-
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.xxs,
- }}
- style={{
- paddingVertical: 0,
- margin: 0,
- height: 35,
- paddingBottom: 10,
- }}>
- {' '}- Topic: Physics
- </MenuItem>
-
- <MenuItem
- disabled={true}
- textStyle={{
- color: colors.icon,
- height: 35,
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.xxs,
- }}
- style={{
- paddingVertical: 0,
- margin: 0,
- height: 35,
- paddingBottom: 10,
- }}>
- Created on:{' '}
- {new Date(item.dateCreated).toISOString().slice(0, 10)}
+ Delete
</MenuItem>
</>
)}
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 8b91aac9d..4a5ed5db5 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -10,7 +10,9 @@ import {
import {SIZE, WEIGHT} from '../../common/common';
import NoteItem from '../NoteItem';
import {DDS} from '../../../App';
+import * as Animatable from 'react-native-animatable';
import {useAppContext} from '../../provider/useAppContext';
+import Icon from 'react-native-vector-icons/Feather';
export const NotesList = ({
keyword = null,
notes,
@@ -18,31 +20,40 @@ export const NotesList = ({
onScroll,
isSearch = false,
isGrouped = false,
+ isFavorites = false,
+ emptyPlaceholderText = '',
refresh = () => {},
}) => {
const {colors} = useAppContext();
const [numColumns, setNumColumns] = useState(1);
+
+ const slideRight = {
+ 0: {
+ transform: [{translateX: -4}],
+ },
+ 0.5: {
+ transform: [{translateX: 0}],
+ },
+ 1: {
+ transform: [{translateX: 4}],
+ },
+ };
+ const slideLeft = {
+ 0: {
+ transform: [{translateX: 4}],
+ },
+ 0.5: {
+ transform: [{translateX: 0}],
+ },
+ 1: {
+ transform: [{translateX: -4}],
+ },
+ };
+
return isGrouped ? (
<SectionList
sections={notes}
keyExtractor={(item, index) => item.dateCreated.toString()}
- ListFooterComponent={
- <View
- style={{
- height: 150,
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Text
- style={{
- color: colors.navbg,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
- }}>
- - End -
- </Text>
- </View>
- }
renderSectionHeader={({section: {title}}) => (
<Text
style={{
@@ -51,6 +62,7 @@ export const NotesList = ({
color: colors.accent,
width: DDS.isTab ? '95%' : '90%',
alignSelf: 'center',
+ marginTop: 15,
paddingBottom: 5,
}}>
{title}
@@ -60,14 +72,212 @@ export const NotesList = ({
y = event.nativeEvent.contentOffset.y;
onScroll(y);
}}
+ ListEmptyComponent={
+ <View
+ style={{
+ height: '80%',
+ width: '100%',
+ alignItems: 'center',
+ alignSelf: 'center',
+ justifyContent: 'center',
+ opacity: 0.8,
+ }}>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ easing="ease-in"
+ iterationDelay={0}
+ direction="alternate"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ easing="ease-in"
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ useNativeDriver={true}
+ iterationDelay={0}
+ direction="alternate"
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+
+ <Text
+ style={{
+ color: colors.icon,
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ marginTop: 20,
+ }}>
+ Notes you write show up here.
+ </Text>
+ </View>
+ }
ListHeaderComponent={
<View
style={{
- marginTop: Platform.OS == 'ios' ? 145 : 185,
+ marginTop:
+ Platform.OS == 'ios'
+ ? notes[0]
+ ? 135
+ : 135 - 60
+ : notes[0]
+ ? 175
+ : 175 - 60,
}}>
{notes[0] ? (
<>
- <NoteItem
+ {/* <NoteItem
customStyle={{
backgroundColor: colors.shade,
width: '100%',
@@ -96,7 +306,7 @@ export const NotesList = ({
item={notes[0].data[1]}
numColumns={1}
index={0}
- />
+ /> */}
</>
) : null}
</View>
@@ -104,23 +314,26 @@ export const NotesList = ({
contentContainerStyle={{
width: '100%',
alignSelf: 'center',
+ height: '100%',
}}
ListFooterComponent={
- <View
- style={{
- height: 150,
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Text
+ notes[0] ? (
+ <View
style={{
- color: colors.navbg,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
+ height: 150,
+ alignItems: 'center',
+ justifyContent: 'center',
}}>
- - End -
- </Text>
- </View>
+ <Text
+ style={{
+ color: colors.navbg,
+ fontSize: SIZE.sm,
+ fontFamily: WEIGHT.regular,
+ }}>
+ - End -
+ </Text>
+ </View>
+ ) : null
}
renderItem={({item, index}) => (
<NoteItem
@@ -152,6 +365,236 @@ export const NotesList = ({
</Text>
</View>
}
+ ListEmptyComponent={
+ <View
+ style={{
+ height: '80%',
+ width: '100%',
+ alignItems: 'center',
+ alignSelf: 'center',
+ justifyContent: 'center',
+ opacity: 0.8,
+ }}>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ {isFavorites ? (
+ <Icon
+ name="star"
+ size={SIZE.xl}
+ color={colors.accent}
+ style={{
+ position: 'absolute',
+ right: 5,
+ bottom: 0,
+ }}
+ />
+ ) : null}
+
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ {isFavorites ? (
+ <Icon
+ name="star"
+ size={SIZE.xl}
+ color={colors.accent}
+ style={{
+ position: 'absolute',
+ right: 5,
+ bottom: 0,
+ }}
+ />
+ ) : null}
+
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ {isFavorites ? (
+ <Icon
+ name="star"
+ size={SIZE.xl}
+ color={colors.accent}
+ style={{
+ position: 'absolute',
+ right: 5,
+ bottom: 0,
+ }}
+ />
+ ) : null}
+
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+
+ <Text
+ style={{
+ color: colors.pri,
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ marginTop: 20,
+ }}>
+ {emptyPlaceholderText}
+ </Text>
+ </View>
+ }
onScroll={event => {
y = event.nativeEvent.contentOffset.y;
onScroll(y);
@@ -159,12 +602,20 @@ export const NotesList = ({
ListHeaderComponent={
<View
style={{
- marginTop: Platform.OS == 'ios' ? 145 : 185,
+ marginTop:
+ Platform.OS == 'ios'
+ ? notes[0]
+ ? 175
+ : 135 - 60
+ : notes[0]
+ ? 175
+ : 175 - 60,
}}></View>
}
contentContainerStyle={{
width: '100%',
alignSelf: 'center',
+ height: '100%',
}}
ListFooterComponent={
<View
diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js
index af27fb422..416260bb3 100644
--- a/apps/mobile/src/components/header/index.js
+++ b/apps/mobile/src/components/header/index.js
@@ -79,7 +79,7 @@ export const Header = ({
alignItems: 'flex-start',
height: 40,
marginTop: 2.5,
- width: 40,
+ width: 60,
}}>
<Icon color={colors.pri} name={'menu'} size={SIZE.xxxl - 3} />
</TouchableOpacity>
@@ -96,25 +96,40 @@ export const Header = ({
{heading}
</Text>
</View>
- <Animatable.View
- transition="opacity"
- duration={500}
+ <View
style={{
- opacity: hide ? 1 : 0,
+ flexDirection: 'row',
+ alignItems: 'center',
}}>
+ <Animatable.View
+ transition="opacity"
+ duration={500}
+ style={{
+ opacity: hide ? 1 : 0,
+ }}>
+ <TouchableOpacity
+ onPress={() => showSearch()}
+ style={{
+ justifyContent: 'center',
+ alignItems: 'flex-end',
+ height: 40,
+ width: 60,
+ paddingRight: 0,
+ }}>
+ <Icon name={'search'} size={SIZE.xl} color={colors.icon} />
+ </TouchableOpacity>
+ </Animatable.View>
<TouchableOpacity
- onPress={() => showSearch()}
style={{
justifyContent: 'center',
alignItems: 'flex-end',
height: 40,
width: 60,
paddingRight: 0,
- marginTop: 7,
}}>
- <Icon name={'search'} size={SIZE.xl} color={colors.icon} />
+ <Icon name="more-vertical" size={SIZE.xl} color={colors.pri} />
</TouchableOpacity>
- </Animatable.View>
+ </View>
</Animatable.View>
);
};
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index e98ba02b8..5e8d97c22 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -80,12 +80,14 @@ export const Favorites = ({navigation}) => {
canGoBack={false}
customIcon="menu"
/>
- <Search
- clear={() => setText('')}
- hide={hideHeader}
- placeholder="Search your notes"
- value={text}
- />
+ {favs.length > 0 ? (
+ <Search
+ clear={() => setText('')}
+ hide={hideHeader}
+ placeholder="Search your notes"
+ value={text}
+ />
+ ) : null}
</Animatable.View>
<NotesList
@@ -109,7 +111,9 @@ export const Favorites = ({navigation}) => {
}
offsetY = y;
}}
+ isFavorites={true}
isSearch={false}
+ emptyPlaceholderText="Your favorite notes will appear here"
notes={favs}
keyword={''}
/>
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index 026f59084..2eb97a980 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -174,18 +174,19 @@ export const Home = ({navigation}) => {
canGoBack={false}
customIcon="menu"
/>
-
- <Search
- clear={() => setText('')}
- hide={hideHeader}
- onChangeText={onChangeText}
- onSubmitEditing={onSubmitEditing}
- placeholder="Search your notes"
- onBlur={onBlur}
- onFocus={onFocus}
- clearSearch={clearSearch}
- value={text}
- />
+ {notes[0] ? (
+ <Search
+ clear={() => setText('')}
+ hide={hideHeader}
+ onChangeText={onChangeText}
+ onSubmitEditing={onSubmitEditing}
+ placeholder="Search your notes"
+ onBlur={onBlur}
+ onFocus={onFocus}
+ clearSearch={clearSearch}
+ value={text}
+ />
+ ) : null}
</Animatable.View>
<NotesList
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index 0c31da531..6debd4e66 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -166,29 +166,8 @@ export const Notebook = ({navigation}) => {
}
numColumns={numColumns}
key={numColumns}
- columnWrapperStyle={
- numColumns === 1
- ? null
- : {
- width:
- params.notebook.topics.length === 1
- ? DDS.isTab
- ? '95%'
- : '90%'
- : DDS.isTab
- ? '45%'
- : '42.5%',
- }
- }
contentContainerStyle={{
- width:
- numColumns === 2
- ? DDS.isTab
- ? '100%'
- : null
- : DDS.isTab
- ? '95%'
- : '90%',
+ width: '100%',
alignItems: numColumns === 2 ? 'flex-start' : null,
alignSelf: 'center',
}}