Files
jellyfin-audio-player/src/screens/modals/Player/components/ConnectionNotice.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-01-02 22:50:49 +01:00
import React from 'react';
import { useNetInfo } from '@react-native-community/netinfo';
2023-06-19 22:26:41 +02:00
import { THEME_COLOR } from '@/CONSTANTS';
2022-01-02 22:50:49 +01:00
import styled from 'styled-components/native';
2023-06-19 23:03:17 +02:00
import CloudSlash from '@/assets/icons/cloud-slash.svg';
2022-01-02 22:50:49 +01:00
import { Text } from 'react-native';
2023-06-19 22:26:41 +02:00
import { t } from '@/localisation';
import useDefaultStyles from '@/components/Colors';
2022-01-02 22:50:49 +01:00
const Well = styled.View`
border-radius: 8px;
flex: 1;
flex-direction: row;
align-items: center;
padding: 12px;
2022-11-12 17:27:12 +01:00
margin: 12px -12px;
2022-01-02 22:50:49 +01:00
`;
function ConnectionNotice() {
2022-01-02 23:02:54 +01:00
const defaultStyles = useDefaultStyles();
2022-01-02 22:50:49 +01:00
const { isInternetReachable } = useNetInfo();
if (!isInternetReachable) {
return (
2022-01-02 23:02:54 +01:00
<Well style={defaultStyles.activeBackground}>
2022-01-02 22:50:49 +01:00
<CloudSlash width={24} height={24} fill={THEME_COLOR} />
2022-01-02 23:02:54 +01:00
<Text style={{ color: THEME_COLOR, marginLeft: 12 }}>
{t('you-are-offline-message')}
</Text>
2022-01-02 22:50:49 +01:00
</Well>
);
}
return null;
}
export default ConnectionNotice;