Skip to content

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

mobile: bug fixes

Ammar Ahmedfae6bf8f43b3
diff --git a/apps/mobile/app/components/header/index.tsx b/apps/mobile/app/components/header/index.tsx
index 0e459de72..24762c2ca 100644
--- a/apps/mobile/app/components/header/index.tsx
+++ b/apps/mobile/app/components/header/index.tsx
@@ -99,7 +99,7 @@ export const Header = ({
justifyContent: "space-between",
marginTop: DefaultAppStyles.GAP_SMALL,
borderRadius: 10,
- paddingVertical: DefaultAppStyles.GAP_VERTICAL_SMALL - 2,
+ paddingVertical: 3,
borderWidth: hasSearch ? 1 : 0,
borderColor: colors.primary.border,
paddingHorizontal: !hasSearch ? 0 : DefaultAppStyles.GAP_SMALL,
diff --git a/apps/mobile/app/components/properties/index.js b/apps/mobile/app/components/properties/index.js
index 79b237a38..9d8fd4e09 100644
--- a/apps/mobile/app/components/properties/index.js
+++ b/apps/mobile/app/components/properties/index.js
@@ -210,7 +210,7 @@ export const Properties = ({ close = () => {}, item, buttons = [] }) => {
);
};
-Properties.present = async (item, isSheet) => {
+Properties.present = async (item, isSheet, buttons = []) => {
if (!item) return;
let type = item?.type;
let dbItem;
@@ -239,7 +239,12 @@ Properties.present = async (item, isSheet) => {
presentSheet({
context: isSheet ? "local" : undefined,
component: (ref, close) => (
- <Properties close={close} actionSheetRef={ref} item={dbItem} />
+ <Properties
+ close={close}
+ actionSheetRef={ref}
+ item={dbItem}
+ buttons={buttons}
+ />
)
});
};
diff --git a/apps/mobile/app/components/properties/items.tsx b/apps/mobile/app/components/properties/items.tsx
index 96d444781..ae8b37713 100644
--- a/apps/mobile/app/components/properties/items.tsx
+++ b/apps/mobile/app/components/properties/items.tsx
@@ -75,7 +75,15 @@ const COLUMN_BAR_ITEMS: ActionId[] = [
"delete"
];
-export const Items = ({ item, close }: { item: Item; close: () => void }) => {
+export const Items = ({
+ item,
+ close,
+ buttons
+}: {
+ item: Item;
+ close: () => void;
+ buttons: Action[];
+}) => {
const { colors } = useThemeColors();
const topBarSorting = useStoredRef<{ [name: string]: number }>(
"topbar-sorting-ref",
@@ -341,7 +349,10 @@ export const Items = ({ item, close }: { item: Item; close: () => void }) => {
</View>
</>
) : (
- <View>{columnItems.map(renderColumnItem)}</View>
+ <View>
+ {buttons.map(renderColumnItem)}
+ {columnItems.map(renderColumnItem)}
+ </View>
)}
</View>
);
diff --git a/apps/mobile/app/components/sheets/user/index.tsx b/apps/mobile/app/components/sheets/user/index.tsx
index 125046beb..d543c4ccd 100644
--- a/apps/mobile/app/components/sheets/user/index.tsx
+++ b/apps/mobile/app/components/sheets/user/index.tsx
@@ -28,7 +28,7 @@ import { presentSheet, ToastManager } from "../../../services/event-manager";
import Navigation from "../../../services/navigation";
import { SyncStatus, useUserStore } from "../../../stores/use-user-store";
import { getObfuscatedEmail } from "../../../utils/functions";
-import { AppFontSize } from "../../../utils/size";
+import { AppFontSize, defaultBorderRadius } from "../../../utils/size";
import { DefaultAppStyles } from "../../../utils/styles";
import { AuthMode } from "../../auth/common";
import { Card } from "../../list/card";
@@ -61,8 +61,7 @@ export const UserSheet = () => {
<View
style={{
width: "100%",
- justifyContent: "center",
- gap: DefaultAppStyles.GAP
+ justifyContent: "center"
}}
>
{user ? (
@@ -82,7 +81,7 @@ export const UserSheet = () => {
style={{
width: 40,
height: 40,
- borderRadius: 10
+ borderRadius: defaultBorderRadius
}}
/>
) : null}
@@ -262,15 +261,13 @@ export const UserSheet = () => {
style={{
borderBottomWidth: 1,
height: 1,
- borderColor: colors.primary.border
+ width: "100%",
+ borderColor: colors.primary.border,
+ marginVertical: DefaultAppStyles.GAP_VERTICAL
}}
- ></View>
+ />
- <View
- style={{
- gap: DefaultAppStyles.GAP_VERTICAL
- }}
- >
+ <View>
{[
{
icon: "reload",
diff --git a/apps/mobile/app/components/side-menu/index.tsx b/apps/mobile/app/components/side-menu/index.tsx
index 4a40eaf38..801e072ea 100644
--- a/apps/mobile/app/components/side-menu/index.tsx
+++ b/apps/mobile/app/components/side-menu/index.tsx
@@ -54,6 +54,7 @@ import {
useSideMenuTagsSelectionStore
} from "./stores";
import { useSideBarDraggingStore } from "./dragging-store";
+import { Button } from "../ui/button";
const renderScene = SceneMap({
home: SideMenuHome,
notebooks: SideMenuNotebooks,
@@ -251,172 +252,174 @@ const TabBar = (
</>
) : (
<>
- <View
- style={{
- flexDirection: "row",
- gap: DefaultAppStyles.GAP_SMALL
- }}
- >
- {props.navigationState.routes.map((route, index) => {
- const isFocused = props.navigationState.index === index;
+ {dragging ? (
+ <Button
+ onPress={() => {
+ useSideBarDraggingStore.setState({
+ dragging: false
+ });
+ }}
+ style={{
+ width: "100%"
+ }}
+ type="accent"
+ testID="check"
+ title={strings.done()}
+ icon={"check"}
+ iconSize={AppFontSize.lg - 2}
+ />
+ ) : (
+ <>
+ <View
+ style={{
+ flexDirection: "row",
+ gap: DefaultAppStyles.GAP_SMALL
+ }}
+ >
+ {props.navigationState.routes.map((route, index) => {
+ const isFocused = props.navigationState.index === index;
- return (
- <Pressable
- key={route.key}
- testID={`tab-${route.key}`}
- onPress={() => {
- props.jumpTo(route.key);
- switch (route.key) {
- case "notebooks":
- Navigation.routeNeedsUpdate(
- "Notebooks",
- Navigation.routeUpdateFunctions.Notebooks
- );
- break;
- case "tags":
- Navigation.routeNeedsUpdate(
- "Tags",
- Navigation.routeUpdateFunctions.Tags
- );
- break;
- default:
- break;
- }
- }}
- style={{
- borderRadius: 10,
- paddingVertical: 2,
- width: 40,
- height: 40
- }}
- type={isFocused ? "selected" : "plain"}
- >
- <Icon
- name={getIcon(route.key)}
- color={
- isFocused ? colors.selected.icon : colors.primary.icon
- }
- size={AppFontSize.lg}
- />
- </Pressable>
- );
- })}
- </View>
+ return (
+ <Pressable
+ key={route.key}
+ testID={`tab-${route.key}`}
+ onPress={() => {
+ props.jumpTo(route.key);
+ switch (route.key) {
+ case "notebooks":
+ Navigation.routeNeedsUpdate(
+ "Notebooks",
+ Navigation.routeUpdateFunctions.Notebooks
+ );
+ break;
+ case "tags":
+ Navigation.routeNeedsUpdate(
+ "Tags",
+ Navigation.routeUpdateFunctions.Tags
+ );
+ break;
+ default:
+ break;
+ }
+ }}
+ style={{
+ borderRadius: 10,
+ paddingVertical: 2,
+ width: 40,
+ height: 40
+ }}
+ type={isFocused ? "selected" : "plain"}
+ >
+ <Icon
+ name={getIcon(route.key)}
+ color={
+ isFocused ? colors.selected.icon : colors.primary.icon
+ }
+ size={AppFontSize.lg}
+ />
+ </Pressable>
+ );
+ })}
+ </View>
- <View
- style={{
- flexDirection: "row",
- alignItems: "center",
- gap: DefaultAppStyles.GAP_SMALL
- }}
- >
- {props.navigationState.index > 0 ? (
- <>
- <IconButton
- name="plus"
- testID="sidebar-add-button"
- size={AppFontSize.lg - 2}
- color={colors.primary.icon}
- onPress={() => {
- if (props.navigationState.index === 1) {
- AddNotebookSheet.present();
- } else {
- presentDialog({
- title: strings.addTag(),
- paragraph: strings.addTagDesc(),
- input: true,
- positiveText: "Add",
- positivePress: async (tag) => {
- if (tag) {
- await db.tags.add({
- title: tag
- });
- useTagStore.getState().refresh();
- return true;
- }
- ToastManager.show({
- context: "local",
- type: "error",
- message: strings.allFieldsRequired()
+ <View
+ style={{
+ flexDirection: "row",
+ alignItems: "center",
+ gap: DefaultAppStyles.GAP_SMALL
+ }}
+ >
+ {props.navigationState.index > 0 ? (
+ <>
+ <IconButton
+ name="plus"
+ testID="sidebar-add-button"
+ size={AppFontSize.lg - 2}
+ color={colors.primary.icon}
+ onPress={() => {
+ if (props.navigationState.index === 1) {
+ AddNotebookSheet.present();
+ } else {
+ presentDialog({
+ title: strings.addTag(),
+ paragraph: strings.addTagDesc(),
+ input: true,
+ positiveText: "Add",
+ positivePress: async (tag) => {
+ if (tag) {
+ await db.tags.add({
+ title: tag
+ });
+ useTagStore.getState().refresh();
+ return true;
+ }
+ ToastManager.show({
+ context: "local",
+ type: "error",
+ message: strings.allFieldsRequired()
+ });
+ return false;
+ }
});
- return false;
}
- });
- }
- }}
- style={{
- width: 35,
- height: 35
- }}
- />
-
- <IconButton
- name={
- groupOptions.sortDirection === "asc"
- ? "sort-ascending"
- : "sort-descending"
- }
- testID="sidebar-sort-button"
- color={colors.primary.icon}
- onPress={() => {
- presentSheet({
- component: (
- <Sort
- type={
- props.navigationState.index === 1
- ? "notebook"
- : "tag"
- }
- hideGroupOptions
- />
- )
- });
- }}
- style={{
- width: 35,
- height: 35
- }}
- size={AppFontSize.lg - 2}
- />
- </>
- ) : null}
+ }}
+ style={{
+ width: 35,
+ height: 35
+ }}
+ />
- {props.navigationState.index === 0 ? (
- <>
- <IconButton
- onPress={() => {
- useThemeStore.getState().setColorScheme();
- }}
- style={{
- width: 28,
- height: 28
- }}
- testID="sidebar-theme-button"
- color={colors.primary.icon}
- name={isDark ? "weather-night" : "weather-sunny"}
- size={AppFontSize.lg - 2}
- />
+ <IconButton
+ name={
+ groupOptions.sortDirection === "asc"
+ ? "sort-ascending"
+ : "sort-descending"
+ }
+ testID="sidebar-sort-button"
+ color={colors.primary.icon}
+ onPress={() => {
+ presentSheet({
+ component: (
+ <Sort
+ type={
+ props.navigationState.index === 1
+ ? "notebook"
+ : "tag"
+ }
+ hideGroupOptions
+ />
+ )
+ });
+ }}
+ style={{
+ width: 35,
+ height: 35
+ }}
+ size={AppFontSize.lg - 2}
+ />
+ </>
+ ) : null}
- {dragging ? (
- <IconButton
- onPress={() => {
- useSideBarDraggingStore.setState({
- dragging: false
- });
- }}
- style={{
- width: 28,
- height: 28
- }}
- testID="check"
- color={colors.primary.icon}
- name={"check"}
- size={AppFontSize.lg - 2}
- />
+ {props.navigationState.index === 0 ? (
+ <>
+ <IconButton
+ onPress={() => {
+ useThemeStore.getState().setColorScheme();
+ }}
+ style={{
+ width: 28,
+ height: 28
+ }}
+ testID="sidebar-theme-button"
+ color={colors.primary.icon}
+ name={isDark ? "weather-night" : "weather-sunny"}
+ size={AppFontSize.lg - 2}
+ />
+ </>
) : null}
- </>
- ) : null}
- </View>
+ </View>
+ </>
+ )}
</>
)}
</View>
diff --git a/apps/mobile/app/components/side-menu/menu-item.tsx b/apps/mobile/app/components/side-menu/menu-item.tsx
index 2c4c96abe..0a204bee4 100644
--- a/apps/mobile/app/components/side-menu/menu-item.tsx
+++ b/apps/mobile/app/components/side-menu/menu-item.tsx
@@ -35,6 +35,7 @@ import { AppFontSize, defaultBorderRadius } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph";
+import { useSideBarDraggingStore } from "./dragging-store";
function _MenuItem({
item,
@@ -98,6 +99,7 @@ function _MenuItem({
}, [item.data, item.id]);
const _onPress = () => {
+ if (useSideBarDraggingStore.getState().dragging) return;
if (item.onPress) return item.onPress(item);
if (useNavigationStore.getState().currentRoute !== item.id) {
diff --git a/apps/mobile/app/components/side-menu/side-menu-header.tsx b/apps/mobile/app/components/side-menu/side-menu-header.tsx
index 9eecd66d4..1486b7973 100644
--- a/apps/mobile/app/components/side-menu/side-menu-header.tsx
+++ b/apps/mobile/app/components/side-menu/side-menu-header.tsx
@@ -29,6 +29,7 @@ import { IconButton, IconButtonProps } from "../ui/icon-button";
import { Pressable } from "../ui/pressable";
import { SvgView } from "../ui/svg";
import Heading from "../ui/typography/heading";
+import { useSideBarDraggingStore } from "./dragging-store";
const SettingsIcon = () => {
const { colors } = useThemeColors();
@@ -37,6 +38,7 @@ const SettingsIcon = () => {
return (
<Pressable
onPress={() => {
+ if (useSideBarDraggingStore.getState().dragging) return;
UserSheet.present();
}}
testID="sidemenu-settings-icon"
diff --git a/apps/mobile/app/components/side-menu/side-menu-notebooks.tsx b/apps/mobile/app/components/side-menu/side-menu-notebooks.tsx
index fc81655f3..4a3f6c59a 100644
--- a/apps/mobile/app/components/side-menu/side-menu-notebooks.tsx
+++ b/apps/mobile/app/components/side-menu/side-menu-notebooks.tsx
@@ -266,7 +266,21 @@ const NotebookItemWrapper = React.memo(
Navigation.closeDrawer();
}}
onLongPress={() => {
- Properties.present(item.notebook, false);
+ Properties.present(item.notebook, false, [
+ {
+ id: "select",
+ title: strings.select() + " " + strings.dataTypes["notebook"](),
+ icon: "checkbox-outline",
+ onPress: () => {
+ const store = useSideMenuNotebookSelectionStore;
+ store.setState({
+ enabled: true,
+ selection: {}
+ });
+ store.getState().markAs(item.notebook, "selected");
+ }
+ }
+ ]);
}}
/>
</View>
diff --git a/apps/mobile/app/components/side-menu/side-menu-tags.tsx b/apps/mobile/app/components/side-menu/side-menu-tags.tsx
index d491b598a..8b48ee139 100644
--- a/apps/mobile/app/components/side-menu/side-menu-tags.tsx
+++ b/apps/mobile/app/components/side-menu/side-menu-tags.tsx
@@ -74,7 +74,21 @@ const TagItem = (props: {
<Pressable
type={isSelected || isFocused ? "selected" : "transparent"}
onLongPress={() => {
- Properties.present(item);
+ Properties.present(item, false, [
+ {
+ id: "select",
+ title: strings.select() + " " + strings.dataTypes["tag"](),
+ icon: "checkbox-outline",
+ onPress: () => {
+ const store = useSideMenuTagsSelectionStore;
+ store.setState({
+ enabled: true,
+ selection: {}
+ });
+ store.getState().markAs(item, "selected");
+ }
+ }
+ ]);
}}
testID={`tag-item-${props.id}`}
onPress={() => {
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index b6dce79cb..64d2bc78b 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -43,10 +43,6 @@ import { ReferencesList } from "../components/sheets/references";
import { RelationsList } from "../components/sheets/relations-list/index";
import ReminderSheet from "../components/sheets/reminder";
import { useSideBarDraggingStore } from "../components/side-menu/dragging-store";
-import {
- useSideMenuNotebookSelectionStore,
- useSideMenuTagsSelectionStore
-} from "../components/side-menu/stores";
import { ButtonProps } from "../components/ui/button";
import { useTabStore } from "../screens/editor/tiptap/use-tab-store";
import {
@@ -221,10 +217,11 @@ export const useActions = ({
if (!item.id) return;
if (item.type === "note") {
await db.notes.pin(!item?.pinned, item.id);
+ setItem((await db.notes.note(item.id)) as Item);
} else if (item.type === "notebook") {
await db.notebooks.pin(!item?.pinned, item.id);
+ setItem((await db.notebooks.notebook(item.id)) as Item);
}
- setItem((await db.notes.note(item.id)) as Item);
Navigation.queueRoutesForUpdate();
}
@@ -471,23 +468,6 @@ export const useActions = ({
checked: isPinnedToMenu,
activeColor: colors.error.paragraph
});
- actions.push({
- id: "select",
- title: strings.select() + " " + strings.dataTypes[item.type](),
- icon: "checkbox-outline",
- onPress: () => {
- const store =
- item.type === "tag"
- ? useSideMenuTagsSelectionStore
- : useSideMenuNotebookSelectionStore;
- store.setState({
- enabled: true,
- selection: {}
- });
- store.getState().markAs(item, "selected");
- close();
- }
- });
}
if (item.type === "notebook") {
diff --git a/apps/mobile/app/screens/search/search-bar.tsx b/apps/mobile/app/screens/search/search-bar.tsx
index 8c53310da..ee6498994 100644
--- a/apps/mobile/app/screens/search/search-bar.tsx
+++ b/apps/mobile/app/screens/search/search-bar.tsx
@@ -63,7 +63,8 @@ export const SearchBar = ({
paddingHorizontal: DefaultAppStyles.GAP_SMALL,
borderRadius: 10,
borderColor: colors.primary.border,
- borderWidth: 1
+ borderWidth: 1,
+ paddingVertical: 3
}}
>
<IconButton
@@ -86,8 +87,8 @@ export const SearchBar = ({
fontFamily: "OpenSans-Regular",
flexGrow: 1,
color: colors.primary.paragraph,
- paddingTop: DefaultAppStyles.GAP_VERTICAL,
- paddingBottom: DefaultAppStyles.GAP_VERTICAL
+ paddingTop: 0,
+ paddingBottom: 0
}}
autoFocus
onChangeText={_onChangeText}