Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.1 #382

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/og.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/og.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const metadata: Metadata = {
url: APP_CONST.BASE_URL,
images: [
{
url: `${APP_CONST.BASE_URL}/images/og.png?v=0`,
url: `${APP_CONST.BASE_URL}/images/og.jpg?v=0`,
width: 1200,
height: 630,
alt: APP_CONST.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,43 @@ export const InviteMemberDialogContent = ({
groupId,
}: IInviteMemberDialogContentProps) => {
const [isLinkButtonClicked, setIsLinkButtonClicked] = useState(false);
const [hash, setHash] = useState('');

/**
* This useEffect has two dependencies. When one of them,`isDialogOpen` state, is changed to true, the setup is fired
* which is generating the invitation link hash and put it as state `hash`
*/
useEffect(() => {
const getHash = async () => {
if (!isDialogOpen) return;

const result = await putGenerateInvitationLinkHash(groupId);
if (!result.ok) {
alert('Something went wrong. Please try again');
return;
}
setHash(result.value.invitationLinkHash);
};

getHash();
}, [isDialogOpen, groupId]);
/**
* Handle the link copy button click.
* If the generatedLink is not valid, do nothing.
* If success, generated invitation link URL is copied to clipboard and change the text of button to 'Copied!'
* *A hash, which is part of the URL, is already generated when the dialog open
*/
const handleLinkCopy = async () => {
setIsLinkButtonClicked(true);
const result = await putGenerateInvitationLinkHash(groupId);

if (!result.ok) {
alert('Something went wrong. Please try again');
return;
try {
if (!hash) throw new Error('Invitation link hash is not set.');
return await navigator.clipboard.writeText(`${CLIENT_BASE_URL}/groups/join/${hash}`);
} catch (err) {
console.error(
'Error occurred while copying the link:',
err instanceof Error ? err.message : err,
);
alert('Error occurred while copying the link. Please try again.');
}

const hash = result.value.invitationLinkHash;
navigator.clipboard.writeText(`${CLIENT_BASE_URL}/groups/join/${hash}`);
return;
};

Expand Down