A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix group type usage
Ammar Ahmed2c1b9081bf84
diff --git a/apps/mobile/app/components/list-items/headers/section-header.tsx b/apps/mobile/app/components/list-items/headers/section-header.tsxindex 4ef97c94e..bbf807d77 100644--- a/apps/mobile/app/components/list-items/headers/section-header.tsx+++ b/apps/mobile/app/components/list-items/headers/section-header.tsx@@ -17,7 +17,12 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { GroupHeader, GroupOptions, ItemType } from "@notesnook/core";+import {+ GroupHeader,+ GroupingKey,+ GroupOptions,+ ItemType+} from "@notesnook/core";import { strings } from "@notesnook/intl";import { useThemeColors } from "@notesnook/theme";import React from "react";@@ -40,6 +45,7 @@ type SectionHeaderProps = {color?: string;screen?: RouteName;groupOptions: GroupOptions;+ group: GroupingKey;onOpenJumpToDialog: () => void;};@@ -53,6 +59,7 @@ export const SectionHeader = React.memo<color,screen,groupOptions,+ group,onOpenJumpToDialog}: SectionHeaderProps) {const { colors } = useThemeColors();@@ -133,6 +140,7 @@ export const SectionHeader = React.memo<<Sortscreen={screen}type={dataType}+ group={group}hideGroupOptions={screen === "Reminders" || screen === "Search"}diff --git a/apps/mobile/app/components/list/index.tsx b/apps/mobile/app/components/list/index.tsxindex 9af11a659..1f6e53d3c 100644--- a/apps/mobile/app/components/list/index.tsx+++ b/apps/mobile/app/components/list/index.tsx@@ -53,6 +53,7 @@ type ListProps = {isRenderedInActionSheet?: boolean;CustomListComponent?: React.JSX.ElementType;placeholder?: PlaceholderData;+ groupType: GroupingKey;id?: string;};@@ -73,18 +74,7 @@ export default function List(props: ListProps) {props.dataType === "notebook" ||notebooksListMode === "compact";- const groupType =- props.renderedInRoute === "Archive"- ? "archive"- : props.renderedInRoute === "Notes"- ? "home"- : props.renderedInRoute === "Favorites"- ? "favorites"- : props.renderedInRoute === "Trash" || props.dataType === "trash"- ? "trash"- : `${props.dataType}s`;-- const groupOptions = useGroupOptions(groupType);+ const groupOptions = useGroupOptions(props.groupType);const _onRefresh = async () => {Sync.run("global", false, "full", () => {@@ -107,7 +97,7 @@ export default function List(props: ListProps) {isSheet={props.isRenderedInActionSheet || false}items={props.data}groupOptions={groupOptions}- group={groupType as GroupingKey}+ group={props.groupType as GroupingKey}renderedInRoute={props.renderedInRoute}customAccentColor={props.customAccentColor}dataType={props.dataType}@@ -117,7 +107,7 @@ export default function List(props: ListProps) {},[groupOptions,- groupType,+ props.groupType,props.customAccentColor,props.data,props.dataType,diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsxindex f64364bea..a1fdf11c0 100644--- a/apps/mobile/app/components/list/list-item.wrapper.tsx+++ b/apps/mobile/app/components/list/list-item.wrapper.tsx@@ -53,7 +53,7 @@ import TagItem from "../list-items/tag";import { SearchResult } from "../list-items/search-result";type ListItemWrapperProps<TItem = Item> = {- group?: GroupingKey;+ group: GroupingKey;items: VirtualizedGrouping<TItem> | undefined;isSheet: boolean;index: number;@@ -182,6 +182,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {item={groupHeader}index={index}dataType={item.type}+ group={group}color={props.customAccentColor}groupOptions={groupOptions}onOpenJumpToDialog={() => {@@ -218,6 +219,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {item={groupHeader}index={index}dataType={item.type}+ group={group}color={props.customAccentColor}groupOptions={groupOptions}onOpenJumpToDialog={() => {@@ -245,6 +247,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {screen={props.renderedInRoute}item={groupHeader}index={index}+ group={group}dataType={item.type}color={props.customAccentColor}groupOptions={groupOptions}@@ -271,6 +274,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {screen={props.renderedInRoute}item={groupHeader}index={index}+ group={group}dataType={item.type}color={props.customAccentColor}groupOptions={groupOptions}@@ -297,6 +301,7 @@ export function ListItemWrapper(props: ListItemWrapperProps) {screen={props.renderedInRoute}item={groupHeader}index={index}+ group={group}dataType={item.type}color={props.customAccentColor}groupOptions={groupOptions}diff --git a/apps/mobile/app/components/sheets/relations-list/index.tsx b/apps/mobile/app/components/sheets/relations-list/index.tsxindex c0c912f06..7bb9ab8ae 100644--- a/apps/mobile/app/components/sheets/relations-list/index.tsx+++ b/apps/mobile/app/components/sheets/relations-list/index.tsx@@ -121,6 +121,17 @@ export const RelationsList = ({<Listdata={items}loading={false}+ groupType={+ referenceType === "note"+ ? "notes"+ : referenceType === "tag"+ ? "tags"+ : referenceType === "notebook"+ ? "notebooks"+ : referenceType === "reminder"+ ? "reminders"+ : "notes"+ }dataType={referenceType as any}isRenderedInActionSheet={true}/>diff --git a/apps/mobile/app/components/sheets/reminder-notify/index.tsx b/apps/mobile/app/components/sheets/reminder-notify/index.tsxindex 95c93b4fb..cd50d3d97 100644--- a/apps/mobile/app/components/sheets/reminder-notify/index.tsx+++ b/apps/mobile/app/components/sheets/reminder-notify/index.tsx@@ -181,6 +181,7 @@ export default function ReminderNotify({data={references}loading={false}dataType="note"+ groupType="notes"isRenderedInActionSheet={true}/></View>diff --git a/apps/mobile/app/components/sheets/sort/index.tsx b/apps/mobile/app/components/sheets/sort/index.tsxindex a1f4a4e24..981256648 100644--- a/apps/mobile/app/components/sheets/sort/index.tsx+++ b/apps/mobile/app/components/sheets/sort/index.tsx@@ -45,25 +45,16 @@ import Paragraph from "../../ui/typography/paragraph";const Sort = ({type,screen,- hideGroupOptions+ hideGroupOptions,+ group: groupType}: {type: ItemType;screen?: RouteName;+ group: GroupingKey;hideGroupOptions?: boolean;}) => {const { colors } = useThemeColors();- const groupType =- screen === "Archive"- ? "archive"- : screen === "Search"- ? "search"- : screen === "Notes"- ? "home"- : screen === "Trash" || type === "trash"- ? "trash"- : ((type + "s") as GroupingKey);-const [groupOptions, setGroupOptions] = useState(db.settings.getGroupOptions(groupType));diff --git a/apps/mobile/app/components/side-menu/index.tsx b/apps/mobile/app/components/side-menu/index.tsxindex 7f8bce59b..146bd695a 100644--- a/apps/mobile/app/components/side-menu/index.tsx+++ b/apps/mobile/app/components/side-menu/index.tsx@@ -433,7 +433,7 @@ const TabBar = (props: SimpleTabBarProps) => {name="plus"testID="sidebar-add-button"size={AppFontSize.lg - 2}- top={10}+ top={10}color={colors.primary.icon}onPress={async () => {if (props.navigationState.index === 1) {@@ -498,6 +498,11 @@ const TabBar = (props: SimpleTabBarProps) => {? "notebook": "tag"}+ group={+ props.navigationState.index === 1+ ? "notebooks"+ : "tags"+ }hideGroupOptions/>)diff --git a/apps/mobile/app/screens/archive/index.tsx b/apps/mobile/app/screens/archive/index.tsxindex 6ed7f97ec..d4a81418f 100644--- a/apps/mobile/app/screens/archive/index.tsx+++ b/apps/mobile/app/screens/archive/index.tsx@@ -70,6 +70,7 @@ export const Archive = ({ navigation, route }: NavigationProps<"Archive">) => {onRefresh={() => {refresh();}}+ groupType="archive"renderedInRoute="Archive"loading={loading}placeholder={{diff --git a/apps/mobile/app/screens/favorites/index.tsx b/apps/mobile/app/screens/favorites/index.tsxindex 522051f5e..aea2a66e0 100644--- a/apps/mobile/app/screens/favorites/index.tsx+++ b/apps/mobile/app/screens/favorites/index.tsx@@ -70,6 +70,7 @@ export const Favorites = ({<Listdata={favorites}dataType="note"+ groupType="favorites"onRefresh={() => {refresh();}}diff --git a/apps/mobile/app/screens/home/index.tsx b/apps/mobile/app/screens/home/index.tsxindex a03bee164..46c4fa111 100755--- a/apps/mobile/app/screens/home/index.tsx+++ b/apps/mobile/app/screens/home/index.tsx@@ -70,6 +70,7 @@ export const Home = ({ navigation, route }: NavigationProps<"Notes">) => {<Listdata={notes}dataType="note"+ groupType="home"renderedInRoute={route.name}loading={loading || !isFocused}headerTitle={strings.routes[route.name]()}diff --git a/apps/mobile/app/screens/notebook/index.tsx b/apps/mobile/app/screens/notebook/index.tsxindex 2da888440..ea3aeabcd 100644--- a/apps/mobile/app/screens/notebook/index.tsx+++ b/apps/mobile/app/screens/notebook/index.tsx@@ -185,6 +185,7 @@ const NotebookScreen = ({ route, navigation }: NavigationProps<"Notebook">) => {<Listdata={notes}dataType="note"+ groupType="notes"onRefresh={() => {onRequestUpdate();}}diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsxindex 99d75a4ee..7e06d683a 100644--- a/apps/mobile/app/screens/notes/index.tsx+++ b/apps/mobile/app/screens/notes/index.tsx@@ -214,6 +214,7 @@ const NotesPage = ({<Listdata={notes}dataType="note"+ groupType="notes"onRefresh={onRequestUpdate}loading={false}renderedInRoute={route.name}diff --git a/apps/mobile/app/screens/reminders/index.tsx b/apps/mobile/app/screens/reminders/index.tsxindex fd4201ac4..13e957861 100644--- a/apps/mobile/app/screens/reminders/index.tsx+++ b/apps/mobile/app/screens/reminders/index.tsx@@ -90,6 +90,7 @@ export const Reminders = ({<Listdata={reminders}dataType="reminder"+ groupType="reminders"headerTitle={strings.routes[route.name]()}renderedInRoute="Reminders"loading={loading}@@ -98,9 +99,8 @@ export const Reminders = ({paragraph: strings.remindersEmpty(),button: strings.setReminder(),action: async () => {- const reminderFeature = await isFeatureAvailable(- "activeReminders"- );+ const reminderFeature =+ await isFeatureAvailable("activeReminders");if (!reminderFeature.isAllowed) {ToastManager.show({type: "info",diff --git a/apps/mobile/app/screens/search/index.tsx b/apps/mobile/app/screens/search/index.tsxindex 8759b69c5..9d69d3f77 100644--- a/apps/mobile/app/screens/search/index.tsx+++ b/apps/mobile/app/screens/search/index.tsx@@ -154,6 +154,7 @@ export const Search = ({ route, navigation }: NavigationProps<"Search">) => {data={results}dataType={route.params?.type}renderedInRoute={route.name}+ groupType="search"loading={loading}placeholder={{title: route.name,diff --git a/apps/mobile/app/screens/trash/index.tsx b/apps/mobile/app/screens/trash/index.tsxindex 5d6cda5a4..baf12ceb5 100644--- a/apps/mobile/app/screens/trash/index.tsx+++ b/apps/mobile/app/screens/trash/index.tsx@@ -98,6 +98,7 @@ export const Trash = ({ navigation, route }: NavigationProps<"Trash">) => {<Listdata={trash}dataType="trash"+ groupType="trash"renderedInRoute="Trash"loading={!isFocused}placeholder={PLACEHOLDER_DATA(db.settings.getTrashCleanupInterval())}