From c5cc957c67aee121410f3494088bc5d06f412e0a Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 11 Jun 2024 15:58:29 -0700 Subject: [PATCH] start tweaking qr code --- src/components/StarterPack/QrCode.tsx | 114 ++++++++++++++++++++ src/components/StarterPack/QrCodeDialog.tsx | 42 +------- src/screens/StarterPack/Main/index.tsx | 2 +- 3 files changed, 120 insertions(+), 38 deletions(-) create mode 100644 src/components/StarterPack/QrCode.tsx diff --git a/src/components/StarterPack/QrCode.tsx b/src/components/StarterPack/QrCode.tsx new file mode 100644 index 0000000000..9ffbe68be2 --- /dev/null +++ b/src/components/StarterPack/QrCode.tsx @@ -0,0 +1,114 @@ +import React from 'react' +import {View} from 'react-native' +import QRCode from 'react-native-qrcode-styled' +import ViewShot from 'react-native-view-shot' +import {LinearGradient} from 'expo-linear-gradient' +import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' +import {Trans} from '@lingui/macro' + +import {Logo} from 'view/icons/Logo' +import {Logotype} from 'view/icons/Logotype' +import {useTheme} from '#/alf' +import {atoms as a} from '#/alf' +import {Text} from '#/components/Typography' + +export function QrCode({ + starterPack, +}: { + starterPack: AppBskyGraphDefs.StarterPackView +}) { + const t = useTheme() + const {record} = starterPack + + const gradient = + t.name === 'light' + ? [t.palette.primary_500, t.palette.primary_300] + : [t.palette.primary_600, t.palette.primary_400] + + if (!AppBskyGraphStarterpack.isRecord(record)) { + return null + } + + return ( + + + + + Join the conversation + + + {record.name} + + + + on + + + + + + + + + + + ) +} + +export function QrCodeInner({url}: {url: string}) { + const t = useTheme() + + return ( + + + + ) +} diff --git a/src/components/StarterPack/QrCodeDialog.tsx b/src/components/StarterPack/QrCodeDialog.tsx index 5f5569b2e0..9fb1dccfdb 100644 --- a/src/components/StarterPack/QrCodeDialog.tsx +++ b/src/components/StarterPack/QrCodeDialog.tsx @@ -1,29 +1,28 @@ import React from 'react' import {View} from 'react-native' -import QRCode from 'react-native-qrcode-styled' import * as FS from 'expo-file-system' +import {AppBskyGraphDefs} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {nanoid} from 'nanoid/non-secure' import {saveImageToMediaLibrary} from 'lib/media/manip' import * as Toast from '#/view/com/util/Toast' -import {useTheme} from '#/alf' import {atoms as a} from '#/alf' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {DialogControlProps} from '#/components/Dialog' +import {QrCode} from '#/components/StarterPack/QrCode' import {Text} from '#/components/Typography' export function QrCodeDialog({ control, - url, + starterPack, }: { control: DialogControlProps - url: string + starterPack: AppBskyGraphDefs.StarterPackView }) { const {_} = useLingui() - const t = useTheme() // No types for this // See https://github.com/tokkozhin/react-native-qrcode-styled/blob/main/example/src/examples/DownloadQR.tsx for usage @@ -52,38 +51,7 @@ export function QrCodeDialog({ Share this starter pack with friends! - - - +