Skip to content

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

mobile: reorganize actions in properties

ammarahm-edd2fcd615418f
diff --git a/apps/mobile/app/components/properties/date-meta.js b/apps/mobile/app/components/properties/date-meta.js
index 7cc8ebfc3..572161606 100644
--- a/apps/mobile/app/components/properties/date-meta.js
+++ b/apps/mobile/app/components/properties/date-meta.js
@@ -43,24 +43,33 @@ export const DateMeta = ({ item }) => {
}
};
- const renderItem = (key) =>
- key.startsWith("date") && key !== "date" ? (
- <View
- key={key}
- 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;
+ function getDateMeta() {
+ let keys = Object.keys(item);
+ if (keys.includes("dateEdited"))
+ keys.splice(
+ keys.findIndex((k) => k === "dateModified"),
+ 1
+ );
+ return keys.filter((key) => key.startsWith("date") && key !== "date");
+ }
+
+ const renderItem = (key) => (
+ <View
+ key={key}
+ style={{
+ flexDirection: "row",
+ justifyContent: "space-between",
+ paddingVertical: 3
+ }}
+ >
+ <Paragraph size={SIZE.xs + 1} color={colors.icon}>
+ {getNameFromKey(key)}
+ </Paragraph>
+ <Paragraph size={SIZE.xs + 1} color={colors.icon}>
+ {timeConverter(item[key])}
+ </Paragraph>
+ </View>
+ );
return (
<View
@@ -72,7 +81,7 @@ export const DateMeta = ({ item }) => {
paddingHorizontal: 12
}}
>
- {Object.keys(item).map(renderItem)}
+ {getDateMeta().map(renderItem)}
</View>
);
};
diff --git a/apps/mobile/app/hooks/use-actions.js b/apps/mobile/app/hooks/use-actions.js
index 12271e13e..506383d92 100644
--- a/apps/mobile/app/hooks/use-actions.js
+++ b/apps/mobile/app/hooks/use-actions.js
@@ -616,6 +616,61 @@ export const useActions = ({ close = () => null, item }) => {
},
close: true
},
+ {
+ name: "Vault",
+ title: item.locked ? "Unlock" : "Lock",
+ icon: item.locked ? "shield-off-outline" : "shield-outline",
+ func: addToVault,
+ on: item.locked
+ },
+ {
+ name: "Publish",
+ title: isPublished ? "Published" : "Publish",
+ icon: "cloud-upload-outline",
+ on: isPublished,
+ func: publishNote
+ },
+
+ {
+ name: "Export",
+ title: "Export",
+ icon: "export",
+ func: exportNote
+ },
+ {
+ name: "Reminders",
+ title: "Reminders",
+ icon: "bell",
+ func: async () => {
+ close();
+ RelationsList.present({
+ reference: item,
+ referenceType: "reminder",
+ relationType: "from",
+ title: "Reminders",
+ onAdd: () => ReminderSheet.present(null, item, true),
+ button: {
+ title: "Add",
+ type: "accent",
+ onPress: () => ReminderSheet.present(null, item, true),
+ icon: "plus"
+ }
+ });
+ },
+ close: false
+ },
+ {
+ name: "Attachments",
+ title: "Attachments",
+ icon: "attachment",
+ func: showAttachments
+ },
+ {
+ name: "History",
+ title: "History",
+ icon: "history",
+ func: openHistory
+ },
{
name: "Move notes",
title: "Add notes",
@@ -626,10 +681,9 @@ export const useActions = ({ close = () => null, item }) => {
MoveNotes.present(db.notebooks.notebook(item.notebookId).data, item);
}
},
-
{
name: "Pin",
- title: item.pinned ? "Unpin" : "Pin to top",
+ title: item.pinned ? "Unpin" : "Pin",
icon: item.pinned ? "pin-off-outline" : "pin-outline",
func: pinItem,
close: false,
@@ -697,21 +751,6 @@ export const useActions = ({ close = () => null, item }) => {
func: restoreTrashItem
},
- {
- name: "Publish",
- title: isPublished ? "Published" : "Publish",
- icon: "cloud-upload-outline",
- on: isPublished,
- func: publishNote
- },
- {
- name: "Vault",
- title: item.locked ? "Remove from vault" : "Add to vault",
- icon: item.locked ? "shield-off-outline" : "shield-outline",
- func: addToVault,
- on: item.locked
- },
-
{
name: "Add Shortcut",
title: isPinnedToMenu ? "Remove Shortcut" : "Add Shortcut",
@@ -735,41 +774,6 @@ export const useActions = ({ close = () => null, item }) => {
icon: "share-variant",
func: shareNote
},
- {
- name: "Attachments",
- title: "Attachments",
- icon: "attachment",
- func: showAttachments
- },
- {
- name: "Export",
- title: "Export",
- icon: "export",
- func: exportNote
- },
- {
- name: "RemoveTopic",
- title: "Remove from topic",
- hidden: !isNoteInTopic(),
- icon: "minus-circle-outline",
- func: removeNoteFromTopic
- },
- {
- name: "Delete",
- title:
- item.type !== "notebook" && item.type !== "note"
- ? "Delete " + item.type
- : "Move to trash",
- icon: "delete-outline",
- type: "error",
- func: deleteItem
- },
- {
- name: "PermDelete",
- title: "Delete " + item.itemType,
- icon: "delete",
- func: deleteTrashItem
- },
{
name: "ReadOnly",
title: "Read only",
@@ -784,13 +788,6 @@ export const useActions = ({ close = () => null, item }) => {
func: toggleLocalOnly,
on: item.localOnly
},
-
- {
- name: "History",
- title: "History",
- icon: "history",
- func: openHistory
- },
{
name: "Duplicate",
title: "Duplicate",
@@ -819,28 +816,7 @@ export const useActions = ({ close = () => null, item }) => {
},
close: false
},
- {
- name: "Reminders",
- title: "Reminders",
- icon: "bell",
- func: async () => {
- close();
- RelationsList.present({
- reference: item,
- referenceType: "reminder",
- relationType: "from",
- title: "Reminders",
- onAdd: () => ReminderSheet.present(null, item, true),
- button: {
- title: "Add",
- type: "accent",
- onPress: () => ReminderSheet.present(null, item, true),
- icon: "plus"
- }
- });
- },
- close: false
- },
+
{
name: "ReminderOnOff",
title: !item.disabled ? "Turn off reminder" : "Turn on reminder",
@@ -863,6 +839,29 @@ export const useActions = ({ close = () => null, item }) => {
"Reminders"
);
}
+ },
+ {
+ name: "RemoveTopic",
+ title: "Remove from topic",
+ hidden: !isNoteInTopic(),
+ icon: "minus-circle-outline",
+ func: removeNoteFromTopic
+ },
+ {
+ name: "Delete",
+ title:
+ item.type !== "notebook" && item.type !== "note"
+ ? "Delete " + item.type
+ : "Move to trash",
+ icon: "delete-outline",
+ type: "error",
+ func: deleteItem
+ },
+ {
+ name: "PermDelete",
+ title: "Delete " + item.itemType,
+ icon: "delete",
+ func: deleteTrashItem
}
// {
// name: "ReferencedIn",