mirror of
https://github.com/ruvnet/RuView
synced 2026-07-05 14:33:19 +00:00
fdc7142dfa
- Added IosRssiService to handle synthetic RSSI data for iOS. - Created WebRssiService to simulate RSSI scanning on the web. - Defined shared types for WifiNetwork and RssiService in rssi.service.ts. - Introduced simulation service to generate synthetic sensing data. - Implemented WebSocket service for real-time data handling with reconnection logic. - Established Zustand stores for managing application state related to MAT and pose data. - Developed theme context and utility functions for consistent styling and formatting. - Added type definitions for various application entities including API responses and sensing data. - Created utility functions for color mapping and URL validation. - Configured TypeScript settings for the mobile application.
71 lines
1.4 KiB
TypeScript
71 lines
1.4 KiB
TypeScript
import { StyleSheet, View } from 'react-native';
|
|
import { ThemedText } from './ThemedText';
|
|
|
|
type ConnectionState = 'connected' | 'simulated' | 'disconnected';
|
|
|
|
type ConnectionBannerProps = {
|
|
status: ConnectionState;
|
|
};
|
|
|
|
const resolveState = (status: ConnectionState) => {
|
|
if (status === 'connected') {
|
|
return {
|
|
label: 'LIVE STREAM',
|
|
backgroundColor: '#0F6B2A',
|
|
textColor: '#E2FFEA',
|
|
};
|
|
}
|
|
|
|
if (status === 'disconnected') {
|
|
return {
|
|
label: 'DISCONNECTED',
|
|
backgroundColor: '#8A1E2A',
|
|
textColor: '#FFE3E7',
|
|
};
|
|
}
|
|
|
|
return {
|
|
label: 'SIMULATED DATA',
|
|
backgroundColor: '#9A5F0C',
|
|
textColor: '#FFF3E1',
|
|
};
|
|
};
|
|
|
|
export const ConnectionBanner = ({ status }: ConnectionBannerProps) => {
|
|
const state = resolveState(status);
|
|
|
|
return (
|
|
<View
|
|
style={[
|
|
styles.banner,
|
|
{
|
|
backgroundColor: state.backgroundColor,
|
|
borderBottomColor: state.textColor,
|
|
},
|
|
]}
|
|
>
|
|
<ThemedText preset="labelMd" style={[styles.text, { color: state.textColor }]}>
|
|
{state.label}
|
|
</ThemedText>
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
banner: {
|
|
position: 'absolute',
|
|
left: 0,
|
|
right: 0,
|
|
top: 0,
|
|
zIndex: 100,
|
|
paddingVertical: 6,
|
|
borderBottomWidth: 2,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
text: {
|
|
letterSpacing: 2,
|
|
fontWeight: '700',
|
|
},
|
|
});
|