gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/users/dialogs/settings/user-info/subscription-actions.tsx · v0.3.0
Source
1 45e0190 Mrdn 2y ago import { Button, HStack } from "@marzneshin/components";
2 45e0190 Mrdn 2y ago import { useTranslation } from "react-i18next";
3 45e0190 Mrdn 2y ago import { getSubscriptionLink } from "@marzneshin/utils";
4 45e0190 Mrdn 2y ago import { useUserSubscriptionRevokeCmd } from "@marzneshin/features/users";
5 45e0190 Mrdn 2y ago import type { QRCodeProps } from "./qrcode";
6 45e0190 Mrdn 2y ago import type { FC } from 'react';
7 45e0190 Mrdn 2y ago
8 45e0190 Mrdn 2y ago import { SubscriptionLinkButton } from "./subcription-link-button";
9 45e0190 Mrdn 2y ago export const SubscriptionActions: FC<QRCodeProps> = ({ entity }) => {
10 45e0190 Mrdn 2y ago const subscribeQrLink = getSubscriptionLink(entity.subscription_url);
11 45e0190 Mrdn 2y ago const { mutate: revokeSubscription } = useUserSubscriptionRevokeCmd();
12 45e0190 Mrdn 2y ago const { t } = useTranslation();
13 45e0190 Mrdn 2y ago return (
14 45e0190 Mrdn 2y ago <HStack className="w-full items-center">
15 45e0190 Mrdn 2y ago <SubscriptionLinkButton subscriptionLink={subscribeQrLink} />
16 45e0190 Mrdn 2y ago <Button className="w-full" onClick={() => revokeSubscription(entity)}>
17 45e0190 Mrdn 2y ago {t("page.users.revoke_subscription")}
18 45e0190 Mrdn 2y ago </Button>
19 45e0190 Mrdn 2y ago </HStack>
20 45e0190 Mrdn 2y ago );
21 45e0190 Mrdn 2y ago };