Skip to content

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

mobile: redesign properties sheet

ammarahm-ede34f1f0b45e4
diff --git a/apps/mobile/app/components/dialog/dialog-header.tsx b/apps/mobile/app/components/dialog/dialog-header.tsx
index a18a87460..788a392fc 100644
--- a/apps/mobile/app/components/dialog/dialog-header.tsx
+++ b/apps/mobile/app/components/dialog/dialog-header.tsx
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from "react";
-import { Text, View } from "react-native";
+import { Text, View, ViewStyle } from "react-native";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";
import { Button } from "../ui/button";
@@ -41,6 +41,7 @@ type DialogHeaderProps = {
padding?: number;
centered?: boolean;
titlePart?: string;
+ style: ViewStyle
};
const DialogHeader = ({
@@ -50,7 +51,8 @@ const DialogHeader = ({
paragraphColor,
padding,
centered,
- titlePart
+ titlePart,
+ style
}: DialogHeaderProps) => {
const colors = useThemeStore((state) => state.colors);
@@ -62,7 +64,8 @@ const DialogHeader = ({
alignItems: "center",
justifyContent: "space-between",
minHeight: 50,
- paddingHorizontal: padding
+ paddingHorizontal: padding,
+ ...style
}}
>
<View
diff --git a/apps/mobile/app/components/properties/color-tags.js b/apps/mobile/app/components/properties/color-tags.js
index 3063d67d0..61255bdd3 100644
--- a/apps/mobile/app/components/properties/color-tags.js
+++ b/apps/mobile/app/components/properties/color-tags.js
@@ -27,7 +27,6 @@ import { eSendEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { useMenuStore } from "../../stores/use-menu-store";
import { useSettingStore } from "../../stores/use-setting-store";
-import { dWidth } from "../../utils";
import { COLORS_NOTE } from "../../utils/color-scheme";
import { refreshNotesPage } from "../../utils/events";
import { SIZE } from "../../utils/size";
@@ -71,8 +70,8 @@ export const ColorTags = ({ item }) => {
key={color.value}
onPress={() => changeColor(color)}
customStyle={{
- width: DDS.isTab ? width / 10 : dWidth / 9,
- height: DDS.isTab ? width / 10 : dWidth / 9,
+ width: DDS.isTab ? width / 10 : 30,
+ height: DDS.isTab ? width / 10 : 30,
borderRadius: 100,
justifyContent: "center",
alignItems: "center"
@@ -90,10 +89,9 @@ export const ColorTags = ({ item }) => {
style={{
flexDirection: "row",
flexWrap: "wrap",
+ flexGrow: 1,
paddingHorizontal: 12,
- width: "100%",
- marginVertical: 10,
- marginTop: 20,
+ // width: "100%",
alignItems: "center",
justifyContent: "space-between"
}}
diff --git a/apps/mobile/app/components/properties/date-meta.js b/apps/mobile/app/components/properties/date-meta.js
index 572161606..0d21c710d 100644
--- a/apps/mobile/app/components/properties/date-meta.js
+++ b/apps/mobile/app/components/properties/date-meta.js
@@ -74,10 +74,6 @@ export const DateMeta = ({ item }) => {
return (
<View
style={{
- paddingVertical: 5,
- marginTop: 5,
- borderTopWidth: 1,
- borderTopColor: colors.nav,
paddingHorizontal: 12
}}
>
diff --git a/apps/mobile/app/components/properties/index.js b/apps/mobile/app/components/properties/index.js
index 97c3a109c..9fdee3c45 100644
--- a/apps/mobile/app/components/properties/index.js
+++ b/apps/mobile/app/components/properties/index.js
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import { getUpcomingReminder } from "@notesnook/core/collections/reminders";
import React from "react";
import { Platform, View } from "react-native";
import { ScrollView } from "react-native-gesture-handler";
@@ -27,20 +28,32 @@ import SearchService from "../../services/search";
import { useThemeStore } from "../../stores/use-theme-store";
import { COLORS_NOTE } from "../../utils/color-scheme";
import { SIZE } from "../../utils/size";
+import SheetProvider from "../sheet-provider";
+import { ReminderTime } from "../ui/reminder-time";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
-import { ColorTags } from "./color-tags";
import { DateMeta } from "./date-meta";
import { DevMode } from "./dev-mode";
import { Items } from "./items";
import Notebooks from "./notebooks";
import { Synced } from "./synced";
-import { Tags } from "./tags";
-import { Topics } from "./topics";
-import {
- getUpcomingReminder
-} from "@notesnook/core/collections/reminders";
-import { ReminderTime } from "../ui/reminder-time";
+import { Tags, TagStrip } from "./tags";
+
+const Line = ({ top = 6, bottom = 6 }) => {
+ const colors = useThemeStore((state) => state.colors);
+ return (
+ <View
+ style={{
+ height: 1,
+ backgroundColor: colors.nav,
+ width: "100%",
+ marginTop: top,
+ marginBottom: bottom
+ }}
+ />
+ );
+};
+
export const Properties = ({
close = () => {},
item,
@@ -50,13 +63,18 @@ export const Properties = ({
const colors = useThemeStore((state) => state.colors);
const alias = item.alias || item.title;
const isColor = !!COLORS_NOTE[item.title];
- const reminders = db.relations.from(item, "reminder");
- const current = getUpcomingReminder(reminders);
const onScrollEnd = () => {
getRef().current?.handleChildScrollEnd();
};
+ if (!item || !item.id) {
+ return (
+ <Paragraph style={{ marginVertical: 10, alignSelf: "center" }}>
+ Start writing to save your note.
+ </Paragraph>
+ );
+ }
return (
<ScrollView
nestedScrollEnabled
@@ -71,86 +89,52 @@ export const Properties = ({
maxHeight: "100%"
}}
>
- {!item || !item.id ? (
- <Paragraph style={{ marginVertical: 10, alignSelf: "center" }}>
- Start writing to save your note.
- </Paragraph>
- ) : (
- <View
- style={{
- marginTop: 5,
- zIndex: 10
- }}
- >
- <View
- style={{
- paddingHorizontal: 12
- }}
- >
- <Heading size={SIZE.lg}>
- {item.type === "tag" && !isColor ? (
- <Heading size={SIZE.xl} color={colors.accent}>
- #
- </Heading>
- ) : null}
- {alias}
+ <View
+ style={{
+ paddingHorizontal: 12,
+ marginTop: 5,
+ zIndex: 10
+ }}
+ >
+ <Heading size={SIZE.lg}>
+ {item.type === "tag" && !isColor ? (
+ <Heading size={SIZE.xl} color={colors.accent}>
+ #
</Heading>
-
- {item.headline || item.description ? (
- <Paragraph
- style={{
- marginBottom: 5
- }}
- numberOfLines={2}
- color={colors.icon}
- >
- {(item.type === "notebook" ||
- item.itemType === "notebook" ||
- item.type === "reminder") &&
- item?.description
- ? item.description
- : null}
- {(item.type === "note" || item.itemType === "note") &&
- item?.headline
- ? item.headline
- : null}
- </Paragraph>
- ) : null}
-
- {item.type === "reminder" ? (
- <ReminderTime
- reminder={item}
- style={{
- justifyContent: "flex-start",
- borderWidth: 0,
- height: 30,
- alignSelf: "flex-start"
- }}
- fontSize={SIZE.xs + 1}
- />
- ) : null}
-
- {item.type === "note" ? <Tags close={close} item={item} /> : null}
-
- <Topics item={item} close={close} />
- </View>
-
- {item.type === "note" ? (
- <Notebooks note={item} close={close} />
) : null}
+ {alias}
+ </Heading>
- <DateMeta item={item} />
- </View>
- )}
+ {item.type === "note" ? <TagStrip close={close} item={item} /> : null}
+
+ {item.type === "reminder" ? (
+ <ReminderTime
+ reminder={item}
+ style={{
+ justifyContent: "flex-start",
+ borderWidth: 0,
+ height: 30,
+ alignSelf: "flex-start",
+ backgroundColor: "transparent",
+ paddingHorizontal: 0
+ }}
+ fontSize={SIZE.xs + 1}
+ />
+ ) : null}
+ </View>
+ <Line top={12} />
+
+ <DateMeta item={item} />
+ <Line bottom={0} />
+ {item.type === "note" ? <Tags close={close} item={item} /> : null}
<View
style={{
- borderTopWidth: 1,
- borderColor: colors.nav
+ paddingHorizontal: 12
}}
- />
-
- {item.type === "note" ? <ColorTags close={close} item={item} /> : null}
+ >
+ {item.notebooks ? <Notebooks note={item} close={close} /> : null}
+ </View>
<Items
item={item}
@@ -172,6 +156,7 @@ export const Properties = ({
}}
/>
) : null}
+ <SheetProvider context="properties" />
</ScrollView>
);
};
@@ -184,50 +169,50 @@ Properties.present = (item, buttons = [], isSheet) => {
switch (type) {
case "trash":
props[0] = item;
- props.push(["PermDelete", "Restore"]);
+ props.push(["delete", "restore"]);
break;
case "note":
- android = Platform.OS === "android" ? ["PinToNotif"] : [];
+ android = Platform.OS === "android" ? ["pin-to-notifications"] : [];
props[0] = db.notes.note(item.id).data;
props.push([
- "Add to notebook",
- "Add-Reminder",
- "Share",
- "Export",
- "Copy",
- "Publish",
- "Pin",
- "Favorite",
- "Attachments",
- "Vault",
- "Delete",
- "RemoveTopic",
- "History",
- "ReadOnly",
- "Reminders",
- "Local only",
- "Duplicate",
+ "notebooks",
+ "add-reminder",
+ "share",
+ "export",
+ "copy",
+ "publish",
+ "pin",
+ "favorite",
+ "attachments",
+ "lock-unlock",
+ "trash",
+ "remove-from-topic",
+ "history",
+ "read-only",
+ "reminders",
+ "local-only",
+ "duplicate",
...android,
...buttons
]);
break;
case "notebook":
props[0] = db.notebooks.notebook(item.id).data;
- props.push(["Edit Notebook", "Pin", "Add Shortcut", "Delete"]);
+ props.push(["edit-notebook", "pin", "add-shortcut", "trash"]);
break;
case "topic":
props[0] = db.notebooks
.notebook(item.notebookId)
.topics.topic(item.id)._topic;
- props.push(["Move notes", "Edit Topic", "Add Shortcut", "Delete"]);
+ props.push(["move-notes", "edit-topic", "add-shortcut", "trash"]);
break;
case "tag":
props[0] = db.tags.tag(item.id);
- props.push(["Add Shortcut", "Delete", "Rename Tag"]);
+ props.push(["add-shortcut", "trash", "rename-tag"]);
break;
case "reminder": {
props[0] = db.reminders.reminder(item.id);
- props.push(["Edit reminder", "Delete", "ReminderOnOff"]);
+ props.push(["edit-reminder", "trash", "disable-reminder"]);
break;
}
}
diff --git a/apps/mobile/app/components/properties/items.js b/apps/mobile/app/components/properties/items.js
index 3557df8f0..08c45a42f 100644
--- a/apps/mobile/app/components/properties/items.js
+++ b/apps/mobile/app/components/properties/items.js
@@ -33,19 +33,19 @@ export const Items = ({ item, buttons, close }) => {
const colors = useThemeStore((state) => state.colors);
const dimensions = useSettingStore((state) => state.dimensions);
const actions = useActions({ item, close });
- const data = actions.filter((i) => buttons.indexOf(i.name) > -1 && !i.hidden);
+ const data = actions.filter((i) => buttons.indexOf(i.id) > -1 && !i.hidden);
let width = dimensions.width > 600 ? 600 : dimensions.width;
let columnItemsCount = DDS.isLargeTablet() ? 7 : 5;
let columnItemWidth = DDS.isTab
- ? (width - 24) / columnItemsCount
- : (width - 24) / columnItemsCount;
+ ? (width - 12) / columnItemsCount
+ : (width - 12) / columnItemsCount;
const _renderRowItem = ({ item }) => (
<View
onPress={item.func}
- key={item.name}
- testID={"icon-" + item.name}
+ key={item.id}
+ testID={"icon-" + item.id}
style={{
alignItems: "center",
width: columnItemWidth,
@@ -58,7 +58,7 @@ export const Items = ({ item, buttons, close }) => {
customStyle={{
height: columnItemWidth - 12,
width: columnItemWidth - 12,
- borderRadius: 5,
+ borderRadius: 10,
justifyContent: "center",
alignItems: "center",
textAlign: "center",
@@ -72,14 +72,14 @@ export const Items = ({ item, buttons, close }) => {
color={
item.on
? colors.accent
- : item.name === "Delete" || item.name === "PermDelete"
+ : item.id.match(/(delete|trash)/g)
? colors.errorText
: colors.icon
}
/>
</PressableButton>
- <Paragraph size={SIZE.xs + 1} style={{ textAlign: "center" }}>
+ <Paragraph size={SIZE.xs} style={{ textAlign: "center" }}>
{item.title}
</Paragraph>
</View>
@@ -108,26 +108,109 @@ export const Items = ({ item, buttons, close }) => {
/>
);
+ const bottomBarItemsList = [
+ "pin",
+ "favorite",
+ "copy",
+ "share",
+ "export",
+ "lock-unlock",
+ "publish"
+ ];
+ const bottomBarItems = data.filter(
+ (item) => bottomBarItemsList.indexOf(item.id) > -1
+ );
+
+ const gridItems = data.filter(
+ (item) => bottomBarItemsList.indexOf(item.id) === -1
+ );
+
+ const bottomBarItemWidth =
+ (width - (bottomBarItems.length * 10 + 14)) / bottomBarItems.length;
+
return item.type === "note" ? (
- <FlatList
- data={data}
- keyExtractor={(item) => item.title}
- key={columnItemsCount + "key"}
- numColumns={columnItemsCount}
- style={{
- marginTop: item.type !== "note" ? 10 : 0,
- paddingTop: 10
- }}
- columnWrapperStyle={{
- justifyContent: "flex-start"
- }}
- contentContainerStyle={{
- alignSelf: "center",
- width: buttons.length < 5 ? "100%" : null,
- paddingLeft: buttons.length < 5 ? 10 : 0
- }}
- renderItem={_renderRowItem}
- />
+ <>
+ <FlatList
+ data={bottomBarItems}
+ keyExtractor={(item) => item.title}
+ horizontal
+ style={{
+ paddingHorizontal: 12,
+ paddingTop: 12
+ }}
+ renderItem={({ item }) => {
+ return (
+ <PressableButton
+ onPress={item.func}
+ key={item.id}
+ testID={"icon-" + item.id}
+ customStyle={{
+ alignItems: "center",
+ width: bottomBarItemWidth,
+ marginBottom: 10,
+ marginRight: 10,
+ backgroundColor: "transparent"
+ }}
+ >
+ <PressableButton
+ onPress={item.func}
+ type={item.on ? "shade" : "gray"}
+ customStyle={{
+ height: bottomBarItemWidth,
+ width: bottomBarItemWidth,
+ justifyContent: "center",
+ alignItems: "center",
+ textAlign: "center",
+ textAlignVertical: "center",
+ marginBottom: DDS.isTab ? 7 : 3.5,
+ borderRadius: 100
+ }}
+ >
+ <Icon
+ name={item.icon}
+ size={DDS.isTab ? SIZE.xxl : SIZE.md + 4}
+ color={
+ item.on
+ ? colors.accent
+ : item.name === "Delete" || item.name === "PermDelete"
+ ? colors.errorText
+ : colors.icon
+ }
+ />
+ </PressableButton>
+
+ <Paragraph
+ size={SIZE.xxs + 1}
+ style={{ textAlign: "center" }}
+ textBreakStrategy="simple"
+ >
+ {item.title}
+ </Paragraph>
+ </PressableButton>
+ );
+ }}
+ />
+
+ <FlatList
+ data={gridItems}
+ keyExtractor={(item) => item.title}
+ key={columnItemsCount + "key"}
+ numColumns={columnItemsCount}
+ style={{
+ marginTop: item.type !== "note" ? 10 : 0,
+ paddingTop: 10
+ }}
+ columnWrapperStyle={{
+ justifyContent: "flex-start"
+ }}
+ contentContainerStyle={{
+ alignSelf: "center",
+ width: buttons.length < 5 ? "100%" : null,
+ paddingLeft: buttons.length < 5 ? 10 : 0
+ }}
+ renderItem={_renderRowItem}
+ />
+ </>
) : (
<FlatList
data={data}
diff --git a/apps/mobile/app/components/properties/notebooks.js b/apps/mobile/app/components/properties/notebooks.js
index 6efa03da8..a4045b96b 100644
--- a/apps/mobile/app/components/properties/notebooks.js
+++ b/apps/mobile/app/components/properties/notebooks.js
@@ -23,39 +23,34 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { db } from "../../common/database";
import Notebook from "../../screens/notebook";
import { TopicNotes } from "../../screens/notes/topic-notes";
+import { presentSheet, ToastEvent } from "../../services/event-manager";
+import Navigation from "../../services/navigation";
+import { useNotebookStore } from "../../stores/use-notebook-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { SIZE } from "../../utils/size";
import { Button } from "../ui/button";
-import { PressableButton } from "../ui/pressable";
import Heading from "../ui/typography/heading";
-export default function Notebooks({ note, close }) {
- const colors = useThemeStore((state) => state.colors);
+export default function Notebooks({ note, close, full }) {
+ const colors = useThemeStore((state) => state.colors);
+ const notebooks = useNotebookStore((state) => state.notebooks);
function getNotebooks(item) {
if (!item.notebooks || item.notebooks.length < 1) return [];
- let notebooks = [];
- for (let notebook of item.notebooks) {
- let item_notebook = db.notebooks.notebook(notebook.id);
- if (item_notebook) {
- let data = {
- id: notebook.id,
- title: item_notebook.title,
- topics: notebook.topics
- .map((item) => {
- let topic = item_notebook.topics.topic(item)?._topic;
- if (!topic) return null;
- return {
- id: topic.id,
- title: topic.title
- };
- })
- .filter((i) => i !== null)
- };
- notebooks.push(data);
+ let filteredNotebooks = [];
+ for (let notebookReference of item.notebooks) {
+ let notebook = {
+ ...(notebooks.find((item) => item.id === notebookReference.id) || {})
+ };
+ if (notebook.id) {
+ notebook.topics = notebook.topics.filter((topic) => {
+ return notebookReference.topics.findIndex((t) => t === topic.id) > -1;
+ });
+ filteredNotebooks.push(notebook);
}
}
- return notebooks;
+ return filteredNotebooks;
}
+ const noteNotebooks = getNotebooks(note);
const navigateNotebook = (id) => {
let item = db.notebooks.notebook(id)?.data;
@@ -69,84 +64,139 @@ export default function Notebooks({ note, close }) {
TopicNotes.navigate(item, true);
};
- return !note.notebooks || note.notebooks.length === 0 ? null : (
+ const renderItem = (item) => (
<View
+ key={item.id}
style={{
- width: "100%",
- borderTopWidth: 1,
- borderTopColor: colors.nav
+ justifyContent: "flex-start",
+ paddingHorizontal: 12,
+ flexDirection: "row",
+ alignItems: "center",
+ flexShrink: 1,
+ flexGrow: 1,
+ padding: 6,
+ borderWidth: full ? 0 : 1,
+ borderColor: colors.nav,
+ borderRadius: 10,
+ backgroundColor: full ? "transparent" : colors.nav
}}
>
- {getNotebooks(note).map((item) => (
- <PressableButton
- key={item.id}
- onPress={() => {
- navigateNotebook(item.id);
- close();
- }}
- customStyle={{
- justifyContent: "flex-start",
- paddingHorizontal: 12,
- flexDirection: "row",
- alignItems: "center",
- flexShrink: 1,
- flexGrow: 1,
- marginTop: 5,
- paddingVertical: 6
- }}
- >
- <Icon
- name="book-outline"
- color={colors.accent}
- size={SIZE.sm + 1}
- style={{
- marginRight: 5
+ <Icon
+ name="book-outline"
+ color={colors.accent}
+ size={SIZE.sm}
+ style={{
+ marginRight: 5
+ }}
+ />
+ <Heading
+ numberOfLines={1}
+ style={{
+ maxWidth: "50%"
+ }}
+ size={SIZE.sm}
+ onPress={() => {
+ navigateNotebook(item.id);
+ close();
+ }}
+ >
+ {item.title}
+ </Heading>
+
+ <ScrollView
+ horizontal={true}
+ showsHorizontalScrollIndicator={false}
+ style={{
+ flexDirection: "row",
+ marginLeft: 8,
+ borderLeftColor: colors.nav,
+ borderLeftWidth: 1,
+ paddingLeft: 8
+ }}
+ >
+ {item.topics.map((topic) => (
+ <Button
+ key={topic.id}
+ onPress={() => {
+ navigateTopic(topic.id, item.id);
+ close();
}}
- />
- <Heading
- numberOfLines={1}
- style={{
- maxWidth: "50%"
+ onLongPress={async () => {
+ await db.notes.removeFromNotebook(
+ {
+ id: item.id,
+ topic: topic.id
+ },
+ note
+ );
+ useNotebookStore.getState().setNotebooks();
+ Navigation.queueRoutesForUpdate(
+ "Notes",
+ "Favorites",
+ "ColoredNotes",
+ "TaggedNotes",
+ "TopicNotes"
+ );
+ ToastEvent.show({
+ heading: "Note removed from topic",
+ context: "local",
+ type: "success"
+ });
}}
- size={SIZE.sm}
- >
- {item.title}
- </Heading>
-
- <ScrollView
- horizontal={true}
- showsHorizontalScrollIndicator={false}
+ title={topic.title}
+ type="gray"
+ height={30}
+ fontSize={SIZE.xs + 1}
+ icon="bookmark-outline"
style={{
- flexDirection: "row",
- marginLeft: 8,
- borderLeftColor: colors.nav,
- borderLeftWidth: 1,
- paddingLeft: 8
+ marginRight: 5,
+ borderRadius: 100,
+ paddingHorizontal: 8
}}
- >
- {item.topics.map((topic) => (
- <Button
- key={topic.id}
- onPress={() => {
- navigateTopic(topic.id, item.id);
- close();
- }}
- title={topic.title}
- type="grayBg"
- height={22}
- fontSize={SIZE.xs + 1}
- icon="bookmark-outline"
- style={{
- marginRight: 5,
- borderRadius: 100,
- paddingHorizontal: 8
- }}
- />
- ))}
- <View style={{ width: 10 }} />
- </ScrollView>
- </PressableButton>
- ))}
+ />
+ ))}
+ <View style={{ width: 10 }} />
+ </ScrollView>
+ </View>
+ );
+
+ return !note.notebooks || note.notebooks.length === 0 ? null : (
+ <View
+ style={{
+ width: "100%",
+ borderRadius: 10,
+ marginTop: 6
+ }}
+ >
+ {full
+ ? noteNotebooks.map(renderItem)
+ : noteNotebooks.slice(0, 1).map(renderItem)}
+
+ {noteNotebooks.length > 1 && !full ? (
+ <Button
+ title={`See all linked notebooks`}
+ fontSize={SIZE.xs + 1}
+ style={{
+ alignSelf: "flex-end",
+ marginRight: 12,
+ paddingHorizontal: 0,
+ backgroundColor: "transparent"
+ }}
+ type="gray"
+ textStyle={{
+ textDecorationLine: "underline"
+ }}
+ height={20}
+ onPress={() => {
+ presentSheet({
+ context: "properties",
+ component: (ref, close) => (
+ <Notebooks note={note} close={close} full={true} />
+ )
+ });
+ }}
+ />
+ ) : undefined}
</View>
);
}
diff --git a/apps/mobile/app/components/properties/tags.js b/apps/mobile/app/components/properties/tags.js
index b4c8f52f6..7314aa8f1 100644
--- a/apps/mobile/app/components/properties/tags.js
+++ b/apps/mobile/app/components/properties/tags.js
@@ -27,6 +27,7 @@ import { eOpenTagsDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
import { Button } from "../ui/button";
+import { ColorTags } from "./color-tags";
export const Tags = ({ item, close }) => {
const colors = useThemeStore((state) => state.colors);
@@ -34,41 +35,52 @@ export const Tags = ({ item, close }) => {
<View
style={{
marginTop: 5,
- marginBottom: 5
+ paddingTop: 6,
+ paddingBottom: 6,
+ flexDirection: "row",
+ flexWrap: "wrap",
+ alignItems: "center",
+ paddingHorizontal: 12
}}
>
- <View
+ <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.xs + 1}
style={{
- flexDirection: "row",
- flexWrap: "wrap",
- alignItems: "center"
+ marginRight: 5,
+ borderRadius: 100,
+ paddingHorizontal: 8
}}
- >
- <Button
- onPress={async () => {
- close();
- await sleep(300);
- eSendEvent(eOpenTagsDialog, item);
- }}
- buttonType={{
- text: colors.accent
- }}
- title="Add tags"
- type="grayBg"
- icon="plus"
- iconPosition="right"
- height={25}
- fontSize={SIZE.xs + 1}
- style={{
- marginRight: 5,
- borderRadius: 100,
- paddingHorizontal: 8
- }}
- />
- {item.tags.map((item) =>
- item ? <TagItem key={item} tag={item} close={close} /> : null
- )}
- </View>
+ />
+ <ColorTags item={item} />
+ </View>
+ ) : null;
+};
+
+export const TagStrip = ({ item, close }) => {
+ return item.tags?.length > 0 ? (
+ <View
+ style={{
+ flexDirection: "row",
+ flexWrap: "wrap",
+ alignItems: "center"
+ }}
+ >
+ {item.tags.map((item) =>
+ item ? <TagItem key={item} tag={item} close={close} /> : null
+ )}
</View>
) : null;
};
@@ -83,23 +95,24 @@ const TagItem = ({ tag, close }) => {
};
const style = {
- paddingHorizontal: 8,
- marginVertical: 5,
+ paddingHorizontal: 0,
borderRadius: 100,
- marginRight: 5
+ marginRight: 10,
+ marginTop: 0,
+ backgroundColor: "transparent"
};
return (
<Button
onPress={onPress}
title={"#" + tag}
- // buttonType={{
- // text: colors.accent
- // }}
type="grayBg"
- height={25}
+ height={20}
fontSize={SIZE.xs + 1}
style={style}
+ textStyle={{
+ textDecorationLine: "underline"
+ }}
/>
);
};
diff --git a/apps/mobile/app/components/sheet-provider/index.js b/apps/mobile/app/components/sheet-provider/index.js
index d2562b4d2..9fe38f2c2 100644
--- a/apps/mobile/app/components/sheet-provider/index.js
+++ b/apps/mobile/app/components/sheet-provider/index.js
@@ -58,7 +58,7 @@ const SheetProvider = ({ context = "global" }) => {
if (visible || dialogData) {
setDialogData(null);
setVisible(false);
- await sleep(500);
+ await sleep(0);
}
setDialogData(data);
setVisible(true);
diff --git a/apps/mobile/app/hooks/use-actions.js b/apps/mobile/app/hooks/use-actions.js
index 506383d92..1781d8d05 100644
--- a/apps/mobile/app/hooks/use-actions.js
+++ b/apps/mobile/app/hooks/use-actions.js
@@ -21,7 +21,6 @@ import Clipboard from "@react-native-clipboard/clipboard";
import React, { useCallback, useEffect, useState } from "react";
import { Platform } from "react-native";
import Share from "react-native-share";
-import { notesnook } from "../../e2e/test.ids";
import { db } from "../common/database";
import { presentDialog } from "../components/dialog/functions";
import NoteHistory from "../components/note-history";
@@ -602,29 +601,35 @@ export const useActions = ({ close = () => null, item }) => {
};
const actions = [
{
- name: "Add to notebook",
- title: "Add to notebook",
+ id: "notebooks",
+ title: "Link Notebooks",
icon: "book-outline",
func: addTo
},
{
- name: "Add-Reminder",
- title: "Add reminder",
- icon: "bell-plus",
+ id: "add-tag",
+ title: "Add tags",
+ icon: "pound",
+ func: addTo
+ },
+ {
+ id: "add-reminder",
+ title: "Remind me",
+ icon: "clock-plus-outline",
func: () => {
ReminderSheet.present(null, { id: item.id, type: "note" });
},
close: true
},
{
- name: "Vault",
+ id: "lock-unlock",
title: item.locked ? "Unlock" : "Lock",
- icon: item.locked ? "shield-off-outline" : "shield-outline",
+ icon: item.locked ? "lock-open-outline" : "key-outline",
func: addToVault,
on: item.locked
},
{
- name: "Publish",
+ id: "publish",
title: isPublished ? "Published" : "Publish",
icon: "cloud-upload-outline",
on: isPublished,
@@ -632,47 +637,13 @@ export const useActions = ({ close = () => null, item }) => {
},
{
- name: "Export",
+ id: "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",
+ id: "move-notes",
title: "Add notes",
icon: "plus",
func: async () => {
@@ -682,41 +653,39 @@ export const useActions = ({ close = () => null, item }) => {
}
},
{
- name: "Pin",
+ id: "pin",
title: item.pinned ? "Unpin" : "Pin",
icon: item.pinned ? "pin-off-outline" : "pin-outline",
func: pinItem,
close: false,
check: true,
on: item.pinned,
- nopremium: true,
- id: notesnook.ids.dialogs.actionsheet.pin
+ pro: true
},
{
- name: "Favorite",
+ id: "favorite",
title: !item.favorite ? "Favorite" : "Unfavorite",
icon: item.favorite ? "star-off" : "star-outline",
func: addToFavorites,
close: false,
check: true,
on: item.favorite,
- nopremium: true,
- id: notesnook.ids.dialogs.actionsheet.favorite,
+ pro: true,
color: "orange"
},
{
- name: "PinToNotif",
+ id: "pin-to-notifications",
title:
notifPinned !== null
? "Unpin from Notifications"
- : "Pin to Notifications",
- icon: "bell",
+ : "Pin to notifications",
+ icon: "message-badge-outline",
on: notifPinned !== null,
func: pinToNotifications
},
{
- name: "Edit Notebook",
+ id: "edit-notebook",
title: "Edit notebook",
icon: "square-edit-outline",
func: async () => {
@@ -726,7 +695,7 @@ export const useActions = ({ close = () => null, item }) => {
}
},
{
- name: "Edit Topic",
+ id: "edit-topic",
title: "Edit topic",
icon: "square-edit-outline",
func: async () => {
@@ -739,74 +708,72 @@ export const useActions = ({ close = () => null, item }) => {
}
},
{
- name: "Copy",
+ id: "copy",
title: "Copy",
icon: "content-copy",
func: copyContent
},
{
- name: "Restore",
+ id: "restore",
title: "Restore " + item.itemType,
icon: "delete-restore",
func: restoreTrashItem
},
{
- name: "Add Shortcut",
+ id: "add-shortcut",
title: isPinnedToMenu ? "Remove Shortcut" : "Add Shortcut",
icon: isPinnedToMenu ? "link-variant-remove" : "link-variant",
func: createMenuShortcut,
close: false,
check: true,
on: isPinnedToMenu,
- nopremium: true,
- id: notesnook.ids.dialogs.actionsheet.pinMenu
+ pro: true
},
{
- name: "Rename Tag",
+ id: "rename-tag",
title: "Rename tag",
icon: "square-edit-outline",
func: renameTag
},
{
- name: "Share",
+ id: "share",
title: "Share",
icon: "share-variant",
func: shareNote
},
{
- name: "ReadOnly",
+ id: "read-only",
title: "Read only",
icon: "pencil-lock",
func: toggleReadyOnlyMode,
on: item.readonly
},
{
- name: "Local only",
+ id: "local-only",
title: "Local only",
icon: "sync-off",
func: toggleLocalOnly,
on: item.localOnly
},
{
- name: "Duplicate",
+ id: "duplicate",
title: "Duplicate",
icon: "content-duplicate",
func: duplicateNote
},
{
- name: "Dark Mode",
+ id: "dark-mode",
title: "Dark mode",
icon: "theme-light-dark",
func: switchTheme,
switch: true,
on: colors.night ? true : false,
close: false,
- nopremium: true,
- id: notesnook.ids.dialogs.actionsheet.night
+ pro: true
},
{
- name: "Edit reminder",
+ id: "edit-reminder",
title: "Edit reminder",
icon: "pencil",
func: async () => {
@@ -818,7 +785,42 @@ export const useActions = ({ close = () => null, item }) => {
},
{
- name: "ReminderOnOff",
+ id: "reminders",
+ title: "Reminders",
+ icon: "clock-outline",
+ 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
+ },
+ {
+ id: "attachments",
+ title: "Attachments",
+ icon: "attachment",
+ func: showAttachments
+ },
+ {
+ id: "history",
+ title: "History",
+ icon: "history",
+ func: openHistory
+ },
+
+ {
+ id: "disable-reminder",
title: !item.disabled ? "Turn off reminder" : "Turn on reminder",
icon: !item.disabled ? "bell-off-outline" : "bell",
func: async () => {
@@ -841,14 +843,14 @@ export const useActions = ({ close = () => null, item }) => {
}
},
{
- name: "RemoveTopic",
+ id: "remove-from-topic",
title: "Remove from topic",
hidden: !isNoteInTopic(),
icon: "minus-circle-outline",
func: removeNoteFromTopic
},
{
- name: "Delete",
+ id: "trash",
title:
item.type !== "notebook" && item.type !== "note"
? "Delete " + item.type
@@ -858,13 +860,13 @@ export const useActions = ({ close = () => null, item }) => {
func: deleteItem
},
{
- name: "PermDelete",
+ id: "delete",
title: "Delete " + item.itemType,
icon: "delete",
func: deleteTrashItem
}
// {
- // name: "ReferencedIn",
+ // id: "ReferencedIn",
// title: "References",
// icon: "link",
// func: async () => {