-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add birdseye screen and nav button on home screen #6
Changes from 2 commits
d91c7ae
e7233b8
e279969
612293c
b241fbd
9fe97ca
8f62dc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,30 +1,35 @@ | ||||||
import {useColorScheme} from 'react-native'; | ||||||
import {Button, useColorScheme} from 'react-native'; | ||||||
|
||||||
import EventIcon from '@icons/event.svg'; | ||||||
import HomeIcon from '@icons/home.svg'; | ||||||
import VideoIcon from '@icons/video-waveform.svg'; | ||||||
import BirdseyeIcon from '@icons/birdseye.svg'; | ||||||
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; | ||||||
import { | ||||||
NavigationContainer, | ||||||
NavigatorScreenParams, | ||||||
useNavigation, | ||||||
} from '@react-navigation/native'; | ||||||
import {createNativeStackNavigator} from '@react-navigation/native-stack'; | ||||||
|
||||||
import { | ||||||
EventsScreen, | ||||||
HomeScreen, | ||||||
Check failure on line 17 in src/navigation/navigationContainer.tsx GitHub Actions / typescript-check
|
||||||
LiveViewScreen, | ||||||
OnBoardingScreen, | ||||||
BirdseyeScreen, | ||||||
} from '@screens'; | ||||||
import {useAppDataStore} from '@stores'; | ||||||
|
||||||
//? Can't figure out how to properly type this | ||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||||||
//@ts-ignore | ||||||
import {colors, hslFunction} from '../../themeColors.js'; | ||||||
import {useConfig} from '@api'; | ||||||
|
||||||
export type MainStackParamList = { | ||||||
Home: undefined; | ||||||
Birdseye: undefined; | ||||||
Tabs: NavigatorScreenParams<TabsStackParamList>; | ||||||
Onboarding: undefined; | ||||||
}; | ||||||
|
@@ -41,6 +46,7 @@ | |||||
|
||||||
const TabNavigator = () => { | ||||||
const isDarkMode = useColorScheme() === 'dark'; | ||||||
|
||||||
//TODO: make work with tailwind theme... | ||||||
return ( | ||||||
<TabStack.Navigator | ||||||
|
@@ -98,6 +104,8 @@ | |||||
}; | ||||||
|
||||||
export const NavigationWrapper = () => { | ||||||
const config = useConfig(); | ||||||
|
||||||
const currentCamera = useAppDataStore(state => state.currentCamera); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI using tint color like this is currently causing a warning since it's sort of an HSL value, but I don't think RN knows how to parse that. I'll be addressing this soon when I try and overhaul theming a bit. |
||||||
const isDarkMode = useColorScheme() === 'dark'; | ||||||
|
||||||
|
@@ -117,6 +125,25 @@ | |||||
options={{ | ||||||
headerBackTitle: 'Back', | ||||||
headerTitle: 'Bird Watcher - Frigate', | ||||||
headerLeft: () => { | ||||||
const nav = useNavigation(); | ||||||
Check failure on line 129 in src/navigation/navigationContainer.tsx GitHub Actions / lint
|
||||||
|
||||||
if (!config.data?.birdseye.enabled) { | ||||||
return null; | ||||||
} | ||||||
|
||||||
return ( | ||||||
<BirdseyeIcon | ||||||
height={25} | ||||||
width={25} | ||||||
onPress={() => { | ||||||
nav.navigate('Birdseye'); | ||||||
}} | ||||||
fill={tintColor} | ||||||
fillSecondary={tintColor} | ||||||
/> | ||||||
); | ||||||
}, | ||||||
headerTintColor: isDarkMode | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then we can use is like this in the component.
Suggested change
|
||||||
? colors.dark.accent | ||||||
: colors.light.accent, | ||||||
|
@@ -132,6 +159,13 @@ | |||||
}} | ||||||
/> | ||||||
<Stack.Screen name="Onboarding" component={OnBoardingScreen} /> | ||||||
<Stack.Screen | ||||||
name="Birdseye" | ||||||
component={BirdseyeScreen} | ||||||
options={{ | ||||||
headerBackTitle: 'Home', | ||||||
}} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Last nit - I think this should actually be presented in a Modal since the button to access is in the nav header. It feels a bit weird that it slides in as a card now. I'm okay with adding this later too, but wanted to call it out. |
||||||
/> | ||||||
</Stack.Navigator> | ||||||
</NavigationContainer> | ||||||
); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {useConfig} from '@api'; | ||
import {BaseText, WebRTCView} from '@components'; | ||
|
||
export const BirdseyeScreen = () => { | ||
const config = useConfig(); | ||
|
||
if (config.isLoading) { | ||
return <BaseText>Loading ...</BaseText>; | ||
} | ||
|
||
if (config.data?.birdseye.enabled) { | ||
return <WebRTCView cameraName="birdseye" />; | ||
} | ||
|
||
return <BaseText>Birdseye is not enabled</BaseText>; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './BirdseyeScreen'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './HomeScreen'; | ||
Check failure on line 1 in src/screens/index.ts GitHub Actions / lint
|
||
export * from './LiveViewScreen'; | ||
export * from './EventsScreen'; | ||
// | ||
export * from './onboardingScreen'; | ||
export * from './BirdseyeScreen'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Header Button should be defined before the actual nav component.