commit c2c8470e0031c4f8e5a63ed65e640e557a6ba7b6
Author: Fantič <58391275+FantaFantic@users.noreply.github.com>
Date:   Mon Oct 30 09:21:29 2023 +0100

    re #10844 PlanView init reducer, page

diff --git a/src/pages/Navigation.tsx b/src/pages/Navigation.tsx
index e703ce0..5eeb88c 100644
--- a/src/pages/Navigation.tsx
+++ b/src/pages/Navigation.tsx
@@ -12,12 +12,14 @@ import SearchPage from "./SearchPage"
 import Logout from "./Logout"
 import ItemViewPage from "./ItemViewPage"
 import NotesViewPage from "./NotesViewPage"
+import PlanViewPage from "./PlanViewPage"
 
 export type RootDrawerParamList = {
     Home: undefined,
     Search: { inventoryId: string | null },
     Logout: undefined,
     Item: { itemId: string },
+    Plan: {  },
     Login: undefined,
     Notes: undefined,
 }
@@ -78,6 +80,10 @@ const Navigation = () => {
                             component={ItemViewPage}
                             options={{ drawerItemStyle: { display: "none" } }}
                         />
+                        <Drawer.Screen
+                            name={"Plan"}
+                            component={PlanViewPage}
+                        />
                     </>
                 ) : (
                     <Drawer.Screen
diff --git a/src/pages/PlanViewPage.tsx b/src/pages/PlanViewPage.tsx
new file mode 100644
index 0000000..bdc98ef
--- /dev/null
+++ b/src/pages/PlanViewPage.tsx
@@ -0,0 +1,69 @@
+import React, { useCallback, useEffect } from "react"
+import { useDispatch, useSelector } from "react-redux"
+import { AppDispatch, RootState } from "../stores/store"
+import { getItem, getItemNotes, setConcordances } from "../stores/actions/itemThunks"
+import { login } from "../stores/actions/userThunks"
+import { TabView } from "react-native-tab-view"
+import ItemView from "../components/item/ItemView"
+import { useWindowDimensions } from "react-native"
+import LoadingBox from "../components/loading/LoadingBox"
+import ItemTabBar from "../components/item/ItemTabBar"
+import { log } from "../logging/logger"
+import { DrawerScreenProps } from "@react-navigation/drawer"
+import { RootDrawerParamList } from "./Navigation"
+import { Box, useToast } from "native-base"
+import { ErrorToast } from "../components/toast/ErrorToast"
+import Typography from "native-base/lib/typescript/theme/base/typography"
+
+
+const PlanViewPage = ({ route, navigation }: DrawerScreenProps<RootDrawerParamList, 'Plan'>) => {
+
+  const layout = useWindowDimensions();
+
+  const [routes, setRoutes] = React.useState<{ key: string, title: string }[]>([
+    // initial tab
+    { key: 'loading', title: 'Loading item...' },
+  ]);
+
+  // // TODO vyřešit, aby nebyly freezy při přepínání
+  // const [renderSceneDict, setRenderSceneDict] = React.useState({});
+
+
+  const dispatch = useDispatch<AppDispatch>();
+
+  const { planLoading, lastError } = useSelector((state: RootState) => state.planViewState)
+
+  const toast = useToast();
+
+  useEffect(() => {
+    if (lastError) {
+      toast.closeAll()
+      toast.show({
+        render: ({
+          id
+        }) => {
+          return <ErrorToast headerText={"Error"} text={lastError} onClose={() => toast.close(id)} />;
+        },
+        duration: 3000
+      });
+    }
+  }, [lastError])
+
+  // // initial: load selected plan
+  // useEffect(() => {
+  //   dispatch(getItem(route.params.itemId));
+  //   log.debug("PlanViewPage", "useEffect", "getPlan", route.params.itemId);
+  // }, [route.params.itemId])
+
+
+  const onBackPressed = () => {
+    log.debug("back pressed")
+    navigation.goBack();
+  }
+
+  return (
+    <Box></Box>
+  );
+}
+
+export default PlanViewPage;
diff --git a/src/stores/reducers/planSlice.ts b/src/stores/reducers/planSlice.ts
new file mode 100644
index 0000000..96e22a2
--- /dev/null
+++ b/src/stores/reducers/planSlice.ts
@@ -0,0 +1,17 @@
+import { PayloadAction, createSlice } from "@reduxjs/toolkit"
+import { PlanViewState } from "../../types/plan";
+
+const initialState: PlanViewState = {
+    lastError: "",
+    planLoading: true,
+}
+
+export const planSlice = createSlice({
+    name: "plan",
+    initialState: initialState,
+    reducers: {},
+    extraReducers: (builder) => {
+    }
+})
+
+export default planSlice.reducer
\ No newline at end of file
diff --git a/src/stores/store.ts b/src/stores/store.ts
index 3f636e5..df8fd4f 100644
--- a/src/stores/store.ts
+++ b/src/stores/store.ts
@@ -5,11 +5,13 @@ import searchFormReducer from "./reducers/searchFormSlice"
 import listViewReducer from "./reducers/listViewSlice"
 import homePageReducer from "./reducers/homePageSlice"
 import noteViewReducer from "./reducers/notesSlice"
+import planViewReducer from "./reducers/planSlice"
 
 const store = configureStore({
     reducer: {
         user: userReducer,
         itemViewState: itemReducer,
+        planViewState: planViewReducer,
         noteViewState: noteViewReducer,
         searchForm: searchFormReducer,
         listView: listViewReducer,
diff --git a/src/types/plan.ts b/src/types/plan.ts
new file mode 100644
index 0000000..6f92e25
--- /dev/null
+++ b/src/types/plan.ts
@@ -0,0 +1,6 @@
+
+
+export type PlanViewState = {
+    planLoading: boolean
+    lastError?: string
+}
\ No newline at end of file
