import React from 'react'; import {Text, TouchableOpacity, View} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import {ph, pv, SIZE, WEIGHT} from '../../common/common'; import {useTracked} from '../../provider'; import {ACTIONS} from '../../provider/actions'; import {db, ToastEvent} from '../../utils/utils'; import {Button} from '../Button'; import {ActionSheetEvent, moveNoteHideEvent} from '../DialogManager/recievers'; import Seperator from '../Seperator'; export const NotebookItem = ({ item, hideMore = false, isTopic = false, notebookID, numColumns, isTrash, customStyle, }) => { const [state, dispatch] = useTracked(); const {colors, selectedItemsList} = state; return ( {item.title} {isTopic || !item.description ? null : ( {item.description} )} {isTopic ? null : ( {item && item.topics ? ( item.topics.slice(1, 4).map((topic) => ( {topic.title} )) ) : ( This notebook has no topics. )} )} {isTrash ? ( {'Deleted on: ' + item && item.dateDeleted ? new Date(item.dateDeleted).toISOString().slice(0, 10) : null + ' '} {item.type[0].toUpperCase() + item.type.slice(1) + ' '} ) : null} {isTrash ? null : ( {new Date(item.dateCreated).toDateString().substring(4)} )} {item && item.totalNotes && item.totalNotes > 1 ? item.totalNotes + ' Notes' : item.totalNotes === 1 ? item.totalNotes + ' Note' : '0 Notes'} {item.title === 'General' && item.type === 'topic' ? null : ( { let rowItems = isTrash ? ['Restore', 'Remove'] : [ item.type == 'topic' ? 'Edit Topic' : 'Edit Notebook', 'Delete', ]; let columnItems = item.type === 'topic' ? [] : ['Pin']; ActionSheetEvent(item, false, false, rowItems, columnItems, { notebookID: notebookID, }); }}> )} ); };