feat: 建立整改 Task 1 多端质量基线
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: '@react-native',
|
||||
rules: {
|
||||
'prettier/prettier': 'warn',
|
||||
},
|
||||
};
|
||||
Generated
+3292
-274
File diff suppressed because it is too large
Load Diff
+4
-2
@@ -17,14 +17,13 @@
|
||||
"@react-navigation/native-stack": "^6.10.0",
|
||||
"axios": "^1.7.2",
|
||||
"dayjs": "^1.11.11",
|
||||
"react": "18.3.1",
|
||||
"react": "18.2.0",
|
||||
"react-native": "0.74.5",
|
||||
"react-native-paper": "^5.12.3",
|
||||
"react-native-safe-area-context": "^4.10.5",
|
||||
"react-native-screens": "^3.32.0",
|
||||
"react-native-vector-icons": "^10.1.0",
|
||||
"react-native-video": "^6.2.0",
|
||||
"victory-native": "^41.6.0",
|
||||
"zustand": "^4.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -32,9 +31,12 @@
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"@babel/runtime": "^7.25.0",
|
||||
"@react-native/babel-preset": "0.74.85",
|
||||
"@react-native/eslint-config": "0.74.85",
|
||||
"@react-native/metro-config": "^0.74.85",
|
||||
"@react-native/typescript-config": "0.74.85",
|
||||
"@types/react": "^18.3.3",
|
||||
"eslint": "^8.57.1",
|
||||
"prettier": "^2.8.8",
|
||||
"react-native-dotenv": "^3.4.11",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { View, StyleSheet, Text, Dimensions } from 'react-native';
|
||||
import { View, StyleSheet, Text } from 'react-native';
|
||||
|
||||
interface MiniChartProps {
|
||||
data: { time: string; temp?: number; humidity?: number; co2?: number }[];
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
|
||||
import { NavigationContainer, useNavigation } from '@react-navigation/native';
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import { Provider as PaperProvider, useTheme, MD3LightTheme } from 'react-native-paper';
|
||||
import { Provider as PaperProvider, MD3LightTheme } from 'react-native-paper';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { setNavigationRef } from '../api/client';
|
||||
import { useAuthStore } from '../store/authStore';
|
||||
@@ -25,7 +25,7 @@ import SettingsScreen from '../screens/SettingsScreen';
|
||||
const Stack = createNativeStackNavigator<RootStackParamList>();
|
||||
const Tab = createBottomTabNavigator<MainTabParamList>();
|
||||
|
||||
const TabIcon: React.FC<{ name: string; activeName: string; color: string; size: number; focused: boolean }> = ({ name, activeName, color, size, focused }) => (
|
||||
const TabIcon: React.FC<{ name: string; activeName: string; color: string; size: number; focused: boolean }> = ({ name, activeName, color, focused }) => (
|
||||
<Icon name={focused ? activeName : name} size={focused ? 26 : 22} color={color} />
|
||||
);
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { StyleSheet, View, FlatList, RefreshControl, Alert } from 'react-native';
|
||||
import { Text, Card, useTheme, ActivityIndicator, Surface, SegmentedButtons, Button, Snackbar } from 'react-native-paper';
|
||||
import { Text, Card, ActivityIndicator, Surface, SegmentedButtons, Button, Snackbar } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { getAlarms, ackAlarm, getAlarmClip } from '../api/alarms';
|
||||
import { extractErrorMessage } from '../api/client';
|
||||
import { formatRelativeTime, getSeverityLabel } from '../utils/format';
|
||||
import type { Alarm } from '../types';
|
||||
|
||||
export default function AlertsScreen() {
|
||||
const theme = useTheme();
|
||||
const navigation = useNavigation<any>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [alarms, setAlarms] = useState<Alarm[]>([]);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { StyleSheet, View, ScrollView, Alert } from 'react-native';
|
||||
import { Text, Card, Button, Switch, useTheme, ActivityIndicator, TextInput, SegmentedButtons, Divider, Snackbar } from 'react-native-paper';
|
||||
import { StyleSheet, View, ScrollView } from 'react-native';
|
||||
import { Text, Card, Button, Switch, ActivityIndicator, TextInput, SegmentedButtons, Divider, Snackbar } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import { sendControl } from '../api/devices';
|
||||
@@ -10,7 +10,6 @@ import { formatNumber } from '../utils/format';
|
||||
import type { RealtimeMetric } from '../types';
|
||||
|
||||
export default function DeviceControlScreen() {
|
||||
const theme = useTheme();
|
||||
const route = useRoute<any>();
|
||||
const { deviceKey, deviceName } = route.params;
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { StyleSheet, View, FlatList, RefreshControl } from 'react-native';
|
||||
import { Text, Card, useTheme, ActivityIndicator, Surface, Searchbar, IconButton } from 'react-native-paper';
|
||||
import { Text, Card, ActivityIndicator, Surface, Searchbar, IconButton } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { getDevices } from '../api/devices';
|
||||
@@ -8,7 +8,6 @@ import { formatRelativeTime } from '../utils/format';
|
||||
import type { Device } from '../types';
|
||||
|
||||
export default function DevicesScreen() {
|
||||
const theme = useTheme();
|
||||
const navigation = useNavigation<any>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import { StyleSheet, View, ScrollView, RefreshControl } from 'react-native';
|
||||
import { Text, Card, useTheme, ActivityIndicator, Surface } from 'react-native-paper';
|
||||
import { Text, Card, ActivityIndicator, Surface } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import { getRoom } from '../api/rooms';
|
||||
@@ -11,7 +11,6 @@ import { formatRelativeTime } from '../utils/format';
|
||||
import type { Room, RealtimeMetric, Device, TrendPoint } from '../types';
|
||||
|
||||
export default function RoomDetailScreen() {
|
||||
const theme = useTheme();
|
||||
const route = useRoute<any>();
|
||||
const { roomId, roomName } = route.params;
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { StyleSheet, View, FlatList, RefreshControl } from 'react-native';
|
||||
import { Text, Card, useTheme, ActivityIndicator, IconButton } from 'react-native-paper';
|
||||
import { Text, Card, ActivityIndicator, IconButton } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { getRooms } from '../api/rooms';
|
||||
import { formatRelativeTime } from '../utils/format';
|
||||
import type { Room } from '../types';
|
||||
|
||||
export default function RoomsScreen() {
|
||||
const theme = useTheme();
|
||||
const navigation = useNavigation<any>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
@@ -2,13 +2,11 @@ import React, { useState } from 'react';
|
||||
import { StyleSheet, View, Alert, ScrollView } from 'react-native';
|
||||
import { Text, Card, Button, useTheme, Divider, TextInput, List, Avatar } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { useAuthStore } from '../store/authStore';
|
||||
import { API_BASE_URL } from '@env';
|
||||
|
||||
export default function SettingsScreen() {
|
||||
const theme = useTheme();
|
||||
const navigation = useNavigation<any>();
|
||||
const { user, logout } = useAuthStore();
|
||||
const [apiUrl, setApiUrl] = useState(API_BASE_URL || 'http://localhost:3000/api/v1');
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { StyleSheet, View, StatusBar, Alert, ActivityIndicator } from 'react-native';
|
||||
import { StyleSheet, View, StatusBar, ActivityIndicator } from 'react-native';
|
||||
import { Text, IconButton, Surface } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useRoute, useNavigation } from '@react-navigation/native';
|
||||
|
||||
@@ -3,8 +3,8 @@ import { StyleSheet, View, FlatList, RefreshControl, Alert } from 'react-native'
|
||||
import { Text, Card, Button, useTheme, ActivityIndicator, Surface, IconButton, SegmentedButtons } from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { getCameras, getClips, playCamera } from '../api/video';
|
||||
import { extractErrorMessage, resolveUrl } from '../api/client';
|
||||
import { getCameras, getClips } from '../api/video';
|
||||
import { resolveUrl } from '../api/client';
|
||||
import { formatDateTime, formatDuration, formatFileSize } from '../utils/format';
|
||||
import type { Camera, VideoClip } from '../types';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user