feat: simplify code for pair device
This commit is contained in:
parent
ba56e05438
commit
3db25407db
|
@ -27,11 +27,7 @@ const PairDevice = () => {
|
||||||
setIsConnectingViaIp(state => !state)
|
setIsConnectingViaIp(state => !state)
|
||||||
}
|
}
|
||||||
|
|
||||||
const continueHandler = () => {
|
const continueHandler = () => {}
|
||||||
if (isConnectingViaIp) {
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapperShadow rightImageSrc="./background-images/day-night-bg.png" rightImageLogo={true}>
|
<PageWrapperShadow rightImageSrc="./background-images/day-night-bg.png" rightImageLogo={true}>
|
||||||
|
@ -43,23 +39,42 @@ const PairDevice = () => {
|
||||||
/>
|
/>
|
||||||
{isConnectingViaIp ? (
|
{isConnectingViaIp ? (
|
||||||
<ConnectViaIP />
|
<ConnectViaIP />
|
||||||
) : (
|
) : isPaired ? (
|
||||||
<>
|
|
||||||
{isPaired ? (
|
|
||||||
<PairedSuccessfully />
|
<PairedSuccessfully />
|
||||||
) : (
|
) : (
|
||||||
|
<>
|
||||||
<GenerateId isAwaitingPairing={isAwaitingPairing} />
|
<GenerateId isAwaitingPairing={isAwaitingPairing} />
|
||||||
)}
|
|
||||||
{isPaired === false && (
|
|
||||||
<SyncStatus
|
<SyncStatus
|
||||||
isPairing={isPairing}
|
isPairing={isPairing}
|
||||||
isAwaitingPairing={isAwaitingPairing}
|
isAwaitingPairing={isAwaitingPairing}
|
||||||
changeSetIsAwaitingPairing={changeSetIsAwaitingPairing}
|
changeSetIsAwaitingPairing={changeSetIsAwaitingPairing}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{isPaired === false && (
|
{isPaired ? (
|
||||||
|
<>
|
||||||
|
<YStack space={'$3'}>
|
||||||
|
<Separator alignSelf="stretch" borderColor={'#F0F2F5'} marginTop={3} />
|
||||||
|
<Text size={19} weight="semibold">
|
||||||
|
General Settings
|
||||||
|
</Text>
|
||||||
|
<XStack space={'$4'} alignItems={'center'}>
|
||||||
|
<Checkbox
|
||||||
|
id="auto-connect"
|
||||||
|
selected={isAutoConnectChecked}
|
||||||
|
onCheckedChange={e => setIsAutoConnectChecked(e)}
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
<Label htmlFor="auto-connect">
|
||||||
|
<Text size={15} weight="regular">
|
||||||
|
Auto Connect Paired Device
|
||||||
|
</Text>
|
||||||
|
</Label>
|
||||||
|
</XStack>
|
||||||
|
</YStack>
|
||||||
|
<CreateAvatar />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
<YStack space={'$3'}>
|
<YStack space={'$3'}>
|
||||||
<Separator borderColor={'#e3e3e3'} />
|
<Separator borderColor={'#e3e3e3'} />
|
||||||
<YStack space={'$1'}>
|
<YStack space={'$1'}>
|
||||||
|
@ -80,28 +95,6 @@ const PairDevice = () => {
|
||||||
</YStack>
|
</YStack>
|
||||||
</YStack>
|
</YStack>
|
||||||
)}
|
)}
|
||||||
{isPaired && (
|
|
||||||
<YStack space={'$3'}>
|
|
||||||
<Separator alignSelf="stretch" borderColor={'#F0F2F5'} marginTop={3} />
|
|
||||||
<Text size={19} weight="semibold">
|
|
||||||
General Settings
|
|
||||||
</Text>
|
|
||||||
<XStack space={'$4'} alignItems={'center'}>
|
|
||||||
<Checkbox
|
|
||||||
id="auto-connect"
|
|
||||||
selected={isAutoConnectChecked}
|
|
||||||
onCheckedChange={e => setIsAutoConnectChecked(e)}
|
|
||||||
variant="outline"
|
|
||||||
/>
|
|
||||||
<Label htmlFor="auto-connect">
|
|
||||||
<Text size={15} weight="regular">
|
|
||||||
Auto Connect Paired Device
|
|
||||||
</Text>
|
|
||||||
</Label>
|
|
||||||
</XStack>
|
|
||||||
</YStack>
|
|
||||||
)}
|
|
||||||
{isPaired && <CreateAvatar />}
|
|
||||||
<Separator borderColor={'#e3e3e3'} />
|
<Separator borderColor={'#e3e3e3'} />
|
||||||
<div>
|
<div>
|
||||||
<Button icon={<NodeIcon size={20} />} disabled={!isPaired} onPress={continueHandler}>
|
<Button icon={<NodeIcon size={20} />} disabled={!isPaired} onPress={continueHandler}>
|
||||||
|
|
Loading…
Reference in New Issue