Skip to content

Commit

Permalink
Merge pull request #505 from sinamics/qrcode-link
Browse files Browse the repository at this point in the history
Open the joinzt site when clicking the qrcode
  • Loading branch information
sinamics authored Aug 21, 2024
2 parents e168b28 + be515e1 commit 93ba3a5
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/components/networkByIdPage/networkQrCode.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useTheme } from "next-themes";
import { QRCodeSVG } from "qrcode.react";
import React, { useEffect, useState } from "react";
import { CopyToClipboard } from "react-copy-to-clipboard";
import toast from "react-hot-toast";
import daisyuiColors from "daisyui/src/theming/themes";
import { useTranslations } from "next-intl";
import Link from "next/link";

interface IProps {
networkId: string;
Expand All @@ -15,7 +13,6 @@ const urlBuilder = (networkId: string) => {
};

const NetworkQrCode = ({ networkId }: IProps) => {
const t = useTranslations();
const [themeRGBColor, setThemeRGBColor] = useState("");
const { theme } = useTheme();

Expand All @@ -24,20 +21,7 @@ const NetworkQrCode = ({ networkId }: IProps) => {
}, [theme]);

return (
<CopyToClipboard
text={urlBuilder(networkId)}
onCopy={() =>
toast.success(
t("commonToast.copyToClipboard.success", {
element: urlBuilder(networkId),
}),
{
id: "copyNwid",
},
)
}
title={t("commonToast.copyToClipboard.title")}
>
<Link target="_blank" rel="nofollow noopener noreferrer" href={urlBuilder(networkId)}>
<QRCodeSVG
value={urlBuilder(networkId)}
size={100}
Expand All @@ -46,7 +30,7 @@ const NetworkQrCode = ({ networkId }: IProps) => {
level={"M"}
includeMargin={true}
/>
</CopyToClipboard>
</Link>
);
};

Expand Down

0 comments on commit 93ba3a5

Please sign in to comment.