/* This file is part of the Notesnook project (https://notesnook.com/) Copyright (C) 2023 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 . */ import React, { useCallback } from "react"; import { FlatList, View } from "react-native"; import { notesnook } from "../../../e2e/test.ids"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; import { DDS } from "../../services/device-detection"; import { eSendEvent } from "../../services/event-manager"; import Navigation from "../../services/navigation"; import { useNoteStore } from "../../stores/use-notes-store"; import { useSettingStore } from "../../stores/use-setting-store"; import { useThemeColors } from "@notesnook/theme"; import { useUserStore } from "../../stores/use-user-store"; import { MenuItemsList } from "../../utils/menu-items"; import { SUBSCRIPTION_STATUS } from "../../utils/constants"; import { eOpenPremiumDialog } from "../../utils/events"; import { ColorSection } from "./color-section"; import { MenuItem } from "./menu-item"; import { TagsSection } from "./pinned-section"; import { UserStatus } from "./user-status"; import { useThemeStore } from "../../stores/use-theme-store"; export const SideMenu = React.memo( function SideMenu() { const { colors, isDark } = useThemeColors(); const insets = useGlobalSafeAreaInsets(); const subscriptionType = useUserStore( (state) => state.user?.subscription?.type ); const loading = useNoteStore((state) => state.loading); const introCompleted = useSettingStore( (state) => state.settings.introCompleted ); const noTextMode = false; const BottomItemsList = [ { name: isDark ? "Day" : "Night", icon: "theme-light-dark", func: () => { useThemeStore.getState().setColorScheme(); }, switch: true, on: !!isDark, close: false }, { name: "Settings", icon: "cog-outline", close: true, func: () => { Navigation.navigate({ name: "Settings", title: "Settings" }); } } ]; const pro = { name: "Notesnook Pro", icon: "crown", func: () => { eSendEvent(eOpenPremiumDialog); } }; const renderItem = useCallback( () => ( <> {MenuItemsList.map((item, index) => ( ))} ), [noTextMode] ); return !loading && introCompleted ? ( "mainMenuView"} renderItem={renderItem} /> {subscriptionType === SUBSCRIPTION_STATUS.TRIAL || subscriptionType === SUBSCRIPTION_STATUS.BASIC ? ( ) : null} {BottomItemsList.slice(DDS.isLargeTablet() ? 0 : 1, 3).map( (item, index) => ( ) )} ) : null; }, () => true );