gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/users/dialogs/settings/user-info/qrcode.tsx · v0.3.0-alpha2
Source
1 857e289 Mrdn 2y ago
2 857e289 Mrdn 2y ago import { UserType } from '@marzneshin/features/users';
3 857e289 Mrdn 2y ago import QRCode from "react-qr-code";
4 857e289 Mrdn 2y ago import { QrCodeIcon } from "lucide-react";
5 857e289 Mrdn 2y ago import { FC } from 'react'
6 857e289 Mrdn 2y ago import { Card, CardContent, CardHeader, CardTitle } from '@marzneshin/components';
7 857e289 Mrdn 2y ago import { useTranslation } from 'react-i18next';
8 857e289 Mrdn 2y ago import { SubscriptionLinkButton } from './subcription-link-button';
9 857e289 Mrdn 2y ago
10 857e289 Mrdn 2y ago interface QRCodeProps {
11 857e289 Mrdn 2y ago entity: UserType
12 857e289 Mrdn 2y ago }
13 857e289 Mrdn 2y ago
14 857e289 Mrdn 2y ago export const QRCodeSection: FC<QRCodeProps> = (
15 857e289 Mrdn 2y ago { entity }
16 857e289 Mrdn 2y ago ) => {
17 857e289 Mrdn 2y ago const subscribeQrLink = String(entity.subscription_url).startsWith('/')
18 857e289 Mrdn 2y ago ? window.location.origin + entity.subscription_url
19 857e289 Mrdn 2y ago : String(entity.subscription_url);
20 857e289 Mrdn 2y ago const { t } = useTranslation()
21 857e289 Mrdn 2y ago return (
22 857e289 Mrdn 2y ago <Card>
23 857e289 Mrdn 2y ago <CardHeader>
24 857e289 Mrdn 2y ago <CardTitle className="flex flex-row gap-4 justify-start">
25 857e289 Mrdn 2y ago <QrCodeIcon />
26 857e289 Mrdn 2y ago {t('subscription')}
27 857e289 Mrdn 2y ago </CardTitle>
28 857e289 Mrdn 2y ago </CardHeader>
29 857e289 Mrdn 2y ago <CardContent className='flex flex-col justify-center items-center py-10 w-full h-full'>
30 857e289 Mrdn 2y ago <div className="flex flex-col gap-3 justify-center items-center w-1/2 h-1/2">
31 857e289 Mrdn 2y ago <QRCode
32 857e289 Mrdn 2y ago size={150}
33 857e289 Mrdn 2y ago className="w-full h-full"
34 857e289 Mrdn 2y ago value={subscribeQrLink}
35 857e289 Mrdn 2y ago />
36 857e289 Mrdn 2y ago <SubscriptionLinkButton subscriptionLink={subscribeQrLink} />
37 857e289 Mrdn 2y ago </div>
38 857e289 Mrdn 2y ago </CardContent>
39 857e289 Mrdn 2y ago </Card>
40 857e289 Mrdn 2y ago );
41 857e289 Mrdn 2y ago }