2020-06-17 14:58:04 +02:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
import { View, Text, SafeAreaView, Button } from 'react-native';
|
|
|
|
|
import { Picker } from '@react-native-community/picker';
|
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-06-16 23:11:05 +02:00
|
|
|
|
|
|
|
|
const InputContainer = styled.View`
|
|
|
|
|
margin: 10px 0;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const Input = styled.TextInput`
|
|
|
|
|
background-color: #fbfbfb;
|
|
|
|
|
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>();
|
2020-07-07 13:33:08 +02:00
|
|
|
const handleClick = useCallback(() => navigation.navigate('SetJellyfinServer'), [navigation]);
|
2020-06-16 23:11:05 +02:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ScrollView>
|
|
|
|
|
<SafeAreaView>
|
|
|
|
|
<View style={{ padding: 20 }}>
|
|
|
|
|
<Text style={{ fontSize: 36, marginBottom: 24, fontWeight: 'bold' }}>Settings</Text>
|
|
|
|
|
<InputContainer>
|
|
|
|
|
<Text>Jellyfin Server URL</Text>
|
2020-06-17 14:58:04 +02:00
|
|
|
<Input placeholder="https://jellyfin.yourserver.com/" value={jellyfin?.uri} editable={false} />
|
2020-06-16 23:11:05 +02:00
|
|
|
</InputContainer>
|
|
|
|
|
<InputContainer>
|
2020-06-17 14:58:04 +02:00
|
|
|
<Text>Jellyfin Access Token</Text>
|
|
|
|
|
<Input placeholder="deadbeefdeadbeefdeadbeef" value={jellyfin?.access_token} editable={false} />
|
2020-06-16 23:11:05 +02:00
|
|
|
</InputContainer>
|
|
|
|
|
<InputContainer>
|
|
|
|
|
<Text>Jellyfin User ID</Text>
|
2020-06-17 14:58:04 +02:00
|
|
|
<Input placeholder="deadbeefdeadbeefdeadbeef" value={jellyfin?.user_id} editable={false} />
|
|
|
|
|
</InputContainer>
|
2020-07-10 15:25:32 +02:00
|
|
|
<Button title="Set Jellyfin server" onPress={handleClick} color={THEME_COLOR} />
|
2020-06-17 14:58:04 +02:00
|
|
|
<InputContainer>
|
|
|
|
|
<Text>Bitrate</Text>
|
|
|
|
|
<Picker selectedValue={bitrate}>
|
|
|
|
|
<Picker.Item label="320kbps" value={140000000} />
|
|
|
|
|
</Picker>
|
2020-06-16 23:11:05 +02:00
|
|
|
</InputContainer>
|
|
|
|
|
</View>
|
|
|
|
|
</SafeAreaView>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
);
|
|
|
|
|
}
|