-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from animo/feature/TBX-50
feat: Possibility to create invite with QR generation and clipboard support
- Loading branch information
Showing
7 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { ContextModalProps } from '@mantine/modals' | ||
|
||
import { Box, Center, createStyles, Divider, Text } from '@mantine/core' | ||
import { showNotification } from '@mantine/notifications' | ||
import { QRCodeSVG } from 'qrcode.react' | ||
import React from 'react' | ||
|
||
import { PrimaryButton } from '../components/generic' | ||
|
||
const useStyles = createStyles((theme) => ({ | ||
qrCode: { | ||
borderRadius: theme.radius.sm, | ||
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.gray[0] : theme.white, | ||
padding: theme.spacing.xs, | ||
}, | ||
})) | ||
|
||
export const PresentInviteModal = ({ innerProps }: ContextModalProps<{ inviteUrl: string }>) => { | ||
const { classes } = useStyles() | ||
const { inviteUrl } = innerProps | ||
|
||
const copyToClipboard = async () => { | ||
await window.navigator.clipboard.writeText(inviteUrl) | ||
|
||
showNotification({ | ||
title: 'Invitation copied to clipboard', | ||
message: 'You can now use it how you like', | ||
}) | ||
} | ||
|
||
return ( | ||
<> | ||
<Center> | ||
<Box className={classes.qrCode}> | ||
<Box h={250} w={250}> | ||
<QRCodeSVG value={inviteUrl} size={250} /> | ||
</Box> | ||
</Box> | ||
</Center> | ||
<Text mt="xs" align="center"> | ||
Scan this QR code with your mobile device. | ||
</Text> | ||
<Divider label="OR" labelPosition="center" mb="xs" /> | ||
<PrimaryButton fullWidth onClick={copyToClipboard}> | ||
Copy url | ||
</PrimaryButton> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1464,6 +1464,13 @@ | |
resolved "https://registry.yarnpkg.com/@mantine/hooks/-/hooks-5.7.2.tgz#29ffa4f68c61145dd091e07763854c4624e254f9" | ||
integrity sha512-g+fxcnQwEeVM/5h+SAX/rDNL2s1652DGbP4xxfNg6yFqqhQzmtxQN7xsmkZ+ffx8wKhbsP5z13x6WZoxuJQh9Q== | ||
|
||
"@mantine/modals@^5.10.0": | ||
version "5.10.0" | ||
resolved "https://registry.yarnpkg.com/@mantine/modals/-/modals-5.10.0.tgz#b02cadfd875375eeea87f7135848fc0d1bbe869c" | ||
integrity sha512-SP9mPoa7FlfGkVzjVMUZ36i7YmYMh7p/9CoeWT/0Rcy7WmOfotNBbs/H/9CXdMNVNZTkehEeHoKeVy9oEkk2zg== | ||
dependencies: | ||
"@mantine/utils" "5.10.0" | ||
|
||
"@mantine/notifications@^5.8.4": | ||
version "5.8.4" | ||
resolved "https://registry.yarnpkg.com/@mantine/notifications/-/notifications-5.8.4.tgz#87a7edba7e39393226cb9b5a385c4f45afff94b9" | ||
|
@@ -1480,6 +1487,11 @@ | |
clsx "1.1.1" | ||
csstype "3.0.9" | ||
|
||
"@mantine/[email protected]": | ||
version "5.10.0" | ||
resolved "https://registry.yarnpkg.com/@mantine/utils/-/utils-5.10.0.tgz#d77bdbd4fbf0ef7b10dd0c6480ce9a035dd31ae9" | ||
integrity sha512-mHnNm0ajIa8qLAIEwv82N6+7YKecynOA3I8vzgBHXS2x4HwGsHITFYGmMh2LNpx5dRL034tObfEFYZXqncyEDw== | ||
|
||
"@mantine/[email protected]": | ||
version "5.7.1" | ||
resolved "https://registry.yarnpkg.com/@mantine/utils/-/utils-5.7.1.tgz#d6890be0650cdd499afd2d954713901672d15711" | ||
|
@@ -8201,6 +8213,11 @@ pvutils@^1.1.3: | |
resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" | ||
integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== | ||
|
||
qrcode.react@^3.1.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8" | ||
integrity sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q== | ||
|
||
[email protected]: | ||
version "6.11.0" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" | ||
|