mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
add folders and favorites
This commit is contained in:
@@ -4,6 +4,8 @@ import Home from '../views/Home/index';
|
|||||||
import Editor from '../views/Editor';
|
import Editor from '../views/Editor';
|
||||||
import Reminders from '../views/Reminders';
|
import Reminders from '../views/Reminders';
|
||||||
import Lists from '../views/Lists';
|
import Lists from '../views/Lists';
|
||||||
|
import Folders from '../views/Folders';
|
||||||
|
import Favorites from '../views/Favorites';
|
||||||
|
|
||||||
const TopLevelNavigator = createStackNavigator(
|
const TopLevelNavigator = createStackNavigator(
|
||||||
{
|
{
|
||||||
@@ -19,6 +21,12 @@ const TopLevelNavigator = createStackNavigator(
|
|||||||
Lists: {
|
Lists: {
|
||||||
screen: Lists,
|
screen: Lists,
|
||||||
},
|
},
|
||||||
|
Folders: {
|
||||||
|
screen: Folders,
|
||||||
|
},
|
||||||
|
Favorites: {
|
||||||
|
screen: Favorites,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
initialRouteName: 'Home',
|
initialRouteName: 'Home',
|
||||||
|
|||||||
62
apps/mobile/src/views/Favorites/index.js
Normal file
62
apps/mobile/src/views/Favorites/index.js
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import React, {useEffect, useState} from 'react';
|
||||||
|
import {
|
||||||
|
ScrollView,
|
||||||
|
View,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
Dimensions,
|
||||||
|
Image,
|
||||||
|
SafeAreaView,
|
||||||
|
Platform,
|
||||||
|
} from 'react-native';
|
||||||
|
import NavigationService from '../../services/NavigationService';
|
||||||
|
import {
|
||||||
|
COLOR_SCHEME,
|
||||||
|
SIZE,
|
||||||
|
br,
|
||||||
|
ph,
|
||||||
|
pv,
|
||||||
|
opacity,
|
||||||
|
FONT,
|
||||||
|
WEIGHT,
|
||||||
|
} from '../../common/common';
|
||||||
|
import Icon from 'react-native-vector-icons/Ionicons';
|
||||||
|
import {Reminder} from '../../components/Reminder';
|
||||||
|
import {ListItem} from '../../components/ListItem';
|
||||||
|
|
||||||
|
const w = Dimensions.get('window').width;
|
||||||
|
const h = Dimensions.get('window').height;
|
||||||
|
|
||||||
|
export const Favorites = ({navigation}) => {
|
||||||
|
const [colors, setColors] = useState(COLOR_SCHEME);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
paddingHorizontal: '5%',
|
||||||
|
marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,
|
||||||
|
marginBottom: h * 0.04,
|
||||||
|
}}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: SIZE.xxl,
|
||||||
|
color: colors.pri,
|
||||||
|
fontFamily: WEIGHT.bold,
|
||||||
|
}}>
|
||||||
|
Favorites
|
||||||
|
</Text>
|
||||||
|
<Icon name="md-more" color={colors.icon} size={SIZE.xxl} />
|
||||||
|
</View>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Favorites.navigationOptions = {
|
||||||
|
header: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Favorites;
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
import React, {useEffect, useState} from 'react';
|
||||||
|
import {
|
||||||
|
ScrollView,
|
||||||
|
View,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
Dimensions,
|
||||||
|
Image,
|
||||||
|
SafeAreaView,
|
||||||
|
Platform,
|
||||||
|
} from 'react-native';
|
||||||
|
import NavigationService from '../../services/NavigationService';
|
||||||
|
import {
|
||||||
|
COLOR_SCHEME,
|
||||||
|
SIZE,
|
||||||
|
br,
|
||||||
|
ph,
|
||||||
|
pv,
|
||||||
|
opacity,
|
||||||
|
FONT,
|
||||||
|
WEIGHT,
|
||||||
|
} from '../../common/common';
|
||||||
|
import Icon from 'react-native-vector-icons/Ionicons';
|
||||||
|
import {Reminder} from '../../components/Reminder';
|
||||||
|
import {ListItem} from '../../components/ListItem';
|
||||||
|
import {getElevation} from '../../utils/utils';
|
||||||
|
import {FlatList} from 'react-native-gesture-handler';
|
||||||
|
|
||||||
|
const w = Dimensions.get('window').width;
|
||||||
|
const h = Dimensions.get('window').height;
|
||||||
|
|
||||||
|
export const Folders = ({navigation}) => {
|
||||||
|
const [colors, setColors] = useState(COLOR_SCHEME);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
paddingHorizontal: '5%',
|
||||||
|
marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,
|
||||||
|
marginBottom: h * 0.04,
|
||||||
|
}}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: SIZE.xxl,
|
||||||
|
color: colors.pri,
|
||||||
|
fontFamily: WEIGHT.bold,
|
||||||
|
}}>
|
||||||
|
Folders
|
||||||
|
</Text>
|
||||||
|
<Icon name="md-more" color={colors.icon} size={SIZE.xxl} />
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<FlatList
|
||||||
|
numColumns={2}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
columnWrapperStyle={{
|
||||||
|
paddingHorizontal: '5%',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
data={[
|
||||||
|
{
|
||||||
|
name: 'Class Notes',
|
||||||
|
Qty: '8',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Notes of water tabs',
|
||||||
|
Qty: '3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'My Lists',
|
||||||
|
Qty: '3',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
renderItem={({item, index}) => (
|
||||||
|
<View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
...getElevation(5),
|
||||||
|
width: w * 0.4,
|
||||||
|
height: w * 0.3,
|
||||||
|
borderRadius: 5,
|
||||||
|
backgroundColor: colors.accent,
|
||||||
|
alignItems: 'flex-end',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
padding: 5,
|
||||||
|
}}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontFamily: WEIGHT.regular,
|
||||||
|
fontSize: SIZE.lg,
|
||||||
|
color: 'white',
|
||||||
|
opacity: 0.5,
|
||||||
|
}}>
|
||||||
|
{item.Qty} Files
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontFamily: WEIGHT.bold,
|
||||||
|
fontSize: SIZE.md,
|
||||||
|
color: colors.pri,
|
||||||
|
maxWidth: w * 0.4,
|
||||||
|
}}>
|
||||||
|
{item.name}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Folders.navigationOptions = {
|
||||||
|
header: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Folders;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React, {useEffect, useState, createRef} from 'react';
|
||||||
import {
|
import {
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View,
|
View,
|
||||||
@@ -35,25 +35,13 @@ const h = Dimensions.get('window').height;
|
|||||||
export const Home = ({navigation}) => {
|
export const Home = ({navigation}) => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [colors, setColors] = useState(COLOR_SCHEME);
|
const [colors, setColors] = useState(COLOR_SCHEME);
|
||||||
|
const [isOpen, setOpen] = useState(false);
|
||||||
const RenderSideMenu = (
|
const RenderSideMenu = (
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
height: '100%',
|
height: '100%',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}>
|
}}>
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
backgroundColor: colors.accent,
|
|
||||||
height: h * 0.5,
|
|
||||||
width: h * 0.5,
|
|
||||||
position: 'absolute',
|
|
||||||
top: h * -0.15,
|
|
||||||
left: h * -0.2,
|
|
||||||
transform: [{rotateZ: '340deg'}],
|
|
||||||
borderRadius: 100,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
height: '25%',
|
height: '25%',
|
||||||
@@ -61,6 +49,7 @@ export const Home = ({navigation}) => {
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
|
backgroundColor: colors.accent,
|
||||||
}}>
|
}}>
|
||||||
<Image
|
<Image
|
||||||
style={{
|
style={{
|
||||||
@@ -111,8 +100,7 @@ export const Home = ({navigation}) => {
|
|||||||
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: colors.navbg,
|
width: '100%',
|
||||||
width: '90%',
|
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
height: '60%',
|
height: '60%',
|
||||||
marginVertical: 10,
|
marginVertical: 10,
|
||||||
@@ -123,12 +111,27 @@ export const Home = ({navigation}) => {
|
|||||||
{
|
{
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
icon: 'ios-home',
|
icon: 'ios-home',
|
||||||
|
func: () => NavigationService.navigate('Home'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Favorites',
|
||||||
|
icon: 'md-star',
|
||||||
|
func: () => NavigationService.navigate('Favorites'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Folders',
|
||||||
|
icon: 'md-folder',
|
||||||
|
func: () => NavigationService.navigate('Folders'),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
keyExtractor={(item, index) => item.name}
|
keyExtractor={(item, index) => item.name}
|
||||||
renderItem={({item, index}) => (
|
renderItem={({item, index}) => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={opacity}
|
activeOpacity={opacity}
|
||||||
|
onPress={() => {
|
||||||
|
item.func();
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
@@ -162,7 +165,7 @@ export const Home = ({navigation}) => {
|
|||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: '#F3A712',
|
backgroundColor: '#F3A712',
|
||||||
width: '90%',
|
width: '95%',
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
@@ -202,7 +205,11 @@ export const Home = ({navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SideMenu
|
<SideMenu
|
||||||
|
isOpen={isOpen}
|
||||||
bounceBackOnOverdraw={false}
|
bounceBackOnOverdraw={false}
|
||||||
|
onChange={args => {
|
||||||
|
setOpen(args);
|
||||||
|
}}
|
||||||
menu={RenderSideMenu}
|
menu={RenderSideMenu}
|
||||||
openMenuOffset={w / 1.5}>
|
openMenuOffset={w / 1.5}>
|
||||||
<SafeAreaView style={styles.container}>
|
<SafeAreaView style={styles.container}>
|
||||||
|
|||||||
Reference in New Issue
Block a user