import React from 'react'; import {Text, TouchableOpacity, View} from 'react-native'; import {useTracked} from '../../provider'; import NavigationService from '../../services/Navigation'; import {ActionSheetEvent} from '../DialogManager/recievers'; import Seperator from '../Seperator'; import {ph, pv, SIZE, WEIGHT} from "../../utils/SizeUtils"; import {ActionIcon} from "../ActionIcon"; export const NotebookItem = ({ item, isTopic = false, notebookID, isTrash, customStyle, }) => { const [state,] = useTracked(); const {colors,} = state; return ( {item.title} {isTopic || !item.description ? null : ( {item.description} )} {isTopic ? null : ( {item && item.topics ? ( item.topics.slice(1, 4).map((topic) => ( { NavigationService.navigate('Notes', { ...topic, }); }} key={topic.dateCreated.toString() + topic.title} style={{ borderRadius: 2.5, backgroundColor: colors.accent, paddingHorizontal: ph / 1.5, paddingVertical: pv / 3, marginRight: 5, marginVertical: 2.5, }}> {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, }); }} customStyle={{ justifyContent: 'center', height: 35, width: 35, borderRadius: 100, alignItems: 'center', }} /> )} ); };