diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js index 15d428feb..7c5f40da2 100644 --- a/apps/mobile/src/components/ActionSheetComponent/index.js +++ b/apps/mobile/src/components/ActionSheetComponent/index.js @@ -125,10 +125,10 @@ export const ActionSheetComponent = ({ const localRefresh = (type, nodispatch = false) => { if (!note || !note.dateCreated) return; let toAdd; + console.log(type); switch (type) { case 'note': { toAdd = db.getNote(note.dateCreated); - break; } case 'notebook': { @@ -136,10 +136,13 @@ export const ActionSheetComponent = ({ break; } case 'topic': { + console.log(note, 'topics'); toAdd = db.getTopic(note.notebookId, note.title); + console.log(toAdd, 'heree'); break; } } + if (!toAdd || !toAdd.dateCreated) return; if (!nodispatch) { dispatch({type: type}); @@ -410,7 +413,7 @@ export const ActionSheetComponent = ({ const _renderColumnItem = item => (note.dateCreated && columnItems.includes(item.name)) || - item.name === 'Dark Mode' ? ( + (item.name === 'Dark Mode' && columnItems.includes(item.name)) ? ( {}, ''); + ToastEvent.show('Trash cleared', 'error', 1000, () => {}, ''); this.setState({ visible: false, }); @@ -76,6 +76,13 @@ export class Dialog extends Component { } case dialogActions.ACTION_TRASH: { db.restoreItem(item.dateCreated); + ToastEvent.show( + item.type.slice(0, 1).toUpperCase() + + item.type.slice(1) + + ' restored', + 'success', + 3000, + ); updateEvent({type: ACTIONS.TRASH}); this.hide(); } diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js index 80f0c0c72..4a6eed24d 100644 --- a/apps/mobile/src/components/NoteItem/index.js +++ b/apps/mobile/src/components/NoteItem/index.js @@ -137,7 +137,7 @@ export default class NoteItem extends React.Component { numberOfLines={1} style={{ color: colors.pri, - fontSize: SIZE.md, + fontSize: SIZE.sm + 1, fontFamily: WEIGHT.bold, maxWidth: '95%', marginBottom: 5, @@ -153,7 +153,7 @@ export default class NoteItem extends React.Component { diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js index 10319e5dc..b10c442df 100644 --- a/apps/mobile/src/components/NotebookItem/index.js +++ b/apps/mobile/src/components/NotebookItem/index.js @@ -6,6 +6,7 @@ import {useTracked} from '../../provider'; import NavigationService from '../../services/NavigationService'; import {ToastEvent, w} from '../../utils/utils'; import {ActionSheetEvent, moveNoteHideEvent} from '../DialogManager'; +import {db} from '../../../App'; export const NotebookItem = ({ item, @@ -65,6 +66,8 @@ export const NotebookItem = ({ @@ -72,9 +75,10 @@ export const NotebookItem = ({ numberOfLines={1} style={{ fontFamily: WEIGHT.bold, - fontSize: SIZE.md, + fontSize: SIZE.sm + 1, color: colors.pri, maxWidth: '100%', + marginBottom: 5, }}> {item.title} @@ -100,8 +104,8 @@ export const NotebookItem = ({ flexDirection: 'row', alignItems: 'center', marginTop: 5, - width: '95%', - maxWidth: '95%', + width: '80%', + maxWidth: '80%', flexWrap: 'wrap', }}> {item && item.topics @@ -190,7 +194,7 @@ export const NotebookItem = ({ )} - {isTopic ? ( + {isTopic && item.totalNotes > 0 ? ( - {item && item.totalNotes && item.totalNotes.length == 1 + {item && item.totalNotes && item.totalNotes > 1 ? item.totalNotes + ' notes' - : item.totalNotes + ' note'} + : item.totalNotes === 1 + ? item.totalNotes + ' note' + : null} ) : null} - {hideMore ? null : ( + {hideMore || + (item.title === 'General' && item.type === 'topic') ? null : ( { console.log(selectedItemsList, item); - /* if (!noteToMove.notebook.notebook) { + + /* let noteIds = []; + selectedItemsList.forEach(item => noteIds.push(item.dateCreated)); + if (!noteToMove.notebook.notebook) { + await db.moveNotes(null, { + topic: item.title, + id: item.notebookId, + }); await db.addNoteToTopic( notebookID, item.title, noteToMove.dateCreated, ); } else if (selectedItemsList) { - + + await db.moveNotes(null, { + topic: item.title, + id: item.notebookId, + }); await db.moveNote(noteToMove.dateCreated, noteToMove.notebook, { notebook: notebookID, topic: item.title, - }); - } */ + }); - // moveNoteHideEvent(); + }*/ + + moveNoteHideEvent(); ToastEvent.show( `Note moved to ${item.title}`, diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js index ab0f6e385..7f622d7ad 100644 --- a/apps/mobile/src/components/NotesList/index.js +++ b/apps/mobile/src/components/NotesList/index.js @@ -140,7 +140,7 @@ export const NotesList = ({isGrouped = false}) => { { link.click(); }`; + const timeConverter = timestamp => { + 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 ( { + }}> {noMenu ? null : ( { { + + + {timeConverter(timestamp)} + + (EditorWebView = ref)} onError={error => console.log(error)}