feat: initial implementation of qtfm android

This commit is contained in:
鲁树人
2023-11-29 23:45:56 +00:00
parent 85ab69d41d
commit 18d02a906b
12 changed files with 871 additions and 416 deletions

View File

@@ -0,0 +1,43 @@
import { Box, Flex, Heading, Input, Table, Tbody, Td, Text, Th, Tr } from '@chakra-ui/react';
import { qtfmAndroidUpdateKey } from '../settingsSlice';
import { useAppDispatch, useAppSelector } from '~/hooks';
import { selectStagingQtfmAndroidDevice } from '../settingsSelector';
import type { QingTingDeviceInfo } from '@jixun/libparakeet';
const QTFM_ANDROID_DEVICE_PROPS = ['product', 'device', 'manufacturer', 'brand', 'board', 'model'] as const;
export function PanelQingTing() {
const dispatch = useAppDispatch();
const qingTingAndroidDeviceInfo = useAppSelector(selectStagingQtfmAndroidDevice);
const handleChangeDeviceInfo = (name: keyof QingTingDeviceInfo) => (e: React.ChangeEvent<HTMLInputElement>) => {
dispatch(qtfmAndroidUpdateKey({ field: name, value: e.target.value }));
};
return (
<Flex minH={0} flexDir="column" flex={1}>
<Heading as="h2" size="lg">
FM
</Heading>
<Text> FM</Text>
<Box flex={1} minH={0} overflow="auto" pr="4">
<Table>
<Tbody>
{QTFM_ANDROID_DEVICE_PROPS.map((name) => (
<Tr key={name}>
<Th w="1px" p={1} textAlign="right">
{name}
</Th>
<Td pl={1} pr={1}>
<Input value={qingTingAndroidDeviceInfo[name]} onChange={handleChangeDeviceInfo(name)} />
</Td>
</Tr>
))}
</Tbody>
</Table>
</Box>
</Flex>
);
}