ClipSync-Mobile/src/components/notif/NotifView.tsx
Djalim Simaila 74402b8c2d
Some checks failed
Building APK / build-apk (push) Failing after 1m30s
🔧 chore(deploy.yaml): add new GitHub Actions workflow for building APK
🔄 refactor(ClipView.tsx, NotifView.tsx): reorder tabs to show 'Remote' before 'Local'
🌐 fix(ClipViewRemote.tsx, NotifViewRemote.tsx): change API calls from http to https
🔤 fix(ClipViewLocal.tsx, NotifViewLocal.tsx): translate button text to English
🔇 fix(ClipViewRemote.tsx, NotifViewRemote.tsx): remove unnecessary toast messages
🔧 chore(NotifViewLocal.tsx): add platform check to disable feature on non-Android platforms
🔤 fix(NotifViewLocal.tsx): translate button text to English
🔧 chore(reducers.tsx): remove unused action parameters in clear functions
2024-04-12 21:07:01 +02:00

73 lines
2.0 KiB
TypeScript

import React from 'react';
import {useWindowDimensions, ScrollView, View} from 'react-native';
import {Searchbar, Button} from 'react-native-paper';
import NotifViewLocal from './NotifViewLocal';
import NotifViewRemote from './NotifViewRemote';
import {ps} from '../../utils';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
export default function NotifView() {
const [searchQuery, setSearchQuery] = React.useState('');
const {height, width} = useWindowDimensions();
const Tab = createMaterialTopTabNavigator();
let layout = '';
if (width < 600) layout = 'compact';
else if (width < 1200) layout = 'medium';
else layout = 'expanded';
return (
<>
<View
style={{
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
gap: 5,
margin: ps(4),
}}>
{layout == 'compact' ? (
<Button
children={<></>}
icon="dots-vertical"
mode="contained"
style={{width: 'auto'}}
onPress={() => console.log('Pressed')}
/>
) : (
<></>
)}
<Searchbar
placeholder="Notifications"
onChangeText={setSearchQuery}
value={searchQuery}
style={{
flex: 1,
}}
/>
</View>
{layout == 'compact' ? (
<Tab.Navigator tabBarPosition="bottom">
<Tab.Screen name="Remote" options={{title: 'distant'}}>
{() => <NotifViewRemote />}
</Tab.Screen>
<Tab.Screen name="Local" options={{title: 'local'}}>
{() => <NotifViewLocal />}
</Tab.Screen>
</Tab.Navigator>
) : (
<ScrollView
contentContainerStyle={{
flexDirection: 'row',
justifyContent: 'center',
height: '100%',
padding: ps(30),
}}>
<NotifViewRemote />
<NotifViewLocal />
</ScrollView>
)}
</>
);
}