Files
jellyfin-audio-player/src/screens/Settings/index.tsx

57 lines
2.6 KiB
TypeScript
Raw Normal View History

2020-06-17 14:58:04 +02:00
import React, { useCallback } from 'react';
2020-08-25 10:39:21 +02:00
import { View, Text, SafeAreaView, Button, StyleSheet } from 'react-native';
2020-06-16 23:11:05 +02:00
import { ScrollView } from 'react-native-gesture-handler';
import styled from 'styled-components/native';
2020-06-17 14:58:04 +02:00
import { useSelector } from 'react-redux';
2020-06-21 10:30:41 +02:00
import { AppState } from 'store';
2020-06-17 14:58:04 +02:00
import { useNavigation } from '@react-navigation/native';
import { NavigationProp } from '..';
2020-07-10 15:25:32 +02:00
import { THEME_COLOR } from 'CONSTANTS';
2020-07-26 14:45:32 +02:00
import { Header } from 'components/Typography';
import { colors } from 'components/Colors';
2020-06-16 23:11:05 +02:00
const InputContainer = styled.View`
margin: 10px 0;
`;
const Input = styled.TextInput`
padding: 15px;
margin-top: 5px;
border-radius: 5px;
`;
export default function Settings() {
2020-06-17 14:58:04 +02:00
const { jellyfin, bitrate } = useSelector((state: AppState) => state.settings);
const navigation = useNavigation<NavigationProp>();
const handleClick = useCallback(() => navigation.navigate('SetJellyfinServer'), [navigation]);
2020-06-16 23:11:05 +02:00
return (
<ScrollView>
<SafeAreaView>
<View style={{ padding: 20 }}>
2020-07-26 14:45:32 +02:00
<Header style={colors.text}>Settings</Header>
2020-06-16 23:11:05 +02:00
<InputContainer>
2020-07-26 14:45:32 +02:00
<Text style={colors.text}>Jellyfin Server URL</Text>
2020-08-25 10:39:21 +02:00
<Input placeholder="https://jellyfin.yourserver.com/" value={jellyfin?.uri} editable={false} style={colors.input} />
2020-06-16 23:11:05 +02:00
</InputContainer>
<InputContainer>
2020-07-26 14:45:32 +02:00
<Text style={colors.text}>Jellyfin Access Token</Text>
2020-08-25 10:39:21 +02:00
<Input placeholder="deadbeefdeadbeefdeadbeef" value={jellyfin?.access_token} editable={false} style={colors.input} />
2020-06-16 23:11:05 +02:00
</InputContainer>
<InputContainer>
2020-07-26 14:45:32 +02:00
<Text style={colors.text}>Jellyfin User ID</Text>
2020-08-25 10:39:21 +02:00
<Input placeholder="deadbeefdeadbeefdeadbeef" value={jellyfin?.user_id} editable={false} style={colors.input} />
2020-06-17 14:58:04 +02:00
</InputContainer>
2020-07-10 15:25:32 +02:00
<Button title="Set Jellyfin server" onPress={handleClick} color={THEME_COLOR} />
{/* The bitrate setting is hidden for now, since Jellyfin does not appear to support custom bitrates */}
{/* <InputContainer>
2020-07-26 14:45:32 +02:00
<Text style={colors.text}>Bitrate</Text>
2020-06-17 14:58:04 +02:00
<Picker selectedValue={bitrate}>
<Picker.Item label="320kbps" value={140000000} />
</Picker>
</InputContainer> */}
2020-06-16 23:11:05 +02:00
</View>
</SafeAreaView>
</ScrollView>
);
}