Skip to content

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

mobile: add beta tag on Reminders screen

ammarahm-ed1c66266f2d26
diff --git a/apps/mobile/app/components/header/title.js b/apps/mobile/app/components/header/title.js
index b8b2645f6..9b2fa206a 100644
--- a/apps/mobile/app/components/header/title.js
+++ b/apps/mobile/app/components/header/title.js
@@ -32,6 +32,7 @@ import { SIZE } from "../../utils/size";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { useCallback } from "react";
+import Tag from "../ui/tag";
const titleState = {};
@@ -99,12 +100,14 @@ export const Title = () => {
if (!isTopic) return;
Notebook.navigate(notebook, true);
}
+ console.log(currentScreen);
return (
<View
style={{
opacity: 1,
flexShrink: 1,
- flexDirection: "row"
+ flexDirection: "row",
+ alignItems: "center"
}}
>
{!hide && !isHidden ? (
@@ -135,6 +138,7 @@ export const Title = () => {
{title}
</Heading>
) : null}
+ <Tag visible={currentScreen.beta} text="BETA" />
</View>
);
};
diff --git a/apps/mobile/app/components/side-menu/menu-item.js b/apps/mobile/app/components/side-menu/menu-item.js
index bb331f1f7..8331ffa19 100644
--- a/apps/mobile/app/components/side-menu/menu-item.js
+++ b/apps/mobile/app/components/side-menu/menu-item.js
@@ -30,6 +30,7 @@ import { PressableButton } from "../ui/pressable";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { useCallback } from "react";
+import Tag from "../ui/tag";
export const MenuItem = React.memo(
function MenuItem({ item, index, testID, rightBtn }) {
@@ -44,7 +45,10 @@ export const MenuItem = React.memo(
if (item.func) {
item.func();
} else {
- Navigation.navigate({ name: item.name }, { canGoBack: false });
+ Navigation.navigate(
+ { name: item.name, beta: item.isBeta },
+ { canGoBack: false }
+ );
}
if (item.close) {
setImmediate(() => {
@@ -123,22 +127,8 @@ export const MenuItem = React.memo(
) : (
<Paragraph size={SIZE.md}>{item.name}</Paragraph>
)}
- {item.isBeta ? (
- <View
- style={{
- backgroundColor: colors.accent,
- borderRadius: 100,
- paddingHorizontal: 4,
- paddingVertical: 2,
- marginLeft: 2,
- marginTop: -10
- }}
- >
- <Paragraph color={colors.light} size={SIZE.xxs}>
- BETA
- </Paragraph>
- </View>
- ) : null}
+
+ <Tag visible={item.isBeta} text="BETA" />
</View>
{item.switch ? (
diff --git a/apps/mobile/app/components/ui/animated-button.tsx/index.tsx b/apps/mobile/app/components/ui/animated-button/index.tsx
similarity index 100%
rename from apps/mobile/app/components/ui/animated-button.tsx/index.tsx
rename to apps/mobile/app/components/ui/animated-button/index.tsx
diff --git a/apps/mobile/app/components/ui/tag/index.tsx b/apps/mobile/app/components/ui/tag/index.tsx
new file mode 100644
index 000000000..d36981708
--- /dev/null
+++ b/apps/mobile/app/components/ui/tag/index.tsx
@@ -0,0 +1,57 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2022 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+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 React from "react";
+import { View, ViewStyle } from "react-native";
+import { useThemeStore } from "../../../stores/use-theme-store";
+import { SIZE } from "../../../utils/size";
+import Paragraph from "../typography/paragraph";
+
+export default function Tag({
+ text,
+ textColor,
+ background,
+ visible,
+ style
+}: {
+ text: string;
+ background?: string;
+ textColor?: string;
+ visible?: boolean;
+ style?: ViewStyle;
+}) {
+ const colors = useThemeStore((state) => state.colors);
+ return !visible ? null : (
+ <View
+ style={{
+ backgroundColor: background || colors.accent,
+ borderRadius: 100,
+ paddingHorizontal: 4,
+ paddingVertical: 2,
+ marginLeft: 2,
+ marginTop: -10,
+ height: 20,
+ ...style
+ }}
+ >
+ <Paragraph color={textColor || colors.light} size={SIZE.xxs}>
+ {text}
+ </Paragraph>
+ </View>
+ );
+}
diff --git a/apps/mobile/app/screens/reminders/index.tsx b/apps/mobile/app/screens/reminders/index.tsx
index 7695c52cb..7302ebc19 100644
--- a/apps/mobile/app/screens/reminders/index.tsx
+++ b/apps/mobile/app/screens/reminders/index.tsx
@@ -61,7 +61,8 @@ export const Reminders = ({
Navigation.routeUpdateFunctions[route.name]
);
useNavigationStore.getState().update({
- name: route.name
+ name: route.name,
+ beta:true
});
SearchService.prepareSearch = prepareSearch;
diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.ts
index cf1dddcec..7a4559785 100644
--- a/apps/mobile/app/stores/use-navigation-store.ts
+++ b/apps/mobile/app/stores/use-navigation-store.ts
@@ -81,6 +81,7 @@ export type CurrentScreen = {
color?: string | null;
alias?: string;
notebookId?: string;
+ beta?: boolean
};
export type HeaderRightButton = {
@@ -120,7 +121,6 @@ const useNavigationStore = create<NavigationStore>((set, get) => ({
JSON.stringify(currentScreen) === JSON.stringify(get().currentScreenRaw)
)
return;
-
set({
currentScreen: {
name: currentScreen.name,
@@ -129,7 +129,8 @@ const useNavigationStore = create<NavigationStore>((set, get) => ({
title: currentScreen.alias || currentScreen.title || currentScreen.name,
type: currentScreen.type,
color: color,
- notebookId: currentScreen.notebookId
+ notebookId: currentScreen.notebookId,
+ beta: currentScreen.beta
},
currentScreenRaw: currentScreen,
canGoBack,