2023-05-14 23:09:54 +00:00
|
|
|
import { InfoOutlineIcon } from '@chakra-ui/icons';
|
2023-05-15 20:32:38 +00:00
|
|
|
import { Tooltip, VStack, Text, Flex } from '@chakra-ui/react';
|
2023-05-17 00:46:20 +00:00
|
|
|
import { workerClientBus } from './decrypt-worker/client.ts';
|
2023-05-14 23:09:54 +00:00
|
|
|
import { DECRYPTION_WORKER_ACTION_NAME } from './decrypt-worker/constants';
|
|
|
|
|
|
|
|
import usePromise from 'react-promise-suspense';
|
|
|
|
|
2023-05-17 23:18:22 +00:00
|
|
|
const getSDKVersion = async (): Promise<string> => {
|
2023-05-14 23:22:23 +00:00
|
|
|
return workerClientBus.request(DECRYPTION_WORKER_ACTION_NAME.VERSION, null);
|
2023-05-14 23:09:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export function SDKVersion() {
|
|
|
|
const sdkVersion = usePromise(getSDKVersion, []);
|
|
|
|
return (
|
2023-05-14 23:27:21 +00:00
|
|
|
<Flex as="span" pl="1" alignItems="center">
|
2023-05-14 23:22:23 +00:00
|
|
|
<Tooltip
|
|
|
|
hasArrow
|
|
|
|
placement="top"
|
|
|
|
label={
|
|
|
|
<VStack>
|
|
|
|
<Text>App: __APP_VERSION__</Text>
|
|
|
|
<Text>SDK: {sdkVersion}</Text>
|
|
|
|
</VStack>
|
|
|
|
}
|
|
|
|
bg="gray.300"
|
|
|
|
color="black"
|
|
|
|
>
|
|
|
|
<InfoOutlineIcon />
|
|
|
|
</Tooltip>
|
|
|
|
</Flex>
|
2023-05-14 23:09:54 +00:00
|
|
|
);
|
|
|
|
}
|