diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 418659012..b2131381e 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -166,9 +166,10 @@ export const Container = ({
) : null}
-
- {title}
-
+ {template.noTitle ? null : (
+
+ {title}
+
+ )}
{paragraph ? (
@@ -182,58 +184,60 @@ export class Dialog extends Component {
) : null}
-
-
-
- {negativeText}
-
-
-
-
+ {negativeText}
+
+
+
- {positiveText}
-
-
-
+
+ {positiveText}
+
+
+
+ )}
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 879160dba..f4b6a1040 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -29,6 +29,7 @@ import {Dialog} from '../Dialog';
import LoginDialog from '../LoginDialog';
import MoveNoteDialog from '../MoveNoteDialog';
import {VaultDialog} from '../VaultDialog';
+import {timeConverter} from '../../utils/utils';
export const dialogActions = {
ACTION_DELETE: 511,
@@ -135,6 +136,19 @@ export const TEMPLATE_EXIT = type => {
};
};
+export const TEMPLATE_INFO = dateCreated => {
+ return {
+ title: `Note Info`,
+ paragraph: `Created on ${timeConverter(dateCreated)}`,
+ positiveText: ``,
+ negativeText: '',
+ noButtons: true,
+ noTitle: true,
+ action: dialogActions.ACTION_CLOSE,
+ icon: 'info',
+ };
+};
+
export const TEMPLATE_EMPTY_TRASH = {
title: 'Empty Trash',
paragraph: 'Are you sure you want to clear the trash?',
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 0626f1c43..35503d44d 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useEffect, useState} from 'react';
import {
Platform,
ScrollView,
@@ -26,7 +26,7 @@ import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import NavigationService from '../../services/NavigationService';
import {AnimatedSafeAreaView} from '../../views/Home';
-import {DDS} from '../../../App';
+import {DDS, db} from '../../../App';
import {
eOpenLoginDialog,
eOpenModalMenu,
@@ -42,7 +42,7 @@ export const Menu = ({
}) => {
const [state, dispatch] = useTracked();
const {colors} = state;
-
+ const [tags, setTags] = useState([]);
// todo
let overlayRef;
@@ -54,6 +54,17 @@ export const Menu = ({
dispatch({type: ACTIONS.THEME, colors: newColors});
}
+ useEffect(() => {
+ let allTags = db.getTags();
+ let tagsToAdd = [];
+ allTags.sort((a, b) => {
+ return a.count > b.count;
+ });
+
+ setTags([...allTags]);
+ console.log(allTags);
+ }, []);
+
const listItems = [
{
name: 'Home',
@@ -315,22 +326,16 @@ export const Menu = ({
flexWrap: 'wrap',
marginBottom: 0,
}}>
- {[
- 'home',
- 'office',
- 'work',
- 'book_notes',
- 'poem',
- 'lists',
- 'water',
- ].map(item => (
+ {tags.map(item => (
{
close();
NavigationService.navigate('Notes', {
- heading: item,
+ heading: item.title,
+ tag: item,
+ type: 'tag',
});
}}
style={{
@@ -339,6 +344,7 @@ export const Menu = ({
alignItems: 'center',
padding: 5,
paddingLeft: 2.5,
+ marginTop: 5,
}}>
- #{item}
+ #{item.title}
+ {item.count > 1 ? (
+
+ {item.count}
+
+ ) : null}
))}
@@ -378,8 +401,21 @@ export const Menu = ({
height: noTextMode ? SIZE.md : normalize(30),
backgroundColor: item,
borderRadius: 100,
- }}
- />
+ }}>
+
),
)}
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 4a6eed24d..de289f37f 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -110,7 +110,7 @@ export default class NoteItem extends React.Component {
) : null}
onLongPress()}
onPress={() => {
if (item.locked) {
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js
index b10c442df..2a443541a 100644
--- a/apps/mobile/src/components/NotebookItem/index.js
+++ b/apps/mobile/src/components/NotebookItem/index.js
@@ -64,8 +64,10 @@ export const NotebookItem = ({
width: '100%',
}}>
{
keyword,
} = state;
const notes = [...state.notes];
-
+ const [refreshing, setRefreshing] = useState(false);
const _renderItem = ({item, index}) => (
{
(sectionListRef = ref)}
sections={notes}
+ refreshControl={
+ {
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
keyExtractor={_listKeyExtractor}
renderSectionHeader={_renderSectionHeader}
onScroll={_onScroll}
diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.js
index b488ae35c..05fee79a6 100755
--- a/apps/mobile/src/utils/utils.js
+++ b/apps/mobile/src/utils/utils.js
@@ -69,6 +69,71 @@ export const ToastEvent = {
},
};
+export const timeConverter = timestamp => {
+ if (!timestamp) return;
+ var d = new Date(timestamp), // Convert the passed timestamp to milliseconds
+ yyyy = d.getFullYear(),
+ mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
+ dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
+ currentDay = d.getDay(),
+ hh = d.getHours(),
+ h = hh,
+ min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
+ ampm = 'AM',
+ time;
+ let days = [
+ 'Sunday',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ ];
+ var months = [
+ 'Jan',
+ 'Feb',
+ 'Mar',
+ 'Apr',
+ 'May',
+ 'Jun',
+ 'Jul',
+ 'Aug',
+ 'Sep',
+ 'Oct',
+ 'Nov',
+ 'Dec',
+ ];
+
+ if (hh > 12) {
+ h = hh - 12;
+ ampm = 'PM';
+ } else if (hh === 12) {
+ h = 12;
+ ampm = 'PM';
+ } else if (hh == 0) {
+ h = 12;
+ }
+
+ // ie: 2013-02-18, 8:35 AM
+ time =
+ days[currentDay] +
+ ' ' +
+ dd +
+ ' ' +
+ months[d.getMonth()] +
+ ', ' +
+ yyyy +
+ ', ' +
+ h +
+ ':' +
+ min +
+ ' ' +
+ ampm;
+
+ return time;
+};
+
export const SideMenuEvent = {
open: () => {
eSendEvent(eOpenSideMenu);
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index bb07e169d..41f6faa23 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -20,6 +20,7 @@ import {
simpleDialogEvent,
TEMPLATE_EXIT,
TEMPLATE_EXIT_FULLSCREEN,
+ TEMPLATE_INFO,
} from '../../components/DialogManager';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
@@ -33,12 +34,13 @@ import {
eOnLoadNote,
eOpenFullscreenEditor,
} from '../../services/events';
-import {SideMenuEvent} from '../../utils/utils';
+import {SideMenuEvent, timeConverter} from '../../utils/utils';
import {AnimatedSafeAreaView} from '../Home';
let EditorWebView;
let note = {};
let timestamp = null;
+let dateEdited = null;
var content = null;
var title = null;
let timer = null;
@@ -260,9 +262,11 @@ const Editor = ({navigation, noMenu}) => {
const updateEditor = () => {
title = note.title;
timestamp = note.dateCreated;
+ dateEdited = note.dateEditted;
content = note.content;
saveCounter = 0;
- console.log('here');
+
+ console.log(note);
if (title !== null || title === '') {
post(
JSON.stringify({
@@ -294,71 +298,6 @@ const Editor = ({navigation, noMenu}) => {
link.click();
}`;
- const timeConverter = timestamp => {
- if (!timestamp) return;
- var d = new Date(timestamp), // Convert the passed timestamp to milliseconds
- yyyy = d.getFullYear(),
- mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
- dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
- currentDay = d.getDay(),
- hh = d.getHours(),
- h = hh,
- min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
- ampm = 'AM',
- time;
- let days = [
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- ];
- var months = [
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec',
- ];
-
- if (hh > 12) {
- h = hh - 12;
- ampm = 'PM';
- } else if (hh === 12) {
- h = 12;
- ampm = 'PM';
- } else if (hh == 0) {
- h = 12;
- }
-
- // ie: 2013-02-18, 8:35 AM
- time =
- days[currentDay] +
- ' ' +
- dd +
- ' ' +
- months[d.getMonth()] +
- ', ' +
- yyyy +
- ', ' +
- h +
- ':' +
- min +
- ' ' +
- ampm;
-
- return time;
- };
-
const _renderEditor = () => {
return (
{
flexDirection: 'row',
alignItems: 'center',
paddingLeft: noMenu ? 12 : 12 + 50,
+ zIndex: 999,
}}>
{
+ simpleDialogEvent(TEMPLATE_INFO(timestamp));
+ }}
style={{
color: colors.icon,
fontSize: SIZE.xxs,
textAlignVertical: 'center',
fontFamily: WEIGHT.regular,
}}>
- {timeConverter(timestamp)}
+ {timeConverter(dateEdited)}
{
const [state, dispatch] = useTracked();
const {colors, selectionMode, favorites} = state;
-
+ const [refreshing, setRefreshing] = useState(false);
useEffect(() => {
dispatch({type: ACTIONS.FAVORITES});
}, []);
@@ -35,6 +35,20 @@ export const Favorites = ({navigation}) => {
noBottomButton={true}>
item.dateCreated.toString()}
+ refreshControl={
+ {
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
style={{
width: '100%',
alignSelf: 'center',
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index 228279b32..aa1b0a9d0 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -1,5 +1,12 @@
-import React, {useEffect} from 'react';
-import {BackHandler, FlatList, Platform, Text, View} from 'react-native';
+import React, {useEffect, useState} from 'react';
+import {
+ BackHandler,
+ FlatList,
+ Platform,
+ Text,
+ View,
+ RefreshControl,
+} from 'react-native';
import {useIsFocused} from 'react-navigation-hooks';
import {DDS} from '../../../App';
import {SIZE, WEIGHT} from '../../common/common';
@@ -24,7 +31,9 @@ export const Folders = ({navigation}) => {
notebooks,
preventDefaultMargins,
} = state;
+ const [refreshing, setRefreshing] = useState(false);
let isFocused = useIsFocused();
+
///
const handleBackPress = () => {
@@ -80,6 +89,20 @@ export const Folders = ({navigation}) => {
style={{
width: '100%',
}}
+ refreshControl={
+ {
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
onScroll={onScroll}
ListHeaderComponent={
{
const [state, dispatch] = useTracked();
const {colors, selectionMode, preventDefaultMargins} = state;
const [topics, setTopics] = useState([]);
+ const [refreshing, setRefreshing] = useState(false);
let params = navigation.state.params;
let isFocused = useIsFocused();
@@ -106,6 +107,20 @@ export const Notebook = ({navigation}) => {
//setAddTopic(true);
}}>
{
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
style={{
width: '100%',
}}
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index b739b3b8a..57ae52f62 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from 'react';
-import {FlatList, Text, View, Platform} from 'react-native';
+import {FlatList, Text, View, Platform, RefreshControl} from 'react-native';
import {db} from '../../../App';
import Container from '../../components/Container';
import NoteItem from '../../components/NoteItem';
@@ -13,7 +13,7 @@ export const Notes = ({navigation}) => {
const {colors, selectionMode, currentEditingNote} = state;
const allNotes = state.notes;
const [notes, setNotes] = useState([]);
-
+ const [refreshing, setRefreshing] = useState(false);
let params = navigation.state ? navigation.state.params : null;
useEffect(() => {
@@ -115,6 +115,20 @@ export const Notes = ({navigation}) => {
bottomButtonOnPress={() => {}}>
{
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
keyExtractor={_listKeyExtractor}
ListFooterComponent={_ListFooterComponent}
onScroll={_onScroll}
diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.js
index ea51d758a..6229a05c1 100644
--- a/apps/mobile/src/views/Tags/index.js
+++ b/apps/mobile/src/views/Tags/index.js
@@ -1,4 +1,4 @@
-import React, {useEffect} from 'react';
+import React, {useEffect, useState} from 'react';
import {
Dimensions,
FlatList,
@@ -6,6 +6,7 @@ import {
Text,
View,
TouchableOpacity,
+ RefreshControl,
} from 'react-native';
import {pv, SIZE, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
@@ -20,7 +21,7 @@ const h = Dimensions.get('window').height;
export const Tags = ({navigation}) => {
const [state, dispatch] = useTracked();
const {colors, tags} = state;
-
+ const [refreshing, setRefreshing] = useState(false);
useEffect(() => {
dispatch({type: ACTIONS.TAGS});
}, []);
@@ -44,6 +45,20 @@ export const Tags = ({navigation}) => {
style={{
height: '100%',
}}
+ refreshControl={
+ {
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
contentContainerStyle={{
height: '100%',
}}
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index ab4d3e697..672ea0882 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -1,5 +1,5 @@
-import React, {useEffect} from 'react';
-import {FlatList, Text, View} from 'react-native';
+import React, {useEffect, useState} from 'react';
+import {FlatList, Text, View, RefreshControl} from 'react-native';
import {SIZE, WEIGHT} from '../../common/common';
import Container from '../../components/Container';
import {
@@ -17,7 +17,7 @@ import SelectionWrapper from '../../components/SelectionWrapper';
export const Trash = ({navigation}) => {
const [state, dispatch] = useTracked();
const {colors, selectionMode, trash} = state;
-
+ const [refreshing, setRefreshing] = useState(false);
useEffect(() => {
dispatch({
type: ACTIONS.TRASH,
@@ -113,6 +113,20 @@ export const Trash = ({navigation}) => {
menu={true}
bottomButtonText="Clear all trash">
{
+ setRefreshing(true);
+ setTimeout(() => {
+ setRefreshing(false);
+ }, 1000);
+ }}
+ refreshing={refreshing}
+ />
+ }
ListHeaderComponent={