Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactor an redesign properties sheet

ammarahm-ed0ad961c4ab0a
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js
deleted file mode 100644
index cfa632ed0..000000000
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetTagsSection.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import React, {useState} from 'react';
-import {View} from 'react-native';
-import {eSendEvent} from '../../services/EventManager';
-import Navigation from '../../services/Navigation';
-import {db} from '../../utils/database';
-import {refreshNotesPage} from '../../utils/Events';
-import {SIZE} from '../../utils/SizeUtils';
-import {sleep} from '../../utils/TimeUtils';
-import {Button} from '../Button';
-
-export const ActionSheetTagsSection = ({item, close}) => {
- const [note, setNote] = useState(item);
-
- return note.id || note.dateCreated ? (
- <View
- style={{
- marginHorizontal: 12,
- }}>
- <View
- style={{
- flexDirection: 'row',
- flexWrap: 'wrap',
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- {note.tags.map(
- (item, index) =>
- item ? <TagItem key={item} tag={item} close={close} /> : null,
- )}
- </View>
- </View>
- ) : null;
-};
-
-const TagItem = ({tag, close}) => {
- const onPress = async () => {
- let tags = db.tags.all;
- let _tag = tags.find(t => t.title === tag);
- let params = {
- ..._tag,
- type: 'tag',
- get: 'tagged',
- };
-
- eSendEvent(refreshNotesPage, params);
- Navigation.navigate('NotesPage', params, {
- heading: '#' + _tag.title,
- id: _tag.id,
- type: _tag.type,
- });
- await sleep(300);
- close();
- };
-
- const style = {
- paddingHorizontal: 0,
- paddingHorizontal: 6,
- marginVertical: 5,
- };
-
- return (
- <Button
- onPress={onPress}
- title={'#' + tag}
- type="gray"
- height={30}
- fontSize={SIZE.sm}
- style={style}
- />
- );
-};
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
index 9ab337c6a..49c3ab1d1 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
+++ b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
@@ -1,12 +1,13 @@
import React from 'react';
-import { Platform, View } from 'react-native';
+import {Platform, View} from 'react-native';
import ActionSheet from 'react-native-actions-sheet';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useTracked } from '../../provider';
-import { useSettingStore } from '../../provider/stores';
-import { Toast } from '../Toast';
-import { BouncingView } from './BouncingView';
-import { GetPremium } from './GetPremium';
+import {useSafeAreaInsets} from 'react-native-safe-area-context';
+import {useTracked} from '../../provider';
+import {useSettingStore} from '../../provider/stores';
+import {COLOR_SCHEME_DARK} from '../../utils/Colors';
+import {Toast} from '../Toast';
+import {BouncingView} from './BouncingView';
+import {GetPremium} from './GetPremium';
const ActionSheetWrapper = ({
children,
@@ -68,6 +69,7 @@ const ActionSheetWrapper = ({
indicatorColor={colors.nav}
onOpen={_onOpen}
keyboardDismissMode="none"
+ overlayColor={'#585858'}
keyboardShouldPersistTaps="always"
ExtraOverlayComponent={
<>
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js b/apps/mobile/src/components/ActionSheetComponent/colortags.js
similarity index 95%
rename from apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js
rename to apps/mobile/src/components/ActionSheetComponent/colortags.js
index dd5142782..19fbd651f 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js
+++ b/apps/mobile/src/components/ActionSheetComponent/colortags.js
@@ -13,13 +13,13 @@ import {refreshNotesPage} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {PressableButton} from '../PressableButton';
-export const ActionSheetColorsSection = ({item, close}) => {
+export const ColorTags = ({item, close}) => {
const [note, setNote] = useState(item);
const setColorNotes = useMenuStore(state => state.setColorNotes);
const dimensions = useSettingStore(state => state.dimensions);
let width = dimensions.width > 600 ? 600 : 500;
- const changeColor = async (color) => {
+ const changeColor = async color => {
if (note.color === color.name) {
await db.notes.note(note.id).uncolor();
} else {
@@ -34,7 +34,7 @@ export const ActionSheetColorsSection = ({item, close}) => {
Navigation.routeNames.Notes
]);
eSendEvent(refreshNotesPage);
- }
+ };
const _renderColor = c => {
const color = {
diff --git a/apps/mobile/src/components/ActionSheetComponent/datemeta.js b/apps/mobile/src/components/ActionSheetComponent/datemeta.js
new file mode 100644
index 000000000..018ed5883
--- /dev/null
+++ b/apps/mobile/src/components/ActionSheetComponent/datemeta.js
@@ -0,0 +1,54 @@
+import React from 'react';
+import {View} from 'react-native';
+import {useTracked} from '../../provider';
+import {SIZE} from '../../utils/SizeUtils';
+import { timeConverter } from '../../utils/TimeUtils';
+import Paragraph from '../Typography/Paragraph';
+
+export const DateMeta = ({item}) => {
+ const [state] = useTracked();
+ const {colors} = state;
+
+ const getNameFromKey = key => {
+ switch (key) {
+ case 'dateCreated':
+ return 'Created at:';
+ case 'dateEdited':
+ return 'Last edited at:';
+ case 'dateDeleted':
+ return 'Deleted at:';
+ default:
+ return key;
+ }
+ };
+
+ const renderItem = key =>
+ key.startsWith('date') && key !== 'dateModified' ? (
+ <View
+ style={{
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ paddingVertical: 3
+ }}>
+ <Paragraph size={SIZE.xs} color={colors.icon}>
+ {getNameFromKey(key)}
+ </Paragraph>
+ <Paragraph size={SIZE.xs} color={colors.icon}>
+ {timeConverter(item[key])}
+ </Paragraph>
+ </View>
+ ) : null;
+
+ return (
+ <View
+ style={{
+ paddingVertical: 5,
+ marginTop: 5,
+ borderTopWidth: 1,
+ borderTopColor: colors.nav,
+ paddingHorizontal: 12
+ }}>
+ {Object.keys(item).map(renderItem)}
+ </View>
+ );
+};
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index c177bc5c2..77e86892b 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -15,7 +15,6 @@ import {notesnook} from '../../../e2e/test.ids';
import {useTracked} from '../../provider';
import {Actions} from '../../provider/Actions';
import {
- useEditorStore,
useMenuStore,
useSelectionStore,
useSettingStore,
@@ -34,7 +33,6 @@ import {
import Navigation from '../../services/Navigation';
import Notifications from '../../services/Notifications';
import SettingsService from '../../services/SettingsService';
-import Sync from '../../services/Sync';
import {editing} from '../../utils';
import {
ACCENT,
@@ -48,22 +46,22 @@ import {
eOpenAttachmentsDialog,
eOpenLoginDialog,
eOpenMoveNoteDialog,
- eOpenPublishNoteDialog,
- eOpenTagsDialog,
- refreshNotesPage
+ eOpenPublishNoteDialog
} from '../../utils/Events';
import {deleteItems, openLinkInBrowser} from '../../utils/functions';
import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils';
-import {sleep, timeConverter} from '../../utils/TimeUtils';
+import {sleep} from '../../utils/TimeUtils';
import {Button} from '../Button';
import {presentDialog} from '../Dialog/functions';
import NoteHistory from '../NoteHistory';
import {PressableButton} from '../PressableButton';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-import {ActionSheetColorsSection} from './ActionSheetColorsSection';
-import {ActionSheetTagsSection} from './ActionSheetTagsSection';
+import {ColorTags} from './color-tags';
+import {DateMeta} from './date-meta';
+import {Tags} from './tags';
+import {Topics} from './topics';
const w = Dimensions.get('window').width;
let htmlToText;
@@ -388,8 +386,9 @@ export const ActionSheetComponent = ({
{
name: 'Publish',
- title: 'Publish',
+ title: isPublished ? 'Published' : 'Publish',
icon: 'cloud-upload-outline',
+ on: isPublished,
func: async () => {
if (!user) {
ToastEvent.show({
@@ -724,6 +723,29 @@ export const ActionSheetComponent = ({
getRef().current?.handleChildScrollEnd();
};
+ const renderColumnItem = ({item, index}) => (
+ <Button
+ buttonType={{
+ text: item.on
+ ? colors.accent
+ : item.name === 'Delete' || item.name === 'PermDelete'
+ ? colors.errorText
+ : colors.icon
+ }}
+ onPress={item.func}
+ title={item.title}
+ icon={item.icon}
+ type={item.on ? 'shade' : 'gray'}
+ fontSize={SIZE.sm}
+ style={{
+ borderRadius: 0,
+ justifyContent: 'flex-start',
+ alignSelf: 'flex-start',
+ width: '100%'
+ }}
+ />
+ );
+
return (
<ScrollView
nestedScrollEnabled
@@ -760,182 +782,94 @@ export const ActionSheetComponent = ({
) : (
<View
style={{
- paddingHorizontal: 12,
- alignItems: 'center',
marginTop: 5,
zIndex: 10
}}>
- <Heading
- style={{
- maxWidth: '90%',
- textAlign: 'center'
- }}
- size={SIZE.md}>
- {note.type === 'tag' ? '#' : null}
- {alias}
- </Heading>
-
- {note.headline || note.description ? (
- <Paragraph
- numberOfLines={2}
- style={{
- width: '90%',
- textAlign: 'center',
- maxWidth: '90%'
- }}>
- {note.type === 'notebook' && note.description
- ? note.description
- : null}
- {note.type === 'note' && note.headline
- ? note.headline[item.headline.length - 1] === '\n'
- ? note.headline.slice(0, note.headline.length - 1)
- : note.headline
- : null}
- </Paragraph>
- ) : null}
-
- <Paragraph
- color={colors.icon}
- size={SIZE.xs}
- style={{
- textAlignVertical: 'center',
- marginTop: 2.5
- }}>
- {note.type === 'note' || (note.type === 'tag' && note.dateEdited)
- ? 'Last edited on ' + timeConverter(note.dateEdited)
- : null}
- {note.type !== 'note' &&
- note.type !== 'tag' &&
- note.dateCreated &&
- !note.dateDeleted
- ? ' Created on ' + timeConverter(note.dateCreated)
- : null}
- {note.dateDeleted
- ? 'Deleted on ' + timeConverter(note.dateDeleted)
- : null}
- </Paragraph>
-
- {hasTags && note ? (
- <ActionSheetTagsSection
- close={close}
- item={note}
- localRefresh={localRefresh}
- />
- ) : null}
-
<View
style={{
- flexDirection: 'row',
- marginTop: 5,
- width: '90%',
- maxWidth: '90%',
- flexWrap: 'wrap',
- justifyContent: 'center'
+ paddingHorizontal: 12
}}>
- {note.type === 'notebook' &&
- note &&
- note.topics &&
- note.topics.length > 0
- ? note.topics
- .sort((a, b) => a.dateEdited - b.dateEdited)
- .slice(0, 6)
- .map(topic => (
- <Button
- key={topic.id}
- title={topic.title}
- type="gray"
- height={30}
- onPress={() => {
- close();
- let routeName = 'NotesPage';
- let params = {...topic, menu: false, get: 'topics'};
- let headerState = {
- heading: topic.title,
- id: topic.id,
- type: topic.type
- };
- eSendEvent(refreshNotesPage, params);
- Navigation.navigate(routeName, params, headerState);
- }}
- icon="bookmark-outline"
- fontSize={SIZE.sm - 1}
- style={{
- marginRight: 5,
- paddingHorizontal: 0,
- paddingHorizontal: 6,
- marginTop: 5
- }}
- />
- ))
- : null}
+ <Heading size={SIZE.lg}>
+ {note.type === 'tag' ? '#' : null}
+ {alias}
+ </Heading>
- {note.type === 'note' && isPublished ? (
- <Button
- title="Published"
- type="shade"
- height={30}
- fontSize={SIZE.sm - 1}
- style={{
- margin: 1,
- marginRight: 5,
- paddingHorizontal: 0,
- borderRadius: 100,
- paddingHorizontal: 12
- }}
- />
+ {note.headline || note.description ? (
+ <Paragraph numberOfLines={2} color={colors.icon}>
+ {(note.type === 'notebook' || note.itemType === 'notebook') &&
+ note.description
+ ? note.description
+ : null}
+ {(note.type === 'note' || note.itemType === 'note') &&
+ note.headline
+ ? note.headline[item.headline.length - 1] === '\n'
+ ? note.headline.slice(0, note.headline.length - 1)
+ : note.headline
+ : null}
+ </Paragraph>
) : null}
- {note.type === 'note' ? (
- <Button
- onPress={async () => {
- close();
- await sleep(300);
- eSendEvent(eOpenTagsDialog, note);
- }}
- title="Add tags"
- type="accent"
- icon="plus"
- iconPosition="right"
- height={30}
- fontSize={SIZE.sm}
- style={{
- margin: 1,
- marginRight: 5,
- paddingHorizontal: 0,
- borderRadius: 100,
- paddingHorizontal: 12
- }}
- />
+ {hasTags && note && note.type === 'note' ? (
+ <Tags close={close} item={note} localRefresh={localRefresh} />
) : null}
+
+ <Topics item={note} close={close} />
</View>
+
+ <DateMeta item={note} />
</View>
)}
- {hasColors && note.id ? (
- <ActionSheetColorsSection close={close} item={note} />
- ) : null}
+
+ <View
+ style={{
+ borderTopWidth: 1,
+ borderColor: colors.nav
+ }}
+ />
+
+ {hasColors && note.id ? <ColorTags close={close} item={note} /> : null}
+
{note.id || note.dateCreated ? (
- <FlatList
- data={rowItemsData.filter(
- i => rowItems.indexOf(i.name) > -1 && !i.hidden
+ <>
+ {note.type === 'note' ? (
+ <FlatList
+ data={rowItemsData.filter(
+ i => rowItems.indexOf(i.name) > -1 && !i.hidden
+ )}
+ keyExtractor={item => item.title}
+ numColumns={rowItems.length < 5 ? rowItems.length : 5}
+ style={{
+ marginTop: note.type !== 'note' ? 10 : 0,
+ paddingTop: 10,
+ borderBottomWidth: 1,
+ borderBottomColor: colors.nav
+ }}
+ columnWrapperStyle={{
+ justifyContent: 'flex-start'
+ }}
+ contentContainerStyle={{
+ alignSelf: 'center',
+ width: rowItems.length < 5 ? '100%' : null,
+ paddingLeft: rowItems.length < 5 ? 10 : 0
+ }}
+ renderItem={({item, index}) => _renderRowItem(item)}
+ />
+ ) : (
+ <FlatList
+ data={rowItemsData.filter(
+ i => rowItems.indexOf(i.name) > -1 && !i.hidden
+ )}
+ style={{
+ borderBottomWidth: 1,
+ borderBottomColor: colors.nav
+ }}
+ keyExtractor={item => item.title}
+ renderItem={renderColumnItem}
+ />
)}
- keyExtractor={item => item.title}
- numColumns={rowItems.length < 5 ? rowItems.length : 5}
- style={{
- marginTop: note.type !== 'note' ? 10 : 0,
- borderTopWidth: 1,
- borderColor: colors.nav,
- paddingTop: 20
- }}
- columnWrapperStyle={{
- justifyContent: rowItems.length < 5 ? 'space-around' : 'flex-start'
- }}
- contentContainerStyle={{
- alignSelf: 'center',
- width: rowItems.length < 5 ? '100%' : null
- }}
- renderItem={({item, index}) => _renderRowItem(item)}
- />
+ </>
) : null}
+
{user && lastSynced >= note.dateModified ? (
<View
style={{
@@ -947,8 +881,7 @@ export const ActionSheetComponent = ({
justifyContent: 'flex-start',
alignSelf: 'center',
paddingTop: 5,
- borderTopWidth: 1,
- borderTopColor: colors.nav
+ marginTop: 10
}}>
<Icon
name="shield-key-outline"
@@ -976,7 +909,7 @@ export const ActionSheetComponent = ({
}}
size={SIZE.xs}
color={colors.pri}>
- No one can read this note except you.
+ No one can view this {item.itemType || item.type} except you.
</Paragraph>
</View>
@@ -998,6 +931,7 @@ export const ActionSheetComponent = ({
/>
</View>
) : null}
+
{settings.devMode ? (
<View
style={{
diff --git a/apps/mobile/src/components/ActionSheetComponent/tags.js b/apps/mobile/src/components/ActionSheetComponent/tags.js
new file mode 100644
index 000000000..670fce322
--- /dev/null
+++ b/apps/mobile/src/components/ActionSheetComponent/tags.js
@@ -0,0 +1,102 @@
+import React, {useState} from 'react';
+import {View} from 'react-native';
+import {useTracked} from '../../provider';
+import {eSendEvent} from '../../services/EventManager';
+import Navigation from '../../services/Navigation';
+import {db} from '../../utils/database';
+import {eOpenTagsDialog, refreshNotesPage} from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
+import {sleep} from '../../utils/TimeUtils';
+import {Button} from '../Button';
+
+export const Tags = ({item, close}) => {
+ const [state] = useTracked();
+ const {colors} = state;
+
+ return item.id ? (
+ <View
+ style={{
+ marginTop: 5,
+ marginBottom: 5
+ }}>
+ <View
+ style={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ alignItems: 'center'
+ }}>
+ {item.tags.map((item, index) =>
+ item ? <TagItem key={item} tag={item} close={close} /> : null
+ )}
+ <Button
+ onPress={async () => {
+ close();
+ await sleep(300);
+ eSendEvent(eOpenTagsDialog, item);
+ }}
+ buttonType={{
+ text: colors.accent
+ }}
+ title="Add tags"
+ type="grayBg"
+ icon="plus"
+ iconPosition="right"
+ height={30}
+ fontSize={SIZE.sm}
+ style={{
+ margin: 1,
+ marginRight: 5,
+ paddingHorizontal: 0,
+ borderRadius: 100,
+ paddingHorizontal: 8
+ }}
+ />
+ </View>
+ </View>
+ ) : null;
+};
+
+const TagItem = ({tag, close}) => {
+ const [state] = useTracked();
+ const {colors} = state;
+ const onPress = async () => {
+ let tags = db.tags.all;
+ let _tag = tags.find(t => t.title === tag);
+ let params = {
+ ..._tag,
+ type: 'tag',
+ get: 'tagged'
+ };
+
+ eSendEvent(refreshNotesPage, params);
+ Navigation.navigate('NotesPage', params, {
+ heading: '#' + _tag.title,
+ id: _tag.id,
+ type: _tag.type
+ });
+ await sleep(300);
+ close();
+ };
+
+ const style = {
+ paddingHorizontal: 0,
+ paddingHorizontal: 8,
+ marginVertical: 5,
+ borderRadius: 100,
+ marginRight: 5
+ };
+
+ return (
+ <Button
+ onPress={onPress}
+ title={'#' + tag}
+ buttonType={{
+ text: colors.accent
+ }}
+ type="grayBg"
+ height={30}
+ fontSize={SIZE.sm}
+ style={style}
+ />
+ );
+};
diff --git a/apps/mobile/src/components/ActionSheetComponent/topics.js b/apps/mobile/src/components/ActionSheetComponent/topics.js
new file mode 100644
index 000000000..c028dc792
--- /dev/null
+++ b/apps/mobile/src/components/ActionSheetComponent/topics.js
@@ -0,0 +1,65 @@
+import React from 'react';
+import {View} from 'react-native';
+import {useTracked} from '../../provider';
+import {eSendEvent} from '../../services/EventManager';
+import Navigation from '../../services/Navigation';
+import {refreshNotesPage} from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
+import {Button} from '../Button';
+
+export const Topics = ({item, close}) => {
+ const [state] = useTracked();
+ const {colors} = state;
+ const open = () => {
+ close();
+ let routeName = 'NotesPage';
+ let params = {...topic, menu: false, get: 'topics'};
+ let headerState = {
+ heading: topic.title,
+ id: topic.id,
+ type: topic.type
+ };
+ eSendEvent(refreshNotesPage, params);
+ Navigation.navigate(routeName, params, headerState);
+ };
+
+ const renderItem = topic => (
+ <Button
+ key={topic.id}
+ title={topic.title}
+ type="grayBg"
+ buttonType={{
+ text: colors.accent
+ }}
+ height={30}
+ onPress={open}
+ icon="bookmark-outline"
+ fontSize={SIZE.sm}
+ style={{
+ marginRight: 5,
+ paddingHorizontal: 0,
+ paddingHorizontal: 8,
+ borderRadius: 100,
+ marginVertical: 5
+ }}
+ />
+ );
+
+ return item &&
+ item.type === 'notebook' &&
+ item.topics &&
+ item.topics.length > 0 ? (
+ <View
+ style={{
+ flexDirection: 'row',
+ marginTop: 5,
+ width: '100%',
+ flexWrap: 'wrap'
+ }}>
+ {item.topics
+ .sort((a, b) => a.dateEdited - b.dateEdited)
+ .slice(0, 6)
+ .map(renderItem)}
+ </View>
+ ) : null;
+};
diff --git a/apps/mobile/src/components/NoteHistory/index.js b/apps/mobile/src/components/NoteHistory/index.js
index 53ece2896..a85552f18 100644
--- a/apps/mobile/src/components/NoteHistory/index.js
+++ b/apps/mobile/src/components/NoteHistory/index.js
@@ -5,7 +5,8 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {useTracked} from '../../provider';
import {presentSheet} from '../../services/EventManager';
import {db} from '../../utils/database';
-import {timeConverter} from '../../utils/TimeUtils';
+import {SIZE} from '../../utils/SizeUtils';
+import {timeConverter, timeSince} from '../../utils/TimeUtils';
import DialogHeader from '../Dialog/dialog-header';
import GeneralSheet from '../GeneralSheet';
import {PressableButton} from '../PressableButton';
@@ -21,10 +22,7 @@ export default function NoteHistory({note, ref}) {
useEffect(() => {
(async () => {
- console.log(note.id);
- console.log(await db.noteHistory.get(note.id));
-
- setHistory([...(await db.noteHistory.get(note.id))].reverse());
+ setHistory([...(await db.noteHistory.get(note.id))]);
setLoading(false);
})();
}, []);
@@ -33,26 +31,50 @@ export default function NoteHistory({note, ref}) {
let content = await db.noteHistory.content(item.sessionContentId);
presentSheet({
- component: <NotePreview session={item} content={content} />,
+ component: (
+ <NotePreview
+ session={{
+ ...item,
+ session: getDate(item.dateCreated, item.dateModified)
+ }}
+ content={content}
+ />
+ ),
context: 'note_history',
noProgress: true,
noIcon: true
});
}
+ const getDate = (start, end) => {
+ let _start = timeConverter(start);
+ let _end = timeConverter(end + 60000);
+ if (_start === _end) return _start;
+ let final = _end.lastIndexOf(',');
+ let part = _end.slice(0, final + 1);
+ if (_start.includes(part)) {
+ return _start + ' —' + _end.replace(part, '');
+ }
+ return _start + ' — ' + _end;
+ };
+
const renderItem = useCallback(
({item, index}) => (
<PressableButton
type="grayBg"
onPress={() => preview(item)}
customStyle={{
- justifyContent: 'center',
- alignItems: 'flex-start',
+ justifyContent: 'space-between',
+ alignItems: 'center',
paddingHorizontal: 12,
height: 45,
- marginBottom: 10
+ marginBottom: 10,
+ flexDirection: 'row'
}}>
- <Paragraph>{timeConverter(item.dateEdited)}</Paragraph>
+ <Paragraph>{getDate(item.dateCreated, item.dateModified)}</Paragraph>
+ <Paragraph color={colors.icon} size={SIZE.xs}>
+ {timeSince(item.dateModified)}
+ </Paragraph>
</PressableButton>
),
[]
@@ -92,6 +114,13 @@ export default function NoteHistory({note, ref}) {
}
renderItem={renderItem}
/>
+ <Paragraph
+ size={SIZE.xs}
+ style={{
+ alignSelf: 'center'
+ }}>
+ Note version history is local only.
+ </Paragraph>
</View>
);
}
diff --git a/apps/mobile/src/components/NoteHistory/preview.js b/apps/mobile/src/components/NoteHistory/preview.js
index e02a17f74..03cd518a8 100644
--- a/apps/mobile/src/components/NoteHistory/preview.js
+++ b/apps/mobile/src/components/NoteHistory/preview.js
@@ -4,7 +4,7 @@ import WebView from 'react-native-webview';
import {useTracked} from '../../provider';
import {eSendEvent, ToastEvent} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
-import {dHeight} from '../../utils';
+import {dHeight, itemSkus} from '../../utils';
import {db} from '../../utils/database';
import {eCloseProgressDialog} from '../../utils/Events';
import {normalize} from '../../utils/SizeUtils';
@@ -81,7 +81,7 @@ export default function NotePreview({session, content}) {
height: 600,
width: '100%'
}}>
- <DialogHeader padding={12} title={timeConverter(session.dateEdited)} />
+ <DialogHeader padding={12} title={session.session} />
<WebView
ref={webviewRef}
onShouldStartLoadWithRequest={_onShouldStartLoadWithRequest}
@@ -112,7 +112,7 @@ export default function NotePreview({session, content}) {
style={{
paddingHorizontal: 12
}}>
- <Button onPress={restore} title="Restore" type="accent" width="100%" />
+ <Button onPress={restore} title="Restore this version" type="accent" width="100%" />
</View>
</View>
);
diff --git a/apps/mobile/src/components/Sort/index.js b/apps/mobile/src/components/Sort/index.js
index 738aee4e3..5f32520df 100644
--- a/apps/mobile/src/components/Sort/index.js
+++ b/apps/mobile/src/components/Sort/index.js
@@ -42,8 +42,6 @@ const Sort = ({type, screen}) => {
width: '100%',
backgroundColor: colors.bg,
justifyContent: 'space-between',
- borderRadius: 10,
- paddingTop: 10
}}>
<View
style={{