Files
notesnook/apps/mobile/app/screens/notes/monographs.tsx

42 lines
1.2 KiB
TypeScript
Raw Normal View History

import { groupArray } from '@streetwriters/notesnook-core/utils/grouping';
2022-04-24 05:59:14 +05:00
import React from 'react';
import NotesPage, { PLACEHOLDER_DATA } from '.';
2022-04-25 00:37:09 +05:00
import Navigation, { NavigationProps, NotesScreenParams } from '../../services/navigation';
2022-08-16 16:48:10 +05:00
import { db } from '../../common/database';
2022-04-24 05:59:14 +05:00
import { MonographType } from '../../utils/types';
import { openMonographsWebpage } from './common';
export const Monographs = ({ navigation, route }: NavigationProps<'Monographs'>) => {
return (
<NotesPage
navigation={navigation}
route={route}
get={Monographs.get}
placeholderData={PLACEHOLDER_DATA}
onPressFloatingButton={openMonographsWebpage}
canGoBack={route.params.canGoBack}
focusControl={true}
/>
);
};
2022-04-25 00:37:09 +05:00
Monographs.get = (params: NotesScreenParams, grouped = true) => {
2022-04-24 05:59:14 +05:00
let notes = db.monographs?.all || [];
return grouped ? groupArray(notes, db.settings?.getGroupOptions('notes')) : notes;
};
Monographs.navigate = (item: MonographType, canGoBack: boolean) => {
Navigation.navigate<'Monographs'>(
{
name: 'Monographs',
type: 'monograph'
},
{
//@ts-ignore
item: { type: 'monograph' },
canGoBack,
title: 'Monographs'
}
);
};