Skip to content

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

mobile: updates

Ammar Ahmed3c9b315f7831
diff --git a/apps/mobile/app/components/properties/items.tsx b/apps/mobile/app/components/properties/items.tsx
index dc5b7b4fe..04cdfb656 100644
--- a/apps/mobile/app/components/properties/items.tsx
+++ b/apps/mobile/app/components/properties/items.tsx
@@ -29,10 +29,10 @@ import { DDS } from "../../services/device-detection";
import { useSettingStore } from "../../stores/use-setting-store";
import { AppFontSize, defaultBorderRadius } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
+import AppIcon from "../ui/AppIcon";
import { Button } from "../ui/button";
import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph";
-import AppIcon from "../ui/AppIcon";
const TOP_BAR_ITEMS: ActionId[] = [
"pin",
@@ -354,7 +354,8 @@ export const Items = ({
paginationStyle={{
position: "relative",
marginHorizontal: 2,
- marginBottom: 0
+ marginBottom: 0,
+ marginTop: 0
}}
contentContainerStyle={{
justifyContent: "flex-start",
diff --git a/apps/mobile/app/components/sheets/plan-limits/index.tsx b/apps/mobile/app/components/sheets/plan-limits/index.tsx
new file mode 100644
index 000000000..2f8e6cd6a
--- /dev/null
+++ b/apps/mobile/app/components/sheets/plan-limits/index.tsx
@@ -0,0 +1,102 @@
+import { FeatureUsage, getFeature, getFeaturesUsage } from "@notesnook/common";
+import { strings } from "@notesnook/intl";
+import { useThemeColors } from "@notesnook/theme";
+import { useEffect, useState } from "react";
+import { View } from "react-native";
+import { AppFontSize } from "../../../utils/size";
+import { DefaultAppStyles } from "../../../utils/styles";
+import Paragraph from "../../ui/typography/paragraph";
+import Heading from "../../ui/typography/heading";
+import Navigation from "../../../services/navigation";
+import { Button } from "../../ui/button";
+import { eSendEvent } from "../../../services/event-manager";
+import { eCloseSheet } from "../../../utils/events";
+
+export function PlanLimits() {
+ const { colors } = useThemeColors();
+ const [featureUsage, setFeatureUsage] = useState<FeatureUsage[]>();
+
+ useEffect(() => {
+ getFeaturesUsage()
+ .then((result) => {
+ setFeatureUsage(result);
+ })
+ .catch((e) => console.log(e));
+ }, []);
+
+ return (
+ <View
+ style={{
+ paddingHorizontal: DefaultAppStyles.GAP,
+ width: "100%",
+ paddingVertical: DefaultAppStyles.GAP_VERTICAL,
+ gap: DefaultAppStyles.GAP_VERTICAL
+ }}
+ >
+ <Heading>Plan limits</Heading>
+
+ {featureUsage?.map((item) => (
+ <View
+ key={item.id}
+ style={{
+ gap: DefaultAppStyles.GAP_VERTICAL_SMALL,
+ width: "100%"
+ }}
+ >
+ <View
+ style={{
+ flexDirection: "row",
+ width: "100%",
+ justifyContent: "space-between"
+ }}
+ >
+ <Paragraph size={AppFontSize.sm}>
+ {getFeature(item.id).title}
+ </Paragraph>
+ <Paragraph size={AppFontSize.sm}>
+ {item.used}/{item.total} {strings.used()}
+ </Paragraph>
+ </View>
+ <View
+ style={{
+ backgroundColor: colors.secondary.background,
+ width: "100%",
+ height: 5,
+ borderRadius: 10
+ }}
+ >
+ <View
+ style={{
+ backgroundColor: colors.primary.accent,
+ height: 5,
+ width: `${
+ ((item.used > item.total ? item.total : item.used) /
+ item.total) *
+ 100
+ }%`,
+ borderRadius: 10
+ }}
+ />
+ </View>
+ </View>
+ ))}
+
+ <Button
+ title={strings.upgradePlan()}
+ onPress={() => {
+ Navigation.navigate("PayWall", {
+ context: "logged-in",
+ canGoBack: true
+ });
+ eSendEvent(eCloseSheet);
+ }}
+ type="accent"
+ fontSize={AppFontSize.xs}
+ style={{
+ width: "100%",
+ marginTop: DefaultAppStyles.GAP_VERTICAL
+ }}
+ />
+ </View>
+ );
+}
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
index f3b54151d..62febf823 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx
@@ -243,8 +243,7 @@ export const useEditorEvents = (
timeFormat,
loading,
fontScale,
- markdownShortcuts,
- features
+ markdownShortcuts
]);
const onBackPress = useCallback(async () => {
diff --git a/apps/mobile/app/screens/settings/user-section.jsx b/apps/mobile/app/screens/settings/user-section.jsx
index 23fb5a58c..c522dc082 100644
--- a/apps/mobile/app/screens/settings/user-section.jsx
+++ b/apps/mobile/app/screens/settings/user-section.jsx
@@ -27,16 +27,17 @@ import ImagePicker from "react-native-image-crop-picker";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { db } from "../../common/database";
import { presentDialog } from "../../components/dialog/functions";
+import { PlanLimits } from "../../components/sheets/plan-limits";
import AppIcon from "../../components/ui/AppIcon";
import { Button } from "../../components/ui/button";
import { TimeSince } from "../../components/ui/time-since";
import Paragraph from "../../components/ui/typography/paragraph";
+import { presentSheet } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import { useThemeStore } from "../../stores/use-theme-store";
import { SyncStatus, useUserStore } from "../../stores/use-user-store";
import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
-import { SectionItem } from "./section-item";
export const getTimeLeft = (t2) => {
let daysRemaining = dayjs(t2).diff(dayjs(), "days");
@@ -134,9 +135,7 @@ const SettingsUserSection = ({ item }) => {
style={{
paddingHorizontal: DefaultAppStyles.GAP,
paddingTop: 25,
- borderBottomWidth: 1,
- paddingBottom: 20,
- borderColor: colors.primary.border
+ paddingBottom: 20
}}
>
<View
@@ -309,7 +308,14 @@ const SettingsUserSection = ({ item }) => {
borderRadius: 10
}}
>
- <View>
+ <TouchableOpacity
+ activeOpacity={1}
+ onPress={() => {
+ presentSheet({
+ component: <PlanLimits />
+ });
+ }}
+ >
<Paragraph size={AppFontSize.sm}>
{strings.freePlan()}
</Paragraph>
@@ -320,7 +326,7 @@ const SettingsUserSection = ({ item }) => {
{strings.viewAllLimits()}{" "}
<AppIcon name="information" size={AppFontSize.xxxs} />
</Paragraph>
- </View>
+ </TouchableOpacity>
<Button
title={strings.upgradePlan()}
@@ -342,9 +348,9 @@ const SettingsUserSection = ({ item }) => {
</View>
</View>
- {item.sections.map((item) => (
+ {/* {item.sections.map((item) => (
<SectionItem key={item.name} item={item} />
- ))}
+ ))} */}
</>
) : null}
</>